Skip to content

Instantly share code, notes, and snippets.

@kmorey
Forked from slezica/tumblr-gist.js
Created April 30, 2014 12:26
Show Gist options
  • Save kmorey/b802197774f84ba15511 to your computer and use it in GitHub Desktop.
Save kmorey/b802197774f84ba15511 to your computer and use it in GitHub Desktop.
var real_docwrite = document.write,
body = $('body');
(function insertGists(a_tags) {
if (a_tags.length > 0) {
a_tag = a_tags.shift()
document.write = function(stylesheet) {
$('head').append(stylesheet);
document.write = function(gist) {
$(a_tag).replaceWith(gist)
insertGists(a_tags);
}
}
body.append('<scr' + 'ipt src="' + a_tag.href + '"></scr' + 'ipt>');
} else
document.write = real_docwrite;
})($('a.gist').get());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment