PageSourceSearch

https://www.norberts.com/javascript/jquery/plugins/jqzoom/jqzoom.js?3b

js norberts.com collected 2026-10-07 22:49:57 UTC 27,696 bytes, 1,128 lines download raw bytes

1/*
2 * JQZoom Evolution 1.0.1 - Javascript Image magnifier
3 *
4 * Copyright (c) Engineer Renzi Marco(www.mind-projects.it)
5 *
6 * $Date: 12-12-2008
7 *
8 *	ChangeLog:
9 *  
10 * $License : GPL,so any change to the code you should copy and paste this section,and would be nice to report this to me([email protected]).
11 */
12(function($)
13{
14    $.fn.jqzoom = function(options)
15    {
16        var settings = {
17            zoomType: 'standard', //standard/reverse/innerzoom
18            zoomWidth: 200,		//zoomed width default width
19            zoomHeight: 200,		//zoomed div default width
20            xOffset: 10,		//zoomed div default offset
21            yOffset: 0,
22            position: "right" ,//zoomed div default position,offset position is to the right of the image
23            lens:true, //zooming lens over the image,by default is 1;
24			lensReset : false,
25			imageOpacity: 0.2,
26			title : true,
27			alwaysOn: false,
28			showEffect: 'show',
29			hideEffect: 'hide',
30			fadeinSpeed: 'fast',
31			fadeoutSpeed: 'slow',
32			preloadImages :true,
33			showPreload: true,
34			preloadText : 'Loading zoom',
35			preloadPosition : 'center',   //bycss
36			cursor: 'pointer' //:ISC Change: add the cursor option, so it allows user to define a cursor style
37        };
38
39			//extending options
40			options = options || {};
41        	$.extend(settings, options);
42
43
44		return this.each(function()
45		{
46			var a = $(this);
47			var aTitle = a.attr('title'); //variabile per memorizzare il titolo href
48			$(a).removeAttr('title');
49			$(a).css('outline-style','none');
50
51
52			var img = $("img", this);
53			var imageTitle = img.attr('title');
54			img.removeAttr('title');	//variabile per memorizzare il titolo immagine
55
56
57			var smallimage = new Smallimage( img );
58			var smallimagedata = {};
59			//imageborder
60			var btop = 0;
61			var bleft = 0;
62
63			var loader = null;     //variabile per memorizzare oggetto loader
64			loader = new Loader();
65
66			var ZoomTitle = (trim(aTitle).length > 0) ? aTitle :
67			(trim(imageTitle).length > 0) ? imageTitle : null;  //setting zoomtitle
68			var ZoomTitleObj = new zoomTitle();
69
70			var largeimage = new Largeimage( a[0].href );
71
72			var lens = new Lens();
73			var lensdata = {};
74			//lensborder
75
76
77
78			var largeimageloaded = false;
79			var scale = {}; //rapporto tra immagine grande e piccola scale.x/scale.y
80			var stage = null; // quadrato che mostra l'immagine ingrandita
81			var running = false; // running = true quando si verifica l'evento che mostra lo zoom(adesso mouseover).
82			var mousepos = {};
83			var firstime = 0;
84			var preloadshow = false;
85			var isMouseDown = false;
86			var dragstatus = false
87			//loading smallimagedata
88			smallimage.loadimage();
89
90			//ritorna false al click dell href
91			$(this).click(function(){return false;});
92
93			//se settato alwaysOn attivo lo Zoom e lo mostro.
94
95			//attivo al mouseover
96			$(this).hover(function(e)
97			{
98				//:ISC Change: add a check for the zoom image href, and only active the zoomer when zoom image href is not empty. 
99				if($(this).attr('href')!='') {
100					mousepos.x = e.pageX;
101					mousepos.y	= e.pageY;
102					activate();
103				}
104			},function()
105			{
106				deactivate();
107			});
108
109
110			//ALWAYS ON
111			if(settings.alwaysOn)
112			{
113				setTimeout(function(){activate();},150);
114			}
115
116
117			function activate()
118			{
119
120				if ( !running ) {
121
122					//finding border
123					smallimage.findborder();
124
125					running = true;
126
127					//rimuovo il titolo al mouseover
128					imageTitle = img.attr('title');
129					img.removeAttr('title');
130					aTitle = a.attr('title');
131					$(a).removeAttr('title');
132
133					//se non cè creo l'oggetto largeimage
134					//:ISC Change: added "largeimage.url != a[0].href" in the if statement, so it reloads the zoom image when the zoom image's href is changed. This happens in image gallery where the small image can change without the page refresh
135					if (!largeimage || $.browser.safari || largeimage.url != a[0].href) {
136						largeimage = new Largeimage( a[0].href );
137						largeimageloaded = false;
138					}
139
140					//se l'immagine grande non è stata caricata la carico
141					if(!largeimageloaded || $.browser.safari)
142					{
143						largeimage.loadimage();
144					}else
145					{
146					//after preload
147						if(settings.zoomType != 'innerzoom')
148						{
149							stage = new Stage();
150							stage.activate();
151						}
152						lens = new Lens;
153						lens.activate();
154					}
155
156					//hack per MAC
157				/*	if($.browser.safari)
158					{
159						if(settings.zoomType != 'innerzoom') //se innerzoom non mostro la finestra dello zoom
160						{
161							stage = new Stage();
162							stage.activate();
163						}
164						if($('div.jqZoomPup').length <= 0)
165						{
166						lens = new Lens();
167						}
168						//if(settings.zoomType == 'innerzoom'){lens = new Lens()};
169						lens.activate();
170						(settings.alwaysOn) ? lens.center() : lens.setposition(null);
171					}
172					*/
173					a[0].blur();
174					//alert($('div.jqZoomPup').length);
175					return false;
176				}
177
178
179
180
181			}
182
183			function deactivate()
184			{
185				if(settings.zoomType == 'reverse' &&  !settings.alwaysOn)
186				{
187					img.css({'opacity' : 1});
188				}
189
190				if(!settings.alwaysOn)
191				{
192					//resetting parameters
193					running = false;
194					largeimageloaded = false;
195					$(lens.node).unbind('mousemove');
196					lens.remove();
197					if($('div.jqZoomWindow').length >0)
198					{
199						stage.remove();
200					}
201					if($('div.jqZoomTitle').length > 0)
202					{
203						ZoomTitleObj.remove();
204					}
205					//resetting title
206					img.attr('title',imageTitle);
207					a.attr('title',aTitle);
208					$().unbind();
209
210					a.unbind('mousemove');
211					//resetto il parametro che mi dice che è la prima volta che mostor lo zoom
212					firstime = 0;
213					//remove ieiframe
214					if(jQuery('.zoom_ieframe').length > 0)
215					{
216						jQuery('.zoom_ieframe').remove();
217					}
218				}else
219				{
220					if(settings.lensReset)
221					{
222						switch(settings.zoomType)
223						{
224							case 'innerzoom':
225							largeimage.setcenter();
226							break;
227							default:
228							lens.center();
229							break;
230						}
231					}
232				}
233
234				//non so se serve da provare
235				if(settings.alwaysOn)
236				{
237					activate();
238				}
239			};
240
241
242
243
244
245		//smallimage
246		function Smallimage( image )
247		{
248			this.node = image[0];
249
250			this.loadimage = function() {
251				this.node.src = image[0].src;
252			};
253			this.findborder = function()
254			{
255				var bordertop = '';
256				bordertop = $(img).css('border-top-width');
257				btop = '';
258				var borderleft = '';
259				borderleft = $(img).css('border-left-width');
260				bleft = '';
261				/*if($.browser.msie)
262				{
263					var temp = bordertop.split(' ');
264
265					bordertop = temp[1];
266					var temp = borderleft.split(' ');
267					borderleft = temp[1];
268				}*/
269
270				if(bordertop)
271				{
272					for(i=0;i<3;i++)
273					{
274						var x = [];
275						x = bordertop.substr(i,1);
276
277						if(isNaN(x) == false)
278						{
279							btop = btop +''+ bordertop.substr(i,1);
280						}else
281						{
282							break;
283						}
284					}
285				}
286
287				if(borderleft)
288				{
289					for(i=0;i<3;i++)
290					{
291						if(!isNaN(borderleft.substr(i,1)))
292						{
293							bleft = bleft + borderleft.substr(i,1)
294						}else
295						{
296							break;
297						}
298					}
299				}
300				btop = (btop.length > 0) ? eval(btop) : 0;
301				bleft = (bleft.length > 0) ? eval(bleft) : 0;
302
303
304			}
305			this.node.onload = function()
306			{
307				//setto il cursor e la posizione dell'href
308
309				//:ISC Change: change the hard coded cursor style to use the cursor style defined in the setting options
310				a.css({'cursor':settings.cursor,'display':'block'});
311
312				if(a.css('position')!= 'absolute' && a.parent().css('position'))
313				{
314					//:ISC Change: change the hard coded cursor style to use the cursor style defined in the setting options
315					a.css({'cursor':settings.cursor,'position':'relative','display':'block'});
316				}
317				if(a.parent().css('position') != 'absolute')
318				{
319					a.parent().css('position','relative');
320					//a.css('position','relative');
321				}
322				else{
323				//a.css('position','relative');
324				}
325				if($.browser.safari || $.browser.opera)
326				{
327					$(img).css({position:'absolute',top:'0px',left:'0px'});
328				}
329				/*if(a.css('position')!= 'absolute' && a.parent().css('position'))
330				{
331					a.css({'cursor':'crosshair','position':'relative','display':'block'});
332				}
333				if(a.parent().css('position') != 'absolute')
334				{
335					alert('in');
336					a.parent().css('position','relative');
337					//a.css('position','relative');
338				}
339				else{
340				//a.css('position','relative');
341				}*/
342
343
344
345				/*
346				if(a.parent().css('position') != 'relative' && a.css('position') != 'absolute')
347				{
348				a.css({'cursor':'crosshair','position':'relative','display':'block'});
349				}*/
350
351				//al docuemnt ready viene caricato l'src quindi viene azionato l'onload e carico tutti i dati
352				smallimagedata.w = $( this ).width();
353				smallimagedata.h = $( this ).height();
354
355
356				//non viene fatta assegnazione alla variabile globale
357				smallimagedata.h = $( this ).height();
358				smallimagedata.pos = $( this ).offset();
359				smallimagedata.pos.l = $( this ).offset().left;
360				smallimagedata.pos.t = $( this ).offset().top;
361				smallimagedata.pos.r = smallimagedata.w + smallimagedata.pos.l;
362				smallimagedata.pos.b = smallimagedata.h + smallimagedata.pos.t;
363
364				//per sicurezza setto l'altezza e la width dell'href
365				a.height(smallimagedata.h);
366				a.width(smallimagedata.w);
367
368
369				//PRELOAD IMAGES
370				if(settings.preloadImages)
371				{
372					largeimage.loadimage();
373				}
374			};
375
376
377
378			return this;
379		};
380
381
382
383		//Lens
384		function Lens()
385		{
386
387
388			//creating element and adding class
389			this.node = document.createElement("div");
390			$(this.node).addClass('jqZoomPup');
391
392			this.node.onerror = function() {
393				$( lens.node ).remove();
394				lens = new Lens();
395				lens.activate() ;
396			};
397
398
399
400
401			//funzione privata per il caricamento dello zoom
402			this.loadlens = function()
403			{
404
405
406				switch(settings.zoomType)
407				{
408					case 'reverse':
409						this.image = new Image();
410						this.image.src = smallimage.node.src;
410 // fires off async
411						this.node.appendChild( this.image );
412						$( this.node ).css({'opacity' : 1});
413					break;
414					case 'innerzoom':
415
416						this.image = new Image();
417						this.image.src = largeimage.node.src; // fires off async
418						this.node.appendChild( this.image );
419						$( this.node ).css({'opacity' : 1});
420					break
421					default:
422					break;
423				}
424
425
426
427				switch(settings.zoomType)
428				{
429					case 'innerzoom':
430						lensdata.w = smallimagedata.w;
431						lensdata.h = smallimagedata.h;
432					break;
433					default:
434						lensdata.w = (settings.zoomWidth)/scale.x;
435						lensdata.h = (settings.zoomHeight)/scale.y;
436					break;
437				}
438
439			$( this.node ).css({
440					width: lensdata.w + 'px',
441					height: lensdata.h + 'px',
442					position: 'absolute',
443					/*cursor: 'crosshair',*/
444					display: 'none',
445					//border: '1px solid blue'
446					borderWidth: 1+'px'
447				});
448			a.append(this.node);
449			}
450			return this;
451		};
452
453		Lens.prototype.activate = function()
454		{
455			//carico la lente
456			this.loadlens();
457
458			switch(settings.zoomType)
459			{
460				case 'reverse':
461					img.css({'opacity' : settings.imageOpacity});
462
463					(settings.alwaysOn) ? lens.center() : lens.setposition(null);
464					//lens.center();
465					//bindo ad a il mousemove della lente
466					a.bind( 'mousemove', function(e)
467					{
468						mousepos.x = e.pageX;
469						mousepos.y = e.pageY;
470						lens.setposition( e );
471					});
472				break;
473				case 'innerzoom':
474
475					//	lens = new Lens();
476					//	lens.activate();
477
478					$( this.node ).css({top : 0 ,left: 0});
479				   	if(settings.title)
480					{
481						ZoomTitleObj.loadtitle();
482					}
483
484					largeimage.setcenter();
485
486				   	a.bind( 'mousemove', function(e)
487				   	{
488						mousepos.x = e.pageX;
489						mousepos.y = e.pageY;
490						largeimage.setinner( e );
491
492					/*if(settings.zoomType == 'innerzoom' && running)
493					{
494						$(a).mousemove(function(){
495							if($('div.jqZoomPup').length <= 0)
496							{
497								lens = new Lens();
498								lens.activate();
499							}
500						});
501					}*/
502
503						/*if($('div.jqZoomPup').length <= 0)
504							{
505								lens = new Lens();
506								lens.activate();
507							}*/
508
509					});
510				break;
511				default:
512					/*$(document).mousemove(function(e){
513					if(isMouseDown && dragstatus != false){
514					lens.setposition( e );
515					}
516					});
517					lens.center()
518
519
520					dragstatus = 'on'
521					$(document).mouseup(function(e){
522					if(isMouseDown && dragstatus != false){
523						isMouseDown = false;
524						dragstatus = false;
525
526					}
527					});
528
529					$(this.node).mousedown(function(e){
530					$('div.jqZoomPup').css("cursor", "move");
531					$(this.node).css("position", "absolute");
532
533				// set z-index
534					$(this.node).css("z-index", parseInt( new Date().getTime()/1000 ));
535					if($.browser.safari)
536					{
537						$(a).css("cursor", "move");
538					}
539					isMouseDown    = true;
540					dragstatus = 'on';
541					lens.setposition( e );
542					});
543					*/
544
545
546					(settings.alwaysOn) ? lens.center() : lens.setposition(null);
547
548					//bindo ad a il mousemove della lente
549					$(a).bind( 'mousemove', function(e)
550					{
551
552						mousepos.x = e.pageX;
553						mousepos.y = e.pageY;
554						lens.setposition( e );
555					});
556
557				break;
558			}
559
560
561			return this;
562		};
563
564		Lens.prototype.setposition = function( e)
565		{
566
567
568			if(e)
569			{
570				mousepos.x = e.pageX;
571				mousepos.y	= e.pageY;
572			}
573
574			if(firstime == 0)
575			{
576			 	var lensleft = (smallimagedata.w)/2 - (lensdata.w)/2 ;
577			 	var lenstop = (smallimagedata.h)/2 - (lensdata.h)/2 ;
578				//ADDED
579
580				$('div.jqZoomPup').show()
581				if(settings.lens)
582				{
583					this.node.style.visibility = 'visible';
584				}
585				else
586				{
587					this.node.style.visibility = 'hidden';
588					$('div.jqZoomPup').hide();
589				}
590				//ADDED
591				firstime = 1;
592
593			}else
594			{
595				var lensleft = mousepos.x - smallimagedata.pos.l - (lensdata.w)/2 ;
596				var lenstop = mousepos.y - smallimagedata.pos.t -(lensdata.h)/2 ;
597			}
598
599
600				//a sinistra
601				if(overleft())
602				{
603					lensleft = 0  + bleft;
604				}else
605				//a destra
606				if(overright())
607				{
608					if($.browser.msie)
609					{
610					lensleft = smallimagedata.w - lensdata.w  + bleft + 1  ;
611					}else
612					{
613					lensleft = smallimagedata.w - lensdata.w  + bleft - 1  ;
614					}
615
616
617				}
618
619				//in alto
620				if(overtop())
621				{
622					lenstop = 0 + btop ;
623				}else
624				//sotto
625				if(overbottom())
626				{
627
628					if($.browser.msie)
629					{
630					lenstop = smallimagedata.h - lensdata.h  + btop + 1 ;
631					}else
632					{
633					lenstop = smallimagedata.h - lensdata.h - 1 + btop  ;
634					}
635
636				}
637				lensleft = parseInt(lensleft);
638				lenstop = parseInt(lenstop);
639
640				//setto lo zoom ed un eventuale immagine al centro
641				$('div.jqZoomPup',a).css({top: lenstop,left: lensleft });
642
643				if(settings.zoomType == 'reverse')
644				{
645					$('div.jqZoomPup img',a).css({'position': 'absolute','top': -( lenstop - btop +1) ,'left': -(lensleft - bleft +1)  });
646				}
647
648				this.node.style.left = lensleft + 'px';
649				this.node.style.top = lenstop + 'px';
650
651				//setto l'immagine grande
652				largeimage.setposition();
653
654				function overleft() {
655					return mousepos.x - (lensdata.w +2*1)/2  - bleft < smallimagedata.pos.l;
656				}
657
658				function overright() {
659
660					return mousepos.x + (lensdata.w + 2* 1)/2  > smallimagedata.pos.r + bleft ;
661				}
662
663				function overtop() {
664					return mousepos.y - (lensdata.h + 2* 1)/2  - btop < smallimagedata.pos.t;
665				}
666
667				function overbottom() {
668					return mousepos.y + (lensdata.h + 2* 1)/2    > smallimagedata.pos.b + btop;
669				}
670
671			return this;
672		};
673
674
675		//mostra la lente al centro dell'immagine
676		Lens.prototype.center = function()
677		{
678			$('div.jqZoomPup',a).css('display','none');
679			var lensleft = (smallimagedata.w)/2 - (lensdata.w)/2 ;
680			var lenstop = (smallimagedata.h)/2 - (lensdata.h)/2;
681			this.node.style.left = lensleft + 'px';
682			this.node.style.top = lenstop + 'px';
683			$('div.jqZoomPup',a).css({top: lenstop,left: lensleft });
684
685			if(settings.zoomType == 'reverse')
686			{
687				/*if($.browser.safari){
688					alert('safari');
689					alert(2*bleft);
690					$('div.jqZoomPup img',a).css({'position': 'absolute','top': -( lenstop - btop +1) ,'left': -(lensleft - 2*bleft)  });
691				}else
692				{*/
693					$('div.jqZoomPup img',a).css({'position': 'absolute','top': -(lenstop - btop + 1) ,'left': -( lensleft  - bleft +1)   });
694				//}
695			}
696
697			largeimage.setposition();
698			if($.browser.msie)
699			{
700				$('div.jqZoomPup',a).show();
701			}else
702			{
703				setTimeout(function(){$('div.jqZoomPup').fadeIn('fast');},10);
704			}
705		};
706
707
708		//ritorna l'offset
709		Lens.prototype.getoffset = function() {
710			var o = {};
711			o.left = parseInt(this.node.style.left) ;
712			o.top =  parseInt(this.node.style.top) ;
713			return o;
714		};
715
716		//rimuove la lente
717		Lens.prototype.remove = function()
718		{
719
720			if(settings.zoomType == 'innerzoom')
721			{
722				$('div.jqZoomPup',a).fadeOut('fast',function(){/*$('div.jqZoomPup img').remove();*/$(this).remove();});
723			}else
724			{
725				//$('div.jqZoomPup img').remove();
726				$('div.jqZoomPup',a).remove();
727			}
728		};
729
730		Lens.prototype.findborder = function()
731		{
732			var bordertop = '';
733			bordertop = $('div.jqZoomPup').css('borderTop');
734			//alert(bordertop);
735			lensbtop = '';
736			var borderleft = '';
737			borderleft = $('div.jqZoomPup').css('borderLeft');
738			lensbleft = '';
739			if($.browser.msie)
740			{
741				var temp = bordertop.split(' ');
742
743				bordertop = temp[1];
744				var temp = borderleft.split(' ');
745				borderleft = temp[1];
746			}
747
748			if(bordertop)
749			{
750				for(i=0;i<3;i++)
751				{
752					var x = [];
753					x = bordertop.substr(i,1);
754
755					if(isNaN(x) == false)
756					{
757						lensbtop = lensbtop +''+ bordertop.substr(i,1);
758					}else
759					{
760						break;
761					}
762				}
763			}
764
765			if(borderleft)
766			{
767				for(i=0;i<3;i++)
768				{
769					if(!isNaN(borderleft.substr(i,1)))
770					{
771						lensbleft = lensbleft + borderleft.substr(i,1)
772					}else
773					{
774						break;
775					}
776				}
777			}
778
779
780			lensbtop = (lensbtop.length > 0) ? eval(lensbtop) : 0;
781			lensbleft = (lensbleft.length > 0) ? eval(lensbleft) : 0;
782		}
783
784		//LARGEIMAGE
785		function Largeimage( url )
786		{
787			this.url = url;
788			this.node = new Image();
789
790			/*if(settings.preloadImages)
791			{
792			 	preload.push(new Image());
793				preload.slice(-1).src = url ;
794			}*/
795
796			this.loadimage = function()
797			{
798
799
800				if(!this.node)
801				this.node = new Image();
802
803				this.node.style.position = 'absolute';
804				this.node.style.display = 'none';
805				this.node.style.left = '-5000px';
806				this.node.style.top = '10px';
807				loader = new Loader();
808
809				if(settings.showPreload && !preloadshow)
810				{
811					loader.show();
812					preloadshow = true;
813				}
814
815				document.body.appendChild( this.node );
816				this.node.src = this.url; // fires off async
817			}
818
819			this.node.onload = function()
820			{
821				this.style.display = 'block';
822				var w = Math.round($(this).width());
823				var	h = Math.round($(this).height());
824
825				this.style.display = 'none';
826
827				//setting scale
828				scale.x = (w / smallimagedata.w);
829				scale.y = (h / smallimagedata.h);
830
831
832
833
834
835				if($('div.preload').length > 0)
836				{
837					$('div.preload').remove();
838				}
839
840				largeimageloaded = true;
841
842				if(settings.zoomType != 'innerzoom' && running){
843					stage = new Stage();
844					stage.activate();
845				}
846
847				if(running)
848				{
849				//alert('in');
850				lens = new Lens();
851
852				lens.activate() ;
853
854				}
855				//la attivo
856
857				if($('div.preload').length > 0)
858				{
859					$('div.preload').remove();
860				}
861			}
862			return this;
863		}
864
865
866		Largeimage.prototype.setposition = function()
867		{
868          	this.node.style.left = Math.ceil( - scale.x * parseInt(lens.getoffset().left) + bleft) + 'px';
869			this.node.style.top = Math.ceil( - scale.y * parseInt(lens.getoffset().top) +btop) + 'px';
870		};
871
872		//setto la posizione dell'immagine grande nel caso di innerzoom
873		Largeimage.prototype.setinner = function(e) {
874          	this.node.style.left = Math.ceil( - scale.x * Math.abs(e.pageX - smallimagedata.pos.l)) + 'px';
875			this.node.style.top = Math.ceil( - scale.y * Math.abs(e.pageY - smallimagedata.pos.t)) + 'px';
876			$('div.jqZoomPup img',a).css({'position': 'absolute','top': this.node.style.top,'left': this.node.style.left  });
877		};
878
879
880		Largeimage.prototype.setcenter = function() {
881          	this.node.style.left = Math.ceil(- scale.x * Math.abs((smallimagedata.w)/2)) + 'px';
882			this.node.style.top = Math.ceil( - scale.y * Math.abs((smallimagedata.h)/2)) + 'px';
883
884
885			$('div.jqZoomPup img',a).css({'position': 'absolute','top': this.node.style.top,'left': this.node.style.left  });
886		};
887
888
889		//STAGE
890		function Stage()
891		{
892
893			var leftpos = smallimagedata.pos.l;
894			var toppos = smallimagedata.pos.t;
895			//creating element and class
896			this.node = document.createElement("div");
897			$(this.node).addClass('jqZoomWindow');
898
899			$( this.node )
900				.css({
901					position: 'absolute',
902					width: Math.round(settings.zoomWidth) + 'px',
903					height: Math.round(settings.zoomHeight) + 'px',
904					display: 'none',
905					zIndex: 10000,
906					overflow: 'hidden'
907				});
908
909			//fa il positionamento
910		    switch(settings.position)
911		    {
912		    	case "right":
913
914				leftpos = (smallimagedata.pos.r + Math.abs(settings.xOffset) + settings.zoomWidth < screen.width)
915				? (smallimagedata.pos.l + smallimagedata.w + Math.abs(settings.xOffset))
916				: (smallimagedata.pos.l - settings.zoomWidth - Math.abs(settings.xOffset));
917
918				topwindow = smallimagedata.pos.t + settings.yOffset + settings.zoomHeight;
919				toppos = (topwindow < screen.height && topwindow > 0)
920				?  smallimagedata.pos.t + settings.yOffset
921				:  smallimagedata.pos.t;
922
923		    	break;
924		    	case "left":
925
926				leftpos = (smallimagedata.pos.l - Math.abs(settings.xOffset) - settings.zoomWidth > 0)
927				? (smallimagedata.pos.l - Math.abs(settings.xOffset) - settings.zoomWidth)
928				: (smallimagedata.pos.l + smallimagedata.w + Math.abs(settings.xOffset));
929
930				topwindow = smallimagedata.pos.t + settings.yOffset + settings.zoomHeight;
931				toppos = (topwindow < screen.height && topwindow > 0)
932				?  smallimagedata.pos.t + settings.yOffset
933				:  smallimagedata.pos.t;
934
935		    	break;
936		    	case "top":
937
938				toppos = (smallimagedata.pos.t - Math.abs(settings.yOffset) - settings.zoomHeight > 0)
939				? (smallimagedata.pos.t - Math.abs(settings.yOffset) - settings.zoomHeight)
940				: (smallimagedata.pos.t + smallimagedata.h + Math.abs(settings.yOffset));
941
942
943				leftwindow = smallimagedata.pos.l + settings.xOffset + settings.zoomWidth;
944				leftpos = (leftwindow < screen.width && leftwindow > 0)
945				? smallimagedata.pos.l + settings.xOffset
946				: smallimagedata.pos.l;
947
948		    	break;
949		    	case "bottom":
950
951
952				toppos = (smallimagedata.pos.b + Math.abs(settings.yOffset) + settings.zoomHeight < $('body').height())
953				? (smallimagedata.pos.b + Math.abs(settings.yOffset))
954				: (smallimagedata.pos.t - settings.zoomHeight - Math.abs(settings.yOffset));
955
956
957				leftwindow = smallimagedata.pos.l + settings.xOffset + settings.zoomWidth;
958				leftpos = (leftwindow < screen.width && leftwindow > 0)
959				? smallimagedata.pos.l + settings.xOffset
960				: smallimagedata.pos.l;
961
962		    	break;
963		    	default:
964
965				leftpos = (smallimagedata.pos.l + smallimagedata.w + settings.xOffset + settings.zoomWidth < screen.width)
966				? (smallimagedata.pos.l + smallimagedata.w + Math.abs(settings.xOffset))
967				: (smallimagedata.pos.l - settings.zoomWidth - Math.abs(settings.xOffset));
968
969				toppos = (smallimagedata.pos.b + Math.abs(settings.yOffset) + settings.zoomHeight < screen.height)
970				? (smallimagedata.pos.b + Math.abs(settings.yOffset))
971				: (smallimagedata.pos.t - settings.zoomHeight - Math.abs(settings.yOffset));
972
973		    	break;
974		    }
975
976			this.node.style.left = leftpos + 'px';
977			this.node.style.top = toppos + 'px';
978			return this;
979		}
980
981
982		Stage.prototype.activate = function()
983		{
984
985			if ( !this.node.firstChild )
986					this.node.appendChild( largeimage.node );
987
988
989			if(settings.title)
990			{
991				ZoomTitleObj.loadtitle();
992			}
993
994
995
996			document.body.appendChild( this.node );
997
998
999			switch(settings.showEffect)
1000			{
1001				case 'show':
1002					$(this.node).show();
1003				break;
1004				case 'fadein':
1005					$(this.node).fadeIn(settings.fadeinSpeed);
1006				break;
1007				default:
1008					$(this.node).show();
1009				break;
1010			}
1011
1012			$(this.node).show();
1013
1014            if ($.browser.msie && $.browser.version < 7) {
1015	        this.ieframe = $('<iframe class="zoom_ieframe" frameborder="0" src="#"></iframe>')
1016	          .css({ position: "absolute", left:this.node.style.left,top:this.node.style.top,zIndex: 99,width:settings.zoomWidth,height:settings.zoomHeight })
1017	          .insertBefore(this.node);
1018	     	 };
1019
1020
1021			largeimage.node.style.display = 'block';
1022		}
1023
1024		Stage.prototype.remove = function() {
1025			switch(settings.hideEffect)
1026			{
1027				case 'hide':
1028					$('.jqZoomWindow').remove();
1029				break;
1030				case 'fadeout':
1031					$('.jqZoomWindow').fadeOut(settings.fadeoutSpeed);
1032				break;
1033				default:
1034					$('.jqZoomWindow').remove();
1035				break;
1036			}
1037		}
1038
1039		function zoomTitle()
1040		{
1041
1042			this.node =  jQuery('<div />')
1043				.addClass('jqZoomTitle')
1044				.html('' + ZoomTitle +'');
1045
1046			this.loadtitle = function()
1047			{
1048				if(settings.zoomType == 'innerzoom')
1049				{
1050					$(this.node)
1051					.css({position: 'absolute',
1052						  top: smallimagedata.pos.b +3,
1053						  left: (smallimagedata.pos.l+1),
1054						  width:smallimagedata.w
1055						  })
1056					.appendTo('body');
1057				}else
1058				{
1059					$(this.node).appendTo(stage.node);
1060				}
1061			};
1062		}
1063
1064		zoomTitle.prototype.remove = function() {
1065			$('.jqZoomTitle').remove();
1066		}
1067
1068
1069		function Loader()
1070		{
1071
1072			this.node = document.createElement("div");
1073			$(this.node).addClass('preload');
1074			$(this.node).html(settings.preloadText);//appendo il testo
1075
1076			$(this.node )
1077				.appendTo("body")
1078				.css('visibility','hidden');
1079
1080
1081
1082			this.show = function()
1083			{
1084				switch(settings.preloadPosition)
1085				{
1086					case 'center':
1087						loadertop =  smallimagedata.pos.t + (smallimagedata.h - $(this.node ).height())/2;
1088						loaderleft = smallimagedata.pos.l + (smallimagedata.w - $(this.node ).width())/2;
1089					break;
1090					default:
1091					var loaderoffset = this.getoffset();
1092					loadertop = !isNaN(loaderoffset.top) ? smallimagedata.pos.t + loaderoffset.top : smallimagedata.pos.t + 0;
1093					loaderleft = !isNaN(loaderoffset.left) ? smallimagedata.pos.l + loaderoffset.left : smallimagedata.pos.l + 0;
1094					break;
1095				}
1096
1097				//setting position
1098				$(this.node).css({
1099							top: loadertop  ,
1100							left: loaderleft ,
1101							position: 'absolute',
1102							visibility:'visible'
1103					    	});
1104			}
1105			return this;
1106		}
1107
1108		Loader.prototype.getoffset = function()
1109		{
1110			var o = null;
1111			o = $('div.preload').offset();
1112			return o;
1113		}
1114
1115		});
1116	}
1117})(jQuery);
1118
1119	function trim(stringa)
1120	{
1121	    while (stringa.substring(0,1) == ' '){
1122	        stringa = stringa.substring(1, stringa.length);
1123	    }
1124	    while (stringa.substring(stringa.length-1, stringa.length) == ' '){
1125	        stringa = stringa.substring(0,stringa.length-1);
1126	    }
1127	    return stringa;
1128	}

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.