1 2/** 3 * Feature/brower/OS detection 4 * 5 * @author John Dyer (http://j.hn/) 6 */ 7 8docs.Features = (function() { 9 var 10 t = {}, 11 d = document, 12 nav = navigator, 13 ua = nav.userAgent.toLowerCase(); 14 15 // detect browsers (only the ones that have some kind of quirk we need to work around) 16 t.isiPad = (ua.match(/ipad/i) !== null); 17 t.isiPhone = (ua.match(/iphone/i) !== null); 18 t.isiOS = t.isiPhone || t.isiPad; 19 t.isAndroid = (ua.match(/android/i) !== null); 20 t.isIE = (nav.appName.toLowerCase().indexOf("microsoft") != -1); 21 t.isChrome = (ua.match(/chrome/gi) !== null); 22 t.isFirefox = (ua.match(/firefox/gi) !== null); 23 t.isWebkit = (ua.match(/webkit/gi) !== null); 24 t.isOpera = (ua.match(/opera/gi) !== null); 25 t.hasTouch = ('ontouchstart' in window); 26 27 // Webkit/firefox 28 t.hasWebkitNativeFullScreen = (typeof d.webkitRequestFullScreen !== 'undefined'); 29 t.hasMozNativeFullScreen = (typeof d.mozRequestFullScreen !== 'undefined'); 30 31 t.hasTrueNativeFullScreen = (t.hasWebkitNativeFullScreen || t.hasMozNativeFullScreen); 32 t.nativeFullScreenEnabled = t.hasTrueNativeFullScreen; 33 if (t.hasMozNativeFullScreen) { 34 t.nativeFullScreenEnabled = d.mozFullScreenEnabled; 35 } 36 37 if (t.hasTrueNativeFullScreen) { 38 t.fullScreenEventName = (t.hasWebkitNativeFullScreen) ? 'webkitfullscreenchange' : 'mozfullscreenchange'; 39 40 41 t.isFullScreen = function() { 42 if (d.mozRequestFullScreen) { 43 return d.mozFullScreen; 44 } else if (d.webkitRequestFullScreen) { 45 return d.webkitIsFullScreen; 46 } else { 47 return false; 48 } 49 } 50 51 t.requestFullScreen = function(el) { 52 53 if (t.hasWebkitNativeFullScreen) { 54 el.webkitRequestFullScreen(); 55 } else if (t.hasMozNativeFullScreen) { 56 el.mozRequestFullScreen(); 57 } 58 } 59 60 t.cancelFullScreen = function() { 61 if (t.hasWebkitNativeFullScreen) { 62 document.webkitCancelFullScreen(); 63 } else if (t.hasMozNativeFullScreen) { 64 document.mozCancelFullScreen(); 65 } 66 } 67 68 } 69 70 return t; 71})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.