Changeset 3948 in subversion
- Timestamp:
- Sep 8, 2010 1:57:35 PM (3 years ago)
- File:
-
- 1 edited
-
trunk/roundcubemail/program/js/common.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/js/common.js
r3942 r3948 26 26 function roundcube_browser() 27 27 { 28 this.ver = parseFloat(navigator.appVersion); 29 this.appver = navigator.appVersion; 30 this.agent = navigator.userAgent; 31 this.agent_lc = navigator.userAgent.toLowerCase(); 32 this.name = navigator.appName; 33 this.vendor = navigator.vendor ? navigator.vendor : ''; 34 this.vendver = navigator.vendorSub ? parseFloat(navigator.vendorSub) : 0; 35 this.product = navigator.product ? navigator.product : ''; 36 this.platform = String(navigator.platform).toLowerCase(); 37 this.lang = (navigator.language) ? navigator.language.substring(0,2) : 38 (navigator.browserLanguage) ? navigator.browserLanguage.substring(0,2) : 39 (navigator.systemLanguage) ? navigator.systemLanguage.substring(0,2) : 'en'; 28 var n = navigator; 29 30 this.ver = parseFloat(n.appVersion); 31 this.appver = n.appVersion; 32 this.agent = n.userAgent; 33 this.agent_lc = n.userAgent.toLowerCase(); 34 this.name = n.appName; 35 this.vendor = n.vendor ? n.vendor : ''; 36 this.vendver = n.vendorSub ? parseFloat(n.vendorSub) : 0; 37 this.product = n.product ? n.product : ''; 38 this.platform = String(n.platform).toLowerCase(); 39 this.lang = (n.language) ? n.language.substring(0,2) : 40 (n.browserLanguage) ? n.browserLanguage.substring(0,2) : 41 (n.systemLanguage) ? n.systemLanguage.substring(0,2) : 'en'; 40 42 41 43 this.win = (this.platform.indexOf('win') >= 0); … … 59 61 this.ns7 = (this.ns && parseInt(this.vendver) == 7); // this.agent.indexOf('Netscape/7')>0); 60 62 this.chrome = (this.agent_lc.indexOf('chrome') > 0); 61 this.safari = (!this.chrome && (this.agent_lc.indexOf('safari') > 0 || this.agent .toLowerCase().indexOf('applewebkit') > 0));63 this.safari = (!this.chrome && (this.agent_lc.indexOf('safari') > 0 || this.agent_lc.indexOf('applewebkit') > 0)); 62 64 this.konq = (this.agent_lc.indexOf('konqueror') > 0); 63 65 this.iphone = (this.safari && this.agent_lc.indexOf('iphone') > 0); … … 67 69 68 70 if (this.opera && window.RegExp) 69 this.vendver = (/opera(\s|\/)([0-9\.]+)/ i.test(navigator.userAgent)) ? parseFloat(RegExp.$2) : -1;71 this.vendver = (/opera(\s|\/)([0-9\.]+)/.test(this.agent_lc)) ? parseFloat(RegExp.$2) : -1; 70 72 else if (this.chrome && window.RegExp) 71 this.vendver = (/chrome\/([0-9\.]+)/ i.test(this.agent)) ? parseFloat(RegExp.$1) : 0;73 this.vendver = (/chrome\/([0-9\.]+)/.test(this.agent_lc)) ? parseFloat(RegExp.$1) : 0; 72 74 else if (!this.vendver && this.safari) 73 this.vendver = (/(safari|applewebkit)\/([0-9]+)/ i.test(this.agent)) ? parseInt(RegExp.$2) : 0;75 this.vendver = (/(safari|applewebkit)\/([0-9]+)/.test(this.agent_lc)) ? parseInt(RegExp.$2) : 0; 74 76 else if ((!this.vendver && this.mz) || this.agent.indexOf('Camino')>0) 75 77 this.vendver = (/rv:([0-9\.]+)/.test(this.agent)) ? parseFloat(RegExp.$1) : 0; 76 78 else if (this.ie && window.RegExp) 77 this.vendver = (/msie\s+([0-9\.]+)/ i.test(this.agent)) ? parseFloat(RegExp.$1) : 0;79 this.vendver = (/msie\s+([0-9\.]+)/.test(this.agent_lc)) ? parseFloat(RegExp.$1) : 0; 78 80 else if (this.konq && window.RegExp) 79 this.vendver = (/khtml\/([0-9\.]+)/ i.test(this.agent)) ? parseFloat(RegExp.$1) : 0;81 this.vendver = (/khtml\/([0-9\.]+)/.test(this.agent_lc)) ? parseFloat(RegExp.$1) : 0; 80 82 81 83 // get real language out of safari's user agent 82 if(this.safari && (/;\s+([a-z]{2})-[a-z]{2}\)/ i.test(this.agent)))84 if(this.safari && (/;\s+([a-z]{2})-[a-z]{2}\)/.test(this.agent_lc))) 83 85 this.lang = RegExp.$1; 84 86 … … 88 90 (this.ie && this.win && this.vendver >= 5.5) || this.safari); 89 91 this.opacity = (this.mz || (this.ie && this.vendver >= 5.5 && !this.opera) || (this.safari && this.vendver >= 100)); 90 this.cookies = n avigator.cookieEnabled;92 this.cookies = n.cookieEnabled; 91 93 92 94 // test for XMLHTTP support
Note: See TracChangeset
for help on using the changeset viewer.
