Created
November 1, 2015 14:52
-
-
Save tryvin/74c72bdae96f21e844a0 to your computer and use it in GitHub Desktop.
Tumblr gist insert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
Where should I put this code? Within the header tag?
Hi,
I have modified this code because tumblr modify the href values
https://gist.github.com/Shagshag/018da62b616ed66362b13d9794070b91 become https://t.umblr.com/redirect?z=https%3A%2F%2Fgist.github.com%2FShagshag%2F018da62b616ed66362b13d9794070b91&t=Nzg3MWRjZTViNTNjMTFlMGEzMzY4MzM1NzAzYzVmNjRkYzU3NjI0MyxlaHUwR0ZFRA%3D%3D&b=t%3A_F25qPiGARZrjSHpcWxZ5g&p=http%3A%2F%2Fblog.samdha.net%2Fpost%2F168496483310%2Fremplacer-les-%C3%A3-dans-une-table-sql&m=0
https://gist.github.com/Shagshag/c9cdb058677b021d2e30bb8d0bdce2c8
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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!