Created
November 13, 2009 00:32
-
-
Save BrunoCaimar/233457 to your computer and use it in GitHub Desktop.
MeMeThisLoad.js
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
// | |
// load.js | |
// Loads jQuery and the form-building script | |
// | |
// First and foremost, JQuery to the rescue | |
var memeThisJQueryScript = document.createElement('script'); | |
memeThisJQueryScript.setAttribute('language', 'javascript'); | |
memeThisJQueryScript.setAttribute('type', 'text/javascript'); | |
memeThisJQueryScript.setAttribute('src', 'http://memethis.com/js/jquery-1.3.2.min.js'); | |
document.getElementsByTagName('head')[0].appendChild(memeThisJQueryScript); | |
// We must give the browser some idle time to load JQuery before loading the | |
// form building script (which depends on it), setTimeout will do the trick | |
function memeThisLoadFormScript() { | |
if (typeof jQuery !== 'undefined') { | |
// jQuery available, load stage 2 | |
$.getScript('http://gist.github.com/raw/233458/96882b7a608cdbb2ef70d9f1395126f29c197c48/MeMeThisBuildForm.js'); | |
} else { | |
// jQuery not available yet, try again | |
setTimeout(memeThisLoadFormScript, 100); | |
} | |
} | |
memeThisLoadFormScript(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment