Skip to content

Instantly share code, notes, and snippets.

@softmoth
Forked from slezica/tumblr-gist.js
Created September 7, 2012 05:25
Show Gist options
  • Save softmoth/3663425 to your computer and use it in GitHub Desktop.
Save softmoth/3663425 to your computer and use it in GitHub Desktop.
tumblr gist embedder
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