Created
April 26, 2011 07:39
-
-
Save iamkristian/941947 to your computer and use it in GitHub Desktop.
Adds line numbers to embedded gists
This file contains hidden or 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 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