PageSourceSearch

http://www.wordpress2you.com/wp-content/plugins/nextgen-gallery/shutter/shutter-reloaded_ver_1.3.2.js

js wordpress2you.com collected 2026-10-08 08:26:02 UTC 10,363 bytes, 281 lines download raw bytes

1
2
3
4
5
6/*
7     FILE ARCHIVED ON 22:13:30 Aug 12, 2011 AND RETRIEVED FROM THE
8     INTERNET ARCHIVE ON 2:41:21 Jul 18, 2016.
9     JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.
10
11     ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
12     SECTION 108(a)(3)).
13*/
14/*
15Shutter Reloaded for NextGEN Gallery
16/web/20110812221330/http://www.laptoptips.ca/javascripts/shutter-reloaded/
17Version: 1.3.2
18Copyright (C) 2007-2008  Andrew Ozz (Modification by Alex Rabe)
19Released under the GPL, /web/20110812221330/http://www.gnu.org/copyleft/gpl.html
20
21Acknowledgement: some ideas are from: Shutter by Andrew Sutherland - /web/20110812221330/http://code.jalenack.com, WordPress - /web/20110812221330/http://wordpress.org, Lightbox by Lokesh Dhakar - /web/20110812221330/http://www.huddletogether.com, the icons are from Crystal Project Icons, Everaldo Coelho, /web/20110812221330/http://www.everaldo.com
22
23*/
24
25shutterOnload = function(){shutterReloaded.init('sh');}
26
27if (typeof shutterOnload == 'function') {
28	if ('undefined' != typeof jQuery) jQuery(document).ready(function(){shutterOnload();});
29	else if( typeof window.onload != 'function' ) window.onload = shutterOnload;
30	else {oldonld = window.onload;window.onload = function(){if(oldonld){oldonld();};shutterOnload();}};
31}
32
33shutterReloaded = {
34
35	I : function (a) {
36		return document.getElementById(a);
37	},
38
39	settings : function() {
40		var t = this, s = shutterSettings;
41
42		t.imageCount = s.imageCount || 0;
43		t.msgLoading = s.msgLoading || 'L O A D I N G';
44		t.msgClose = s.msgClose || 'Click to Close';
45	},
46
47	init : function (a) {
48		var t = this, L, T, ext, i, m, setid, inset, shfile, shMenuPre, k, img;
49		shutterLinks = {}, shutterSets = {};
50		if ( 'object' != typeof shutterSettings ) shutterSettings = {};
51
52		for ( i = 0; i < document.links.length; i++ ) {
53			L = document.links[i];
54			ext = ( L.href.indexOf('?') == -1 ) ? L.href.slice(-4).toLowerCase() : L.href.substring( 0, L.href.indexOf('?') ).slice(-4).toLowerCase();
55			if ( ext != '/wp-content/plugins/nextgen-gallery/shutter/.jpg' && ext != '/wp-content/plugins/nextgen-gallery/shutter/.png' && ext != '/wp-content/plugins/nextgen-gallery/shutter/.gif' && ext != 'jpeg' ) continue;
56			if ( a == 'sh' && L.className.toLowerCase().indexOf('shutter') == -1 ) continue;
57			if ( a == 'lb' && L.rel.toLowerCase().indexOf('lightbox') == -1 ) continue;
58
59			if ( L.className.toLowerCase().indexOf('shutterset') != -1 )
60			setid = L.className.replace(/\s/g, '_');			
61			else if ( L.rel.toLowerCase().indexOf('lightbox[') != -1 )
62			setid = L.rel.replace(/\s/g, '_');
63			else setid = 0, inset = -1;
64			
65			if( setid ) {
66				if ( ! shutterSets[setid] ) shutterSets[setid] = [];
67					inset = shutterSets[setid].push(i);
68			}
69			
70			shfile = L.href.slice(L.href.lastIndexOf('/index.html')+1);
71			T = ( L.title && L.title != shfile ) ? L.title : '';
72			
73			shutterLinks[i] = {link:L.href,num:inset,set:setid,title:T}
74			L.onclick = new Function('shutterReloaded.make("' + i + '");return false;');
75		}
76
77		t.settings();
78
79	},
80
81	make : function(ln,fs) {
82		var t = this, prev, next, prevlink = '', nextlink = '', previmg, nextimg, D, S, W, fsarg = -1, imgNum, NavBar;
83
84		if ( ! t.Top ) {
85			if ( typeof window.pageYOffset != 'undefined' ) t.Top = window.pageYOffset;
86			else t.Top = (document.documentElement.scrollTop > 0) ? document.documentElement.scrollTop : document.body.scrollTop;
87		}
88
89		if ( typeof t.pgHeight == 'undefined' )
90			t.pgHeight = Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);
91
92		if ( fs ) t.FS = ( fs > 0 ) ? 1 : 0;
93		else t.FS = shutterSettings.FS || 0;
94
95		if ( t.resizing ) t.resizing = null;
96		window.onresize = new Function('shutterReloaded.resize("'+ln+'");');
97
98		document.documentElement.style.overflowX = 'hidden';
99		if ( ! t.VP ) {
100			t._viewPort();
101			t.VP = true;
102		}
103
104		if ( ! (S = t.I('shShutter')) ) {
105			S = document.createElement('div');
106			S.setAttribute('id','shShutter');
107			document.getElementsByTagName('body')[0].appendChild(S);
108			t.hideTags();
109		}
110
111		if ( ! (D = t.I('shDisplay')) ) {
112			D = document.createElement('div');
113			D.setAttribute('id','shDisplay');
114			D.style.top = t.Top + 'px';
115			document.getElementsByTagName('body')[0].appendChild(D);
116		}
117
118		S.style.height = t.pgHeight + 'px';
119
120		var dv = t.textBtns ? ' | ' : '';
121		if ( shutterLinks[ln].num > 1 ) {
122			prev = shutterSets[shutterLinks[ln].set][shutterLinks[ln].num - 2];
123			prevlink = '<a href="#" id="prevpic" onclick="shutterReloaded.make('+prev+');return false">&lt;&lt;</a>'+dv;
124			previmg = new Image();
125			previmg.src = shutterLinks[prev].link;
126		} else {
127			prevlink = '';
128		}
129
130		if ( shutterLinks[ln].num != -1 && shutterLinks[ln].num < (shutterSets[shutterLinks[ln].set].length) ) {
131			next = shutterSets[shutterLinks[ln].set][shutterLinks[ln].num];
132			nextlink = '<a href="#" id="nextpic" onclick="shutterReloaded.make('+next+');return false">&gt;&gt;</a>'+dv;
133			nextimg = new Image();
134			nextimg.src = shutterLinks[next].link;
135		} else {
136			nextlink = '';
137		}
138
139		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>' : '';
140
141		NavBar = '<div id="shTitle"><div id="shPrev">' + prevlink + '</div><div id="shNext">' + nextlink + '</div><div id="shName">' + shutterLinks[ln].title + '</div>' + imgNum + '</div>';
142
143		D.innerHTML = '<div id="shWrap"><img src="'+shutterLinks[ln].link+'" id="shTopImg" title="' + t.msgClose + '" onload="shutterReloaded.showImg();" onclick="shutterReloaded.hideShutter();" />' + NavBar +'</div>';
144		
145		document.onkeydown = function(event){shutterReloaded.handleArrowKeys(event);};
146		//Google Chrome 4.0.249.78 bug for onload attribute
147		document.getElementById('shTopImg').src = shutterLinks[ln].link;
148		
149		window.setTimeout(function(){shutterReloaded.loading();},2000);
150	},
151
152	loading : function() {
153		var t = this, S, WB, W;
154		if ( (W = t.I('shWrap')) && W.style.visibility == 'visible' ) return;
155		if ( ! (S = t.I('shShutter')) ) return;
156		if ( t.I('shWaitBar') ) return;
157		WB = document.createElement('div');
158		WB.setAttribute('id','shWaitBar');
159		WB.style.top = t.Top + '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		var deW = document.documentElement ? document.documentElement.clientWidth : 0;
200		var dbW = window.innerWidth ? window.innerWidth : document.body.clientWidth;
201		t.wWidth = ( deW > 1 ) ? deW : dbW;
202	},
203
204	showImg : function() {
205		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;
206
207		if ( ! S ) return;
208		if ( (W = t.I('shWrap')) && W.style.visibility == 'visible' ) return;
209		if ( WB = t.I('shWaitBar') ) WB.parentNode.removeChild(WB);
210
211		S.style.width = D.style.width = '';
212		T.style.width = (TI.width - 4) + 'px';
213
214		shHeight = t.wHeight - 50;
215
216		if ( t.FS ) {
217			if ( TI.width > (t.wWidth - 10) )
218			S.style.width = D.style.width = TI.width + 10 + 'px';
219			document.documentElement.style.overflowX = '';
220		} else {
221			window.scrollTo(0,t.Top);
222			if ( TI.height > shHeight ) {
223				TI.width = TI.width * (shHeight / TI.height);
224				TI.height = shHeight;
225				resized = 1;
226			}
227			if ( TI.width > (t.wWidth - 16) ) {
228				TI.height = TI.height * ((t.wWidth - 16) / TI.width);
229				TI.width = t.wWidth - 16;
230				resized = 1;
231			}
232			T.style.width = (TI.width - 4) + 'px';
233		}
234
235		maxHeight = t.Top + TI.height + 10;
236		if ( maxHeight > t.pgHeight ) S.style.height = maxHeight + 'px';
237		window.scrollTo(0,t.Top);
238
239		itop = (shHeight - TI.height) * 0.45;
240		mtop = (itop > 3) ? Math.floor(itop) : 3;
241		D.style.top = t.Top + mtop + 'px';
242		W.style.visibility = 'visible';
243	},
244
245	hideTags : function(arg) {
246		var sel = document.getElementsByTagName('select');
247		var obj = document.getElementsByTagName('object');
248		var emb = document.getElementsByTagName('embed');
249		var ifr = document.getElementsByTagName('iframe');
250
251		var vis = ( arg ) ? 'visible' : 'hidden';
252
253		for (i = 0; i < sel.length; i++) sel[i].style.visibility = vis;
254		for (i = 0; i < obj.length; i++) obj[i].style.visibility = vis;
255		for (i = 0; i < emb.length; i++) emb[i].style.visibility = vis;
256		for (i = 0; i < ifr.length; i++) ifr[i].style.visibility = vis;
257	},
258	
259	handleArrowKeys : function(e) {
260	    var code = 0;
261	    if (!e) var e = window.event
262	    	if (e.keyCode) code = e.keyCode;
263	    	else if (e.which) code = e.which;
264	    	
265		var nextlink = document.getElementById('prevpic');
266		var prevlink = document.getElementById('nextpic');
267		var closelink = document.getElementById('shTopImg');
268	
269		switch (code) {
270		    case 39:
271			if (prevlink) prevlink.onclick();
272			break;    
273		    case 37:
274			if (nextlink) nextlink.onclick();
275			break;    
276		    case 27:
277			if (closelink) closelink.onclick();
278			break;    
279		 }
280	}
281}

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.