public
Created

Ancient script loader

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
/** helper function to dynamically include js */
var js;
function include_js(file) {
var html_doc = document.getElementsByTagName('head')[0];
js = document.createElement('script');
js.setAttribute('type', 'text/javascript');
js.setAttribute('src', file);
html_doc.appendChild(js);
js.onreadystatechange = function () {
if (js.readyState == 'complete' || js.readyState == 'loaded') {
thumbgalleryinit(TGconfig);
}
};
js.onload = function () {
thumbgalleryinit(TGconfig);
};
return false;
}
showTG = function(config){
TGconfig = config;
include_js('assets/js/yuiloader-dom-event/yuiloader-dom-event.js');
};

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.