Last active
December 25, 2015 18:39
-
-
Save LarryAnomie/7021683 to your computer and use it in GitHub Desktop.
conditionally load JQuery 2 for new browsers
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
<script> | |
// set a global version var for cache busting | |
var CITY_VERSION = "%globals_snippet_77381%."; | |
yepnope([ | |
{ | |
test: 'querySelector' in document && 'localStorage' in window && 'addEventListener' in window, | |
yep: { | |
"jQuery2" : '//ajax.aspnetcdn.com/ajax/jQuery/jquery-2.0.3.min.js' | |
}, | |
nope: { | |
'jQuery1': '//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js' | |
}, | |
callback: { | |
"jQuery1" : function (url, result, key) { | |
if (!window.jQuery) { | |
yepnope('local/jquery.min.js'); | |
} | |
}, | |
"jQuery2" : function (url, result, key) { | |
if (!window.jQuery) { | |
yepnope('local/jquery.min.js'); | |
} | |
} | |
} | |
}, { | |
// this should download as soon as this line is executed, but won't be executed until after the local jquery is loaded | |
load : "//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js" | |
}, { | |
load : "//s1.dev.city.ac.uk/cassrmain/js/%globals_snippet_77381%.cassrmain.js", | |
callback : function (url, result, key) { | |
CASS.init(); | |
} | |
} | |
]); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment