PageSourceSearch

https://nadwisla24.pl/wp-content/plugins/nextgen-gallery/static/Lightbox/shutter/shutter.js?ver=4.5.1

js nadwisla24.pl collected 2026-09-25 07:42:44 UTC 11,193 bytes, 318 lines download raw bytes

1/*
2Shutter Reloaded for NextGEN Gallery
3http://www.laptoptips.ca/javascripts/shutter-reloaded/
4Version: 1.3.3
5Copyright (C) 2007-2008  Andrew Ozz (Modification by Alex Rabe)
6Released under the GPL, http://www.gnu.org/copyleft/gpl.html
7
8Acknowledgement: some ideas are from: Shutter by Andrew Sutherland - http://code.jalenack.com, WordPress - http://wordpress.org, Lightbox by Lokesh Dhakar - http://www.huddletogether.com, the icons are from Crystal Project Icons, Everaldo Coelho, http://www.everaldo.com
9
10*/
11
12shutterReloaded = {
13
14	I : function (a) {
15		return document.getElementById(a);
16	},
17
18	settings : function() {
19		var t = this, s = shutterSettings;
20
21		t.imageCount = s.imageCount || 0;
22		t.msgLoading = s.msgLoading || 'L O A D I N G';
23		t.msgClose = s.msgClose || 'Click to Close';
24	},
25
26	init : function (a) {
27		var t = this, L, T, ext, i, m, setid, inset, shfile, shMenuPre, k, img;
28		shutterLinks = {}, shutterSets = {};
29		if ( 'object' != typeof shutterSettings ) shutterSettings = {};
30
31        // If the screen orientation is defined we are in a modern mobile OS
32        t.mobileOS = typeof orientation != 'undefined' ? true : false;
33
34		for ( i = 0; i < document.links.length; i++ ) {
35			L = document.links[i];
36			ext = ( L.href.indexOf('?') == -1 ) ? L.href.slice(-4).toLowerCase() : L.href.substring( 0, L.href.indexOf('?') ).slice(-4).toLowerCase();
37			if ( ext != '.jpg' && ext != '.png' && ext != '.gif' && ext != 'jpeg' && ext != 'webp') continue;
38			if ( a == 'sh' && L.className.toLowerCase().indexOf('shutter') == -1 ) continue;
39			if ( a == 'lb' && L.rel.toLowerCase().indexOf('lightbox') == -1 ) continue;
40
41			if ( L.className.toLowerCase().indexOf('shutterset') != -1 )
42			setid = L.className.replace(/\s/g, '_');
43			else if ( L.rel.toLowerCase().indexOf('lightbox[') != -1 )
44			setid = L.rel.replace(/\s/g, '_');
45			else setid = 0, inset = -1;
46
47			if( setid ) {
48				if ( ! shutterSets[setid] ) shutterSets[setid] = [];
49					inset = shutterSets[setid].push(i);
50			}
51
52			shfile = L.href.slice(L.href.lastIndexOf('/')+1);
53			T = ( L.title && L.title != shfile ) ? L.title : '';
54
55			shutterLinks[i] = {link:L.href,num:inset,set:setid,title:T};
56			L.onclick = new Function('shutterReloaded.make("' + i + '");return false;');
57		}
58
59		t.settings();
60
61	},
62
63	make : function(ln,fs) {
64		var t = this, prev, next, prevlink = '', nextlink = '', previmg, nextimg, D, S, W, fsarg = -1, imgNum, NavBar;
65
66		if ( ! t.Top ) {
67			if ( typeof window.pageYOffset != 'undefined' ) t.Top = window.pageYOffset;
68			else t.Top = (document.documentElement.scrollTop > 0) ? document.documentElement.scrollTop : document.body.scrollTop;
69		}
70
71		if (window.parent) {
72			// XXX exception test attach to post tabs
73			var container = window.parent;
74
75			if (typeof(container.ngg_get_measures_for_frame) != 'undefined') {
76				var measures = container.ngg_get_measures_for_frame(window.frameElement);
77
78				t.Top = t.Top + measures.scrollTop;
79				//t.pgHeight = measures.scrollHeight;
80			}
81		}
82
83		if ( typeof t.pgHeight == 'undefined' )
84			t.pgHeight = Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);
85
86		if ( fs ) t.FS = ( fs > 0 ) ? 1 : 0;
87		else t.FS = shutterSettings.FS || 0;
88
89		if ( t.resizing ) t.resizing = null;
90
91        // resize event if window or orientation changed (i.e. iOS)
92        if(t.mobileOS == true)
93            window.onorientationchange = new Function('shutterReloaded.resize("'+ln+'");');
94        else
95            window.onresize = new Function('shutterReloaded.resize("'+ln+'");');
96
97		document.documentElement.style.overflowX = 'hidden';
98		if ( ! t.VP ) {
99			t._viewPort();
100			t.VP = true;
101		}
102
103		if ( ! (S = t.I('shShutter')) ) {
104			S = document.createElement('div');
105			S.setAttribute('id','shShutter');
106			document.getElementsByTagName('body')[0].appendChild(S);
107			t.hideTags();
108		}
109
110		if ( ! (D = t.I('shDisplay')) ) {
111			D = document.createElement('div');
112			D.setAttribute('id','shDisplay');
113			D.style.top = t.Top + 'px';
114			document.getElementsByTagName('body')[0].appendChild(D);
115		}
116
117		S.style.height = t.pgHeight + 'px';
118
119		var dv = t.textBtns ? ' | ' : '';
120		if ( shutterLinks[ln].num > 1 ) {
121			prev = shutterSets[shutterLinks[ln].set][shutterLinks[ln].num - 2];
122			prevlink = '<a href="#" id="prevpic" onclick="shutterReloaded.make('+prev+');return false">&lt;&lt;</a>'+dv;
123			previmg = new Image();
124			previmg.src = shutterLinks[prev].link;
125		} else {
126			prevlink = '';
127		}
128
129		if ( shutterLinks[ln].num != -1 && shutterLinks[ln].num < (shutterSets[shutterLinks[ln].set].length) ) {
130			next = shutterSets[shutterLinks[ln].set][shutterLinks[ln].num];
131			nextlink = '<a href="#" id="nextpic" onclick="shutterReloaded.make('+next+');return false">&gt;&gt;</a>'+dv;
132			nextimg = new Image();
133			nextimg.src = shutterLinks[next].link;
134		} else {
135			nextlink = '';
136		}
137
138		imgNum = ( (shutterLinks[ln].num > 0) && t.imageCount ) ? '<div id="shCount">&nbsp;(&nbsp;' + shutterLinks[ln].num + '&nbsp;/&nbsp;' + shutterSets[shutterLinks[ln].set].length + '&nbsp;)&nbsp;</div>' : '';
139
140		NavBar = '<div id="shTitle"><div id="shPrev">' + prevlink + '</div><div id="shNext">' + nextlink + '</div><div id="shName">' + shutterLinks[ln].title + '</div>' + imgNum + '</div>';
141
142		D.innerHTML = '<div id="shWrap"><img src="'+shutterLinks[ln].link+'" id="shTopImg" title="' + t.msgClose + '" onload="shutterReloaded.showImg();" onclick="shutterReloaded.hideShutter();" />' + NavBar +'</div>';
143
144		document.onkeydown = function(event){shutterReloaded.handleArrowKeys(event);};
145		//Google Chrome 4.0.249.78 bug for onload attribute
146		document.getElementById('shTopImg').src = shutterLinks[ln].link;
147
148		window.setTimeout(function(){shutterReloaded.loading();},1000);
149	},
150
151	loading : function() {
152		var t = this, S, WB, W;
153		if ( (W = t.I('shWrap')) && W.style.visibility == 'visible' ) return;
154		if ( ! (S = t.I('shShutter')) ) return;
155		if ( t.I('shWaitBar') ) return;
156		WB = document.createElement('div');
157		WB.setAttribute('id','shWaitBar');
158		WB.style.top = t.Top + 'px';
159        WB.style.marginTop =(t.pgHeight/2) + 'px';
160		WB.innerHTML = t.msgLoading;
161		S.appendChild(WB);
162	},
163
164	hideShutter : function() {
165		var t = this, D, S;
166		if ( D = t.I('shDisplay') ) D.parentNode.removeChild(D);
167		if ( S = t.I('shShutter') ) S.parentNode.removeChild(S);
168		t.hideTags(true);
169		window.scrollTo(0,t.Top);
170		window.onresize = t.FS = t.Top = t.VP = null;
171		document.documentElement.style.overflowX = '';
172		document.onkeydown = null;
173	},
174
175	resize : function(ln) {
176		var t = this;
177
178		if ( t.resizing ) return;
179		if ( ! t.I('shShutter') ) return;
180		var W = t.I('shWrap');
181		if ( W ) W.style.visibility = 'hidden';
182
183		window.setTimeout(function(){shutterReloaded.resizing = null},500);
184		window.setTimeout(new Function('shutterReloaded.VP = null;shutterReloaded.make("'+ln+'");'),100);
185		t.resizing = true;
186	},
187
188	_viewPort : function() {
189		var t = this;
190		var wiH = window.innerHeight ? window.innerHeight : 0;
191		var dbH = document.body.clientHeight ? document.body.clientHeight : 0;
192		var deH = document.documentElement ? document.documentElement.clientHeight : 0;
193
194		if( wiH > 0 ) {
195			t.wHeight = ( (wiH - dbH) > 1 && (wiH - dbH) < 30 ) ? dbH : wiH;
196			t.wHeight = ( (t.wHeight - deH) > 1 && (t.wHeight - deH) < 30 ) ? deH : t.wHeight;
197		} else t.wHeight = ( deH > 0 ) ? deH : dbH;
198
199        // check & adjust for Wordpress admin bar
200        if (document.getElementsByTagName("body")[0].className.match(/admin-bar/)
201        &&  document.getElementById('wpadminbar') !== null) {
202            t.wHeight = t.wHeight - document.getElementById('wpadminbar').offsetHeight;
203        }
204
205		var deW = document.documentElement ? document.documentElement.clientWidth : 0;
206		var dbW = window.innerWidth ? window.innerWidth : document.body.clientWidth;
207		t.wWidth = ( deW > 1 ) ? deW : dbW;
208	},
209
210	showImg : function() {
211		var t = this, S = t.I('shShutter'), D = t.I('shDisplay'), TI = t.I('shTopImg'), T = t.I('shTitle'), NB = t.I('shNavBar'), W, WB, wHeight, wWidth, shHeight, maxHeight, itop, mtop, resized = 0;
212
213		if ( ! S ) return;
214		if ( (W = t.I('shWrap')) && W.style.visibility == 'visible' ) return;
215		if ( WB = t.I('shWaitBar') ) WB.parentNode.removeChild(WB);
216
217		S.style.width = D.style.width = '';
218		T.style.width = (TI.width - 4) + 'px';
219
220		shHeight = t.wHeight - 50;
221
222		if (window.parent) {
223			// XXX exception test attach to post tabs
224			var container = window.parent;
225
226			if (typeof(container.ngg_get_measures_for_frame) != 'undefined') {
227				var measures = container.ngg_get_measures_for_frame(window.frameElement);
228
229				shHeight = measures.scrollHeight - 50;
230			}
231		}
232
233		if ( t.FS ) {
234			if ( TI.width > (t.wWidth - 10) )
235			S.style.width = D.style.width = TI.width + 10 + 'px';
236			document.documentElement.style.overflowX = '';
237		} else {
238			window.scrollTo(0,t.Top);
239			if ( TI.height > shHeight ) {
240				TI.width = TI.width * (shHeight / TI.height);
241				TI.height = shHeight;
242				resized = 1;
243			}
244			if ( TI.width > (t.wWidth - 16) ) {
245				TI.height = TI.height * ((t.wWidth - 16) / TI.width);
246				TI.width = t.wWidth - 16;
247				resized = 1;
248			}
249			T.style.width = (TI.width - 4) + 'px';
250		}
251
252		maxHeight = t.Top + TI.height + 10;
253		if ( maxHeight > t.pgHeight ) S.style.height = maxHeight + 'px';
254		window.scrollTo(0,t.Top);
255
256		itop = (shHeight - TI.height) * 0.45;
257		mtop = (itop > 3) ? Math.floor(itop) : 3;
258
259        // check & adjust for Wordpress admin bar
260        if (document.getElementsByTagName("body")[0].className.match(/admin-bar/)
261        &&  document.getElementById('wpadminbar') !== null) {
262            mtop = mtop + document.getElementById('wpadminbar').offsetHeight;
263        }
264
265		D.style.top = t.Top + mtop + 'px';
266		W.style.visibility = 'visible';
267	},
268
269	hideTags : function(arg) {
270		var sel = document.getElementsByTagName('select');
271		var obj = document.getElementsByTagName('object');
272		var emb = document.getElementsByTagName('embed');
273		var ifr = document.getElementsByTagName('iframe');
274
275		var vis = ( arg ) ? 'visible' : 'hidden';
276
277		for (i = 0; i < sel.length; i++) sel[i].style.visibility = vis;
278		for (i = 0; i < obj.length; i++) obj[i].style.visibility = vis;
279		for (i = 0; i < emb.length; i++) emb[i].style.visibility = vis;
280		for (i = 0; i < ifr.length; i++) ifr[i].style.visibility = vis;
281	},
282
283	handleArrowKeys : function(e) {
284	    var code = 0;
285	    if (!e) var e = window.event;
286	    	if (e.keyCode) code = e.keyCode;
287	    	else if (e.which) code = e.which;
288
289		var nextlink = document.getElementById('prevpic');
290		var prevlink = document.getElementById('nextpic');
291		var closelink = document.getElementById('shTopImg');
292
293		switch (code) {
294		    case 39:
295			if (prevlink) prevlink.onclick();
296			break;
297		    case 37:
298			if (nextlink) nextlink.onclick();
299			break;
300		    case 27:
301			if (closelink) closelink.onclick();
302			break;
303		 }
304	}
305};
306shutterOnload = function(){shutterReloaded.init('sh');};
307
308if (typeof shutterOnload == 'function') {
309	if ('undefined' != typeof jQuery) {
310		(function ($) {
311			$(function () {
312				shutterOnload();
313			});
314		})(jQuery);
315	}
316	else if( typeof window.onload != 'function' ) window.onload = shutterOnload;
317	else {oldonld = window.onload;window.onload = function(){if(oldonld){oldonld();};shutterOnload();}};
318}

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.