diff options
Diffstat (limited to 'program/js/common.js')
-rw-r--r-- | program/js/common.js | 62 |
1 files changed, 13 insertions, 49 deletions
diff --git a/program/js/common.js b/program/js/common.js index 722eb3f60..28f79d56f 100644 --- a/program/js/common.js +++ b/program/js/common.js @@ -53,7 +53,6 @@ function roundcube_browser() this.ie = (document.all && !window.opera) || (this.win && this.agent_lc.indexOf('trident/') > 0); if (this.ie) { - this.ie6 = this.appver.indexOf('MSIE 6') > 0; this.ie7 = this.appver.indexOf('MSIE 7') > 0; this.ie8 = this.appver.indexOf('MSIE 8') > 0; this.ie9 = this.appver.indexOf('MSIE 9') > 0; @@ -256,13 +255,17 @@ remove_listener: function(p) cancel: function(evt) { var e = evt ? evt : window.event; + if (e.preventDefault) e.preventDefault(); + else + e.returnValue = false; + if (e.stopPropagation) e.stopPropagation(); e.cancelBubble = true; - e.returnValue = false; + return false; }, @@ -327,13 +330,17 @@ removeEventListener: function(evt, func, obj) triggerEvent: function(evt, e) { var ret, h; + if (e === undefined) e = this; else if (typeof e === 'object') e.event = evt; - if (this._events && this._events[evt] && !this._event_exec) { - this._event_exec = true; + if (!this._event_exec) + this._event_exec = {}; + + if (this._events && this._events[evt] && !this._event_exec[evt]) { + this._event_exec[evt] = true; for (var i=0; i < this._events[evt].length; i++) { if ((h = this._events[evt][i])) { if (typeof h.func === 'function') @@ -356,7 +363,8 @@ triggerEvent: function(evt, e) } } - this._event_exec = false; + delete this._event_exec[evt]; + if (e.event) { try { delete e.event; @@ -530,36 +538,6 @@ function getCookie(name) roundcube_browser.prototype.set_cookie = setCookie; roundcube_browser.prototype.get_cookie = getCookie; -// tiny replacement for Firebox functionality -function rcube_console() -{ - this.log = function(msg) - { - var box = rcube_find_object('dbgconsole'); - - if (box) { - if (msg.charAt(msg.length-1)=='\n') - msg += '--------------------------------------\n'; - else - msg += '\n--------------------------------------\n'; - - // Konqueror doesn't allow to just change the value of hidden element - if (bw.konq) { - box.innerText += msg; - box.value = box.innerText; - } else - box.value += msg; - } - }; - - this.reset = function() - { - var box = rcube_find_object('dbgconsole'); - if (box) - box.innerText = box.value = ''; - }; -}; - var bw = new roundcube_browser(); bw.set_html_class(); @@ -597,20 +575,6 @@ if (!String.prototype.startsWith) { }; } -// Make getElementById() case-sensitive on IE -if (bw.ie) { - document._getElementById = document.getElementById; - document.getElementById = function(id) { - var i = 0, obj = document._getElementById(id); - - if (obj && obj.id != id) - while ((obj = document.all[i]) && obj.id != id) - i++; - - return obj; - } -} - // jQuery plugin to emulate HTML5 placeholder attributes on input elements jQuery.fn.placeholder = function(text) { return this.each(function() { |