Skip to content

Instantly share code, notes, and snippets.

@niwaringo
Created January 29, 2012 08:49
Show Gist options
  • Save niwaringo/1697922 to your computer and use it in GitHub Desktop.
Save niwaringo/1697922 to your computer and use it in GitHub Desktop.
gitsEmbedWriteCapture
$(function() {
$('.gists').each(function() {
var $this = $(this);
var scriptSrc = '<scr'+'ipt src="' + $this.text() + '" type="text/javascript"></scr'+'ipt>';
var isLine = ($this.data('gistline') !== undefined)? true: false;
$this.writeCapture().html(scriptSrc, function() {
if(isLine === false) return false;
$this.each(function() {
$(this).find('.line').each(function(i, e) {
$(this).prepend($('<div/>').attr('unselectable','on').addClass('gist-line-no').text(++i));
});
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment