Initial Commit
This commit is contained in:
parent
4c352bf02e
commit
1ab6e5f0b0
1085 changed files with 195258 additions and 0 deletions
28
plugins/jetpack/modules/shortcodes/js/gist.js
Normal file
28
plugins/jetpack/modules/shortcodes/js/gist.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
;(function( $, undefined ) {
|
||||
var gistStylesheetLoaded = false,
|
||||
gistEmbed = function() {
|
||||
$( '.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 ) {
|
||||
var stylesheet = '<link rel="stylesheet" href="' +
|
||||
response.stylesheet +
|
||||
'" type="text/css" />';
|
||||
|
||||
$( 'head' ).append( stylesheet );
|
||||
|
||||
gistStylesheetLoaded = true;
|
||||
}
|
||||
} );
|
||||
} );
|
||||
};
|
||||
|
||||
$( document ).ready( gistEmbed );
|
||||
$( 'body' ).on( 'post-load', gistEmbed );
|
||||
})( jQuery );
|
Reference in a new issue