Created
June 27, 2010 08:59
-
-
Save scrooloose/454771 to your computer and use it in GitHub Desktop.
A hack to add line numbers to gists, requires jquery
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
function addLineNumbersToAllGists() { | |
$('.gist').each( function() { | |
_addLineNumbersToGist('#' + $(this).attr('id')); | |
}); | |
} | |
function addLineNumbersToGist(id) { | |
_addLineNumbersToGist('#gist-' + id); | |
} | |
function _addLineNumbersToGist(css_selector) { | |
$(document).ready( function() { | |
$(css_selector + ' .line').each(function(i, e) { | |
$(this).prepend( | |
$('<div/>').css({ | |
'float' : 'left', | |
'width': '30px', | |
'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
ah, thanks :) that article is hilarious, ie6 requires an "a" for gray, but also requires an "e" for lightgrey! wtf?! ultimate fail!