PageSourceSearch

https://earthabitats.com/cdn/shop/t/16/assets/xzoom.min.js?v=84147631030780292901593607784

js earthabitats.com collected 2026-10-08 10:35:13 UTC 29,369 bytes, 922 lines download raw bytes

1/*!-----------------------------------------------------
2 * xZoom v1.0.4
3 * (c) 2013 by Azat Ahmedov & Elman Guseynov
4 * https://github.com/payalord
5 * https://dribbble.com/elmanvebs
6 * Apache License 2.0
7 *------------------------------------------------------*/
8window.requestAnimFrame = (function(){
9  return window.requestAnimationFrame ||
10  window.webkitRequestAnimationFrame ||
11  window.mozRequestAnimationFrame ||
12  window.oRequestAnimationFrame ||
13  window.msRequestAnimationFrame ||
14  function(callback){
15    window.setTimeout(callback, 20);
16  };
17})();
18
19function detect_old_ie() {
20if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){
21 var ieversion=new Number(RegExp.$1);
22 if (ieversion>=9)
23  return false
24 else if (ieversion>=8)
25  return true
26 else if (ieversion>=7)
27  return true
28 else if (ieversion>=6)
29  return true
30 else if (ieversion>=5)
31  return true
32} else return false;
33}
34
35(function ($) {
36  //Compatibility between old and new versions of jQuery
37  $.fn.xon = $.fn.on || $.fn.bind;
38  $.fn.xoff = $.fn.off || $.fn.bind;
39
40  function xobject(mObj, opts) {
41    //Properties
42    this.xzoom = true;
43    var current = this;
44    var parent;
45    var xzoomID = {};
46
47    var sw, sh, mw, mh, moffset, stop, sleft, mtop, mleft, ctop, cleft;
48    var source, tint, preview, loading, trans, transImg, sobjects = new Array();
49    var imageGallery = new Array(), index = 0, cindex = 0;
50    var img, imgObj, lens, lensImg;
51    var lw, lh, ll, lt, llc, ltc, ocofx, ocofy, cofx, cofy, c1, c2, iwh, scale = 0;
52    var imgObjwidth, imgObjheight;
53    var flag, u = 0, v = 0, su = 0, sv = 0, lsu = 0, lsv = 0, lu = 0, lv = 0, llu = 0, llv = 0;
54    var ie = detect_old_ie(), aie = /MSIE (\d+\.\d+);/.test(navigator.userAgent), iex, iey;
55    var active, title = '', caption, caption_container;
56
57    //Adaptive properties
58    var wsw, wsh, osw, osh, tsw, tsh, oposition, reverse, smoothNormal;
59
60    this.adaptive = function() {
61      if (osw == 0 || osh == 0) {
62        mObj.css('width', '');
63        mObj.css('height', '');
64        osw = mObj.width();
65        osh = mObj.height();
66      }
67
68      xremove();
69      wsw = $(window).width();
70      wsh = $(window).height();
71
72      tsw = mObj.width();
73      tsh = mObj.height();
74
75      var update = false;
76      if (osw>wsw || osh>wsh) update = true;
77
78      if (tsw > osw) tsw = osw;
79      if (tsh > osh) tsh = osh;
80      if (update) {
81        mObj.width('100%');
82      } else {
83        if (osw != 0) mObj.width(osw);
84      }
85      if (oposition != 'fullscreen') if (adaptive_position_fit()) current.options.position = oposition; else current.options.position = current.options.mposition;
86      if (!current.options.lensReverse) reverse = current.options.adaptiveReverse && current.options.position == current.options.mposition;
87    }
88
89    function spos() {
90      var doc = document.documentElement;
91      var left = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0);
92      var top = (window.pageYOffset || doc.scrollTop)  - (doc.clientTop || 0);
93
94      return {left: left, top: top};
95    }
96
97    function adaptive_position_fit() {
98      var moffset = mObj.offset();
99
100      if (current.options.zoomWidth == 'auto') mw = tsw; else mw = tsw/osw * current.options.zoomWidth;
101      if (current.options.zoomHeight == 'auto') mh = tsh; else mh = tsw/osh * current.options.zoomHeight;
102
103      if (current.options.position.substr(0,1) == '#') xzoomID = $(current.options.position); else xzoomID.length = 0;
104      if (xzoomID.length != 0) return true;
105
106      switch(oposition) {
107        case 'lens':
108        case 'inside':
109        return true;
110        break;
111        case 'top':
112          stop = moffset.top;
113          sleft = moffset.left;
114          mtop = stop - tsh;
115          mleft = sleft;
116        break;
117        case 'left':
118          stop = moffset.top;
119          sleft = moffset.left;
120          mtop = stop;
121          mleft = sleft - tsw;
122        break;
123        case 'bottom':
124          stop = moffset.top;
125          sleft = moffset.left;
126          mtop = stop + tsh;
127          mleft = sleft;
128        break;
129        case 'right':
130        default:
131          stop = moffset.top;
132          sleft = moffset.left;
133          mtop = stop;
134          mleft = sleft + tsw;
135      }
136      if (mleft+mw>wsw || mleft<0) return false; //if (mtop+mh>wsh || mtop<0) return false;
137      return true;
138    }
139
140    this.xscroll = function(event) {
141      event.preventDefault();
142
143      if (event.xscale) {
144        var x = event.pageX || event.originalEvent.pageX;
145        var y = event.pageY || event.originalEvent.pageY;
146
147        scale = event.xscale;
148        xscale(x, y);
149      } else {
150        var delta = -event.originalEvent.detail || event.originalEvent.wheelDelta || event.xdelta;
151        var x = event.pageX || event.originalEvent.pageX;
152        var y = event.pageY || event.originalEvent.pageY;
153        if (ie) {
154          x = iex;
155          y = iey;
156        }
157
158          if (delta > 0) delta = -0.05; else delta = 0.05;
159
160          scale += delta;
161          xscale(x, y);
162      }
163    }
164
165    function lensShape() {
166      if (current.options.lensShape == 'circle' && current.options.position == 'lens') {
167        //this function must be called before set_lens()
168        lw = lh = Math.max(lw, lh);
169        var radius = (lw + Math.max(ltc,llc) * 2) / 2;
170        lens.css({'-moz-border-radius': radius, '-webkit-border-radius': radius, 'border-radius': radius});
171      }
172    }
173
174    function lensOutput(x, y, sx, sy) {
175      if (current.options.position == 'lens') {
176        imgObj.css({top: -(y-stop) * cofy + (lh / 2), left: -(x-sleft) * cofx + (lw / 2)});
177        if (current.options.bg) {
178          lens.css({'background-image': 'url('+imgObj.attr('src')+')', 'background-repeat': 'no-repeat', 'background-position': (-(x-sleft) * cofx + (lw / 2))+'px '+(-(y-stop) * cofy + (lh / 2))+'px'});
179          if (sx && sy) lens.css({'background-size': sx+'px '+sy+'px'});
180        }
181      } else {
182        imgObj.css({top: -lt * cofy, left: -ll * cofx});
183      }
184    }
185
186    function xscale(x, y) {
187      if (scale < -1) scale = -1;
188      if (scale > 1) scale = 1;
189
190      if (c1 < c2) {
191        var cc = c1 - (c1 - 1) * scale;
192        var iw = mw * cc;
193        var ih = iw / iwh;
194      } else {
195        var cc = c2 - (c2 - 1) * scale;
196        var ih = mh * cc;
197        var iw = ih * iwh;
198      }
199      if (smoothNormal && flag) {
200        //If smoothMove
201        u = x;
202        v = y;
203        su = iw;
204        sv = ih;
205      } else {
206        if (!flag) {
207          lsu = su = iw;
208          lsv = sv = ih;
209        }
210        cofx = iw / sw;
211        cofy = ih / sh;
212        lw = mw / cofx;
213        lh = mh / cofy;
214        lensShape();
215        set_lens(x, y);
216
217        imgObj.width(iw);
218        imgObj.height(ih);
219        lens.width(lw);
220        lens.height(lh);
221
222        lens.css({top: lt - ltc, left: ll - llc});
223        lensImg.css({top: -lt, left: -ll});
224        lensOutput(x, y, iw, ih);
225      }
226    }
227
228    function loopZoom() {
229      var x = lu;
230      var y = lv;
231      var x2 = llu;
232      var y2 = llv;
233            var sx = lsu;
234            var sy = lsv;     
235      x += (u - x) / current.options.smoothLensMove;
236      y += (v - y) / current.options.smoothLensMove;
237
238      x2 += (u - x2) / current.options.smoothZoomMove;
239      y2 += (v - y2) / current.options.smoothZoomMove;
240
241      sx += (su - sx) / current.options.smoothScale;
242      sy += (sv - sy) / current.options.smoothScale;
243
244      cofx = sx / sw;
245      cofy = sy / sh;
246
247      lw = mw / cofx;
248      lh = mh / cofy;
249      lensShape();
250      set_lens(x, y);
251
252      imgObj.width(sx);
253      imgObj.height(sy);
254      
255      lens.width(lw);
256      lens.height(lh);
257
258      lens.css({top: lt - ltc, left: ll - llc});
259      lensImg.css({top: -lt, left: -ll});
260
261      set_lens(x2, y2);
262      lensOutput(x, y, sx, sy);
263
264      lu = x;
265      lv = y;
266      llu = x2;
267      llv = y2;
268      lsu = sx;
269      lsv = sy;
270
271      if (flag) requestAnimFrame(loopZoom);
272    }
273
274    function set_lens(x, y) {
275      x -= sleft;
276      y -= stop;
277      ll = x - (lw / 2);
278      lt = y - (lh / 2);
279
280      if (current.options.position != 'lens') {
281        if (ll < 0) ll = 0;
282        if (ll > sw - lw) ll = sw - lw;
283        if (lt < 0) lt = 0;
284        if (lt > sh - lh) lt = sh - lh;
285      }
286    }
287
288    function xremove() {
289      if (typeof source != "undefined") source.remove();
290      if (typeof preview != "undefined") preview.remove();
291      if (typeof caption_container != "undefined") caption_container.remove();
292    }
293
294    function prepare_zoom(x, y) {
295      if (current.options.position == 'fullscreen') {
296        sw = $(window).width();
297        sh = $(window).height();
298      } else {
299        sw = mObj.width();
300        sh = mObj.height();
301      }
302
303      loading.css({top: sh / 2 - loading.height() / 2, left: sw / 2 - loading.width() / 2});
304
305      if (current.options.rootOutput || current.options.position == 'fullscreen') {
306        moffset = mObj.offset();
307      } else {
308        moffset = mObj.position();
309      }
310
311      //Round
312      moffset.top = Math.round(moffset.top);
313      moffset.left = Math.round(moffset.left);
314
315      switch(current.options.position) {
316        case 'fullscreen':
317          stop = spos().top;
318          sleft = spos().left;
319          mtop = 0;
320          mleft = 0;
321        break;
322        case 'inside':
323          stop = moffset.top;
324          sleft = moffset.left;
325          mtop = 0;
326          mleft = 0;
327        break;
328        case 'top':
329          stop = moffset.top;
330          sleft = moffset.left;
331          mtop = stop - sh;
332          mleft = sleft;
333        break;
334        case 'left':
335          stop = moffset.top;
336          sleft = moffset.left;
337          mtop = stop;
338          mleft = sleft - sw;
339        break;
340        case 'bottom':
341          stop = moffset.top;
342          sleft = moffset.left;
343          mtop = stop + sh;
344          mleft = sleft;
345        break;
346        case 'right':
347        default:
348          stop = moffset.top;
349          sleft = moffset.left;
350          mtop = stop;
351          mleft = sleft + sw;
352      }
353
354      //Correct source position
355      stop -= source.outerHeight() / 2;
356      sleft -= source.outerWidth() / 2;
357
358      if (current.options.position.substr(0,1) == '#') xzoomID = $(current.options.position); else xzoomID.length = 0;
359      if (xzoomID.length == 0 && current.options.position != 'inside' && current.options.position!= 'fullscreen') {
360
361        if (!current.options.adaptive || !osw || !osh) {osw = sw; osh = sh;}
362        if (current.options.zoomWidth == 'auto') mw = sw; else mw = current.options.zoomWidth;
363        if (current.options.zoomHeight == 'auto') mh = sh; else mh = current.options.zoomHeight;
364
365        //Add offset
366        mtop += current.options.Yoffset;
367        mleft += current.options.Xoffset;
368
369        preview.css({width: mw + 'px', height: mh + 'px', top: mtop, left: mleft});
370        if (current.options.position != 'lens') parent.append(preview);
371      } else if (current.options.position == 'inside' || current.options.position == 'fullscreen') {
372        mw = sw;
373        mh = sh;
374
375        preview.css({width: mw + 'px', height: mh + 'px'});
376        source.append(preview);
377      } else {
378        mw = xzoomID.width();
379        mh = xzoomID.height();
380
381        if (current.options.rootOutput) {
382          mtop = xzoomID.offset().top;
383          mleft = xzoomID.offset().left;
384
385          parent.append(preview);
386        } else {
387          mtop = xzoomID.position().top;
388          mleft = xzoomID.position().left;
389
390          xzoomID.parent().append(preview);
391        }
392
393        mtop += (xzoomID.outerHeight() - mh - preview.outerHeight()) / 2;
394        mleft += (xzoomID.outerWidth() - mw - preview.outerWidth()) / 2;
395        preview.css({width: mw + 'px', height: mh + 'px', top: mtop, left: mleft});
396      }
397
398      if (current.options.title && title != '') {
399        if (current.options.position == 'inside' || current.options.position == 'lens' || current.options.position == 'fullscreen') {
400          ctop = mtop;
401          cleft = mleft;
402          source.append(caption_container);
403        } else {
404          ctop = mtop + (preview.outerHeight()-mh)/2;
405          cleft = mleft + (preview.outerWidth()-mw)/2;
406          parent.append(caption_container);
407        }
408        caption_container.css({width: mw + 'px', height: mh + 'px', top: ctop, left: cleft});
409      }
410
411      source.css({width: sw + 'px', height: sh + 'px', top: stop, left: sleft});
412      tint.css({width: sw + 'px', height: sh + 'px'});
413      if (current.options.tint && (current.options.position != 'inside' && current.options.position != 'fullscreen'))
414        tint.css('background-color', current.options.tint)
415      else if (ie) {
416        tint.css({'background-image': 'url('+mObj.attr('src')+')', 'background-color': '#fff'});
417      }
418
419      lu = u = x;
420      lv = v = y;
421
422      //Image object
423      img = new Image();
424      
425      var timestamp = '';
426      if (aie) timestamp = '?r='+(new Date()).getTime();
427      img.src = mObj.attr('xoriginal')+timestamp;
428
429      imgObj = $(img);
430      imgObj.css('position', 'absolute');
431      //debug
432      //imgObj.css('opacity', '0.5');
433
434      img = new Image();
435      img.src = mObj.attr('src');
436
437      lensImg = $(img);
438      lensImg.css('position', 'absolute');
439      lensImg.width(sw);
440      
441      //Append image
442      switch (current.options.position) {
443        case 'fullscreen':
444        case 'inside':
445          preview.append(imgObj);
446        break;
447        case 'lens':
448          lens.append(imgObj);
449          if (current.options.bg) imgObj.css({display: 'none'});
450        break;
451        default:
452          preview.append(imgObj);
453          lens.append(lensImg);
454      }
455    }
456
457    this.openzoom = function (event) {
458        if (current.options.adaptive) current.adaptive();
459        scale = current.options.defaultScale; flag = false;
460
461        //Source container
462        source = $('<div></div>');
463        if (current.options.sourceClass != '') source.addClass(current.options.sourceClass);
464        source.css('position', 'absolute');
465
466        //Loading container
467        loading = $('<div></div>');
468        if (current.options.loadingClass != '') loading.addClass(current.options.loadingClass);
469        loading.css('position', 'absolute');
470
471        tint = $('<div style="position: absolute; top: 0; left: 0;"></div>');
472
473        source.append(loading);
474
475        //Preview container
476        preview = $('<div></div>');
477        if (current.options.zoomClass != '' && current.options.position != 'fullscreen') preview.addClass(current.options.zoomClass);
478        preview.css({position: 'absolute', overflow: 'hidden', opacity: 1});
479        
480        //Caption
481        if (current.options.title && title != '') {
482          caption_container = $('<div></div>');
483          caption = $('<div></div>');
484          caption_container.css({position: 'absolute', opacity: 1});
485          if (current.options.titleClass) caption.addClass(current.options.titleClass);
486          caption.html('<span>'+title+'</span>');
487          caption_container.append(caption);
488          if (current.options.fadeIn) caption_container.css({opacity:0});
489        }
490
491        //Lens object
492        lens = $('<div></div>');
493        if (current.options.lensClass != '') lens.addClass(current.options.lensClass);
494        lens.css({position: 'absolute', overflow: 'hidden'});
495
496        //Lens tint
497        if (current.options.lens) {
498          lenstint = $('<div></div>');
499          lenstint.css({position: 'absolute', background: current.options.lens, opacity: current.options.lensOpacity, width: '100%', height: '100%', top: 0, left: 0, 'z-index': 9999});
500          lens.append(lenstint);
501        }
502
503        if (current.options.position != 'inside' && current.options.position != 'fullscreen') {
504          if (current.options.tint || ie) source.append(tint);
505
506          if (current.options.fadeIn) {
507            tint.css({opacity:0});
508            lens.css({opacity:0});
509            preview.css({opacity:0});
510          }
511          parent.append(source);
512        } else {
513          if (current.options.fadeIn) preview.css({opacity:0});
514          parent.append(source);
515        }
516
517        //On mouse leave delete containers
518        current.eventleave(source);
519
520        prepare_zoom(event.pageX, event.pageY);
521
522        //Correct preview
523        switch(current.options.position) {
524          case 'inside':
525            mtop -= (preview.outerHeight() - preview.height()) / 2;
526            mleft -= (preview.outerWidth() - preview.width()) / 2;
527          break;
528          case 'top':
529            mtop -= preview.outerHeight() - preview.height();
530            mleft -= (preview.outerWidth() - preview.width()) / 2;
531          break;
532          case 'left':
533            mtop -= (preview.outerHeight()  - preview.height()) / 2;
534            mleft -= preview.outerWidth() - preview.width();
535          break;
536          case 'bottom':
537            mleft -= (preview.outerWidth() - preview.width()) / 2;
538          break;
539          case 'right':
540            mtop -= (preview.outerHeight() - preview.height()) / 2;
541        }
542
543        preview.css({top: mtop, left: mleft});
544
545        //We must be sure that image has been loaded
546        imgObj.xon('load', function() {
547          loading.remove();
548
549          //Scroll functionality
550          if (current.options.scroll) current.eventscroll(source);
551
552          if (current.options.position != 'inside' && current.options.position != 'fullscreen') {
553            //Append lens to source container
554            source.append(lens);
555            if (current.options.fadeIn) {
556              tint.fadeTo(300, current.options.tintOpacity);
557              lens.fadeTo(300, 1);
558              preview.fadeTo(300,1);
559            } else {
560              tint.css({opacity: current.options.tintOpacity});
561              lens.css({opacity: 1});
562              preview.css({opacity: 1});
563            }
564          } else {
565            if (current.options.fadeIn) {
566              preview.fadeTo(300,1);
567            } else {
568              preview.css({opacity: 1});
569            }
570          }
571
572          if (current.options.title && title != '') {
573            if (current.options.fadeIn) caption_container.fadeTo(300,1); else caption_container.css({opacity: 1});
574          }
575
576          imgObjwidth = imgObj.width();
577          imgObjheight = imgObj.height();
578
579          if (current.options.adaptive) {
580          //Images corrections for adaptive
581            if (sw<osw || sh<osh) {
582              lensImg.width(sw);
583              lensImg.height(sh);
584
585              imgObjwidth = sw/osw * imgObjwidth;
586              imgObjheight = sh/osh * imgObjheight;
587              
588              imgObj.width(imgObjwidth);
589              imgObj.height(imgObjheight);
590            }
591          }
592
593          //Calculate lens size
594          lsu = su = imgObjwidth;
595          lsv = sv = imgObjheight;
596          iwh = imgObjwidth / imgObjheight;
597          c1 = imgObjwidth / mw;
598          c2 = imgObjheight / mh;
599          //outerHeight and outerWidth work wrong sometimes, especially when we use init() function
600          //ltc = lens.outerHeight() / 2;
601          //llc = lens.outerWidth() / 2;
602          //Issue #2 Test .css() function that can return NaN and break lens object position
603          var t, o = ['padding-','border-'];
604          ltc = llc = 0;
605          for(var i = 0; i<o.length;i++) {
606            t = parseFloat(lens.css(o[i]+'top-width'));
607            ltc += t !== t ? 0 : t;
608            t = parseFloat(lens.css(o[i]+'bottom-width'));
609            ltc += t !== t ? 0 : t;
610            t = parseFloat(lens.css(o[i]+'left-width'));
611            llc += t !== t ? 0 : t;
612            t = parseFloat(lens.css(o[i]+'right-width'));
613            llc += t !== t ? 0 : t;
614          }
615          ltc /= 2;
616          llc /= 2;
617          //ltc = (parseFloat(lens.css('padding-top-width')) + parseFloat(lens.css('padding-bottom-width')) + parseFloat(lens.css('border-top-width')) + parseFloat(lens.css('border-bottom-width'))) / 2;
618          //llc = (parseFloat(lens.css('padding-left-width')) + parseFloat(lens.css('padding-right-width')) + parseFloat(lens.css('border-left-width')) + parseFloat(lens.css('border-right-width'))) / 2;
619          //ltc = (pb(lens, 'padding', 1) + pb(lens, 'border', 1)) / 2;
620          //llc = (pb(lens, 'padding', 0) + pb(lens, 'border', 0)) / 2;
621
622          xscale(event.pageX, event.pageY);
623          
624          if (smoothNormal && !current.options.bg) {flag = true;
624 requestAnimFrame(loopZoom);}
625
626          //Add event on mouse move
627          current.eventmove(source);
628          
629          current.eventclick(source);
630        });     
631    }
632
633    /*function pb(obj, name, dir) {
634      if (dir) {
635        return parseFloat(obj.css(name + '-top')) + parseFloat(obj.css(name + '-bottom'));
636      } else {
637        return parseFloat(obj.css(name + '-left')) + parseFloat(obj.css(name + '-right'));
638      }
639    }*/
640
641    this.movezoom = function(event) {
642      if (ie) {
643        iex = event.pageX;
644        iey = event.pageY;
645      }
646
647      var x = event.pageX - sleft;
648      var y = event.pageY - stop;
649
650      if (reverse) {
651        event.pageX -= (x - sw / 2) * 2;
652        event.pageY -= (y - sh / 2) * 2;
653      }
654
655      if (x < 0 || x > sw || y < 0 || y > sh) source.trigger('mouseleave');
656      if (smoothNormal && !current.options.bg) {
657        u = event.pageX;
658        v = event.pageY;
659      } else {
660        //Calculate zoom image position
661        lensShape();
662        set_lens(event.pageX, event.pageY);
663        lens.css({top: lt - ltc, left: ll - llc});
664        lensImg.css({top: -lt, left: -ll});
665        lensOutput(event.pageX,event.pageY, 0, 0);
666      }
667    }
668
669    this.eventdefault = function() {
670      current.eventopen = function(element) {
671        element.xon('mouseenter', current.openzoom);
672      }
673
674      current.eventleave = function(element) {
675        element.xon('mouseleave', current.closezoom);
676      }
677
678      current.eventmove = function(element) {
679        element.xon('mousemove', current.movezoom);
680      }
681      
682      current.eventscroll = function(element) {
683        element.xon('mousewheel DOMMouseScroll', current.xscroll);
684      }
685
686      current.eventclick = function(element) {
687        element.xon('click', function(event) {
688          mObj.trigger('click');
689        });
690      }
691    }
692
693    this.eventunbind = function() {
694      mObj.xoff('mouseenter');
695      current.eventopen = function(element) {}
696      current.eventleave = function(element) {}
697      current.eventmove = function(element) {}
698      current.eventscroll = function(element) {}
699      current.eventclick = function(element) {}
700    }
701
702    this.init = function (options) {
703      //Default options
704      current.options = $.extend({},$.fn.xzoom.defaults, options);
705
706      if (current.options.rootOutput) {
707        parent = $("body");
708      } else {
709        parent = mObj.parent();
710      }
711
712      oposition = current.options.position; //ocof,
713
714      reverse = current.options.lensReverse && current.options.position == 'inside';
715
716      //Limits
717      if (current.options.smoothZoomMove < 0) current.options.smoothZoomMove = 0;
718      if (current.options.smoothLensMove < 0) current.options.smoothLensMove = 0;
719      if (current.options.smoothScale < 0) current.options.smoothScale = 0;
720
721      smoothNormal = current.options.smoothZoomMove && current.options.smoothLensMove && current.options.smoothScale;
722
723      //Adaptive
724      if (current.options.adaptive) {
725        $(window).xon('load',function(){
726          osw = mObj.width();
727          osh = mObj.height();
728
729          current.adaptive();
730          $(window).resize(current.adaptive);
731        });
732      }
733      current.eventdefault();
734      current.eventopen(mObj);
735    }
736
737    this.destroy = function() {
738      current.eventunbind();
739      delete current;
740    }
741
742    this.closezoom = function() {
743      flag = false;
744      if (current.options.fadeOut) {
745        if (current.options.title && title != '') caption_container.fadeOut(299);
746        if (current.options.position != 'inside' || current.options.position != 'fullscreen') {
747          preview.fadeOut(299);
748          source.fadeOut(300, function(){xremove()});
749        } else {
750          source.fadeOut(300, function(){xremove()});
751        }
752      } else {
753        xremove();
754      }
755    }
756
757    this.gallery = function() {
758      var g = new Array();
759      var i,j = 0;
760      for (i = cindex; i<imageGallery.length; i++) {
761        g[j] = imageGallery[i];j++;
762      }
763      for (i = 0; i<cindex; i++) {
764        g[j] = imageGallery[i];j++;
765      }
766
767      return {index: cindex, ogallery: imageGallery, cgallery: g};
768    }
769
770    function get_title(element) {
771      var otitle = element.attr('title');
772      var xotitle = element.attr('xtitle');
773      if (xotitle) {
774        return xotitle;
775      } else if (otitle) {
776        return otitle
777      } else {
778        return '';
779      }
780    }
781
782    this.xappend = function(Obj) {
783      var link = Obj.parent();
784      //Add original image to image gallery
785      imageGallery[index] = link.attr('href');
786      link.data('xindex', index);
787      if (index == 0 && current.options.activeClass) {active = Obj; active.addClass(current.options.activeClass)}
788      if (index == 0 && current.options.title) title = get_title(Obj);
789      index++;
790
791      function thumbchange(event) {
792        xremove();
793        event.preventDefault();
794        if (current.options.activeClass) {
795          active.removeClass(current.options.activeClass);
796          active = Obj;
797          active.addClass(current.options.activeClass);
798        }
799        cindex = $(this).data('xindex');
800        if (current.options.fadeTrans) {
801          transImg = new Image();
802          transImg.src = mObj.attr('src');
803          trans = $(transImg);
804          trans.css({position: 'absolute', top: mObj.offset().top, left: mObj.offset().left, width: mObj.width(), height: mObj.height()});
805          $(document.body).append(trans);
806          trans.fadeOut(200, function() {trans.remove()});
807        }
808        var _xorig = link.attr('href');
809        var _prev;
810
811        if (Obj.attr('xpreview')) {
812          _prev = Obj.attr('xpreview');
813        } else {
814          _prev = Obj.attr('src');
815        }
816
817        title = get_title(Obj);
818        if (Obj.attr('title')) mObj.attr('title',Obj.attr('title'));
819
820        //imgObj.attr('src',_xorig);
821        mObj.attr('xoriginal',_xorig);
822        mObj.attr('src', _prev);
823        //Prevent submit on click
824        //return false;
825      }
826
827      if (current.options.hover) {
828        link.xon('mouseenter', link, thumbchange);
829      }
830      link.xon('click', link, thumbchange);
831    }
832
833    this.init(opts);
834  }
835
836    $.fn.xzoom = function(options) {
837      var mainObj;
838      var secObj;
839
840      if (this.selector) {
841        var el = this.selector.split(",");
842        for (var i in el) el[i] = $.trim(el[i]);
843        this.each(function(index) {
844          if (el.length == 1) {
845            if (index == 0) {
846              //Main window element
847              mainObj = $(this);
848            if (typeof(mainObj.data('xzoom')) !== 'undefined') return mainObj.data('xzoom');
849              mainObj.x = new xobject(mainObj, options);
850            } else if(typeof(mainObj.x) !== 'undefined') {
851              //Thumbs
852              secObj = $(this);
853              mainObj.x.xappend(secObj);
854            }
855          } else {
856            if ($(this).is(el[0]) && index == 0) {
857              //Main window element
858              mainObj = $(this);
859            if (typeof(mainObj.data('xzoom')) !== 'undefined') return mainObj.data('xzoom');
860              mainObj.x = new xobject(mainObj, options);
861            } else if(typeof(mainObj.x) !== 'undefined' && !$(this).is(el[0])) {
862              //Thumbs
863              secObj = $(this);
864              mainObj.x.xappend(secObj);
865            }
866          }
867        });
868      } else this.each(function(index) {
869        if (index == 0) {
870          //Main window element
871          mainObj = $(this);
872          if (typeof(mainObj.data('xzoom')) !== 'undefined') return mainObj.data('xzoom');
873          mainObj.x = new xobject(mainObj, options);
874        } else if(typeof(mainObj.x) !== 'undefined') {
875          //Thumbs
876          secObj = $(this);
877          mainObj.x.xappend(secObj);
878        }
879      });
880      if (typeof(mainObj) === 'undefined') return false;
881      mainObj.data('xzoom', mainObj.x);
882
883      //Fire event xzoom init
884      $(mainObj).trigger('xzoom_ready');
885      return mainObj.x;
886    }
887
888    $.fn.xzoom.defaults = {
889    position: 'right', //top, left, right, bottom, inside, lens, fullscreen, #ID
890    mposition: 'inside', //inside, fullscreen
891    rootOutput: true,
892    Xoffset: 0,
893    Yoffset: 0,
894    fadeIn: true,
895    fadeTrans: true,
896    fadeOut: false,
897    smoothZoomMove: 3,
898    smoothLensMove: 1,
899    smoothScale: 6,
900    defaultScale: 0, //from -1 to 1, that means -100% till 100% scale
901    scroll: true,
902    tint: false, //'#color'
903    tintOpacity: 0.5,
904    lens: false, //'#color'
905    lensOpacity: 0.5,
906    lensShape: 'box', //'box', 'circle'
907    zoomWidth: 'auto',
908    zoomHeight: 'auto',
909    sourceClass: 'xzoom-source',
910    loadingClass: 'xzoom-loading',
911    lensClass: 'xzoom-lens',
912    zoomClass: 'xzoom-preview',
913    activeClass: 'xactive',
914    hover: false,
915    adaptive: true,
916    lensReverse: false,
917    adaptiveReverse: false,
918    title: false,
919    titleClass: 'xzoom-caption',
920    bg: false //zoom image output as background
921  };
922})(jQuery);

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.