]>
git.wh0rd.org - tt-rss.git/blob - lib/dojo/sniff.js.uncompressed.js
1 define("dojo/sniff", ["./has"], function(has
){
8 // This module sets has() flags based on the current browser.
9 // It returns the has() function.
19 has
.add("air", dua
.indexOf("AdobeAIR") >= 0),
20 has
.add("khtml", dav
.indexOf("Konqueror") >= 0 ? tv
: undefined);
21 has
.add("webkit", parseFloat(dua
.split("WebKit/")[1]) || undefined);
22 has
.add("chrome", parseFloat(dua
.split("Chrome/")[1]) || undefined);
23 has
.add("safari", dav
.indexOf("Safari")>=0 && !has("chrome") ? parseFloat(dav
.split("Version/")[1]) : undefined);
24 has
.add("mac", dav
.indexOf("Macintosh") >= 0);
25 has
.add("quirks", document
.compatMode
== "BackCompat");
26 has
.add("ios", /iPhone|iPod|iPad/.test(dua
));
27 has
.add("android", parseFloat(dua
.split("Android ")[1]) || undefined);
31 if(dua
.indexOf("Opera") >= 0){
32 // see http://dev.opera.com/articles/view/opera-ua-string-changes and http://www.useragentstring.com/pages/Opera/
33 // 9.8 has both styles; <9.8, 9.9 only old style
34 has
.add("opera", tv
>= 9.8 ? parseFloat(dua
.split("Version/")[1]) || tv
: tv
);
37 // Mozilla and firefox
38 if(dua
.indexOf("Gecko") >= 0 && !has("khtml") && !has("webkit")){
39 has
.add("mozilla", tv
);
42 //We really need to get away from this. Consider a sane isGecko approach for the future.
43 has
.add("ff", parseFloat(dua
.split("Firefox/")[1] || dua
.split("Minefield/")[1]) || undefined);
47 if(document
.all
&& !has("opera")){
48 var isIE
= parseFloat(dav
.split("MSIE ")[1]) || undefined;
50 //In cases where the page has an HTTP header or META tag with
51 //X-UA-Compatible, then it is in emulation mode.
52 //Make sure isIE reflects the desired version.
53 //document.documentMode of 5 means quirks mode.
54 //Only switch the value if documentMode's major version
55 //is different from isIE's major version.
56 var mode
= document
.documentMode
;
57 if(mode
&& mode
!= 5 && Math
.floor(isIE
) != mode
){
65 has
.add("wii", typeof opera
!= "undefined" && opera
.wiiremote
);