yui-prettify.js (482B)
1 YUI().use('node', function(Y) { 2 var code = Y.all('.prettyprint.linenums'); 3 if (code.size()) { 4 code.each(function(c) { 5 var lis = c.all('ol li'), 6 l = 1; 7 lis.each(function(n) { 8 n.prepend('<a name="LINENUM_' + l + '"></a>'); 9 l++; 10 }); 11 }); 12 var h = location.hash; 13 location.hash = ''; 14 h = h.replace('LINE_', 'LINENUM_'); 15 location.hash = h; 16 } 17 });