PageSourceSearch

https://www.3peaks.co.jp/catalog/2024/v2_lib/viewerUtils.min.js

js 3peaks.co.jp collected 2026-10-08 18:49:33 UTC 10,969 bytes, 345 lines download raw bytes

1//psy21131126
2window.viewUtils = (function (n) {
3	var me = {},
4		u = n.userAgent.toLowerCase();
5	
6	me.extend = function (target, obj) {
7		for ( var i in obj ) {
8			target[i] = obj[i];
9		}
10	};
11	
12	//2020-12-28 touchもちのwindows対策
13	me.extend(me, {
14		orientchange 	: 'onorientationchange' in window ? true : false,
15		retina 			: window.devicePixelRatio > 1,
16		hasTouch		: 'ontouchstart' in window || navigator.maxTouchPoints > 0 ,
17		hasPointer		: (n.pointerEnabled || n.msPointerEnabled) && n.msMaxTouchPoints && n.msMaxTouchPoints > 1,
18		iosInfo			:{
19			version : null,
20			check 	: false
21		},
22		androidInfo		: {
23			webkit 		: null,
24			version 	:null,
25			check   	: false,
26			inch7 		: false,
27			isAndroidLowVersion : false
28		},
29		msiever			: null
30	});
31	
32	me.extend(me, {
33		Tablet:(u.indexOf("windows") != -1 && u.indexOf("touch") != -1) || u.indexOf("ipad") != -1 || (u.indexOf("android") != -1 && u.indexOf("mobile") == -1) || (u.indexOf("firefox") != -1 && u.indexOf("tablet") != -1) || u.indexOf("kindle") != -1 || u.indexOf("silk") != -1 || u.indexOf("playbook") != -1,
34		Mobile:(u.indexOf("windows") != -1 && u.indexOf("phone") != -1) || u.indexOf("iphone") != -1 || u.indexOf("ipod") != -1 || (u.indexOf("android") != -1 && u.indexOf("mobile") != -1) || (u.indexOf("firefox") != -1 && u.indexOf("mobile") != -1) || u.indexOf("blackberry") != -1
35	});
36	
37	function _eventType(type){
38		var evetType;
39		switch (type){
40			case 'start' :
41				evetType = 'mousedown';
42				if(me.hasTouch) evetType = "touchstart";
43				else if(me.hasPointer) evetType = window.PointerEvent ? "pointerdown" : "MSPointerDown";
44			break;
45					
46			case 'move' :
47				evetType = 'mousemove';
48				if(me.hasTouch) evetType = "touchmove";
49				else if(me.hasPointer) evetType = window.PointerEvent ? "pointermove" : "MSPointerMove";
50			break;
51				
52			case 'end' :
53				evetType = 'mouseup';
54				if(me.hasTouch) evetType = "touchend";
55				else if(me.hasPointer) evetType = window.PointerEvent ? "pointerup" : "MSPointerUp";
56			break;
57				
58			case 'cancel' :
59				evetType = 'mouseup';
60				if(me.hasTouch) evetType = "touchcancel";	
61				else if(me.hasPointer) evetType = window.PointerEvent ? "pointercancel" : "MSPointerCancel";
62			break;
63		}
64			
65		return evetType;
66	}
67	
68	function device(){
69		var userDevice = 'pc';
70		if( u.match(/ipad/i) || u.match(/iphone/i) ){
71			me.iosInfo.check = true;
72			if( u.match(/ipad/i) ) userDevice = 'ipad';
73			else if( u.match(/iphone/i) ) userDevice = 'iphone';
74			
75			var v =  (n.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/);
76			v = (v) ? v : 7; // test
77			me.iosInfo.version = parseInt(v[1], 10);
78		}
79		else if( u.match(/android/i) ){
80			me.androidInfo.check = true;
81			var v = u.match(/(android)\s[0-9]/g);
82			me.androidInfo.version = v[0].match(/[0-9]/);
83			userDevice = (u.match(/mobile/i)) ? 'android' : 'an_Tablet';
84			
85			if( me.Tablet ){
86				var orient = ( screen.width > screen.height ) ?  "landscape" : "portrait";
87				me.androidInfo.inch7 = ( orient == "portrait" && window.innerWidth >= 600 && window.innerWidth <= 610  ) || ( window.innerWidth >= 960 && window.innerWidth <= 970 );
88			}
89			
90			try{
91    			var tmpAppwebkit_ver =  u.match(/(applewebkit\/)\d*.\d*/);
92                me.androidInfo.webkit = parseFloat( tmpAppwebkit_ver[0].match(/\d.*/g) );
93                var tmpAndroid_ver = u.match(/(android)\s\d*.\d/g);
94                me.androidInfo.version = parseFloat( tmpAndroid_ver[0].match(/\d.*/g) );
95			}catch(e){}
96			
97			
98			if( appFlag && me.androidInfo.version <= 4.2 ) me.androidInfo.isAndroidLowVersion = true;
99		} else if( u.match(/Tablet PC/i) ) {
100			// window tablet pcを判別
101			userDevice = 'pc';
102		} else if( me.hasPointer ) {
103			userDevice = 'wintouch';
104
105		} else if( window.navigator.userAgent.toLowerCase().indexOf('macintosh') > -1 && 'ontouchend' in document ){
106  		//2021-04-30 ipados対策
107		  //userDevice = 'ipad';
108		  //ipad扱いにするとメニュー表示できなくなるので保留
109		  window.is_ipados = true;//2021-05-06 ポインタモードの初期値だけ設定したいので別途フラグをつける
110		}
111
112		if(u.match(/windows/i)){//2021-05-13 windowsが含まれる場合は常にpc扱い
113		  userDevice='pc';
114		}
115
116
117		me.device = userDevice;
118	}
119	
120	function webBrowserCheck(){
121		var browserStr;
122		device();
123		
124		// if( u.match(/msie/) || u.match(/trident/) ) {
125		// 	var ieVer = u.match(/(msie\s|rv:)([\d]+)/)[2];
126		// 	browserStr = 'msie';
127		// 	me.msiever = ieVer;
128		// }
129		// else if( u.indexOf('chrome') != -1 && u.indexOf('edge') == -1 ) browserStr = 'chrome';
130		// else if( u.indexOf('safari') != -1 && u.indexOf('edge') == -1 ) browserStr = 'safari';
131		// else if( u.indexOf('firefox') != -1 ) browserStr = 'firefox';
132		// else if( u.indexOf('opera') != -1 ) browserStr = 'opera';
133		// else if( u.indexOf('edge') != -1 ) browserStr = 'edge';
134		// else {
135		// 	if( me.iosInfo.check ) browserStr = 'safari';
136		// 	else if( me.androidInfo.check ) browserStr = 'chrome';
137		// }
138		let userAgent = navigator.userAgent;
139		let regexChrome = /chrome|chromium|crios/i;
140		let regexFirefox = /firefox|fxios/i;
141		let regexSafari = /safari/i;
142		let regexOpera = /opr\//i;
143		let regexEdge = /edg|edgios/i;
144		
145		browserStr = '';
146		if(me.device != 'pc' && me.device != 'wintouch') {
147			if (userAgent.match(regexSafari) && !userAgent.match(regexChrome)) {
148				browserStr = "safari";
149			} 
150			if (userAgent.match(regexChrome)) {
151				browserStr = "chrome";
152			}
153			if (userAgent.match(regexFirefox)) {
154				browserStr = "firefox";
155			} 
156			if (userAgent.match(regexOpera)) {
157				browserStr = "opera";
158			} 
159			if (userAgent.match(regexEdge)) {
160				browserStr = "edge";
161			}
162		} else {
163			//mac
164			if(navigator.platform.indexOf('Mac') != -1) {
165				if (userAgent.match(regexSafari)) {
166					browserStr = "safari";
167				} 
168				if (userAgent.match(regexChrome)) {
169					browserStr = "chrome";
170				} 
171				if (userAgent.match(regexFirefox)) {
172					browserStr = "firefox";
173				} 
174				if (userAgent.match(regexOpera)) {
175					browserStr = "opera";
176				} 
177				if (userAgent.match(regexEdge)) {
178					browserStr = "edge";
179				}
180			} else {
181				if (userAgent.match(regexChrome)) {
182					browserStr = "chrome";
183				}
184				if (userAgent.match(regexFirefox)) {
185					browserStr = "firefox";
186				} 
187				if (userAgent.match(regexOpera)) {
188					browserStr = "opera";
189				} 
190				if (userAgent.match(regexEdge)) {
191					browserStr = "edge";
192				}
193			}
194		}
195		me.browser = browserStr;
196	}
197
198	function os(){
199		var os, osclass="";
200		var ua = navigator.userAgent;
201		
202		if (navigator.platform.indexOf("Win") != -1) {
203			if (ua.match(/Win(dows )?NT 10/)) {
204				os = "Windows 10";
204				        // Windows 10
205			} else if (ua.match(/Win(dows )?NT 6\.3/)) {
206				os = "Windows 8.1";				        // Windows 8.1 の処理
207			} else if (ua.match(/Win(dows )?NT 6\.2/)) {
208				os = "Windows 8";				        // Windows 8 の処理
209			} else if (ua.match(/Win(dows )?NT 6\.1/)) {
210				os = "Windows 7";				        // Windows 7 の処理
211			} else if (ua.match(/Win(dows )?NT 6\.0/)) {
212				os = "Windows Vista";			        // Windows Vista の処理
213			} else if (ua.match(/Win(dows )?(NT 5\.1|XP)/)) {
214				os = "Windows XP";				        // Windows XP の処理
215			} else if (ua.match(/Win(dows )?NT 5\.2/)) {
216				os = "Windows Server 2003";		        // Windows Server 2003 の処理
217			} else {
218			    os = "Windows Other";
219            }
220			
221			osclass = 'windowsos';
222		} else if(navigator.platform.indexOf("Mac") != -1) {
223			os = _getVer(ua, "Mac OS", ")");
224			osclass = 'macos';
225		} else {
226			if(ua.indexOf("iPhone") != -1 || ua.indexOf("iPad") != -1) {
227				var version = ua.match(/OS (\w+){1,3} /g);
228				os = "i" + version;
229			} else if(ua.indexOf("Android") != -1) {
230				os = _getVer(ua, "Android", ";");
231			} else {
232				os = "N/A";					// 上記以外 OS の処理
233			}
234		}
235		
236		me.osclass = osclass;
237		me.os = os;
238		//use for check Windows 11
239		if(navigator.userAgentData) {
240			navigator.userAgentData.getHighEntropyValues(["platformVersion"]).then(ua => {
241				if (navigator.userAgentData.platform === "Windows") {
242					const majorPlatformVersion = parseInt(ua.platformVersion.split('.')[0]);
243					if (majorPlatformVersion >= 13) {
244						os = "Windows 11";
245						me.os = os;
246					}
247				}
248				else {
249				  console.log("Not running on Windows");
250				}
251			});
252		}
253		
254	}
255	
256	function _vandors(){
257		var dummyStyle = document.createElement('div').style,
258			animationSupport = false,
259			animation = 'animation',
260			vendorPrefix = prefix = '',
261			domPrefixes = ['Webkit', 'Moz', 'O', 'ms', 'Khtml'];
262		
263		for( var i = 0; i < domPrefixes.length; i++ ) {
264            if( dummyStyle[ domPrefixes[i] + 'AnimationName' ] !== undefined ) {
265                prefix = domPrefixes[ i ];
266                animationString = prefix + 'Animation';
267                vendorPrefix = '-' + prefix.toLowerCase() + '-';
268                break;
269            }
270        }
271		return vendorPrefix;
272	}
273	
274	function transitionEnd() {
275		var el = document.createElement('bootstrap');
276		var transEndEventNames = {
277			'WebkitTransition' : 'webkitTransitionEnd',
278			'MozTransition'    : 'transitionend',
279			'OTransition'      : 'oTransitionEnd otransitionend',
280			'transition'       : 'transitionend'
281		};
282		for (var name in transEndEventNames) {
283			if (el.style[name] !== undefined) {
284				return { end: transEndEventNames[name] };
285			}
286		}
287		
288		return false;
289	}
290	
291	function _getVer(ua, myKey, delimiter){
292		var myStart = ua.indexOf(myKey);// + myKey.length;
293		var myEnd = ua.indexOf(delimiter, myStart);
294		return ua.substring (myStart, myEnd);
295	}
296
297	os();
298	device();
299	webBrowserCheck();
300	me.vandor = _vandors();
301	me.transition = transitionEnd();
302
303/*
304	var start_e = (me.device != 'pc') ? _eventType('start') : 'mousedown';
305	var move_e = (me.device != 'pc') ? _eventType('move') : 'mousemove';
306	var end_e = (me.device != 'pc') ? _eventType('end') : 'mouseup';
307	var cancel_e = (me.device != 'pc') ? _eventType('cancel') : 'mouseup';
308*/
309
310  //2020-12-28 touchもちのwindows対応
311	var start_e = (me.device != 'pc' || me.hasTouch) ? _eventType('start') : 'mousedown';
312	var move_e = (me.device != 'pc' || me.hasTouch) ? _eventType('move') : 'mousemove';
313	var end_e = (me.device != 'pc' || me.hasTouch) ? _eventType('end') : 'mouseup';
314	var cancel_e = (me.device != 'pc' || me.hasTouch) ? _eventType('cancel') : 'mouseup';
315
316	//2021-04-21
317	//sessionStorageのwisebook_force_mouseがyesならイベントを強制的にマウスモードに切り替える
318	if(sessionStorage['wisebook_force_mouse']=="yes"){
319	  start_e = "mousedown";
320	  move_e = "mousemove";
321	  end_e = "mouseup";
322	  cancel_e = "mouseup";
323	};
324	
325	me.extend(me, {
326		START_EV 	: start_e,
327		MOVE_EV	 	: move_e,
328		END_EV		: end_e,
329		CANCEL_EV	: cancel_e,
330		CLICK_EV	: 'click',
331		MOUSE_DW	: 'mousedown',
332		MOUSE_MV	: 'mousemove',
333		MOUSE_EN	: 'mouseup'
334	});
335    
336	return me;
337})( window.navigator );
338
339var waitForResizeEvent = (function(){
340	var timer = 0;
341	return function(callback, ms){
342		clearTimeout (timer);
343		timer = setTimeout(callback, ms);
344	};
345})();

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.