Skip to content

Instantly share code, notes, and snippets.

@slezica
Created May 20, 2012 06:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save slezica/2757069 to your computer and use it in GitHub Desktop.
Save slezica/2757069 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