1 2function tilesizeArea(base, perrow) { 3 // Initialize variables 4 var boxes = new Array(), max_p = 0, max_a = 0, max_i = 0, resetCounter = -1, total = 0; 5 6 // Count elements 7 base.find('div.content.box.rounded.markup > div.inner-content').each(function(index){ 8 total++; 9 }); 10 11 base.find('div.content.box.rounded.markup > div.inner-content').each(function(index){ 12 13 var $this = $(this); 14 15 // Set image margin 16 $img = $this.find('img'); 17 if($img.height() > 1) { 18 $img.css('margin-top',Math.round((120-$img.height())/2)+'px'); 19 } 20 21 // Calculate max height so far 22 $this.children('div.image').css('height', null); 23 if (max_i < $this.children('div.image').height()) { 24 max_i = $this.children('div.image').height(); 25 } 26 if (max_p < $this.children('div.class').height()) { 27 max_p = $this.children('div.class').height(); 28 } 29 if (max_a < $this.children('a.link').height()) { 30 max_a = $this.children('a.link').height(); 31 } 32 33 // Add element to stack 34 boxes.push($this); 35 36 // Increase loop counter 37 resetCounter++; 38 39 // If we have f_perrow boxes in a row (or 3 if f_perrow == 0) 40 if(resetCounter==perrow || index==(total-1)) { 41 // Then set the previous boxes of this row to the calculates heights 42 for (var i = Math.floor(index/(perrow+1))*(perrow+1); i <= index; i++) { 43 if(i<0) { 44 continue; 45 } 46 boxes[i].children('div.image').height(max_i); 47 boxes[i].children('div.class').height(max_p); 48 boxes[i].children('a.link').height(max_a); 49 } 50 // And start all over again 51 max_p = 0; 52 max_a = 0; 53 max_i = 0; 54 resetCounter = -1; 55 } 56 }); 57} 58 59function tilesizerMatch(perrow) { 60 // For all pages with a page separator 61 var haveProducts = false; 62 $('body').find('div.tiles').each(function(index0){ 63 $(this).children('div#productlist').each(function(index1){ 64 $(this).children('div').each(function(index2){ 65 haveProducts = true; 66 tilesizeArea($(this), perrow); 67 }); 68 }); 69 }); 70 // For all pages without a page separator 71 if(!haveProducts) { 72 $('body').find('div.tiles').each(function(index0){ 73 tilesizeArea($(this), perrow); 74 }); 75 } 76} 77 78function tilesizerOnload(perrow) { 79 var startingTime = new Date(); 80 var elapsedTime = new Date(); 81 var endingTime = new Date(); 82 83 $('body').find('div.content.box.rounded.markup > div.inner-content').each(function(index0){ 84 $(this).find('div.image').each(function(index1){ 85 $(this).find('img').each(function(index2){ 86 $(this).load(function() { 87 endingTime = new Date(); 88 elapsedTime.setTime(endingTime.getTime() - startingTime.getTime()); 89 if(elapsedTime.getMilliseconds() > 500) { 90 startingTime = new Date(); 91 tilesizerMatch(perrow); 92 } 93 }); 94 }); 95 }); 96 }); 97} 98 99function tilesizerNew(f_perrow){ 100 // f_perrow i set use f_perrow, else use 3 101 var perrow = f_perrow ? f_perrow : 3; 102 perrow--; 103 104 // Run tilesizer 105 tilesizerMatch(perrow); 106 107 // Run tilesizer again if all images are loaded 108 tilesizerOnload(perrow); 109 110 // Run it 1 second later 111 setTimeout(function(){tilesizerOnload(perrow)},1000); 112 113 // Run it 2 seconds later 114 setTimeout(function(){tilesizerOnload(perrow)},2000); 115 116 // Run it 3 seconds later 117 setTimeout(function(){tilesizerOnload(perrow)},3000); 118 119 // Run it 4 seconds later 120 setTimeout(function(){tilesizerOnload(perrow)},4000); 121 122 // Run it 6 seconds later 123 setTimeout(function(){tilesizerOnload(perrow)},6000); 124 125 // Run it 8 seconds later 126 setTimeout(function(){tilesizerOnload(perrow)},8000); 127 128 // ?
129 $('div.categories').find('div.content.box.rounded').each(function(){ 130 var $this = $(this); 131 var link = $this.children('div.inner-content').children('h2').children('a').attr('href'); 132 $this.click(function(){ 133 location.href = link; 134 }).css('cursor','pointer'); 135 136 }); 137 138 // ? 139 $('div.tiles').find('div.content.box.rounded').click(function(e) { 140 if (typeof(e.target.name) && e.target.name != "am") { 141 location.href = $(this).find("div.inner-content a.link").attr("href"); 142 } 143 }).mouseenter(function() { 144 $(this).addClass("over"); 145 }).mouseleave(function() { 146 $(this).removeClass("over"); 147 }); 148 149 // ? 150 $('div.list').find('div.content.box.rounded').click(function(e) { 151 if (typeof(e.target.name) && e.target.name != "am") { 152 location.href = $(this).find("div.inner-content a.link").attr("href"); 153 } 154 }).mouseenter(function() { 155 $(this).addClass("over"); 156 }).mouseleave(function() { 157 $(this).removeClass("over"); 158 }); 159}
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.