diff options
author | Richard Beales <[email protected]> | 2013-03-18 07:32:01 +0000 |
---|---|---|
committer | Richard Beales <[email protected]> | 2013-03-18 07:32:01 +0000 |
commit | 7c97d17aaf373339a8bcd917ad59ca6018148f0d (patch) | |
tree | 5a3c04f0f9529be392c1263d3feb75806eb43797 /lib/dojo/sniff.js.uncompressed.js | |
parent | 70db7424e7068701e60cc5bcdfe8f858be508179 (diff) | |
parent | c670a80ddd9b03bd4ea6d940a9ed682fd26248d7 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'lib/dojo/sniff.js.uncompressed.js')
-rw-r--r-- | lib/dojo/sniff.js.uncompressed.js | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/lib/dojo/sniff.js.uncompressed.js b/lib/dojo/sniff.js.uncompressed.js new file mode 100644 index 000000000..4d52a43f3 --- /dev/null +++ b/lib/dojo/sniff.js.uncompressed.js @@ -0,0 +1,70 @@ +define("dojo/sniff", ["./has"], function(has){ + // module: + // dojo/sniff + + /*===== + return function(){ + // summary: + // This module sets has() flags based on the current browser. + // It returns the has() function. + }; + =====*/ + + if( 1 ){ + var n = navigator, + dua = n.userAgent, + dav = n.appVersion, + tv = parseFloat(dav); + + has.add("air", dua.indexOf("AdobeAIR") >= 0), + has.add("khtml", dav.indexOf("Konqueror") >= 0 ? tv : undefined); + has.add("webkit", parseFloat(dua.split("WebKit/")[1]) || undefined); + has.add("chrome", parseFloat(dua.split("Chrome/")[1]) || undefined); + has.add("safari", dav.indexOf("Safari")>=0 && !has("chrome") ? parseFloat(dav.split("Version/")[1]) : undefined); + has.add("mac", dav.indexOf("Macintosh") >= 0); + has.add("quirks", document.compatMode == "BackCompat"); + has.add("ios", /iPhone|iPod|iPad/.test(dua)); + has.add("android", parseFloat(dua.split("Android ")[1]) || undefined); + + if(!has("webkit")){ + // Opera + if(dua.indexOf("Opera") >= 0){ + // see http://dev.opera.com/articles/view/opera-ua-string-changes and http://www.useragentstring.com/pages/Opera/ + // 9.8 has both styles; <9.8, 9.9 only old style + has.add("opera", tv >= 9.8 ? parseFloat(dua.split("Version/")[1]) || tv : tv); + } + + // Mozilla and firefox + if(dua.indexOf("Gecko") >= 0 && !has("khtml") && !has("webkit")){ + has.add("mozilla", tv); + } + if(has("mozilla")){ + //We really need to get away from this. Consider a sane isGecko approach for the future. + has.add("ff", parseFloat(dua.split("Firefox/")[1] || dua.split("Minefield/")[1]) || undefined); + } + + // IE + if(document.all && !has("opera")){ + var isIE = parseFloat(dav.split("MSIE ")[1]) || undefined; + + //In cases where the page has an HTTP header or META tag with + //X-UA-Compatible, then it is in emulation mode. + //Make sure isIE reflects the desired version. + //document.documentMode of 5 means quirks mode. + //Only switch the value if documentMode's major version + //is different from isIE's major version. + var mode = document.documentMode; + if(mode && mode != 5 && Math.floor(isIE) != mode){ + isIE = mode; + } + + has.add("ie", isIE); + } + + // Wii + has.add("wii", typeof opera != "undefined" && opera.wiiremote); + } + } + + return has; +}); |