ajout flag isMobile.
[Epoz.git] / epoz / epoz_core / epoz_script_detect.js.dtml
old mode 100755 (executable)
new mode 100644 (file)
index 85071e9..0867fc6
@@ -8,8 +8,9 @@ function BrowserDetect() {
    var ua = navigator.userAgent.toLowerCase(); 
 
    // browser engine name
-   this.isGecko       = (ua.indexOf('gecko') != -1 && ua.indexOf('safari') == -1);
    this.isAppleWebKit = (ua.indexOf('applewebkit') != -1);
+   this.isTrident     = (ua.indexOf('trident') != -1);
+   this.isGecko       = (!this.isTrident && (ua.indexOf('gecko') != -1 && ua.indexOf('safari') == -1));
 
    // browser name
    this.isKonqueror   = (ua.indexOf('konqueror') != -1); 
@@ -18,9 +19,10 @@ function BrowserDetect() {
    this.isOpera       = (ua.indexOf('opera') != -1); 
    this.isIcab        = (ua.indexOf('icab') != -1); 
    this.isAol         = (ua.indexOf('aol') != -1); 
-   this.isIE          = (ua.indexOf('msie') != -1 && !this.isOpera && (ua.indexOf('webtv') == -1) ); 
+   this.isIE          = (this.isTrident || ua.indexOf('msie') != -1 && !this.isOpera && (ua.indexOf('webtv') == -1) ); 
    this.isMozilla     = (this.isGecko && ua.indexOf('gecko/') + 14 == ua.length);
    this.isFirebird    = (ua.indexOf('firebird/') != -1);
+   this.isFirefox     = (ua.indexOf('firefox/') != -1);
    this.isNS          = ( (this.isGecko) ? (ua.indexOf('netscape') != -1) : ( (ua.indexOf('mozilla') != -1) && !this.isOpera && !this.isSafari && (ua.indexOf('spoofer') == -1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('webtv') == -1) && (ua.indexOf('hotjava') == -1) ) );
    
    // spoofing and compatible browsers
@@ -43,7 +45,11 @@ function BrowserDetect() {
       this.versionMinor = parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) );
    }
    else if (this.isIE && this.versionMinor >= 4) {
-      this.versionMinor = parseFloat( ua.substring( ua.indexOf('msie ') + 5 ) );
+       if (ua.indexOf('msie') != -1) {
+           this.versionMinor = parseFloat( ua.substring( ua.indexOf('msie ') + 5 ) );}
+       else if (this.isTrident) {
+           this.versionMinor = parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) );
+       }
    }
    else if (this.isKonqueror) {
       this.versionMinor = parseFloat( ua.substring( ua.indexOf('konqueror/') + 10 ) );
@@ -76,6 +82,7 @@ function BrowserDetect() {
    this.isMac    = (ua.indexOf('mac') != -1);
    this.isUnix   = (ua.indexOf('unix') != -1 || ua.indexOf('sunos') != -1 || ua.indexOf('bsd') != -1 || ua.indexOf('x11') != -1)
    this.isLinux  = (ua.indexOf('linux') != -1);
+   this.isMobile   = (ua.indexOf('mobile') != -1);
    
    // specific browser shortcuts
    this.isNS4x = (this.isNS && this.versionMajor == 4);
@@ -94,6 +101,10 @@ function BrowserDetect() {
    this.isIE5up = (this.isIE && this.versionMajor >= 5);
    this.isIE6x = (this.isIE && this.versionMajor == 6);
    this.isIE6up = (this.isIE && this.versionMajor >= 6);
+   this.isIE8max = (this.isIE && this.versionMajor <= 8);
+   this.isIE10 = (this.isIE && this.versionMajor == 10);
+   this.isIE10max = (this.isIE && this.versionMajor <= 10);
+   this.isIE11 = (this.isIE && this.versionMajor == 11);
    
    this.isIE4xMac = (this.isIE4x && this.isMac);
 }