$.initLineNumbers = function () { var hash = window.location.hash.substring(1), container = $.get('container'), hasLines, node; // Add ids for each line number in the file source view. $('.linenums>li').each(function () { $(this).set('id', 'l' + (index + 1)); $(this).addClass('file-line'); hasLines = true; }); // Scroll to the desired line. if (hasLines && /^l\d+$/.test(hash)) { if ((node = $.get(hash))) { win.scroll(0, node.offset().x); } } };