/** * Roundcube common js library * * This file is part of the Roundcube Webmail client * * @licstart The following is the entire license notice for the * JavaScript code in this file. * * Copyright (c) The Roundcube Dev Team * * The JavaScript code in this page is free software: you can * redistribute it and/or modify it under the terms of the GNU * General Public License (GNU GPL) as published by the Free Software * Foundation, either version 3 of the License, or (at your option) * any later version. The code is distributed WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. * * As additional permission under GNU GPL version 3 section 7, you * may distribute non-source (e.g., minimized or compacted) forms of * that code without the copy of the GNU GPL normally required by * section 4, provided you include this license notice and a URL * through which recipients can access the Corresponding Source. * * @licend The above is the entire license notice * for the JavaScript code in this file. */ var CONTROL_KEY=1,SHIFT_KEY=2,CONTROL_SHIFT_KEY=3; function roundcube_browser(){var a=navigator;this.agent=a.userAgent;this.agent_lc=a.userAgent.toLowerCase();this.name=a.appName;this.vendor=a.vendor?a.vendor:"";this.vendver=a.vendorSub?parseFloat(a.vendorSub):0;this.product=a.product?a.product:"";this.platform=String(a.platform).toLowerCase();this.lang=a.language?a.language.substring(0,2):a.browserLanguage?a.browserLanguage.substring(0,2):a.systemLanguage?a.systemLanguage.substring(0,2):"en";this.win=0<=this.platform.indexOf("win");this.mac=0<=this.platform.indexOf("mac"); this.linux=0<=this.platform.indexOf("linux");this.unix=0<=this.platform.indexOf("unix");this.dom=document.getElementById?!0:!1;this.dom2=document.addEventListener&&document.removeEventListener;this.edge=0=(a.pageY||0)&&!a.clientX&&0>=(a.clientY||0):!1},keyboard_only:function(a){return rcube_event.is_keyboard(a)?!0:rcube_event.cancel(a)},touchevent:function(a){return{pageX:a.pageX, pageY:a.pageY,offsetX:a.pageX-a.target.offsetLeft,offsetY:a.pageY-a.target.offsetTop,target:a.target,istouch:!0}}};function rcube_event_engine(){this._events={}} rcube_event_engine.prototype={addEventListener:function(a,b,c){this._events||(this._events={});this._events[a]||(this._events[a]=[]);this._events[a].push({func:b,obj:c?c:window});return this},removeEventListener:function(a,b,c){void 0===c&&(c=window);for(var d,e=0;this._events&&this._events[a]&&e|[,;\\s\\n])",c?"ig":"i"):new RegExp("^"+d+"$","i");return c?a.match(b).length:b.test(a)}function rcube_clone_object(a){var b={},c;for(c in a)b[c]=a[c]&&"object"===typeof a[c]?rcube_clone_object(a[c]):a[c];return b}function urlencode(a){return window.encodeURIComponent?encodeURIComponent(a).replace("*","%2A"):escape(a).replace("+","%2B").replace("*","%2A").replace("/","%2F").replace("@","%40")} function rcube_find_object(a,b){var c,d;b||(b=document);if(b.getElementById&&(d=b.getElementById(a)))return d;!d&&b.getElementsByName&&(c=b.getElementsByName(a))&&(d=c[0]);!d&&b.all&&(d=b.all[a]);!d&&b.images.length&&(d=b.images[a]);if(!d&&b.forms.length)for(c=0;c=c.left&&a.x=c.top&&a.yc.length)b=c.length;b-=a.length;a=c.lastIndexOf(a,b);return-1!==a&&a===b});jQuery.last=function(a){return a&&a.length?a[a.length-1]:void 0};jQuery.fn.placeholder=function(a){return this.each(function(){$(this).prop({title:a,placeholder:a})})}; var rcube_parse_query=function(a){if(!a)return{};var b={},c,d=/([^&=]+)=?([^&]*)/g,e=/\+/g;for(a=a.replace(/\?/,"");c=d.exec(a);){var f=decodeURIComponent(c[1].replace(e," "));c=decodeURIComponent(c[2].replace(e," "));"[]"===f.substring(f.length-2)?(f=f.substring(0,f.length-2),(b[f]||(b[f]=[])).push(c)):b[f]=c}return b},Base64=function(){var a=function(b){for(var c=0,d="",e,f,g;ce?(d+=String.fromCharCode(e),c++):191e?(f=b.charCodeAt(c+1),d+=String.fromCharCode((e& 31)<<6|f&63),c+=2):(f=b.charCodeAt(c+1),g=b.charCodeAt(c+2),d+=String.fromCharCode((e&15)<<12|(f&63)<<6|g&63),c+=3);return d};return{encode:function(b){b=b.replace(/\r\n/g,"\n");for(var c="",d=0;de?c+=String.fromCharCode(e):(127e?c+=String.fromCharCode(e>>6|192):(c+=String.fromCharCode(e>>12|224),c+=String.fromCharCode(e>>6&63|128)),c+=String.fromCharCode(e&63|128))}b=c;if("function"===typeof window.btoa)try{return btoa(b)}catch(n){}for(var f,g,h, k=0,l="",m=b.length;k>2,f=(f&3)<<4|c>>4,g=(c&15)<<2|d>>6,h=d&63,isNaN(c)?g=h=64:isNaN(d)&&(h=64),l=l+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(f)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(g)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h);return l},decode:function(b){if("function"=== typeof window.atob)try{return a(atob(b))}catch(m){}var c,d=0,e="";b=b.replace(/[^A-Za-z0-9\+\/=]/g,"");for(c=b.length;d>4;g=(g&15)<<4|h>>2;var l=(h&3)<<6|k;e+=String.fromCharCode(f);64!=h&&(e+=String.fromCharCode(g));64!=k&&(e+=String.fromCharCode(l))}return a(e)}}}();