From a1820ecf6ecaa47487c6f024786ea55613a82a95 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 10 Mar 2015 18:46:28 -0700 Subject: [PATCH] Remove Konami code easter egg Summary: This is cool in theory, but has broken like 5 times and is broken now too. The CSS magic just isn't robust enough to keep up with CSS changes. Just strip it out for now; if we come up with some more durable replacement we can put that back in its place. Test Plan: Typed konami code, page didn't break horribly. Reviewers: chad, btrahan Reviewed By: btrahan Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D12039 --- resources/celerity/map.php | 29 +++-- resources/celerity/packages.php | 1 - src/view/page/PhabricatorStandardPageView.php | 1 - webroot/rsrc/js/core/behavior-konami.js | 104 ------------------ 4 files changed, 13 insertions(+), 122 deletions(-) delete mode 100644 webroot/rsrc/js/core/behavior-konami.js diff --git a/resources/celerity/map.php b/resources/celerity/map.php index e5d7e687d8..7c8f8f2049 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -44,7 +44,7 @@ return array( 'rsrc/css/application/config/config-welcome.css' => '6abd79be', 'rsrc/css/application/config/setup-issue.css' => '22270af2', 'rsrc/css/application/config/unhandled-exception.css' => '37d4f9a2', - 'rsrc/css/application/conpherence/durable-column.css' => '7abcc3f2', + 'rsrc/css/application/conpherence/durable-column.css' => '9207426d', 'rsrc/css/application/conpherence/menu.css' => 'c6ac5299', 'rsrc/css/application/conpherence/message-pane.css' => '5930260a', 'rsrc/css/application/conpherence/notification.css' => '04a6e10a', @@ -353,7 +353,7 @@ return array( 'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18', 'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de', 'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => 'efef202b', - 'rsrc/js/application/conpherence/behavior-durable-column.js' => 'aa3b6c22', + 'rsrc/js/application/conpherence/behavior-durable-column.js' => '1eef9f26', 'rsrc/js/application/conpherence/behavior-menu.js' => 'e476c952', 'rsrc/js/application/conpherence/behavior-pontificate.js' => '21ba5861', 'rsrc/js/application/conpherence/behavior-quicksand-blacklist.js' => '7927a7d3', @@ -470,7 +470,6 @@ return array( 'rsrc/js/core/behavior-hovercard.js' => 'f36e01af', 'rsrc/js/core/behavior-keyboard-pager.js' => 'a8da01f0', 'rsrc/js/core/behavior-keyboard-shortcuts.js' => 'd75709e6', - 'rsrc/js/core/behavior-konami.js' => '5bc2cb21', 'rsrc/js/core/behavior-lightbox-attachments.js' => 'f8ba29d7', 'rsrc/js/core/behavior-line-linker.js' => '1499a8cb', 'rsrc/js/core/behavior-more.js' => 'a80d0378', @@ -515,7 +514,7 @@ return array( 'changeset-view-manager' => '88be0133', 'config-options-css' => '7fedf08b', 'config-welcome-css' => '6abd79be', - 'conpherence-durable-column-view' => '7abcc3f2', + 'conpherence-durable-column-view' => '9207426d', 'conpherence-menu-css' => 'c6ac5299', 'conpherence-message-pane-css' => '5930260a', 'conpherence-notification-css' => '04a6e10a', @@ -586,7 +585,7 @@ return array( 'javelin-behavior-diffusion-locate-file' => '6d3e1947', 'javelin-behavior-diffusion-pull-lastmodified' => '2b228192', 'javelin-behavior-doorkeeper-tag' => 'e5822781', - 'javelin-behavior-durable-column' => 'aa3b6c22', + 'javelin-behavior-durable-column' => '1eef9f26', 'javelin-behavior-error-log' => '6882e80a', 'javelin-behavior-fancy-datepicker' => 'c51ae228', 'javelin-behavior-global-drag-and-drop' => '07f199d8', @@ -594,7 +593,6 @@ return array( 'javelin-behavior-high-security-warning' => '8fc1c918', 'javelin-behavior-history-install' => '7ee2b591', 'javelin-behavior-icon-composer' => '8ef9ab58', - 'javelin-behavior-konami' => '5bc2cb21', 'javelin-behavior-launch-icon-composer' => '48086888', 'javelin-behavior-lightbox-attachments' => 'f8ba29d7', 'javelin-behavior-line-chart' => '88f0c5b3', @@ -956,6 +954,15 @@ return array( 'javelin-dom', 'javelin-reactor-dom', ), + '1eef9f26' => array( + 'javelin-behavior', + 'javelin-dom', + 'javelin-stratcom', + 'javelin-scrollbar', + 'javelin-quicksand', + 'phabricator-keyboard-shortcut', + 'conpherence-thread-manager', + ), '1feea462' => array( 'javelin-install', 'javelin-dom', @@ -1657,15 +1664,6 @@ return array( 'javelin-util', 'phabricator-prefab', ), - 'aa3b6c22' => array( - 'javelin-behavior', - 'javelin-dom', - 'javelin-stratcom', - 'javelin-scrollbar', - 'javelin-quicksand', - 'phabricator-keyboard-shortcut', - 'conpherence-thread-manager', - ), 'b1f0ccee' => array( 'javelin-install', 'javelin-dom', @@ -2128,7 +2126,6 @@ return array( 'phabricator-notification', 'javelin-behavior-aphlict-listen', 'javelin-behavior-phabricator-search-typeahead', - 'javelin-behavior-konami', 'javelin-behavior-aphlict-dropdown', 'javelin-behavior-history-install', 'javelin-behavior-phabricator-gesture', diff --git a/resources/celerity/packages.php b/resources/celerity/packages.php index 8110025896..8e6c6f9677 100644 --- a/resources/celerity/packages.php +++ b/resources/celerity/packages.php @@ -49,7 +49,6 @@ return array( 'phabricator-notification', 'javelin-behavior-aphlict-listen', 'javelin-behavior-phabricator-search-typeahead', - 'javelin-behavior-konami', 'javelin-behavior-aphlict-dropdown', 'javelin-behavior-history-install', 'javelin-behavior-phabricator-gesture', diff --git a/src/view/page/PhabricatorStandardPageView.php b/src/view/page/PhabricatorStandardPageView.php index 091c526679..4ab0e67d88 100644 --- a/src/view/page/PhabricatorStandardPageView.php +++ b/src/view/page/PhabricatorStandardPageView.php @@ -197,7 +197,6 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView { Javelin::initBehavior('aphront-form-disable-on-submit'); Javelin::initBehavior('toggle-class', array()); - Javelin::initBehavior('konami', array()); Javelin::initBehavior('history-install'); Javelin::initBehavior('phabricator-gesture'); diff --git a/webroot/rsrc/js/core/behavior-konami.js b/webroot/rsrc/js/core/behavior-konami.js deleted file mode 100644 index e02c9c2525..0000000000 --- a/webroot/rsrc/js/core/behavior-konami.js +++ /dev/null @@ -1,104 +0,0 @@ -/** - * @provides javelin-behavior-konami - * @requires javelin-behavior - * javelin-stratcom - */ - -JX.behavior('konami', function() { - var sequence = [ 38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13 ]; - var seen = []; - - JX.Stratcom.listen('keyup', null, function(e) { - if (!sequence) { - return; - } - - seen.push(e.getRawEvent().keyCode); - - while (seen.length) { - var mismatch = false; - for (var i = 0; i < seen.length; ++i) { - if (seen[i] != sequence[i]) { - mismatch = true; - break; - } - } - if (!mismatch) { - break; - } - seen.shift(); - } - - if (seen.length == sequence.length) { - sequence = seen = null; - activate(); - } - }); - - var prefixes = { '-webkit-': 1, '-moz-': 1, '-o-': 1, '-ms-': 1, '': 1 }; - - function generateCSS(selector, props) { - var ret = selector + '{'; - for (var key in props) { - ret += key + ':' + props[key] + ';'; - } - return ret + '}'; - } - - function generateAllCSS(selector, props) { - var more_props = {}; - for (var key in props) { - for (var prefix in prefixes) { - more_props[prefix + key] = props[key]; - } - } - return generateCSS(selector, more_props); - } - - function modifyCSS(rule, key, value) { - rule.setProperty(key, value, ''); - } - - function modifyAllCSS(rule, key, value) { - for (var prefix in prefixes) { - modifyCSS(rule, prefix + key, value); - } - } - - var top_rule; - - function activate() { - var matrix = document.createElement('style'); - matrix.textContent = [ - generateAllCSS('html', { - background: '#000' - }), - generateAllCSS('body', { - perspective: '2048px', - background: 'transparent' - }), - generateAllCSS('*', { - 'transform-style': 'preserve-3d' - }), - generateAllCSS('body > *', { - }) - ].join('\n'); - document.head.appendChild(matrix); - - top_rule = matrix.sheet.cssRules[3].style; - - var first_event = null; - document.body.addEventListener('mousemove', function(e) { - if (!first_event) { - first_event = {x: e.screenX, y: e.screenY}; - } - var dx = (e.screenX - first_event.x); - var dy = (e.screenY - first_event.y); - - var x = -(dx / window.innerWidth) * (Math.PI / 2); - var y = (dy / window.innerHeight) * (Math.PI / 2); - var body_rotate = 'rotateY(' + x + 'rad) rotateX(' + y + 'rad)'; - modifyAllCSS(top_rule, 'transform', body_rotate); - }, false); - } -});