Skip to content

Instantly share code, notes, and snippets.

@Dallardtech
Created December 19, 2014 11:47
Show Gist options
  • Save Dallardtech/10806a6a097a3fe0c45d to your computer and use it in GitHub Desktop.
Save Dallardtech/10806a6a097a3fe0c45d to your computer and use it in GitHub Desktop.
SVG Bookmarklet SRC viewer
function importJS(src, look_for, onload) {
var s = document.createElement('script');
s.setAttribute('type', 'text/javascript');
s.setAttribute('src', src);
if (onload) wait_for_script_load(look_for, onload);
var head = document.getElementsByTagName('head')[0];
if (head) {
head.appendChild(s);
} else {
document.body.appendChild(s);
}
}
function importCSS(href, look_for, onload) {
var s = document.createElement('link');
s.setAttribute('rel', 'stylesheet');
s.setAttribute('type', 'text/css');
s.setAttribute('media', 'screen');
s.setAttribute('href', href);
if (onload) wait_for_script_load(look_for, onload);
var head = document.getElementsByTagName('head')[0];
if (head) {
head.appendChild(s);
} else {
document.body.appendChild(s);
}
}
function wait_for_script_load(look_for, callback) {
var interval = setInterval(function() {
if (eval("typeof " + look_for) != 'undefined') {
clearInterval(interval);
callback();
}
}, 50);
}
(function(){
importJS('https://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js', 'jQuery', function() { // Load everything else when it is done.
jQuery.noConflict();
/*importJS('https://dv0akt2986vzh.cloudfront.net/stable/vendor/diff/diff_match_patch.js', 'diff_match_patch', function() {
importJS('https://dv0akt2986vzh.cloudfront.net/stable/lib/dom.js', 'DomPredictionHelper', function() {
importJS('https://dv0akt2986vzh.cloudfront.net/stable/lib/interface.js');
});
});*/
});
})();
alert('dsfsf');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment