Get shortcut keys from preferences automatically without needing to maintain array in Zotero.Keys

This commit is contained in:
Dan Stillman 2007-02-18 01:31:24 +00:00
parent 7c8b185b27
commit 41433841e4

View File

@ -627,8 +627,6 @@ Zotero.Keys = new function() {
this.windowInit = windowInit;
this.getCommand = getCommand;
_actions = ['library', 'quicksearch', 'newItem', 'newNote', 'toggleTagSelector',
'toggleFullscreen', 'copySelectedItemsToClipboard'];
_keys = {};
@ -636,8 +634,14 @@ Zotero.Keys = new function() {
* Called by Zotero.init()
*/
function init() {
var actions = Zotero.Prefs.prefBranch.getChildList('keys', {}, {});
// Get the key=>command mappings from the prefs
for each (var action in _actions) {
for each(var action in actions) {
var action = action.substr(5); // strips 'keys.'
if (action == 'overrideGlobal') {
continue;
}
_keys[Zotero.Prefs.get('keys.' + action)] = action;
}
}