aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorilya2009-10-28 23:22:29 -0700
committerilya2009-10-28 23:22:29 -0700
commit2d23db77662023e10698a56636f05cb17bf52d5b (patch)
tree3f73ac6b2c6526da5784d75b4b08d7db4c2f33b5
parent6f8fb89dd710e6709457ed64fd54a6f30f347d86 (diff)
downloadvimium-2d23db77662023e10698a56636f05cb17bf52d5b.tar.bz2
Simplify the registry in background_page a bit.
-rw-r--r--background_page.html16
1 files changed, 8 insertions, 8 deletions
diff --git a/background_page.html b/background_page.html
index 18f91a6d..776274bb 100644
--- a/background_page.html
+++ b/background_page.html
@@ -35,10 +35,10 @@
}
var keyToCommandRegistry = {};
- keyToCommandRegistry['gg'] = {command: 'scrollToTop'};
- keyToCommandRegistry['G'] = {command: 'scrollToBottom'};
- keyToCommandRegistry['t'] = {command: createTab};
- keyToCommandRegistry['d'] = {command: removeTab};
+ keyToCommandRegistry['gg'] = 'scrollToTop';
+ keyToCommandRegistry['G'] = 'scrollToBottom';
+ keyToCommandRegistry['t'] = createTab;
+ keyToCommandRegistry['d'] = removeTab;
var commandRegistry = {};
var keyQueue = "";
@@ -53,16 +53,16 @@
if (keyToCommandRegistry[keyQueue])
{
registryEntry = keyToCommandRegistry[keyQueue];
- console.log("command found for [", keyQueue, "],", registryEntry.command);
+ console.log("command found for [", keyQueue, "],", registryEntry);
- if (typeof(registryEntry.command) == "string")
+ if (typeof(registryEntry) == "string")
{
chrome.tabs.getSelected(null, function (tab) {
var port = chrome.tabs.connect(tab.id, {name: "executePageCommand"});
- port.postMessage({command: registryEntry.command});
+ port.postMessage({command: registryEntry});
});
}
- else { registryEntry.command.call(); }
+ else { registryEntry.call(); }
keyQueue = "";
}