From 186537b2c60517ba8cc9283a80b7092b6d9e2b3e Mon Sep 17 00:00:00 2001 From: alecpl <alec@alec.pl> Date: Fri, 16 Apr 2010 07:50:59 -0400 Subject: [PATCH] - more code formatting - allow re-selecting highlighted row (#1486442) --- program/js/common.js | 44 +++++++++++++++++++------------------------- 1 files changed, 19 insertions(+), 25 deletions(-) diff --git a/program/js/common.js b/program/js/common.js index 1fd10c2..0254a2c 100644 --- a/program/js/common.js +++ b/program/js/common.js @@ -21,7 +21,7 @@ /** * Default browser check class - * @construcotr + * @constructor */ function roundcube_browser() { @@ -48,8 +48,9 @@ this.ie = (document.all) ? true : false; this.ie4 = (this.ie && !this.dom); this.ie5 = (this.dom && this.appver.indexOf('MSIE 5')>0); - this.ie6 = (this.dom && this.appver.indexOf('MSIE 6')>0); + this.ie8 = (this.dom && this.appver.indexOf('MSIE 8')>0); this.ie7 = (this.dom && this.appver.indexOf('MSIE 7')>0); + this.ie6 = (this.dom && !this.ie8 && !this.ie7 && this.appver.indexOf('MSIE 6')>0); this.mz = (this.dom && this.ver>=5); // (this.dom && this.product=='Gecko') this.ns = ((this.ver<5 && this.name=='Netscape') || (this.ver>=5 && this.vendor.indexOf('Netscape')>=0)); @@ -291,7 +292,7 @@ e = this; else if (typeof e == 'object') e.event = evt; - + if (this._events && this._events[evt] && !this._event_exec) { this._event_exec = true; for (var i=0; i < this._events[evt].length; i++) { @@ -468,27 +469,20 @@ } -// find a value in a specific array and returns the index -function find_in_array() - { - var args = find_in_array.arguments; - if(!args.length) return -1; - - var haystack = typeof(args[0])=='object' ? args[0] : args.length>1 && typeof(args[1])=='object' ? args[1] : new Array(); - var needle = typeof(args[0])!='object' ? args[0] : args.length>1 && typeof(args[1])!='object' ? args[1] : ''; - var nocase = args.length==3 ? args[2] : false; - - if(!haystack.length) return -1; - - for(var i=0; i<haystack.length; i++) - if(nocase && haystack[i].toLowerCase()==needle.toLowerCase()) - return i; - else if(haystack[i]==needle) - return i; - - return -1; +// recursively copy an object +function rcube_clone_object(obj) +{ + var out = {}; + + for (var key in obj) { + if (obj[key] && typeof obj[key] == 'object') + out[key] = clone_object(obj[key]); + else + out[key] = obj[key]; } - + + return out; +} // make a string URL safe function urlencode(str) @@ -580,7 +574,7 @@ { this.log = function(msg) { - var box = rcube_find_object('console'); + var box = rcube_find_object('dbgconsole'); if (box) { if (msg.charAt(msg.length-1)=='\n') @@ -599,7 +593,7 @@ this.reset = function() { - var box = rcube_find_object('console'); + var box = rcube_find_object('dbgconsole'); if (box) box.innerText = box.value = ''; }; -- Gitblit v1.9.1