|
@@ -82,12 +82,8 @@ var KeyboardShortcut = {
|
82
|
82
|
$('body').popover({ selector: '[data-toggle=popover]',
|
83
|
83
|
trigger: 'click hover',
|
84
|
84
|
content: function() {
|
85
|
|
- var shortcutAttr = this.getAttribute("shortcut");
|
86
|
|
-
|
87
|
|
- var shortcutString = (shortcutAttr)
|
88
|
|
- ? self._getShortcutTooltip(shortcutAttr)
|
89
|
|
- : "";
|
90
|
|
- return this.getAttribute("content") + shortcutString;
|
|
85
|
+ return this.getAttribute("content")
|
|
86
|
+ + self._getShortcutTooltip(this.getAttribute("shortcut"));
|
91
|
87
|
}
|
92
|
88
|
});
|
93
|
89
|
},
|
|
@@ -130,22 +126,24 @@ var KeyboardShortcut = {
|
130
|
126
|
},
|
131
|
127
|
|
132
|
128
|
/**
|
|
129
|
+ * Returns the tooltip string for the given shortcut attribute.
|
133
|
130
|
*
|
134
|
|
- * @param id indicates the popover associated with the shortcut
|
135
|
|
- * @returns {string} the keyboard shortcut used for the id given
|
|
131
|
+ * @param shortcutAttr indicates the popover associated with the shortcut
|
|
132
|
+ * @returns {string} the tooltip string to add to the given shortcut popover
|
|
133
|
+ * or an empty string if the shortcutAttr is null, an empty string or not
|
|
134
|
+ * found in the shortcut mapping
|
136
|
135
|
*/
|
137
|
|
- _getShortcutTooltip: function (id) {
|
138
|
|
- if (!id || id.length <= 0)
|
139
|
|
- return "";
|
140
|
|
-
|
141
|
|
- for (var key in _shortcuts) {
|
142
|
|
- if (_shortcuts.hasOwnProperty(key)) {
|
143
|
|
- if (_shortcuts[key].shortcutAttr
|
144
|
|
- && _shortcuts[key].shortcutAttr === id) {
|
|
136
|
+ _getShortcutTooltip: function (shortcutAttr) {
|
|
137
|
+ if (typeof shortcutAttr === "string" && shortcutAttr.length > 0) {
|
|
138
|
+ for (var key in _shortcuts) {
|
|
139
|
+ if (_shortcuts.hasOwnProperty(key)
|
|
140
|
+ && _shortcuts[key].shortcutAttr
|
|
141
|
+ && _shortcuts[key].shortcutAttr === shortcutAttr) {
|
145
|
142
|
return " (" + _shortcuts[key].character + ")";
|
146
|
143
|
}
|
147
|
144
|
}
|
148
|
145
|
}
|
|
146
|
+
|
149
|
147
|
return "";
|
150
|
148
|
},
|
151
|
149
|
/**
|