Skip to content

Instantly share code, notes, and snippets.

@dse
Last active January 3, 2016 12:19
Show Gist options
  • Save dse/8462289 to your computer and use it in GitHub Desktop.
Save dse/8462289 to your computer and use it in GitHub Desktop.
/******** BOOKMARKLET BEGINS ON NEXT LINE ********/var _getScript_=false?
javascript:
function _getScript_(url, callback, something) {
var h,s,pl
if (/^\/\//.test(url)) {
url = ((location.protocol === "https:") ? "https:" : "http:") + url;
}
h = document.getElementsByTagName("head")[0];
s = document.createElement("script");
s.src = url;
if (callback) { s.onload = s.onreadystatechange = callback; }
h.insertBefore(s, h.childNodes[0]);
};
function _bootstrap_() {
if (window._$bootstrap$_) { return; } window._$bootstrap$_ = true;
_getScript_("https://gist.github.com/dse/8462289/raw/css.js");
}
_bootstrap_();
/******** BOOKMARKLET ENDS ********/
(function() { try{console.log("It works!"); } catch (e) { } }());
$ = undefined;
jQuery = undefined;
console.log("about to call _getScript_()");
_getScript_("//code.jquery.com/jquery-1.10.2.min.js", function() {
console.log("yay");
var w = window.open("about:blank", undefined, "width=640,height=480,resizable=yes,scrollbars=yes");
if (!w) {
alert("Looks like you're viewing a local document in MSIE or something. Sorry I can't help you.");
return;
}
w.focus();
var d = window.document;
var b = d.body;
$(b).empty();
$(b).append($("<p></p>").append(new Date().getTime()));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment