Skip to content

Instantly share code, notes, and snippets.

@yannisxu
Created November 24, 2012 13:49
Show Gist options
  • Save yannisxu/4139756 to your computer and use it in GitHub Desktop.
Save yannisxu/4139756 to your computer and use it in GitHub Desktop.
Javascript:BookMarklet_new
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