Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lukemorton/398010 to your computer and use it in GitHub Desktop.
Save lukemorton/398010 to your computer and use it in GitHub Desktop.
(function(d, isIE) {
var s = d.getElementsByTagName('script')[0];
function async(url) {
var scr = [];
for (u in url) {
var j = scr[scr.length] = d.createElement('script');
j.type = 'text/javascript'; j.async = true;
j.src = url[u];
s.parentNode.insertBefore(j, s);
}
return scr;
}
async([
"http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js",
"/js/films.js"
]);
if (isIE) { async(["http://html5shiv.googlecode.com/svn/trunk/html5.js"]); }
function preload(preload) {
var i = 0;
var max = 0;
var o = null;
for (i = 0, max = preload.length; i < max; i += 1) {
if (isIE) {
new Image().src = preload[i];
continue;
}
o = d.createElement('object');
o.data = preload[i];
o.width = 0;
o.height = 0;
d.body.appendChild(o);
}
}
// list of stuff to preload
preload(["/img/warning.png"]);
}(document, navigator.appName.indexOf('Microsoft') === 0));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment