Skip to content

Instantly share code, notes, and snippets.

@elyalvarado
Created November 24, 2014 02:22
Show Gist options
  • Save elyalvarado/fbb15fe86fba6c8fbcb6 to your computer and use it in GitHub Desktop.
Save elyalvarado/fbb15fe86fba6c8fbcb6 to your computer and use it in GitHub Desktop.
Inject javascript and css for c3 and d3 from the console
(function() {
var javascriptLibraries = [
"//cdnjs.cloudflare.com/ajax/libs/d3/3.4.13/d3.min.js",
"//cdnjs.cloudflare.com/ajax/libs/c3/0.4.4/c3.min.js"
];
var stylesheetLibraries = [
"//cdnjs.cloudflare.com/ajax/libs/c3/0.4.4/c3.min.css"
];
for (var i = 0; i < javascriptLibraries.length; i++) {
var _me = document.createElement('script'); _me.type = 'text/javascript'; _me.async = false;
_me.src = javascriptLibraries[i];
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(_me, s);
}
for (var i = 0; i < stylesheetLibraries.length; i++) {
var _me = document.createElement('link'); _me.rel = 'stylesheet';
_me.href = stylesheetLibraries[i];
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(_me, s);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment