Created
July 22, 2014 19:00
-
-
Save miketaylr/dfb281026b8362bca58f 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
Site = { | |
isDesktop: function() { | |
return "desktop" == $("html").attr("data-device"); | |
}, | |
isMobile: function() { | |
return "mobile" == $("html").attr("data-device"); | |
}, | |
isProduction: function() { | |
var t = location.host.split("."); | |
return !($.inArray("systest", t) > -1 || $.inArray("uat", t) > -1 || $.inArray("localhost", t) > -1); | |
} | |
}, Site.browser = new function() { | |
var t = this, e = { | |
touch: { | |
chrome: 31, | |
safari: 6 | |
}, | |
noTouch: { | |
msie: 9, | |
chrome: 32, | |
mozilla: 27, | |
safari: 5, | |
opera: 20 | |
} | |
}; | |
t.isSupported = function() { | |
var t = !1, i = $("html"); | |
return i.is(".touch") && ("chrome" === $.browser.name && $.browser.versionNumber >= e.touch.chrome && (t = !0), | |
"webkit" === $.browser.name && (t = !0), "safari" === $.browser.name && $.browser.versionNumber >= e.touch.safari && (t = !0)), | |
i.is(".no-touch") && ("msie" === $.browser.name && $.browser.versionNumber >= e.noTouch.msie && (t = !0), | |
"chrome" === $.browser.name && $.browser.versionNumber >= e.noTouch.chrome && (t = !0), | |
"mozilla" === $.browser.name && $.browser.versionNumber >= e.noTouch.mozilla && (t = !0), | |
"safari" === $.browser.name && $.browser.versionNumber >= e.noTouch.safari && (t = !0), | |
"opera" === $.browser.name && $.browser.versionNumber >= e.noTouch.opera && (t = !0)), | |
t; | |
}, t.displayUnsupportedPopup = function() { | |
var t = $("html"), i = ""; | |
i += '<div id="unsupported-browser">', i += '<div class="overlay"></div>', i += '<div class="message">', | |
i += '<div class="col desktop-12">', i += '<div class="sprite exclamation"></div>', | |
i += "<h1>Your browser isn't currently supported.</h1>", i += "<h2>To view the latest Westfield has to offer, upgrade to one of these versions:</h2>", | |
i += "</div>", i += '<div class="col desktop-3">', i += '<a class="sprite chrome" href="https://www.google.com/intl/en/chrome/browser/"><span>Chrome ' + e[t.is(".touch") ? "touch" : "noTouch"].chrome + "+</span></a>", | |
i += "</div>", i += '<div class="col desktop-3">', i += '<a class="sprite firefox" href="https://www.mozilla.org/en-US/firefox/new/"><span>Firefox ' + e.noTouch.mozilla + "+</span></a>", | |
i += "</div>", i += '<div class="col desktop-3">', i += '<a class="sprite safari" href="https://www.apple.com/safari/"><span>Safari ' + e[t.is(".touch") ? "touch" : "noTouch"].safari + "+</span></a>", | |
i += "</div>", i += '<div class="col desktop-3">', i += '<a class="sprite ie" href="http://windows.microsoft.com/en-US/internet-explorer/download-ie"><span>Internet Explorer ' + e.noTouch.msie + "+</span></a>", | |
i += "</div>", i += "</div>", i += "</div>", $("body").prepend(i).css({ | |
overflow: "hidden" | |
}); | |
}; | |
}() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment