Merge pull request #817 from jitsi/fix-shortcut-tooltips

Fix shortcut appearing in tooltip of wrong buttons
This commit is contained in:
hristoterezov 2016-08-30 15:30:09 -05:00 committed by GitHub
commit d9559ecf63
1 changed files with 14 additions and 8 deletions

View File

@ -82,8 +82,8 @@ var KeyboardShortcut = {
$('body').popover({ selector: '[data-toggle=popover]',
trigger: 'click hover',
content: function() {
return this.getAttribute("content") +
self._getShortcut(this.getAttribute("shortcut"));
return this.getAttribute("content")
+ self._getShortcutTooltip(this.getAttribute("shortcut"));
}
});
},
@ -126,18 +126,24 @@ var KeyboardShortcut = {
},
/**
* Returns the tooltip string for the given shortcut attribute.
*
* @param id indicates the popover associated with the shortcut
* @returns {string} the keyboard shortcut used for the id given
* @param shortcutAttr indicates the popover associated with the shortcut
* @returns {string} the tooltip string to add to the given shortcut popover
* or an empty string if the shortcutAttr is null, an empty string or not
* found in the shortcut mapping
*/
_getShortcut: function (id) {
for (var key in _shortcuts) {
if (_shortcuts.hasOwnProperty(key)) {
if (_shortcuts[key].shortcutAttr === id) {
_getShortcutTooltip: function (shortcutAttr) {
if (typeof shortcutAttr === "string" && shortcutAttr.length > 0) {
for (var key in _shortcuts) {
if (_shortcuts.hasOwnProperty(key)
&& _shortcuts[key].shortcutAttr
&& _shortcuts[key].shortcutAttr === shortcutAttr) {
return " (" + _shortcuts[key].character + ")";
}
}
}
return "";
},
/**