Last active
August 29, 2015 14:07
-
-
Save karlcow/0b60bc5d225d47b14fcf to your computer and use it in GitHub Desktop.
It doesn't start well inside the JS of m.futureshop.ca
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
| var env = { | |
| uagent: navigator.userAgent.toLowerCase(), | |
| isWebkit: false, | |
| isiPhone: false, | |
| isiPad: false, | |
| isAndroid: false, | |
| isAndroidCromeMobile: false, | |
| isBlackberry: false, | |
| isWindowsPhone: false, | |
| isTouchpad: false, | |
| isTouchEnabled: false, | |
| browserWidth: $(window).width(), | |
| browserHeight: $(window).height(), | |
| //… | |
| //Then | |
| env.isWebkit = /webkit/gi.test(env.uagent); | |
| env.isiPhone = /iphone/gi.test(env.uagent); | |
| env.isiPad = /ipad/gi.test(env.uagent); | |
| env.isAndroid = /android/gi.test(env.uagent); | |
| env.isAndroidCromeMobile = /mobile/gi.test(env.uagent) && /chrome/gi.test(env.uagent) && env.isAndroid; | |
| env.isPlaybook = /playbook/gi.test(env.uagent); | |
| env.isTouchpad = /touchpad/gi.test(env.uagent); | |
| env.isBlackberry = /blackberry/gi.test(env.uagent); | |
| env.isMobile = /mobile/gi.test(env.uagent) || env.isPlaybook || env.isAndroid; | |
| env.isTablet = !env.isiPhone && !env.isAndroidCromeMobile && Math.floor(env.browserWidth, env.browserHeight) > 599; | |
| env.isMobileLayout = false; | |
| env.isTabletLayout = false; | |
| env.isWindowsPhone = /windows phone/gi.test(env.uagent); | |
| env.isTouchEnabled = true || ('ontouchstart' in document.documentElement); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment