-
-
Save dpesch/5706696 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /vendor/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "tvandervossen/detect.js", | |
| "description": "environment / user agent / device / feature detection code", | |
| "authors": [ | |
| { | |
| "name": "Thijs van der Vossen", | |
| "email": "thijs@fngtps.com" | |
| } | |
| ] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| env = function(){ | |
| var flags = {}, ua = navigator.userAgent, el = document.createElement('div'), root = document.documentElement, i | |
| function flag(names) { | |
| root.className += (root.className ? ' ' : '') + names | |
| names = names.split(' ') | |
| for (i = 0; i < names.length; i++) flags[names[i]] = true | |
| } | |
| if (ua.indexOf('WebKit/') > -1) flag('webkit') | |
| if (ua.indexOf('MSIE ') > -1) flag('msie') | |
| if (ua.indexOf('Firefox') > -1) flag('firefox') | |
| if (ua.indexOf('(iPad') > -1) flag('ios ipad') | |
| if (ua.indexOf('(iPhone') > -1 || ua.indexOf('(iPod') > 1) flag('ios iphone') | |
| if (!flags.ios) flag('desktop') | |
| el.setAttribute('ontouchstart', 'return;') | |
| if (typeof el.ontouchstart === 'function') flag('touch') | |
| if (window.navigator.msPointerEnabled) flag('touch mspointer') | |
| if (window.navigator.standalone) flag('standalone') | |
| if (window.devicePixelRatio >= 2) flag('retina') | |
| if (window !== window.top) flag('embedded') | |
| if (!!document.createElement('video').canPlayType) flag('video') | |
| return flags | |
| }() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment