X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/112eb7bb8f673c6e9ecd955634e0c392c054a9c0..70173b7798fd1df574d81b525e69ff6c1c6741e7:/js/kivi.ActionBar.js diff --git a/js/kivi.ActionBar.js b/js/kivi.ActionBar.js index e85fbe45f..0963d73da 100644 --- a/js/kivi.ActionBar.js +++ b/js/kivi.ActionBar.js @@ -7,7 +7,7 @@ namespace('kivi', function(k){ disabled: 'layout-actionbar-action-disabled', action: 'layout-actionbar-action', combobox: 'layout-actionbar-combobox', - } + }; k.ActionBarCombobox = function(e) { this.combobox = e; @@ -15,7 +15,7 @@ namespace('kivi', function(k){ this.toggle = this.head.childNodes[1]; this.list = e.childNodes[0]; this.init(); - } + }; k.ActionBarCombobox.prototype = { init: function() { @@ -41,7 +41,7 @@ namespace('kivi', function(k){ target = 'document'; } - var normalized = $.map(keystring.split('+'), function(val, i) { + var normalized = $.map(String.prototype.split.call(keystring, '+'), function(val, i) { switch (val) { case 'ctrl': case 'alt': return val; @@ -49,18 +49,14 @@ namespace('kivi', function(k){ default: if (val.length == 1) { return val.charChodeAt(0) - } else if (typeof val === 'number') { - return val } else if (val % 1 === 0) { - return val % 1; + return val; } else { console.log('can not normalize access key token: ' + val); } } }).join('+'); - console.log(normalized) - if (!(target in this.actions)) this.actions[target] = {}; this.actions[target][normalized] = action; @@ -83,9 +79,12 @@ namespace('kivi', function(k){ accesskey += e.which; // special case. HTML elements that make legitimate use of enter will also trigger the enter accesskey. - // so. if accesskey is '13' and the event source is one of these (currently only textarea) ignore it. + // so. if accesskey is '13' and the event source is one of these (currently only textareas & combo boxes) ignore it. // higher level widgets will usually prevent their key events from bubbling if used. - if (accesskey == 13 && e.target.tagName == 'TEXTAREA') return true; + if ( (accesskey == 13) + && ( (e.target.tagName == 'TEXTAREA') + || (e.target.tagName == 'SELECT'))) + return true; if ((target in k.ActionBarAccesskeys.actions) && (accesskey in k.ActionBarAccesskeys.actions[target])) { e.stopPropagation(); @@ -106,6 +105,8 @@ namespace('kivi', function(k){ if (data.disabled) { $(e).addClass(CLASSES.disabled); + if (!data.tooltip && (data.disabled != '1')) + data.tooltip = data.disabled; } if (data.accesskey) { @@ -117,6 +118,10 @@ namespace('kivi', function(k){ } } + if (data.tooltip) { + $(e).tooltipster({ content: data.tooltip, theme: 'tooltipster-light' }); + } + if (data.call || data.submit) { $(e).click(function(event) { var $hidden, key, func, check; @@ -150,7 +155,7 @@ namespace('kivi', function(k){ } }); } - } + }; }); $(function(){