1var tools = { 2 3 delay: (function(){ 4 var timer = 0; 5 return function(callback, ms){ 6 clearTimeout (timer); 7 timer = setTimeout(callback, ms); 8 }; 9 })(), 10 11 resortUl: function(containerWidth) { 12 var columns = Math.round(containerWidth/parseInt($('.resortlist li').width())); 13 //var columns = Math.floor(Math.round(containerWidth)/Math.round($('.resortlist li').width())); 14 //console.log(containerWidth+" - "+$('.resortlist li').width()+" - "+columns); 15 //alert(1); 16 if(columns == 0){return;} 17 $('.resortlist').each(function(kList,list){ 18 var listContainer = $(this); 19 var children = $(this).children('li'); 20 var totalChildren = children.length; 21 var maxItems = Math.ceil(totalChildren/columns); 22 var tempColumns = {}; 23 for (var i=1; i<=columns; i++) tempColumns[i] = []; 24 var colI=1; 25 26 27 if (!$(this).attr('sort')) { 28 children.each(function(k,el){ 29 $(this).attr('data-sort', (k+1)); 30 }) 31 $(this).attr('sort', 'initiated'); 32 } 33 34 var tempI = 0; 35 var itemsLeft = totalChildren; 36 children.sort(function(a,b){ 37 var sortA =parseInt( $(a).attr('data-sort')); 38 var sortB =parseInt( $(b).attr('data-sort')); 39 return (sortA < sortB) ? -1 : (sortA > sortB) ? 1 : 0; 40 }).each(function(k,el){ 41 //if (typeof tempColumns[colI] == 'undefined'){tempColumns[colI] ={};} 42 tempColumns[colI][tempColumns[colI].length] = $(this); 43 tempI++; 44 if (tempI==Math.ceil(itemsLeft/(columns-(colI-1)))) { 45 colI++; 46 itemsLeft = itemsLeft-tempI; 47 tempI=0; 48 } 49 }) 50 var newChildren = []; 51 for (var i=1; i<=columns; i++) { 52 tempColumns[i] = tempColumns[i].reverse(); 53 } 54 55 var colI = 1; 56 for (var i=0; i<totalChildren+10; i++) { 57 newChildren[newChildren.length] = tempColumns[colI].pop(); 58 colI++; 59 if (colI>columns) colI=1; 60 } 61 $(this).empty(); 62 $(this).append(newChildren); 63 64 65 var lineHeights = {}; 66 $('li', $(this)).css('height', '').each(function(kLi,li){ 67 var line = Math.floor(kLi/columns); 68 var myHeight = $(this).height(); 69 if (lineHeights[line] && myHeight>lineHeights[line]) { 70 lineHeights[line] = myHeight 71 } 72 else if (lineHeights[line]) { 73 $(this).height(lineHeights[line]) 74 } 75 else { 76 lineHeights[line] = myHeight 77 } 78 79 }) 80 81 82 //return; 83 }) 84 85 86 87 } 88} 89
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.