Skip to content

Instantly share code, notes, and snippets.

@tryvin
Created November 1, 2015 14:52
Show Gist options
  • Save tryvin/74c72bdae96f21e844a0 to your computer and use it in GitHub Desktop.
Save tryvin/74c72bdae96f21e844a0 to your computer and use it in GitHub Desktop.
Tumblr gist insert
<script src="http://static.tumblr.com/fpifyru/VCxlv9xwi/writecapture.js"></script>
<script type="text/javascript">
$(function() {
$("a[href]").each(
function(index, element) {
if ( $(element).attr('href').indexOf('gist.github.com') > 0 ) {
var divElement = $('<div></div>');
$(element).after(divElement);
writeCapture.html(divElement, '<script src="'+$(element).attr('href')+'.js"></'+'script>');
$(element).remove();
}
}
);
});
</script>
@tryvin
Copy link
Author

tryvin commented Nov 1, 2015

Use this so you can use the Rich text editor from Tumblr, all the other codes I saw needed to create a div element, this one just goes throw all a elements, and if it has gist.github.com on the url, it inserts the element!

@keitaito
Copy link

keitaito commented Mar 6, 2016

Where should I put this code? Within the header tag?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment