From 910d07e3002a9077500e09abea968fc7f2eaeb91 Mon Sep 17 00:00:00 2001 From: alecpl <alec@alec.pl> Date: Fri, 29 Aug 2008 02:44:09 -0400 Subject: [PATCH] - signature in html editor must be in <div> not <span>, because IE not allows to include block elements inside <span> - if identity has no signature, replace previous with empty div --- program/js/common.js | 60 +++++++++++++++++++++++++++++++++++------------------------- 1 files changed, 35 insertions(+), 25 deletions(-) diff --git a/program/js/common.js b/program/js/common.js index fb49bfb..6e4c643 100644 --- a/program/js/common.js +++ b/program/js/common.js @@ -3,7 +3,7 @@ | RoundCube common js library | | | | This file is part of the RoundCube web development suite | - | Copyright (C) 2005-2006, RoundCube Dev, - Switzerland | + | Copyright (C) 2005-2007, RoundCube Dev, - Switzerland | | Licensed under the GNU GPL | | | +-----------------------------------------------------------------------+ @@ -52,16 +52,12 @@ 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)); - this.ns4 = (this.ns && parseInt(this.ver)==4); this.ns6 = (this.ns && parseInt(this.vendver)==6); // (this.mz && this.ns) ? true : false; this.ns7 = (this.ns && parseInt(this.vendver)==7); // this.agent.indexOf('Netscape/7')>0); this.safari = (this.agent.toLowerCase().indexOf('safari')>0 || this.agent.toLowerCase().indexOf('applewebkit')>0); this.konq = (this.agent.toLowerCase().indexOf('konqueror')>0); this.opera = (window.opera) ? true : false; - this.opera5 = (this.opera5 && this.agent.indexOf('Opera 5')>0) ? true : false; - this.opera6 = (this.opera && this.agent.indexOf('Opera 6')>0) ? true : false; - this.opera7 = (this.opera && this.agent.indexOf('Opera 7')>0) ? true : false; if(this.opera && window.RegExp) this.vendver = (/opera(\s|\/)([0-9\.]+)/i.test(navigator.userAgent)) ? parseFloat(RegExp.$2) : -1; @@ -80,11 +76,7 @@ this.lang = RegExp.$1; this.dhtml = ((this.ie4 && this.win) || this.ie5 || this.ie6 || this.ns4 || this.mz); - this.layers = this.ns4; // (document.layers); - this.div = (this.ie4 || this.dom); this.vml = (this.win && this.ie && this.dom && !this.opera); - this.linkborder = (this.ie || this.mz); - this.rollover = (this.ver>=4 || (this.ns && this.ver>=3)); // (document.images) ? true : false; this.pngalpha = (this.mz || (this.opera && this.vendver>=6) || (this.ie && this.mac && this.vendver>=5) || (this.ie && this.win && this.vendver>=5.5) || this.safari); this.opacity = (this.mz || (this.ie && this.vendver>=5.5 && !this.opera) || (this.safari && this.vendver>=100)); @@ -103,14 +95,23 @@ // static functions for event handling var rcube_event = { - /** - * returns the event key code - */ - get_keycode: function(e) - { - e = e || window.event; - return e && e.keyCode ? e.keyCode : (e && e.which ? e.which : 0); - }, +/** + * returns the event target element + */ +get_target: function(e) +{ + e = e || window.event; + return e && e.target ? e.target : e.srcElement; +}, + +/** + * returns the event key code + */ +get_keycode: function(e) +{ + e = e || window.event; + return e && e.keyCode ? e.keyCode : (e && e.which ? e.which : 0); +}, /** * returns modifier key (constants defined at top of file) @@ -170,7 +171,12 @@ if (p.element.addEventListener) p.element.addEventListener(p.event, p.object._rc_events[key], false); else if (p.element.attachEvent) + { + // IE allows multiple events with the same function to be applied to the same object + // forcibly detach the event, then attach + p.element.detachEvent('on'+p.event, p.object._rc_events[key]); p.element.attachEvent('on'+p.event, p.object._rc_events[key]); + } else p.element['on'+p.event] = p.object._rc_events[key]; }, @@ -407,7 +413,8 @@ var domain = sub_domain+'(\\x2e'+sub_domain+')*'; var local_part = word+'(\\x2e'+word+')*'; var addr_spec = local_part+'\\x40'+domain; - var reg1 = inline ? new RegExp('(^|<)'+addr_spec+'(>|$)', 'i') : new RegExp('^'+addr_spec+'$', 'i'); + var delim = '[,;\s\n]'; + var reg1 = inline ? new RegExp('(^|<|'+delim+')'+addr_spec+'($|>|'+delim+')', 'i') : new RegExp('^'+addr_spec+'$', 'i'); return reg1.test(input) ? true : false; } return false; @@ -572,18 +579,21 @@ // tiny replacement for Firebox functionality function rcube_console() { - this.box = rcube_find_object('console'); - this.log = function(msg) { - if (this.box) - this.box.value += str+'\n--------------------------------------\n'; + box = rcube_find_object('console'); + if (box) + if (msg[msg.length-1]=='\n') + box.value += msg+'--------------------------------------\n'; + else + box.value += msg+'\n--------------------------------------\n'; }; - + this.reset = function() { - if (this.box) - this.box.value = ''; + box = rcube_find_object('console'); + if (box) + box.value = ''; }; } -- Gitblit v1.9.1