1(function($){ 2$.fn.ndxz_grow = function(options) 3{ 4 var tmpnode = new Array(); 5 var opened = false; 6 var active = 0; 7 var closer = false; 8 var enable = true; 9 var preloadFrame = 0; 10 var preloadActive = false; 11 var preloadAnimTimer; 12 13 // maybe in the future 14 var options = $.extend({ 15 br: 0, 16 lheight: 0, 17 speed: 100, // speed of transitions 18 single: true, // only allow one node open at a time 19 start: function(){}, // event trigger that fires at the start of execution. 20 stop: function(){}, // event trigger that fires at the end of execution. 21 complete: function(){}, // event trigger that fires once execution has finished. 22 load: function(){}, // event trigger that fires upon page load. 23 loading: function(){}, // event trigger that fires upon page load. 24 doneload: function(){} // event trigger that fires upon page load complete. 25 }, options); 26 27 $.fn.ndxz_grow.grower = function(obj, state) 28 { 29 // only one at a time 30 if (options.single == true) 31 { 32 if (enable == false) return false; 33 enable = false; 34 } 35 36 var node = obj.id; 37 node = node.replace('a', ''); 38 39 // single image at a time mode 40 if (options.single == true) 41 { 42 if (active != node) 43 { 44 // send a trigger to close below 45 closer = true; 46 var tmp = active; 47 //if (active != 0) $('#node' + active).replaceWith(tmpnode[active]); 48 active = node; 49 } 50 else 51 { 52 active = 0; 53 } 54 } 55 56 if (state == true) 57 { 58 // do the grow 59 // clone things first 60 tmpnode[node] = $('#node' + node).clone(); 61 62 /* 63 <div class='picture_holder' id='node33' style='width: 225px; height: 178px;'> 64 <div class='picture' style='width: 200px;'> 65 <div style='padding-top: 0;'> 66 <a href='#' class='link' id='a33' onclick="$.fn.ndxz_grow.grower(this, true); return false;"><img src='http://www.indexhibit.dev/files/gimgs/th-11_imagefile.jpg' width='200' height='113' alt='http://www.indexhibit.dev/files/gimgs/th-11_imagefile.jpg' /></a> 67 </div> 68 </div> 69 <div class='captioning' style='width: 200px;'></div> 70 </div> 71 */ 72 73 var imgw = parseInt($('#node' + node + ' .picture div img').width()); 74 var imgh = $('#node' + node + ' .picture div img').height(); 75 var imgp = $('#node' + node + ' .picture div').css('padding-top'); 76 imgp = parseInt(imgp.replace('px', '')); 77 var itmp = parseInt(((imgh/2) - 12) + imgp); //loading image is 24x24 78 var pw = parseInt($('#node' + node + ' .picture').width()); 79 80 if (pw != imgw) 81 { 82 if ($('#node' + node + ' .picture').css('text-align') == 'center') 83 { 84 imgw = pw; 85 } 86 else 87 { 88 imgw = imgw 89 } 90 } 91 92 var isIE6 = $.browser.msie && $.browser.version < 7; 93 94 if (!isIE6) 95 { 96 //style='background-image: url(" + baseurl + "/ndxzsite/img/loading/" + theme + "-small2.png);' 97 preloadActive = true; 98 $('#node' + node + ' .picture').prepend("<div class='loading' style='background-image: url(" + baseurl + "/ndxzsite/img/loading/dark-small2.png); top: " + itmp + "px; width: " + imgw + "px;'> </div>"); 99 $.fn.ndxz_grow.preloadAnimStart(); 100 } 101 else 102 { 103 // alt loader 104 } 105 106 // get the grow content via ajax 107 $.post(baseurl + '/ndxzsite/plugin/ajax.php', { jxs : 'grow', i : node, s : state }, 108 function(html) { 109 // remove 'once' 110 $('div').remove('.once'); 111 112 // happens at the same time 113 if (closer == true) 114 { 115 if (tmp != 0) $('#node' + tmp).replaceWith(tmpnode[tmp]); 116 closer = false; 117 } 118 119 preloadActive = false; 120 // display - loader disappears 121 $('#node' + node).replaceWith(html); 122 123 // reflow 124 $.fn.ndxz_grow.flow(); 125 126 if (options.single == true) enable = true; 127 128 return false; 129 }); 130 } 131 else 132 { 133 // close the grow 134 // show the cloned content 135 $('#node' + node).replaceWith(tmpnode[node]); 136 137 // reflow 138 $.fn.ndxz_grow.flow(); 139 140 if (options.single == true) enable = true; 141 142 return false; 143 } 144 } 145 146 // adapted from Cabel/Panic Fancyzoom - credited totally goes to him 147 // http://www.panic.com 148 $.fn.ndxz_grow.preloadAnimStart = function() 149 { 150 preloadTime = new Date(); 151 preloadFrame = 1; 152 preloadActive = true; 153 preloadAnimTimer = setInterval($.fn.ndxz_grow.preloadAnim, 100); 154 } 155 156 $.fn.ndxz_grow.preloadAnim = function() 157 { 158 var frames = (options.lheight / 24); 159 160 if (preloadActive != false) 161 { 162 $('.loading').css('background-position', 'center ' + (-24 * preloadFrame) + 'px'); 163 preloadFrame++; 164 if (preloadFrame > (frames - 1)) { preloadFrame = 0; } 165 } 166 else 167 { 168 clearInterval(preloadAnimTimer); 169 preloadAnimTimer = 0; 170 preloadActive = false;
171 } 172 } 173 174 $.fn.ndxz_grow.flow = function() 175 { 176 $('div').remove('.once'); 177 var thiswidth = 0; 178 var bigwidth = ($('#img-container').width()); 179 i = 1; 180 181 //alert(bigwidth); 182 183 $('div.picture_holder').each(function() 184 { 185 var thewidth = $(this).width(); 186 thiswidth = parseInt(thiswidth) + parseInt(thewidth); 187 188 if (thiswidth > bigwidth) 189 { 190 $(this).prev('div.picture_holder').after("<div class='once'><!-- --></div>"); 191 thiswidth = thewidth; 192 } 193 194 i++; 195 }); 196 } 197 198 // let's set our breaks 199 //$.fn.ndxz_grow.flow(); 200 201 // loading graphic preload 202 var loading_image = new Image(); 203 loading_image.onload = function() { options.lheight = loading_image.height; } 204 loading_image.src = baseurl + '/ndxzsite/img/loading/dark-small2.png'; 205}; 206})(jQuery); 207 208 209$(window).resize( function(){ $.fn.ndxz_grow.flow(); });
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.