Created
June 20, 2014 21:42
-
-
Save AgelxNash/0ba65897eada74e1d42c to your computer and use it in GitHub Desktop.
<pre class="gist" data-id="7377194"></pre>
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
$('pre.gist').each(function(){ | |
var placeholder = $(this); | |
var filename = placeholder.data('file'); | |
$.ajax({ | |
url: 'https://api.github.com/gists/'+$(this).data('id'), | |
type: 'GET', | |
dataType: 'jsonp' | |
}).success( function(gistdata) { | |
if(filename != null && typeof gistdata.data.files[filename] !== "undefined"){ | |
var content = gistdata.data.files[filename].content; | |
}else{ | |
var content = gistdata.data.files[Object.keys(gistdata.data.files)[0]].content; | |
} | |
placeholder.removeClass('prettyprinted'); | |
placeholder.text(content); | |
prettyPrint(); | |
}).error( function(e) { | |
// ajax error | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment