Created
October 26, 2015 14:45
-
-
Save zinigor/2e6a802d7fa41ac96546 to your computer and use it in GitHub Desktop.
Test
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
;(function($, undefined) { | |
gistStylesheetLoaded = false; | |
var gistEmbed = function( data ) { | |
$('.gist-oembed').each(function(i, el) { | |
var url = 'https://gist.github.com/' + $(el).data('gist'); | |
$.ajax({ | |
url: url, | |
dataType: 'jsonp' | |
}).done(function( response ) { | |
$(el).replaceWith( response.div ); | |
if ( ! gistStylesheetLoaded ) { | |
$('head').append( | |
"<link rel='stylesheet' href='" + response.stylesheet + "' type='text/css' />" | |
); | |
gistStylesheetLoaded = true; | |
} | |
}); | |
}); | |
}; | |
$(document).ready(gistEmbed); | |
$('body').on('post-load', gistEmbed); | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment