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) | |
); | |
}); | |
}); | |
} |
hey gaving!
Your hacks are far superior, but there is one really strange thing I've found with IE6: it doesnt like the 'color': 'grey' line.... if you use 'color': '#808080' (where #808080 == 'grey') then it works fine. OMG IE6 FTW
Aaaah IE6, good times. Seems like it doesn't recognise the 'grey' keyword and only 'gray' or the hex. http://code.merlak.net/2010/04/grey-vs-gray-internet-explorer-css-color-difference/
ah, thanks :) that article is hilarious, ie6 requires an "a" for gray, but also requires an "e" for lightgrey! wtf?! ultimate fail!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
maybe