| | |
| | | // 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 modifier key (constants defined at top of file) |
| | | */ |
| | |
| | | { |
| | | if(d.layers[id]) obj = d.layers[id]; |
| | | for(n=0; !obj && n<d.layers.length; n++) |
| | | obj = nex_get_object(id, d.layers[n].document); |
| | | obj = rcube_find_object(id, d.layers[n].document); |
| | | } |
| | | |
| | | return obj; |
| | |
| | | function rcube_get_object_pos(obj) |
| | | { |
| | | if(typeof(obj)=='string') |
| | | obj = nex_get_object(obj); |
| | | obj = rcube_find_object(obj); |
| | | |
| | | if(!obj) return {x:0, y:0}; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | if(bw.mac && bw.ie5) iX += document.body.leftMargin; |
| | | if(bw.mac && bw.ie5) iY += document.body.topMargin; |
| | | //if(bw.mac && bw.ie5) iX += document.body.leftMargin; |
| | | //if(bw.mac && bw.ie5) iY += document.body.topMargin; |
| | | |
| | | return {x:iX, y:iY}; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return the currently applied value of a css property |
| | | * |
| | | * @param {Object} html_element Node reference |
| | | * @param {String} css_property Property name to read in Javascript notation (eg. 'textAlign') |
| | | * @param {String} mozilla_equivalent Equivalent property name in CSS notation (eg. 'text-align') |
| | | * @return CSS property value |
| | | * @type String |
| | | */ |
| | | function get_elements_computed_style(html_element, css_property, mozilla_equivalent) |
| | | { |
| | | if (arguments.length==2) |
| | | mozilla_equivalent = css_property; |
| | | |
| | | var el = html_element; |
| | | if (typeof(html_element)=='string') |
| | | el = rcube_find_object(html_element); |
| | | |
| | | if (el && el.currentStyle) |
| | | return el.currentStyle[css_property]; |
| | | else if (el && document.defaultView && document.defaultView.getComputedStyle) |
| | | return document.defaultView.getComputedStyle(el, null).getPropertyValue(mozilla_equivalent); |
| | | else |
| | | return false; |
| | | } |
| | | |
| | | |
| | |
| | | (secure ? "; secure" : ""); |
| | | document.cookie = curCookie; |
| | | } |
| | | |
| | | roundcube_browser.prototype.set_cookie = setCookie; |
| | | |
| | | function getCookie(name) |
| | | { |
| | |
| | | return unescape(dc.substring(begin + prefix.length, end)); |
| | | } |
| | | |
| | | roundcube_browser.prototype.get_cookie = getCookie; |
| | | |
| | | |
| | | // 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'; |
| | | }; |
| | | |
| | | this.reset = function() |
| | | { |
| | | if (this.box) |
| | | this.box.value = ''; |
| | | }; |
| | | } |
| | | |
| | | var bw = new roundcube_browser(); |
| | | |
| | | if (!window.console) |
| | | console = new rcube_console(); |