PageSourceSearch

https://www.hitachi-hansya.jp/shikoku-hitachi/js/jp/r1/common.js

js hitachi-hansya.jp collected 2026-10-05 18:30:23 UTC 10,037 bytes, 411 lines download raw bytes

1/* **************************************************
2
3Name: common.js
4
5Description: Common Settings
6
7Create: 2014.02.13
8Update: 2017.04.25
9Update: 2019.03.01
10Update: 2020.11.10
11Update: 2023.05.22
12Update: 2024.12.12
13
14Copyright 2014 Hitachi, Ltd.
15
16***************************************************** */
17
18
19
20/* content===========================================
21
22[-] Use Agent
23[-] Base Setting
24[-] Skip Link
25[-] Pop-up Window
26[-] Smooth Scroll
27[-] Link Box
28[-] jQuery Easing
29
30===================================================== */
31
32
33
34/* 1: Use Agent
35=========================================================================================== */
36
37var nut = navigator.userAgent.toLowerCase();
38var uaCheck = {
39	"ie"		:nut.indexOf("msie") != -1 || nut.indexOf('trident') != -1,
40	"ie6"		:nut.indexOf("msie 6") != -1,
41	"ie7"		:nut.indexOf("msie 7") != -1,
42	"ie8"		:nut.indexOf("msie 8") != -1,
43	"ff"		:nut.indexOf("firefox") != -1,
44	"safari"	:nut.indexOf("safari") != -1,
45	"chrome"	:nut.indexOf("chrome") != -1,
46	"opera"		:nut.indexOf("opera") != -1,
47	"iphone"	:nut.indexOf("iphone") != -1,
48	"ipad"		:nut.indexOf("ipad") != -1,
49	"ipod"		:nut.indexOf("ipod") != -1,
50	"android"	:nut.indexOf("android") != -1,
51	"xp"		:nut.indexOf("nt 5.1") != -1,
52	"win"		:navigator.appVersion.indexOf ("Win") != -1,
53	"mac"		:navigator.appVersion.indexOf ("Macintosh") != -1,
54	"ios"		:nut.indexOf("iphone") != -1 || nut.indexOf("ipad") != -1 || nut.indexOf("ipod") != -1,
55	"sp"		:nut.indexOf("iphone") != -1 || nut.indexOf("ipad") != -1 || nut.indexOf("ipod") != -1 || nut.indexOf("android") != -1
56};
57
58function ua(target) {
59	return uaCheck[target];
60}
61
62
63
64/* 2: Base Setting
65=========================================================================================== */
66
67if(ua("sp")) $("html").addClass("SP");
68
69
70
71/* 3: Skip Link
72=========================================================================================== */
73
74function skiplink(target_id) {
75
76	function focusIn(event) {
77		var focus_class = 'focus';
78		this.className = focus_class;
79		window.scroll(document.documentElement.scrollTop || document.body.scrollTop, 0);
80	}
81	function focusOut(event) {
82		this.className = '';
83	}
84	function jumpTo(event) {
85		var VK_ENTER = 13;
86		if ((event.type == 'keydown') && (event.keyCode != VK_ENTER)) return;
87		this.className = '';
88		var hrefID = this.getAttribute('href').replace(/.*#/g,'');
89		window.location.hash = '#' + hrefID;
90		var timeID = setTimeout(function(){
91			clearTimeout(timeID);
92			var target = document.getElementById(hrefID);
93			target.setAttribute('href','');
94			target.focus();
95			target.removeAttribute('href');
96		}, 100);
97	}
98
99	function setListeners(e) {
100		if (document.getElementById(target_id)) {
101			var targetAnchor = document.getElementById(target_id).getElementsByTagName('a');
102			if (targetAnchor.length > 0) {
103				targetAnchor = targetAnchor[0];
104				addListener(targetAnchor, 'focus', focusIn, false);
105				addListener(targetAnchor, 'blur', focusOut, false);
106				addListener(targetAnchor, 'keydown', jumpTo, false);
107				addListener(targetAnchor, 'mousedown', jumpTo, false);
108			}
109		} else {
110			return false;
111		}
112	}
113
114	function addListener(elem, eventType, func, cap) {
115		if (elem.addEventListener) {
116			elem.addEventListener(eventType, func, cap);
117		} else if (elem.attachEvent) {
118			elem.attachEvent('on' + eventType, function() {
119				func.call(elem, window.event);
120			});
121		} else {
122			return false;
123		}
124	}
125
126	addListener(window, 'load', setListeners, false);
127
128};
129
130skiplink('top');
131
132
133
134/* 4: Pop-up Window
135=========================================================================================== */
136
137function openWindow()
138{
139		/*
140		 * for pop-up window
141		 *
142		 *  1. url
143		 *  2. window name
144		 *  3. width
145		 *  4. height
146		 *  5. resizable
147		 *  6. toolbar
148		 *  7. scrollbars
149		 *  8. location
150		 *  9. menubar
151		 * 10. status
152		 *
153		 */
154		var args = arguments;
155		var win_set = '';
156		win_set += 'width=' + ((args[2])? args[2] : screen.width-30) 
157		win_set += ',height=' + ((args[3])? args[3] : screen.height-30) 
158		win_set += ',resizable=' + ((args[4])? 1 : 0) 
159		win_set += ',toolbar=' + ((args[5])? 1 : 0) 
vendor: 5,930 bytes, lines 160-411
160		win_set += ',scrollbars=' + ((args[6])? 1 : 0) 
161		win_set += ',location=' + ((args[7])? 1 : 0) 
162		win_set += ',menubar=' + ((args[8])? 1 : 0) 
163		win_set += ',status=' + ((args[9])? 1 : 0);
164		swin = window.open(args[0],args[1],win_set);
165		swin.focus();
166}
167
168function openNormalWindow(url,wname)
169{
170		/*
171		 * Pop-up - normal
172		 */
173		swin = window.open(url,wname, "width=600, height=550, resizable=yes, toolbar=no, scrollbars=yes, location=no, menubar=yes, status=yes");
174		swin.focus();
175}
176
177function openLargeWindow(url,wname)
178{
179		/*
180		 * Pop-up - large
181		 */
182		swin = window.open(url,wname, "width=800, height=550, resizable=yes, toolbar=no, scrollbars=yes, location=no, menubar=yes, status=yes");
183		swin.focus();
184}
185
186function openBlankWindow(url,wname)
187{
188		/*
189		 * The target pseudo-class ="_blank"
190		 */
191		swin = window.open(url,wname);
192		swin.focus();
193}
194
195
196
197(function($){
198
199/* 5: Smooth Scroll
200=========================================================================================== */
201
202$(function(){
203	
204	var topID = (ua("safari")) ? "html,body" : "html";
205	
206	$(".SmoothScroll").click(function(){
207		var link = $(this).attr("href");
208		if(link.charAt(0)=="#" && link.charAt(1)!="") {
209			var offset = $(link).offset();
210			var tid = setTimeout(function() {
211				$(topID).stop().animate({scrollTop: offset.top}, 800, "easeInOutCubic", function() {
212					location.href = link;
213				});
214			}, 10);
215			return false;
216		}
217	});
218	
219});
220
221
222
223/* 6: Link Box
224=========================================================================================== */
225
226$(function(){
227	
228	$(".Link").mouseover(function() {
229		$(this).addClass("hover");
230	}).mouseout(function() {
231		$(this).removeClass("hover");
232	}).click(function(){
233		location.href = $(this).find("a").attr("href");
234	});
235	
236});
237
238
239
240})(jQuery);
241
242
243
244/* 8: jQuery Easing
245=========================================================================================== */
246/*
247 * jQuery Easing v1.4.1 - http://gsgd.co.uk/sandbox/jquery/easing/
248 * Open source under the BSD License.
249 * Copyright ? 2008 George McGinley Smith
250 * All rights reserved.
251 * https://raw.github.com/gdsmith/jquery-easing/master/LICENSE
252*/
253
254(function (factory) {
255	if (typeof define === "function" && define.amd) {
256		define(['jquery'], function ($) {
257			return factory($);
258		});
259	} else if (typeof module === "object" && typeof module.exports === "object") {
260		exports = factory(require('jquery'));
261	} else {
262		factory(jQuery);
263	}
264})(function($){
265
266// Preserve the original jQuery "swing" easing as "jswing"
267$.easing.jswing = $.easing.swing;
268
269var pow = Math.pow,
270	sqrt = Math.sqrt,
271	sin = Math.sin,
272	cos = Math.cos,
273	PI = Math.PI,
274	c1 = 1.70158,
275	c2 = c1 * 1.525,
276	c3 = c1 + 1,
277	c4 = ( 2 * PI ) / 3,
278	c5 = ( 2 * PI ) / 4.5;
279
280// x is the fraction of animation progress, in the range 0..1
281function bounceOut(x) {
282	var n1 = 7.5625,
283		d1 = 2.75;
284	if ( x < 1/d1 ) {
285		return n1*x*x;
286	} else if ( x < 2/d1 ) {
287		return n1*(x-=(1.5/d1))*x + 0.75;
288	} else if ( x < 2.5/d1 ) {
289		return n1*(x-=(2.25/d1))*x + 0.9375;
290	} else {
291		return n1*(x-=(2.625/d1))*x + 0.984375;
292	}
293}
294
295$.extend( $.easing,
296{
297	def: 'easeOutQuad',
298	swing: function (x) {
299		return $.easing[$.easing.def](x);
300	},
301	easeInQuad: function (x) {
302		return x * x;
303	},
304	easeOutQuad: function (x) {
305		return 1 - ( 1 - x ) * ( 1 - x );
306	},
307	easeInOutQuad: function (x) {
308		return x < 0.5 ?
309			2 * x * x :
310			1 - pow( -2 * x + 2, 2 ) / 2;
311	},
312	easeInCubic: function (x) {
313		return x * x * x;
314	},
315	easeOutCubic: function (x) {
316		return 1 - pow( 1 - x, 3 );
317	},
318	easeInOutCubic: function (x) {
319		return x < 0.5 ?
320			4 * x * x * x :
321			1 - pow( -2 * x + 2, 3 ) / 2;
322	},
323	easeInQuart: function (x) {
324		return x * x * x * x;
325	},
326	easeOutQuart: function (x) {
327		return 1 - pow( 1 - x, 4 );
328	},
329	easeInOutQuart: function (x) {
330		return x < 0.5 ?
331			8 * x * x * x * x :
332			1 - pow( -2 * x + 2, 4 ) / 2;
333	},
334	easeInQuint: function (x) {
335		return x * x * x * x * x;
336	},
337	easeOutQuint: function (x) {
338		return 1 - pow( 1 - x, 5 );
339	},
340	easeInOutQuint: function (x) {
341		return x < 0.5 ?
342			16 * x * x * x * x * x :
343			1 - pow( -2 * x + 2, 5 ) / 2;
344	},
345	easeInSine: function (x) {
346		return 1 - cos( x * PI/2 );
347	},
348	easeOutSine: function (x) {
349		return sin( x * PI/2 );
350	},
351	easeInOutSine: function (x) {
352		return -( cos( PI * x ) - 1 ) / 2;
353	},
354	easeInExpo: function (x) {
355		return x === 0 ? 0 : pow( 2, 10 * x - 10 );
356	},
357	easeOutExpo: function (x) {
358		return x === 1 ? 1 : 1 - pow( 2, -10 * x );
359	},
360	easeInOutExpo: function (x) {
361		return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ?
362			pow( 2, 20 * x - 10 ) / 2 :
363			( 2 - pow( 2, -20 * x + 10 ) ) / 2;
364	},
365	easeInCirc: function (x) {
366		return 1 - sqrt( 1 - pow( x, 2 ) );
367	},
368	easeOutCirc: function (x) {
369		return sqrt( 1 - pow( x - 1, 2 ) );
370	},
371	easeInOutCirc: function (x) {
372		return x < 0.5 ?
373			( 1 - sqrt( 1 - pow( 2 * x, 2 ) ) ) / 2 :
374			( sqrt( 1 - pow( -2 * x + 2, 2 ) ) + 1 ) / 2;
375	},
376	easeInElastic: function (x) {
377		return x === 0 ? 0 : x === 1 ? 1 :
378			-pow( 2, 10 * x - 10 ) * sin( ( x * 10 - 10.75 ) * c4 );
379	},
380	easeOutElastic: function (x) {
381		return x === 0 ? 0 : x === 1 ? 1 :
382			pow( 2, -10 * x ) * sin( ( x * 10 - 0.75 ) * c4 ) + 1;
383	},
384	easeInOutElastic: function (x) {
385		return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ?
386			-( pow( 2, 20 * x - 10 ) * sin( ( 20 * x - 11.125 ) * c5 )) / 2 :
387			pow( 2, -20 * x + 10 ) * sin( ( 20 * x - 11.125 ) * c5 ) / 2 + 1;
388	},
389	easeInBack: function (x) {
390		return c3 * x * x * x - c1 * x * x;
391	},
392	easeOutBack: function (x) {
393		return 1 + c3 * pow( x - 1, 3 ) + c1 * pow( x - 1, 2 );
394	},
395	easeInOutBack: function (x) {
396		return x < 0.5 ?
397			( pow( 2 * x, 2 ) * ( ( c2 + 1 ) * 2 * x - c2 ) ) / 2 :
398			( pow( 2 * x - 2, 2 ) *( ( c2 + 1 ) * ( x * 2 - 2 ) + c2 ) + 2 ) / 2;
399	},
400	easeInBounce: function (x) {
401		return 1 - bounceOut( 1 - x );
402	},
403	easeOutBounce: bounceOut,
404	easeInOutBounce: function (x) {
405		return x < 0.5 ?
406			( 1 - bounceOut( 1 - 2 * x ) ) / 2 :
407			( 1 + bounceOut( 2 * x - 1 ) ) / 2;
408	}
409});
410
411});

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.