Permalink
Browse files

konami code

  • Loading branch information...
jcutler committed Feb 29, 2012
1 parent b0a34e9 commit 450303d4d1d7c14121aa817d697c8c6c2ad851e0
View
@@ -1852,6 +1852,8 @@
"messages",
"likes",
"tagged"])) {
+ chrome.tabs.executeScript(sender.tab.id, {file: "core/common/konami.js"});
+
if (getSetting("MissingE_safeDash_enabled",1) == 1) {
activeScripts.safeDash = true;
chrome.tabs.executeScript(sender.tab.id, {file: "core/safeDash/safeDash.js"});
View
@@ -0,0 +1,68 @@
+/*
+ * 'Missing e' Extension
+ *
+ * Copyright 2011, Jeremy Cutler
+ * Released under the GPL version 3 licence.
+ * SEE: license/GPL-LICENSE.txt
+ *
+ * This file is part of 'Missing e'.
+ *
+ * 'Missing e' is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * 'Missing e' is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with 'Missing e'. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+(function($) {
+
+MissingE.utilities.konami = {
+
+ code: [38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13],
+
+ state: 0,
+
+ run: function() {
+ document.addEventListener('keydown', function(e) {
+ var key = e.keyCode;
+ if (!e.shiftKey ||
+ key !== MissingE.utilities.konami
+ .code[MissingE.utilities.konami.state]) {
+ MissingE.utilities.konami.state = 0;
+ return;
+ }
+ MissingE.utilities.konami.state++;
+ if (MissingE.utilities.konami.state ===
+ MissingE.utilities.konami.code.length) {
+ var logo = $('#logo');
+ if (logo.attr('oldsrc')) {
+ var src = logo.attr('oldsrc');
+ logo.attr('oldsrc',logo.attr('src'));
+ logo.attr('src',src);
+ }
+ else {
+ logo.attr('oldsrc',logo.attr('src'));
+ logo.attr('src',extension.getURL('identity/tumblr-with-e.png'));
+ }
+ }
+ }, false);
+ },
+
+ init: function() {
+ MissingE.utilities.konami.run();
+ }
+};
+
+if (extension.isChrome ||
+ extension.isFirefox) {
+ MissingE.utilities.konami.init();
+}
+
+}(jQuery));
@@ -2132,6 +2132,8 @@ function handleMessage(message, myWorker) {
"messages",
"likes",
"tagged"])) {
+ injectScripts.push(data.url("core/common/konami.js"));
+
if (getSetting("extensions.MissingE.safeDash.enabled",1) == 1) {
injectScripts.push(data.url("core/safeDash/safeDash.js"));
activeScripts.safeDash = true;
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -60,6 +60,7 @@
<string>core/common/menuButton.js</string>
<string>lib/facebox/facebox.js</string>
<string>core/common/warningInfo.js</string>
+ <string>core/common/konami.js</string>
<string>core/askTweaks/askTweaks.js</string>
<string>core/betterReblogs/betterReblogs_dash.js</string>
<string>core/betterReblogs/betterReblogs_fill.js</string>
@@ -1928,6 +1928,8 @@
"messages",
"likes",
"tagged"])) {
+ activeScripts.konami = true;
+
if (getSetting("MissingE_safeDash_enabled",1) == 1) {
activeScripts.safeDash = true;
}
@@ -85,7 +85,8 @@ function doStartup(response) {
for (i in response.message) {
if (response.message.hasOwnProperty(i)) {
if (i !== 'url' && i !== 'isFrame' && !(/_fill$/.test(i)) &&
- i !== 'zindexFix' && i !== 'version' && i !== "warningInfo") {
+ i !== 'zindexFix' && i !== 'version' && i !== "warningInfo" &&
+ i !== 'konami') {
info += i + ": " + (response.message[i] ? "active" : "inactive") +
"\n";
}
@@ -100,6 +101,9 @@ function doStartup(response) {
if (response.message.zindexFix) {
MissingE.utilities.zindexFix.init();
}
+ if (response.message.konami) {
+ MissingE.utilities.konami.init();
+ }
if (response.message.massEditor) {
MissingE.packages.massEditor.init();
}

0 comments on commit 450303d

Please sign in to comment.