Created
November 24, 2010 17:24
-
-
Save spullara/714031 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
if(typeof (console) == 'undefined') {var console={init:function(){console.d=document.createElement('div');document.body.appendChild(console.d);var a=document.createElement('a');a.href='javascript:console.hide()';a.innerHTML='close';console.d.appendChild(a);var a=document.createElement('a');a.href='javascript:console.clear();';a.innerHTML='clear';console.d.appendChild(a);var id='fauxconsole';if(!document.getElementById(id)){console.d.id=id;}console.hide();},hide:function(){console.d.style.display='none';},show:function(){console.d.style.display='block';},log:function(o){console.d.innerHTML+='<br/>'+o;console.show();},clear:function(){console.d.parentNode.removeChild(console.d);console.init();console.show();}};console.init();} | |
var bagger___start = function() { | |
// --- Bagger code | |
void(function() { | |
YUI().use('node', 'io-xdr', 'overlay', 'dd', 'json', function(Y) { | |
......... | |
var waitForCSS = setInterval(function() { | |
// will hold correct offset value when this is loaded | |
var css_div = document.createElement('div'); | |
css_div.id='bagger-ccs-has-been-loaded'; | |
css_div.style.display='block'; | |
css_div.style.position='absolute'; | |
css_div.style.left='-1000px'; | |
css_div.style.top='-1000px'; | |
var body = document.body; ///document.getElementsByTagName('body')[0]; | |
body.appendChild(css_div); | |
if(css_div.offsetWidth >= 99 && css_div.offsetHeight >= 99) { | |
// css file is indeed loaded, clear out the interval & clean up the dom | |
clearInterval(waitForCSS); | |
body.removeChild(css_div); | |
// now safe to load next library | |
loadJS('bagger-yui', 'http://yui.yahooapis.com/combo?3.1.1/build/yui/yui-min.js', false); | |
// now wait for YUI to load | |
var waitForYUIJS = setInterval(function() { | |
// If YUI exists, then library is loaded | |
if( typeof YUI != 'undefined' ) { | |
clearInterval(waitForYUIJS); | |
bagger___start(); | |
} | |
}, 10); | |
} | |
}, 10); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment