1(function($) { 2 var $$; 3 $$=$.fn.galleria=function($options) { 4 if(!$$.hasCSS()) { 5 return false; 6 } 7 $.historyInit($$.onPageLoad); 8 var $defaults= { 9 insert:'.galleria_container',history:true,clickNext:true,onImage:function(image,caption,thumb) { 10 } 11 ,onThumb:function(thumb) { 12 } 13 } 14 ; 15 var $opts=$.extend($defaults,$options); 16 for(var i in $opts) { 17 if(i) { 18 $.galleria[i]=$opts[i]; 19 } 20 } 21 var _insert=($($opts.insert).is($opts.insert))?$($opts.insert):jQuery(document.createElement('div')).insertBefore(this); 22 var _div=$(document.createElement('div')).addClass('galleria_wrapper'); 23 var _span=$(document.createElement('span')).addClass('caption2'); 24 _insert.addClass('galleria_container').append(_div).append('<table class="caption2_table" border="0" cellspacing="0" cellpadding="0"><tr><td class=caption2></td></tr></table>'); 25 return this.each(function() { 26 $(this).addClass('galleria'); 27 $(this).children('li').each(function(i) { 28 var _container=$(this); 29 var _o=$.meta?$.extend( { 30 } 31 ,$opts,_container.data()):$opts; 32 _o.clickNext=$(this).is(':only-child')?false:_o.clickNext; 33 var _a=$(this).find('a').is('a')?$(this).find('a'):false; 34 var _img=$(this).children('img').css('display','none'); 35 var _src=_a?_a.attr('href'):_img.attr('src'); 36 var _title=_a?_a.attr('title'):_img.attr('title'); 37 var _alt=_a?_a.attr('alt'):_img.attr('alt'); 38 var _loader=new Image(); 39 if(_o.history&&(window.location.hash&&window.location.hash.replace(/\#/,'')==_src)) { 40 _container.siblings('.active').removeClass('active'); 41 _container.addClass('active'); 42 } 43 $(_loader).load(function() { 44 $(this).attr('alt',_img.attr('alt')); 45 var _thumb=_a?_a.find('img').addClass('thumb noscale').css('display','none'):_img.clone(true).addClass('thumb').css('display','none'); 46 if(_a) { 47 //st _a.replaceWith(_thumb); 48 } 49 if(!_thumb.hasClass('noscale')) { 50 //st var w=Math.ceil(_img.width()/_img.height()*_container.height()); 51 //st var h=Math.ceil(_img.height()/_img.width()*_container.width()); 52 if(w<h) { 53 _thumb.css( { 54 //st height:'auto',width:_container.width(),marginTop:-(h-_container.height())/2 55 } 56 ); 57 } else { 58 _thumb.css( { 59 //st width:'auto',height:_container.height(),marginLeft:-(w-_container.width())/2 60 } 61 ); 62 } 63 } else { 64 window.setTimeout(function() { 65 _thumb.css( { 66 //st marginLeft:-(_thumb.width()-_container.width())/2,marginTop:-(_thumb.height()-_container.height())/2 67 } 68 ); 69 } 70 ,1); 71 }
72 _thumb.attr('rel',_src); 73 _thumb.attr('title',_title); 74 _thumb.attr('alt',_alt); 75 _thumb.click(function() { 76 $.galleria.activate(_src); 77 } 78 ); 79 _thumb.hover(function() { 80 $(this).addClass('hover'); 81 } 82 ,function() { 83 $(this).removeClass('hover'); 84 } 85 ); 86 _container.hover(function() { 87 _container.addClass('hover'); 88 } 89 ,function() { 90 _container.removeClass('hover'); 91 } 92 ); 93 _container.prepend(_thumb); 94 _thumb.css('display','block'); 95 _o.onThumb(jQuery(_thumb)); 96 if(_container.hasClass('active')) { 97 $.galleria.activate(_src); 98 } 99 _img.remove(); 100 } 101 ).error(function() { 102 _container.html('<span class="error" style="color:red">Error loading image: '+_src+'</span>'); 103 } 104 ).attr('src',_src); 105 } 106 ); 107 } 108 ); 109 } 110 ; 111 $$.nextSelector=function(selector) { 112 return $(selector).is(':last-child')?$(selector).siblings(':first-child'):$(selector).next(); 113 } 114 ; 115 $$.previousSelector=function(selector) { 116 return $(selector).is(':first-child')?$(selector).siblings(':last-child'):$(selector).prev(); 117 } 118 ; 119 $$.hasCSS=function() { 120 $('body').append($(document.createElement('div')).attr('id','css_test').css( { 121 width:'1px',height:'1px',display:'none' 122 } 123 )); 124 var _v=($('#css_test').width()!=1)?false:true; 125 $('#css_test').remove(); 126 return _v; 127 } 128 ; 129 $$.onPageLoad=function(_src) { 130 var _wrapper=$('.galleria_wrapper'); 131 var _thumb=$('.galleria img[rel="'+_src+'"]'); 132 if(_src) { 133 if($.galleria.history) { 134 window.location=window.location.href.replace(/\#.*/,'')+'#'+_src; 135 } 136 _thumb.parents('li').siblings('.active').removeClass('active'); 137 _thumb.parents('li').addClass('active'); 138 var _img=$(new Image()).attr('src',_src).addClass('replaced'); 139 _wrapper.empty().append(_img); 140// ST _wrapper.siblings('.caption').text(_thumb.attr('title')); 141 _wrapper.siblings('.caption2_table').children('tbody').children('tr').children('td').html(_thumb.attr('title')+'<font class=caption2_skrot>'+_thumb.attr('alt')+'</font>'); 142 $.galleria.onImage(_img,_wrapper.siblings('.caption2'),_thumb); 143 if($.galleria.clickNext) { 144 145 } 146 } else { 147 _wrapper.siblings().andSelf().empty(); 148 $('.galleria li.active').removeClass('active'); 149 } 150 $.galleria.current=_src; 151 } 152 ; 153 $.extend( { 154 galleria: { 155 current:'',onImage:function() { 156 } 157 ,activate:function(_src) { 158 if($.galleria.history) { 159 $.historyLoad(_src); 160 } else { 161 $$.onPageLoad(_src); 162 } 163 } 164 ,next:function() { 165 var _next=$($$.nextSelector($('.galleria img[rel="'+$.galleria.current+'"]').parents('li'))).find('img').attr('rel'); 166 $.galleria.activate(_next); 167 } 168 ,prev:function() { 169 var _prev=$($$.previousSelector($('.galleria img[rel="'+$.galleria.current+'"]').parents('li'))).find('img').attr('rel'); 170 $.galleria.activate(_prev); 171 } 172 } 173 } 174 ); 175} 176)(jQuery); 177jQuery.extend( { 178 historyCurrentHash:undefined,historyCallback:undefined,historyInit:function(callback) { 179 jQuery.historyCallback=callback; 180 var current_hash=location.hash.replace(/[^\w]/g, ""); 181 jQuery.historyCurrentHash=current_hash; 182 if(jQuery.browser.msie) { 183 if(jQuery.historyCurrentHash==='') { 184 jQuery.historyCurrentHash='#'; 185 } 186 jQuery("body").prepend('<iframe id="jQuery_history" style="display: none;"></iframe>'); 187 var ihistory=jQuery("#jQuery_history")[0]; 188 var iframe=ihistory.contentWindow.document; 189 iframe.open(); 190 iframe.close(); 191 iframe.location.hash=current_hash; 192 } else if(jQuery.browser.safari) { 193 jQuery.historyBackStack=[]; 194 jQuery.historyBackStack.length=history.length; 195 jQuery.historyForwardStack=[]; 196 jQuery.isFirst=true; 197 } 198 jQuery.historyCallback(current_hash.replace(/^#/,'')); 199 setInterval(jQuery.historyCheck,100); 200 } 201 ,historyAddHistory:function(hash) { 202 jQuery.historyBackStack.push(hash); 203 jQuery.historyForwardStack.length=0; 204 this.isFirst=true; 205 } 206 ,historyCheck:function() { 207 if(jQuery.browser.msie) { 208 var ihistory=jQuery("#jQuery_history")[0]; 209 var iframe=ihistory.contentDocument||ihistory.contentWindow.document; 210 var current_hash=iframe.location.hash; 211 if(current_hash!=jQuery.historyCurrentHash) { 212 location.hash=current_hash; 213 jQuery.historyCurrentHash=current_hash; 214 jQuery.historyCallback(current_hash.replace(/^#/,'')); 215 } 216 } else if(jQuery.browser.safari) { 217 if(!jQuery.dontCheck) { 218 var historyDelta=history.length-jQuery.historyBackStack.length; 219 if(historyDelta) { 220 jQuery.isFirst=false; 221 var i; 222 if(historyDelta<0) { 223 for(i=0;i<Math.abs(historyDelta);i++) { 224 jQuery.historyForwardStack.unshift(jQuery.historyBackStack.pop()); 225 } 226 } else { 227 for(i=0;i<historyDelta;i++) { 228 jQuery.historyBackStack.push(jQuery.historyForwardStack.shift()); 229 } 230 } 231 var cachedHash=jQuery.historyBackStack[jQuery.historyBackStack.length-1]; 232 if(cachedHash!==undefined) { 233 jQuery.historyCurrentHash=location.hash.replace(/[^\w]/g, ""); 234 jQuery.historyCallback(cachedHash); 235 } 236 } else if(jQuery.historyBackStack[jQuery.historyBackStack.length-1]===undefined&&!jQuery.isFirst) { 237 if(document.URL.indexOf('#')>=0) { 238 jQuery.historyCallback(document.URL.split('#')[1]); 239 } else { 240 current_hash=location.hash.replace(/[^\w]/g, ""); 241 jQuery.historyCallback(''); 242 } 243 jQuery.isFirst=true; 244 } 245 } 246 } else { 247 current_hash=location.hash.replace(/[^\w]/g, ""); 248 if(current_hash!=jQuery.historyCurrentHash) { 249 jQuery.historyCurrentHash=current_hash; 250 jQuery.historyCallback(current_hash.replace(/^#/,'')); 251 } 252 } 253 } 254 ,historyLoad:function(hash) { 255 hash = hash.replace(/[^\w]/g, ""); 256 var newhash; 257 if(jQuery.browser.safari) { 258 newhash=hash; 259 } else { 260 newhash='#'+hash; 261 location.hash=newhash; 262 } 263 jQuery.historyCurrentHash=newhash; 264 if(jQuery.browser.msie) { 265 var ihistory=jQuery("#jQuery_history")[0]; 266 var iframe=ihistory.contentWindow.document; 267 iframe.open(); 268 iframe.close(); 269 iframe.location.hash=newhash; 270 jQuery.historyCallback(hash); 271 } else if(jQuery.browser.safari) { 272 jQuery.dontCheck=true; 273 this.historyAddHistory(hash); 274 var fn=function() { 275 jQuery.dontCheck=false; 276 } 277 ; 278 window.setTimeout(fn,200); 279 jQuery.historyCallback(hash); 280 location.hash=newhash; 281 } else { 282 jQuery.historyCallback(hash); 283 } 284 } 285} 286);
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.