Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A hack to add line numbers to gists, requires jquery
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)
);
});
});
}
@gaving

This comment has been minimized.

Copy link

commented Jun 27, 2010

$('.line').each(function(i, e) {
    $(this).prepend(
        $('<div/>').css({
            'float' : 'left',
            'width': '30px',
            'font-weight' : 'bold',
            'color': 'grey'
        }).text(++i)
    );
});

maybe

@scrooloose

This comment has been minimized.

Copy link
Owner Author

commented Jun 27, 2010

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

@gaving

This comment has been minimized.

Copy link

commented Jun 28, 2010

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/

@scrooloose

This comment has been minimized.

Copy link
Owner Author

commented Jun 28, 2010

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
You can’t perform that action at this time.