1$(function(){ 2 3 /* build and append preformated code examples */ 4 $("div#content").find("p").last().after(buildCodeBlocks); 5 6 /* toggle/collapse preformated code blocks */ 7 $("pre").bind("click", function(){ 8 this.className = this.className.indexOf("collapse") === -1 ? 9 ( "collapse " + this.className ) : this.className.replace("collapse ", ""); 10 }); 11 12 /* apply code highlight */ 13 $('pre code').each( function(i, e) { 14 hljs.highlightBlock(e, ' '); 15 }); 16 17}); 18 19function buildCodeBlocks() { 20 return "<div class='codeBlocks clearfix'>" + 21 "<pre class='html'><code>" + getHtml() + "</code></pre>" + 22 "<pre class='javascript'><code>" + cleanJson( $("head script").last().text() ) + "</code></pre>" + 23 "<pre class='css'><code>" + cleanCSS( $("head style").text() ) + "</code></pre>" + 24 "</div>"; 25} 26 27 28function getHtml() { 29 var clone, ul, li, code; 30 31 clone = $("<div />").append($("div#content").contents().not("h2, p").clone()); 32 ul = clone.find("ul"); 33 li = ul.find("li"); 34 35 li.slice(3, li.length).remove(); 36 ul.append("..."); 37 38 code = clone.html(); 39 40 return cleanHTML(code).replace(/</gi, "<").replace(/>/gi, ">");; 41 //code = $.tabifier(code, "HTML").replace(/</gi, "<").replace(/>/gi, ">"); 42 43}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.