Skip to content

Instantly share code, notes, and snippets.

@rlemon
Created December 12, 2011 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rlemon/1468913 to your computer and use it in GitHub Desktop.
Save rlemon/1468913 to your computer and use it in GitHub Desktop.
// Embed the CSS
function injectCSS(rulez) {
var style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = rulez;
document.head.appendChild(style);
}
// Embed the Script tags
function injectScript(url) {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
document.head.appendChild(script);
}
var cssString = "#lights { position:absolute; left:0px; top:0px; width:100%; height:100%; overflow:hidden; z-index: 5; } .xlsf-light { position:absolute; } .xlsf-fragment { position:absolute; background:transparent url(http://www.schillmania.com/temp/snowstorm/lights/image/bulbs-50x50-fragments.png) no-repeat 0px 0px; width:50px; height:50px; } .xlsf-fragment-box { position:absolute; left:0px; top:0px; width:50px; height:50px; *width:100%; *height:100%; display:none;} .xlsf-cover { position:fixed; left:0px; top:0px; width:100%; height:100%; background:#fff; opacity:1; z-index:999; display:none; }";
injectCSS(cssString); // does this really have to be a css string or can you inject an external file?
injectScript('http://www.schillmania.com/temp/snowstorm/lights/soundmanager2-nodebug-jsmin.js');
injectScript('http://yui.yahooapis.com/combo?2.6.0/build/yahoo-dom-event/yahoo-dom-event.js&2.6.0/build/animation/animation-min.js');
injectScript('http://www.schillmania.com/temp/snowstorm/lights/christmaslights.js');
urlBase = 'http://www.schillmania.com/temp/snowstorm/lights/';
soundManager.url = 'http://www.schillmania.com/temp/snowstorm/lights/';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment