Skip to content

Instantly share code, notes, and snippets.

@evenv
Forked from slezica/tumblr-gist.js
Created July 1, 2012 13:20
Show Gist options
  • Save evenv/3028410 to your computer and use it in GitHub Desktop.
Save evenv/3028410 to your computer and use it in GitHub Desktop.
tumblr gist embedder - without class requirement
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[href^="http://gist.github.com/"]').get());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment