Skip to content

Instantly share code, notes, and snippets.

@iamkristian
Created April 26, 2011 07:39
Show Gist options
  • Save iamkristian/941947 to your computer and use it in GitHub Desktop.
Save iamkristian/941947 to your computer and use it in GitHub Desktop.
Adds line numbers to embedded gists
function addLineNumbersToAllGists() {
jQuery('.gist').each( function() {
_addLineNumbersToGist('#' + jQuery(this).attr('id'));
});
}
function addLineNumbersToGist(id) {
_addLineNumbersToGist('#gist-' + id);
}
function _addLineNumbersToGist(css_selector) {
jQuery(document).ready( function() {
jQuery(css_selector + ' .line').each(
function(i, e) {
jQuery(this).prepend(
jQuery('<div/>').css({
'float' : 'left',
'width': '30px',
'font-size' : 'x-small',
'font-weight' : 'bold',
'color': '#808080'
}).text(++i)
);
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment