mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-10 06:34:41 +02:00
* Allow hot keys to be case insensitive
* Start of better demo
This commit is contained in:
parent
028c5be418
commit
3e93b5b67d
4 changed files with 52 additions and 7 deletions
|
@ -25,7 +25,9 @@ function MenuView(options) {
|
|||
this.items = [];
|
||||
}
|
||||
|
||||
this.setHotKeys(options.hotkeys);
|
||||
this.caseInsensitiveHotKeys = miscUtil.valueWithDefault(options.caseInsensitiveHotKeys, true);
|
||||
|
||||
this.setHotKeys(options.hotKeys);
|
||||
|
||||
this.focusedItemIndex = options.focusedItemIndex || 0;
|
||||
this.focusedItemIndex = this.items.length >= this.focusedItemIndex ? this.focusedItemIndex : 0;
|
||||
|
@ -103,9 +105,16 @@ MenuView.prototype.setItems = function(items) {
|
|||
}
|
||||
};
|
||||
|
||||
MenuView.prototype.setHotKeys = function(hotkeys) {
|
||||
if(_.isObject(hotkeys)) {
|
||||
this.hotkeys = hotkeys;
|
||||
MenuView.prototype.setHotKeys = function(hotKeys) {
|
||||
if(_.isObject(hotKeys)) {
|
||||
if(this.caseInsensitiveHotKeys) {
|
||||
this.hotKeys = {};
|
||||
for(var key in hotKeys) {
|
||||
this.hotKeys[key.toLowerCase()] = hotKeys[key];
|
||||
}
|
||||
} else {
|
||||
this.hotKeys = hotKeys;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue