Last active
July 27, 2017 10:20
-
-
Save TechNinjaWeb/a10ee28ecdac1794797f9dd58b3c2c28 to your computer and use it in GitHub Desktop.
Will take any array of cdn's and load them by pasting the code into the console.
This file contains 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
/************************************************* | |
* Example Script Loader: will load any scripts | |
* from cdn by pasting this in the console. | |
*************************************************/ | |
var scripts = loadScripts([ | |
"https://code.jquery.com/jquery-3.2.1.min.js", | |
"https://cdnjs.cloudflare.com/ajax/libs/rxjs/4.0.6/rx.all.js", | |
"https://cdnjs.cloudflare.com/ajax/libs/parse/1.10.0/parse.js" | |
]); | |
function loadScript(url, loader){ | |
var script = document.createElement('script'); | |
script.onload = loader; | |
script.src = url; | |
document.getElementsByTagName('head')[0].appendChild(script); | |
return script | |
} | |
function loadScripts(scripts){ return scripts.map((script)=>{ return loadScript(script, null) }) } | |
function defaultObservableHandler(game){ observer.onNext(game) } |
This file contains 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
/************************************************* | |
* Example Style Loader: will load any stylesheet | |
* from cdn by pasting this in the console. | |
*************************************************/ | |
var styles = loadStyles([ | |
"https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.css" | |
]); | |
function loadStyle(url){ | |
var link = document.createElement( "link" ); | |
link.href = url; | |
link.type = "text/css"; | |
link.rel = "stylesheet"; | |
link.media = "screen,print"; | |
document.getElementsByTagName( "head" )[0].appendChild( link ); | |
return link; | |
} | |
function loadStyles(styles){ return styles.map((style)=>{ return loadStyle(style) }) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment