PageSourceSearch

https://matsumoto.ed.jp/wp-content/themes/insp_para/framework/js/p…elentity.backgroundSlider.js?ver=1561346629

js matsumoto.ed.jp collected 2026-10-05 09:39:34 UTC 6,934 bytes, 320 lines download raw bytes

1(function ($) {
2	/*jslint undef: false, browser: true, devel: false, eqeqeq: false, bitwise: false, white: false, plusplus: false, regexp: false, nomen: false */ 
3	/*global jQuery,setTimeout,location,setInterval,YT,clearInterval,clearTimeout,pixelentity,JSON */
4	
5	$.pixelentity = $.pixelentity || {version: '1.0.0'};
6	
7	$.pixelentity.peBackgroundSlider = {	
8		conf: {
9			api: false,
10			wait: false
11		},
12		paused: false
13	};
14	
15	function PeBackgroundSlider(target, conf) {
16		
17		var useTransition = $.support.csstransitionsEnd;
18		var prevColor,currentColor,currentBW,jwindow;
19		var jthis = $(this);
20		var loading = 0;
21		var align = "center,center".split(/,/);
22		var scale = "fillmax";
23		var w,h;
24		var lock = false;
25		var transitioning = false;
26		var go = false;
27		var images,delay,zoom;
28		var idx = 0;
29		var mobile = false;
30		
31		// init function
32		function start() {
33			jwindow = $(window);
34			
35			var attr = "data-slideshow";
36			
37			if (target.attr("data-mobile") === "true") {
38				attr = "data-mobile-slideshow";
39				mobile = true;
40				zoom = 1;
41			} else {
42				zoom = parseFloat(target.attr("data-zoom") || 1.02); 
43			}
44			
45			
46			if ((images = target.attr(attr))) {
47				try {
48					images = JSON.parse(images);
49				} catch (x) {
50					images = images.split(",");
51				}
52				if (typeof images == "object") {
53					delay = parseInt(target.attr("data-delay") || 7,10)*1000;
54					slideshow();
55				} else {
56					images = false;
57				}
58			}
59
60		}
61		
62		function slideshow() {
63			if ($.pixelentity.peBackgroundSlider.paused || ($.pixelentity.peFlareLightbox && $.pixelentity.peFlareLightbox.active)) {
64				setTimeout(slideshow,1000);
65				return;
66			}
67			load(images[idx],zoom != 1 ? images[idx] : null);
68			idx = (idx + 1) % images.length;
69		}
70		
71		function load(color,bw) {
72			
73			if ($.pixelentity.browser.android) {
74				bw = false;
75			}
76			
77			if (transitioning) {
78				if (currentColor) {
79					$.pixelentity.preloader.clear(currentColor,imageLoaded);
80				}
81				if (currentBW) {
82					$.pixelentity.preloader.clear(currentBW,imageLoaded);
83				}				
84				complete();
85			}
86			
87			go = lock = false;
88			transitioning = true;
89			
90			if (currentColor) {
91				prevColor = currentColor.removeClass("peCurrentColor").addClass("pePrevColor");
92			}
93			
94			loading = color ? 1 : 0;
95			loading += bw ? 1 : 0;
96
97			jthis.triggerHandler("loading.pixelentity");
98
99			var firefox = $.browser.mozilla;
100			
101			if (color) {
102				currentColor = $("<img/>").addClass("peCurrentColor").attr("data-src",color);
103				if (firefox) {
104					currentColor.css("background-color","rgba(255,255,255,.01)");
105				}
106				target.append(currentColor.fadeTo(0,0)[0]);
107				$.pixelentity.preloader.load(currentColor,imageLoaded);
108			} else {
109				currentColor = false;
110			}
111
112			if (bw) {
113				currentBW = $("<img/>").addClass("peCurrentBW").attr("data-src",bw);
114				if (firefox) {
115					currentBW.css("background-color","rgba(255,255,255,.01)");
116				}
117				target.append(currentBW.fadeTo(0,0)[0]);
118				$.pixelentity.preloader.load(currentBW,imageLoaded);
119			} else {
120				currentBW = false;
121			}
122			
123			if (!loading) {
124				loaded();
125			}
126
127		}
128		
129		function imageLoaded(c) {
130			loading--;
131			if (loading === 0) {
132				loaded();
133			}
134		}
135
136		function loaded() {
137			if (lock) {
138				return;
139			}
140			lock = true;
141			jthis.triggerHandler("loaded.pixelentity");
142			if (go || !conf.wait) {
143				begin();
144			}
145		}
146		
147		function gogo() {
148			go = true;
149			if (loading === 0) {
150				begin();
151			}
152		}
153
154		
155		function begin() {
156			getSize(currentColor);
157			getSize(currentBW);
158			resize();
159			if (prevColor) {
160				if (currentColor) {
161					if (useTransition) {
162						prevColor.css("opacity",0);						
163					} else {
164						prevColor.fadeTo(400,0);
165					}
166					fadeIn();
167				} else {
168					if (useTransition) {
169						prevColor.css("opacity",0);
170					} else {
171						setTimeout(fadeIn,400);						
172					}
173				}
174			} else {
175				fadeIn();
176			}
177		}
178 
179
180		function resize() {
181			w = jwindow.width();
182			h = window.innerHeight ? window.innerHeight: jwindow.height();
183			resizeImage(currentColor,zoom);
184			//resizeImage(currentColor,1);
185			resizeImage(currentBW,1);
186		}
187		
188		function resizeImage(current,ratio) {
189			if (current) {
190				var iw = current.data("w");
191				var ih = current.data("h");
192				var scaler = $.pixelentity.Geom.getScaler(scale,align[1],align[0],w,h,iw,ih);
193				current.transform(scaler.ratio*ratio,
194								  parseInt(scaler.offset.w+iw*(scaler.ratio-scaler.ratio*ratio)*0.5,10),
195								  parseInt(scaler.offset.h+ih*(scaler.ratio-scaler.ratio*ratio)*0.5,10),
196								  iw,
197								  ih,
198								  true,
199								  $.pixelentity.browser.android && $.pixelentity.browser.android < 3);
200			}
201		}
202		
203		function getSize(current) {
204			if (current) {
205				current.data("w",current[0].width || current.width() || current[0].naturalWidth);
206				current.data("h",current[0].height || current.height() || current[0].naturalHeight);				
207			}
208		}
209		
210		function fadeInBWImg() {
211			currentBW.css("opacity",1);
212		}
213		
214		function fadeInColorImg() {
215			currentColor.css("opacity",1);
216		}
217		
218		function fadeIn() {
219			if (currentBW) {
220				if (useTransition) {					
221					setTimeout(fadeInBWImg,200);
222				} else {
223					currentBW.delay(200).fadeTo(800,1);
224				}
225            }
226			if (currentColor) {
227				if (useTransition) {
228					setTimeout(fadeInColorImg,600);
229					setTimeout(complete,1800);					
230				} else {
231					currentColor.delay(600).fadeTo(1200,1,complete);
232				}
233			} else {
234				complete();
235			}
236		}
237		
238		function complete() {
239			transitioning = false;
240			
241			if (prevColor) {
242				prevColor.remove();
243				prevColor = false;
244			}
245			if (currentBW) {
246				currentBW.remove();
247				currentBW = false;
248			}
249			if (jthis) {
250				jthis.triggerHandler("complete.pixelentity");				
251			}
252			
253			if (images && images.length > 1) {
254				setTimeout(slideshow,delay);
255			}
256		}
257
258		function bind() {
259			jthis.bind.apply(jthis,arguments);
260		}
261		
262		function unbind() {
263			jthis.unbind.apply(jthis,arguments);
264		}
265		
266		function configure(s,a) {
267			scale = s;
268			align = a.split(/,/);
269		}
270		
271		function destroy() {
272			prevColor = currentColor = currentBW = jwindow = jthis = undefined;
273			target.data("peBackgroundSlider", null);
274			target = undefined;
275		}
276		
277		function isMobile() {
278			return mobile;
279		}
280
281		
282		$.extend(this, {
283			// plublic API
284			load:load,
285			resize:resize,
286			gogo:gogo,
287			bind:bind,
288			unbind:unbind,
289			configure:configure,
290			isMobile: isMobile,
291			destroy: destroy
292		});
293		
294		// initialize
295		start();
296	}
297	
298	// jQuery plugin implementation
299	$.fn.peBackgroundSlider = function(conf) {
300		
301		// return existing instance	
302		var api = this.data("peBackgroundSlider");
303		
304		if (api) { 
305			return api; 
306		}
307		
308		conf = $.extend(true, {}, $.pixelentity.peBackgroundSlider.conf, conf);
309		
310		// install the plugin for each entry in jQuery object
311		this.each(function() {
312			var el = $(this);
313			api = new PeBackgroundSlider(el, conf);
314			el.data("peBackgroundSlider", api);
315		});
316		
317		return conf.api ? api: this;		 
318	};
319	
320}(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.