Created
November 24, 2012 13:49
-
-
Save yannisxu/4139756 to your computer and use it in GitHub Desktop.
Javascript:BookMarklet_new
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
javascript:(function(){ | |
var createElement = function (tag,attrs){ | |
var elem = document.createElement(tag); | |
for (var key in attrs){ | |
elem.setAttribute(key, attrs[key]); | |
}; | |
return elem; | |
}; | |
var loadJS = function(src, success) { | |
var domScript = createElement('script', { 'src' : src, 'type' : 'text/javascript'}); | |
success = success || function(){}; | |
domScript.onload = domScript.onreadystatechange = function() { | |
if (!this.readyState || 'loaded' === this.readyState || 'complete' === this.readyState) { | |
success(); | |
this.onload = this.onreadystatechange = null; | |
this.parentNode.removeChild(this); | |
} | |
} | |
document.body.appendChild(domScript); | |
}; | |
loadJS('http://code.jquery.com/jquery-1.8.1.min.js', function(){ | |
loadJS('http://remarker.be/js/markalbe.js'); | |
}); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment