PageSourceSearch

https://nttxstore.jp/js/sys/ui.js

js nttxstore.jp collected 2026-10-03 20:23:04 UTC 30,275 bytes, 954 lines download raw bytes

1/* 名前空間を定義 */
2var ecblib = ecblib || {};
3ecblib.ui = ecblib.ui || {};
4/*!
5 * UIの表示に関する関数群
6 * 
7 * @requires module:jquery1.11+
8 * @requires module:js.cookie.js
9 */
10(function () {
11	/* ローカル用の名前空間 */
12	var _ui = ecblib.ui;
13
14	/*!
15	 * megamenu ui
16	 */
17	jQuery(document).ready(function () {
18		var megamenuForHover = function () {
19			jQuery('.js-animation-megamenu-hover').hover(function () {
20				jQuery(this).children('.js-submenu-hover').stop(true, true).delay(20).slideDown(200);
21				jQuery(this).find('.block-icon-image--angle-up').addClass('block-icon-image--angle-down');
22				jQuery(this).addClass('js-active');
23			}, function () {
24				jQuery(this).children('.js-submenu-hover').stop(true, true).delay(20).slideUp(200);
25				jQuery(this).find('.block-icon-image--angle-up').removeClass('block-icon-image--angle-down');
26				jQuery(this).removeClass('js-active');
27			});
28		}();
29
30		
31		var isBinded = false;
32
33		function bindMegaMenu() {
34			if (isBinded) return;
35			isBinded = true;
36
37			jQuery('.js-animation-megamenu-click').children('a').on('click.megamenu', function (e) {
38				var $this = jQuery(this);
39
40				if ($this.parent('li').hasClass('js-down')) {
41					$this.siblings('.js-submenu-click').stop(true, true).slideUp(200);
42					$this.parent('li').removeClass('js-down');
43				} else {
44					jQuery('.js-animation-megamenu-click').children('a').each(function () {
45						if (!jQuery(this).is($this)) {
46							jQuery(this).siblings('.js-submenu-click').stop(true, true).slideUp(10);
47							jQuery('.js-animation-megamenu-click').removeClass('js-down');
48						}
49					});
50					$this.parent('li').addClass('js-down');
51					$this.siblings('.js-submenu-click').stop(true, true).slideDown(200);
52				}
53				return false;
54			});
55
56			jQuery(document).on('click.megamenu touchstart.megamenu', function (e) {
57				if (!jQuery(e.target).closest('.js-animation-megamenu-click').length) {
58					jQuery('.js-animation-megamenu-click').children('.js-submenu-click').stop(true, true).slideUp(200);
59					jQuery('.js-animation-megamenu-click').removeClass('js-down');
60				}
61			});
62		}
63
64		function unbindMegaMenu() {
65			if (!isBinded) return;
66			isBinded = false;
67
68			jQuery('.js-animation-megamenu-click').children('a').off('.megamenu');
69			jQuery(document).off('.megamenu');
70			// メニューを閉じる
71			jQuery('.js-animation-megamenu-click').children('.js-submenu-click').stop(true, true).slideUp(200);
72			jQuery('.js-animation-megamenu-click').removeClass('js-down');
73		}
74
75		function checkWidthAndBind() {
76			if (window.innerWidth >= 960) {
77				bindMegaMenu();
78			} else {
79				unbindMegaMenu();
80			}
81		}
82
83		// 初回実行
84		checkWidthAndBind();
85
86		// リサイズ時
87		window.addEventListener('resize', function () {
88			checkWidthAndBind();
89		});
90		
91	});
92
93	/*!
94	 * 動的なカテゴリを生成するAJAX
95	 */
96	_ui.generateDynamicCategory = function () {
97		jQuery('.js-dynamic-category').each(function () {
98			const jsDynamicCategory = jQuery(this);
99			const category = jsDynamicCategory.data('category') != undefined ? jsDynamicCategory.data('category') : '';
100			jQuery.ajax({
101				type: 'GET',
102				url: ecblib.sys.wwwroot + '/shop/js/category.aspx',
103				dataType: 'text',
104				data: {
105					category: category
106				},
107				async: false,
108				timeout: 10000
109			}).done(function(data){
110			    jsDynamicCategory.html(data);
111			});
112		});
113	};
114
115	/*!
116	 * 動的なジャンルを生成するAJAX
117	 */
118	_ui.generateDynamicGenre = function () {
119		jQuery('.js-dynamic-genre').each(function () {
120			const jsDynamicGenre = jQuery(this);
121			const genre = jsDynamicGenre.data('genre') != undefined ? jsDynamicGenre.data('genre') : '';
122			jQuery.ajax({
123				type: 'GET',
124				url: ecblib.sys.wwwroot + '/shop/js/genre.aspx',
125				dataType: 'text',
126				data: {
127					genre: genre
128				},
129				async: false,
130				timeout: 10000
131			}).done(function(data){
132			    jsDynamicGenre.html(data);
133			});
134		});
135	};
136
137	document.addEventListener('DOMContentLoaded', () => {
138		if (ecblib.sys.isModeResponsiveView()) {
139			const mediaQueryCallback = (mediaQueryList) => {
140				if (mediaQueryList.matches) {
141					_ui.generateDynamicCategory();
142					_ui.generateDynamicGenre();
143					ecblib.sys.removeMatchMediaEventListener(mediaQueryCallback);
144				}
145			};
146			ecblib.sys.addMatchMediaEventListener(mediaQueryCallback);
147			mediaQueryCallback(ecblib.sys.getDefaultMatchMedia());
148		} else if (!ecblib.sys.isModeSmartPhone()) {
149			_ui.generateDynamicCategory();
150			_ui.generateDynamicGenre();
151		}
152	});
153
154	/*!
155	 * カート内件数のバッジ表示
156	 */
157	jQuery(document).ready(function () {
158		_ui.showCartCount();
159	});
160
161	_ui.showCartCount = function () {
162		if(!jQuery('.js-cart-count').length) return;
163		jQuery.ajax({
164			url: ecblib.sys.wwwroot + "/shop/js/cart.aspx?count=cart_qty",
165			cache: false,
166			dataType: "text",
167			success: function (text) {
168				if (text == "") {
169					jQuery('.js-cart-count').hide();
170				} else {
171					jQuery('.js-cart-count').text(text).show();
172				}
173			}
174		});
175	};
176
177	/*!
178	 * アラート表示
179	 */
180	_ui.alert = function (title, msg, options) {
181
182		jQuery(document.activeElement).blur();
183
184		var template = ecblib.tmpl.ui.ALERT;
185		template = ecblib.sys.render(template, { Title: title });
186
187		var defaults = { quit: function () { }, ok: function () { }, width: null, height: null };
188		var options = jQuery.extend({}, defaults, options);
189		var gloupId = 'stdui-dialog' + getUUID();
190
191		var $obj = jQuery(template);
192		var $overlay = jQuery('<div class="modal-overlay-alert" />');
193
194		var action = function () {
195			return {
196				close: function () {
197					$overlay.remove();
198					$obj.remove();
199
200					/* 一番最後に開かれたダイアログをアクティブにする */
201					jQuery(document).off('keyup.' + gloupId);
202
203					if (jQuery('.js-modal-alert,.js-modal-dialog').last().length > 0) {
204						jQuery('.js-modal-alert,.js-modal-dialog').last().addClass('js-active');
205					} else {
206						/* 背景固定解除 */
207						setBackGroundFixed(false);
208					}
209				}
210			};
211		}();
212
213		var showDialog = function () {
214			/* 他のダイアログはアクティブを削除する */
215			jQuery('.js-modal-alert,.js-modal-dialog').removeClass('js-active');
216
217			/* 背景を固定にする */
218			setBackGroundFixed(true);
219
220			/* 幅、高さの設定 */
221			if (options.width) {
222				$obj.css('width', options.width);
223			}
224			if (options.height) {
225				$obj.css('height', options.height);
226			}
227
228			$obj.find('.js-modal-body-wrapper').text(msg).html(function () {
229				return jQuery(this).text().replace(/\r?\n/g, '<br>');
230			});
231
232			$overlay.appendTo('body');
233			$obj.appendTo('body');
234		};
235
236		/* OKボタン押下 */
237		$obj.find(':button').on('click', function () {
238			options.ok.apply(this, arguments);
239			action.close();
240		});
241
242		/* ×ボタン、オーバーレイ領域、ESC押下 */
243		$obj.find('.js-modal-close').on('click', function () {
244			options.quit.apply(this, arguments);
245			action.close();
246		});
247		$overlay.on('click', function () {
248			options.quit.apply(this, arguments);
249			action.close();
250		});
251		jQuery(document).on('keyup.' + gloupId, function (e) {
252			if ($obj.hasClass("js-active") && e.keyCode === 27) { // etc
253				options.quit.apply(this, arguments);
254				action.close();
255			}
256		});
257
258		showDialog();
259	};
260
261	/*!
262	 * ダイアログ表示
263	 * 
264	 * モーダル表示(引数はIDを指定)
265	 * ecblib.ui.dialog('modal');
266	 */
267	_ui.dialog = function (id, options, quitCallback) {
268
269		jQuery(document.activeElement).blur();
270
271		var template = ecblib.tmpl.ui.MODAL_DIALOG;
272
273		var defaults = { quit: function () { }, buttons: {}, links: {}, width: null, height: null };
274		var options = jQuery.extend({}, defaults, options);
275		var gloupId = 'stdui-dialog' + getUUID();
276		var $obj = jQuery(template);
277		var $overlay = jQuery('<div class="modal-overlay" />');
278		var $contents = jQuery("#" + id);
279
280		var action = function () {
281			return {
282				close: function () {
283					$overlay.remove();
284					$obj.remove();
285
286					/* 一番最後に開かれたダイアログをアクティブにする */
287					jQuery(document).off('keyup.' + gloupId);
288
289					if (jQuery('.js-modal-alert,.js-modal-dialog').last().length > 0) {
290						jQuery('.js-modal-alert,.js-modal-dialog').last().addClass('js-active');
291					} else {
292						/* 背景固定解除 */
293						setBackGroundFixed(false);
294					}
295				}
296			};
297		}();
298
299		var quitEvent = function () {
300			var ret = options.quit.apply(this, [action]);
301			if (ret == undefined || ret) {
302				action.close();
303				if (quitCallback) quitCallback();
304			}
305		};
306
307		var showDialog = function () {
308			/* 他のダイアログはアクティブを削除する */
309			jQuery('.js-modal-alert,.js-modal-dialog').removeClass('js-active');
310
311			/* 背景を固定にする */
312			setBackGroundFixed(true);
313
314			/* 幅、高さの設定 */
315			if (options.width) {
316				$obj.css('width', options.width);
317			}
318			if (options.height) {
319				$obj.css('height', options.height);
320			}
321
322			$obj.find('.js-modal-title').text($contents.data('title'));
323			$obj.find('.js-modal-content').append($contents.html());
324
325			$overlay.appendTo('body');
326			$obj.appendTo('body');
327
328			/* ボタン押下 */
329			$obj.find(':button,:submit,:image').on('click', function () {
330				if (jQuery(this).attr('name') && options.buttons[jQuery(this).attr("name")]) {
331					var ret = options.buttons[jQuery(this).attr("name")].apply(this, [action]);
332					if (jQuery(this).attr('type') == 'submit' && (ret == undefined || ret)) {
333						$obj.find('form').submit();
334					}
335					return ret;
336				}
337			});
338
339			$obj.find('a').on('click', function () {
340				if (jQuery(this).attr('name') && options.links[jQuery(this).attr("name")]) {
341					return options.links[jQuery(this).attr("name")].apply(this, [action]);
342				}
343			});
344
345
346			/* ×ボタン、オーバーレイ領域、ESC押下 */
347			$obj.find('.js-modal-close').on('click', function () {
348				quitEvent.apply(this, arguments);
349			});
350			$overlay.on('click', function () {
351				quitEvent.apply(this, arguments);
352			});
353			jQuery(document).on('keyup.' + gloupId, function (e) {
354				if ($obj.hasClass("js-active") && e.keyCode === 27) {
355					quitEvent.apply(this, arguments);
356				}
357			});
358		};
359
360		showDialog();
361	};
362
363	/*!
364	 * 確認ダイアログ表示
365	 */
366	_ui.confirm = function (msg, options) {
367		var template = ecblib.tmpl.ui.CONFIRM;
368		template = ecblib.sys.render(template, { Message: msg });
369		
370		var defaults = { quit: function () { }, confirm: function () { } };
371		var options = jQuery.extend({}, defaults, options);
372		
373		var $obj = jQuery(template);
374		$obj.appendTo('body');
375		
376		_ui.dialog('confirm-dialog-tmpl', {
377			quit : function(action) {
378				action.close();
379				options.quit();
380			},
381			buttons : {
382				'btnconfirm' : function(action) {
383					action.close();
384					options.confirm();
385				},
386				'btncancel' : function(action) {
387					action.close();
388					options.quit();
389				}
390			}
391		});
392		$obj.remove();
393	};
394	
395	/*!
396	 * ヘッダー警告表示
397	 */
398	_ui.showHeaderWarning = function (contentsHtml, options) {
399		var template = ecblib.tmpl.ui.WARNING;
400		template = ecblib.sys.render(template, { Contents: contentsHtml });
401
402		var defaults = { quit: function () { } };
403		var options = jQuery.extend({}, defaults, options);
404		var action = function () {
405			return {
406				close: function () {
407					$obj.slideUp(200);
408				}
409			};
410		}();
411
412		var $obj = jQuery(template);
413		$obj.find('.js-header-warning-close').on('click', function () {
414			var ret = options.quit.apply(this, [action]);
415			if (ret == undefined || ret) {
416				action.close();
417			}
418		});
419
420		$obj.hide();
421		$obj.prependTo('body');
422		$obj.slideDown(200);
423
424	};
425
426	/*!
427	 * ツールチップを表示する
428	 */
429	_ui.showToolTip = function (target, options) {
430		let elements = [];
431
432		if (window.jQuery && target instanceof jQuery) {
433			elements = Array.from(target);
434		} else if (target instanceof Element) {
435			elements = [target];
436		} else if (target instanceof NodeList || Array.isArray(target)) {
437			elements = Array.from(target);
438		} else {
439			return;
440		}
441
442		const defaults = {
443			tooltip: '',
444			position: 'top',
445			diptimeSec: 3,
446			classname: 'balloontip'
447		};
448		const opts = Object.assign({}, defaults, options);
449
450		elements.forEach(function (element) {
451			if (!element.dataset.tooltipId) {
452				element.dataset.tooltipId = 'tipid-' + Math.random().toString(36).slice(2, 11);
453			}
454			const prevTips = document.querySelectorAll('.balloontip[data-for="' + element.dataset.tooltipId + '"]');
455			if (prevTips.length > 0) {
456				return;
457			}
458
459			const balloon = document.createElement('div');
460			balloon.className = opts.classname + ' balloon-' + opts.position;
461			const content = document.createElement('div');
462			content.className = 'balloon-content';
463			content.innerHTML = opts.tooltip;
464			const arrow = document.createElement('div');
465			arrow.className = 'balloon-arrow balloon-arrow-' + opts.position;
466			balloon.appendChild(content);
467			balloon.appendChild(arrow);
468			balloon.setAttribute('data-for', element.dataset.tooltipId);
469
470			balloon.style.position = 'absolute';
471			balloon.style.visibility = 'hidden';
472			balloon.style.zIndex = 19999;
473			balloon.style.opacity = 0;
474			document.body.appendChild(balloon);
475
476			const rect = element.getBoundingClientRect();
477			const tipRect = balloon.getBoundingClientRect();
478			const winWidth = document.documentElement.clientWidth;
479			const winHeight = document.documentElement.clientHeight;
480			let top = 0, left = 0;
481			switch (opts.position) {
482				case 'top':
483					top = window.scrollY + rect.top - tipRect.height - 8;
484					left = window.scrollX + rect.left + (rect.width - tipRect.width) / 2;
485					break;
486				case 'bottom':
487					top = window.scrollY + rect.bottom + 8;
488					left = window.scrollX + rect.left + (rect.width - tipRect.width) / 2;
489					break;
490				case 'left':
491					top = window.scrollY + rect.top + (rect.height - tipRect.height) / 2;
492					left = window.scrollX + rect.left - tipRect.width - 8;
493					break;
494				case 'right':
495					top = window.scrollY + rect.top + (rect.height - tipRect.height) / 2;
496					left = window.scrollX + rect.right + 8;
497					break;
498				default:
499					top = window.scrollY + rect.top - tipRect.height - 8;
500					left = window.scrollX + rect.left + (rect.width - tipRect.width) / 2;
501			}
502			if (left < window.scrollX) {
503				left = window.scrollX + 2;
504			}
505			if (left + tipRect.width > window.scrollX + winWidth) {
506				left = window.scrollX + winWidth - tipRect.width - 2;
507			}
508			if (top < window.scrollY) {
509				top = window.scrollY + 2;
510			}
511			if (top + tipRect.height > window.scrollY + winHeight) {
512				top = window.scrollY + winHeight - tipRect.height - 2;
513			}
514
515			balloon.style.top = `${top}px`;
516			balloon.style.left = `${left}px`;
517			balloon.style.visibility = 'visible';
518
519			setTimeout(function () {
520				balloon.style.opacity = 1;
521			}, 10);
522
523			if (opts.diptimeSec) {
524				setTimeout(function () {
525					balloon.remove();
526				}, 1000 * opts.diptimeSec);
527			}
528		});
529	};
530
531	/*!
532	 * ツールチップを非表示にする
533	 */
534	_ui.hideToolTip = function (target) {
535		let elements = [];
536
537		if (window.jQuery && target instanceof jQuery) {
538			elements = Array.from(target);
539		} else if (target instanceof Element) {
540			elements = [target];
541		} else if (target instanceof NodeList || Array.isArray(target)) {
542			elements = Array.from(target);
543		} else {
544			return;
545		}
546
547		elements.forEach(function (element) {
548			const prevTips = document.querySelectorAll('.balloontip[data-for="' + element.dataset.tooltipId + '"]');
549			prevTips.forEach(function (tip) { tip.remove(); });
550		});
551	};
552
553	/*!
554	 * コンテキストメニューを表示する
555	 */
556	_ui.showContextMenu = function (jQuerySelector, templateid, options) {
557		var defaults = { offsetY: 0, offsetX: 0, links: {} };
558		var options = jQuery.extend({}, defaults, options);
559		var $template = jQuery(templateid);
560		var gloupId = 'stdui-contextmenu' + getUUID();
561
562		var innerContextMenu = function () {
563			$offset = jQuery(jQuerySelector).offset();
564			$template.find('span').off('click');
565			$template.find('span').on('click', function () {
566				if (jQuery(this).attr('name') && options.links[jQuery(this).attr("name")]) {
567					return options.links[jQuery(this).attr("name")].apply(this, arguments);
568				}
569			});
570
571			if ($template.is(":hidden")) {
572				const followTarget = jQuerySelector[0];
573				let rect = followTarget.getBoundingClientRect();
574				function followInput() {
575					rect = followTarget.getBoundingClientRect();
576					const top = rect.top + options.offsetY + rect.height;
577					const left = rect.left + options.offsetX;
578					$template[0].style.top = `${top}px`; 
579					$template[0].style.left = `${left}px`; 
580				}
581
582				$template.css('position', 'fixed')
583					.css('top', rect.top + options.offsetY + rect.height)
584					.css('left', rect.left + options.offsetX)
585					.fadeIn().promise().done(function () {
586						jQuery(document).on('click.' + gloupId + ' touchend.' + gloupId, function () {
587							$template.fadeOut();
588							jQuery(document).off('click.' + gloupId + ' touchend.' + gloupId);
589							window.removeEventListener('resize', followInput);
590							window.removeEventListener('scroll', followInput);
591						});
592					});
593				window.addEventListener('resize', followInput);
594				window.addEventListener('scroll', followInput);
595			}
596		};
597
598		jQuery(jQuerySelector).each(function () {
599			innerContextMenu.apply(this, arguments);
600		});
601
602	};
603
604	/*!
605	 * ツールチップUI
606	 */
607	document.addEventListener('DOMContentLoaded', function () {
608		const elements = document.querySelectorAll('[data-tooltip]');
609		elements.forEach(function (element) {
610			const rawTooltip = element.getAttribute('data-tooltip') || '';
611			const tooltip = rawTooltip.replace(/\r?\n/g, '<br>');
612			let position = element.getAttribute('data-tooltip-position');
613			if (!position) position = 'top';
614
615			if (!element.dataset.tooltipId) {
616				element.dataset.tooltipId = 'tipid-' + Math.random().toString(36).slice(2, 11);
617			}
618
619			element.addEventListener('focusin', function () {
620				const prevTips = document.querySelectorAll('.balloontip[data-for="' + element.dataset.tooltipId + '"]');
621				prevTips.forEach(function (tip) { tip.remove(); });
622				const balloon = document.createElement('div');
623				balloon.className = 'balloontip balloon-' + position;
624				const content = document.createElement('div');
625				content.className = 'balloon-content';
626				content.innerHTML = tooltip;
627				const arrow = document.createElement('div');
628				arrow.className = 'balloon-arrow balloon-arrow-' + position;
629				balloon.appendChild(content);
630				balloon.appendChild(arrow);
631				balloon.setAttribute('data-for', element.dataset.tooltipId);
632
633				balloon.style.position = 'absolute';
634				balloon.style.visibility = 'hidden';
635				balloon.style.zIndex = 19999;
636				balloon.style.opacity = 0;
637				document.body.appendChild(balloon);
638
639				const rect = element.getBoundingClientRect();
640				const tipRect = balloon.getBoundingClientRect();
641				const winWidth = document.documentElement.clientWidth;
642				const winHeight = document.documentElement.clientHeight;
643				let top = 0, left = 0;
644				switch (position) {
645					case 'top':
646						top = window.scrollY + rect.top - tipRect.height - 8;
647						left = window.scrollX + rect.left + (rect.width - tipRect.width) / 2;
648						break;
649					case 'bottom':
650						top = window.scrollY + rect.bottom + 8;
651						left = window.scrollX + rect.left + (rect.width - tipRect.width) / 2;
652						break;
653					case 'left':
654						top = window.scrollY + rect.top + (rect.height - tipRect.height) / 2;
655						left = window.scrollX + rect.left - tipRect.width - 8;
656						break;
657					case 'right':
658						top = window.scrollY + rect.top + (rect.height - tipRect.height) / 2;
659						left = window.scrollX + rect.right + 8;
660						break;
661					default:
662						top = window.scrollY + rect.top - tipRect.height - 8;
663						left = window.scrollX + rect.left + (rect.width - tipRect.width) / 2;
664				}
665
666				// 画面内に収める(横方向)
667				if (left < window.scrollX) {
668					left = window.scrollX + 2; // 2px余白
669				}
670				if (left + tipRect.width > window.scrollX + winWidth) {
671					left = window.scrollX + winWidth - tipRect.width - 2;
672				}
673				// 画面内に収める(縦方向)
674				if (top < window.scrollY) {
675					top = window.scrollY + 2;
676				}
677				if (top + tipRect.height > window.scrollY + winHeight) {
678					top = window.scrollY + winHeight - tipRect.height - 2;
679				}
680
681				balloon.style.top = `${top}px`;
682				balloon.style.left = `${left}px`;
683				balloon.style.visibility = 'visible';
684
685				setTimeout(function () {
686					balloon.style.opacity = 1;
687				}, 10);
688			});
689
690			element.addEventListener('focusout', function () {
691				_ui.hideToolTip(element);
692			});
693		});
694	});
695
696	/*!
697	 * 郵便番号サジェストUI
698	 */
699	/*  郵便番号検索 */
700	var timerId_lookupzip_ = null;
701	var zipcache_lookupzip_ = '';
702	var timerId_zipcache_ = null;
703	_ui.zipcodeSuggest = function (zip, pref, addr, addr2, cnt, offsetX, offsetY) {
704		var timerOffset = 300;
705		var zip_id = '#' + zip + cnt;
706		var pref_id = '#' + pref + cnt;
707		var addr_id = '#' + addr + cnt;
708		var addr2_id = '#' + addr2 + cnt;
709		var defaultXOffset = 0;
710		var defaultYOffset = jQuery(zip_id).outerHeight();
711		offsetX = offsetX + defaultXOffset;
712		offsetY = offsetY + defaultYOffset;
713		jQuery(zip_id).on('keyup paste', function () {
714			jQuery('ul.js-ziplist').remove();
715			clearTimeout(timerId_zipcache_);
716			timerId_zipcache_ = setTimeout(function () {
717				if (zipcache_lookupzip_ == jQuery(zip_id).val()) {
718					zipcache_lookupzip_ = jQuery(zip_id).val();
719					return false;
720				}
721				zipcache_lookupzip_ = jQuery(zip_id).val();
722			}, timerOffset);
723			clearTimeout(timerId_lookupzip_);
724			timerId_lookupzip_ = setTimeout(function () {
725				if (!jQuery(zip_id).val().match(/^[0-9]{3}[\-]{0,1}[0-9]{0,4}$/)) {
726					return true;
727				}
728
729				jQuery.get('../search/lookupzipjson.aspx', {
730					zip: jQuery(zip_id).val(),
731					charset: 'UTF-8'
732				}, function (data, status) {
733					var of = jQuery(zip_id).offset();
734					var ul = jQuery('<ul></ul>').addClass('js-ziplist block-ziplist--ziplist-frame dropdown');
735					ul.css('position', "absolute");
736					ul.css('top', of.top + offsetY);
737					ul.css('left', of.left + offsetX);
738					var searchCount = 0;
739					var tempzip, temppref, tempaddr, tempaddr2;
740					jQuery.each(data, function (key, item) {
741						searchCount++;
742						tempzip = item.zip;
743						temppref = item.pref;
744						tempaddr = item.addr;
745						tempaddr2 = item.addr2;
746						var li = jQuery('<li><span>' + key + ' ' + item.pref + ' ' + item.addr + ' ' + item.addr2 + '</span></li>');
747						li.bind('click', function () {
748							jQuery(zip_id).val(item.zip);
749							jQuery(pref_id).val(item.pref);
750							jQuery(addr_id).val(item.addr);
751							jQuery(addr2_id).val(item.addr2);
752							jQuery('ul.js-ziplist').remove();
753							jQuery(zip_id).blur();
754							jQuery(pref_id).change();
755							jQuery(addr_id).focus();
756							jQuery(addr2_id).blur().focus();
757							return false;
758						});
759						ul.append(li);
760					});
761					if ((searchCount == 1) && (zipcache_lookupzip_.replace("-", "").length == 7)) {
762						jQuery(zip_id).blur().focus();
763						//IMEの入力を確定させた後に値を詰めなおし
764						setTimeout(function(){
765							jQuery(zip_id).val(tempzip);
766							jQuery(pref_id).val(temppref);
767							jQuery(addr_id).val(tempaddr);
768							jQuery(addr2_id).val(tempaddr2);
769							jQuery('ul.js-ziplist').remove();
770							jQuery(pref_id).change();
771							jQuery(addr_id).focus();
772							jQuery(addr2_id).focus();
773						}, 0);
774						return false;
775					} else if (searchCount != 0) {
776						jQuery(document.body).append(ul);
777					}
778				}, 'json');
779			}, timerOffset);
780		});
781	};
782
783	/*  郵便番号検索 */
784jQuery(window).on('load',function () {
785	var timerOffset = 300;
786	var zip_id = '#zip';
787	var pref_id = '#pref';
788	var addr_id = '#addr';
789	var addr2_id = '#addr2';
790	var defaultXOffset = 0;
791	var defaultYOffset = jQuery(zip_id).outerHeight();
792	offsetX = defaultXOffset;
793	offsetY = defaultYOffset;
794	zipcache_lookupzip_ = jQuery(zip_id).val();
795	jQuery.get('../search/lookupzipjson.aspx', {
796		zip: jQuery(zip_id).val(),
797		charset: 'UTF-8'
798	}, function (data, status) {
799		var of = jQuery(zip_id).offset();
800		var ul = jQuery('<ul></ul>').addClass('js-ziplist block-ziplist--ziplist-frame dropdown');
801		ul.css('position', "absolute");
802		ul.css('top', of.top + offsetY);
803		ul.css('left', of.left + offsetX);
804		var searchCount = 0;
805		var tempzip, temppref, tempaddr, tempaddr2;
806		jQuery.each(data, function (key, item) {
807			searchCount++;
808			tempzip = item.zip;
809			temppref = item.pref;
810			tempaddr = item.addr;
811			tempaddr2 = item.addr2;
812			var li = jQuery('<li><span>' + key + ' ' + item.pref + ' ' + item.addr + ' ' + item.addr2 + '</span></li>');
813			li.bind('click', function () {
814				jQuery(zip_id).val(item.zip);
815				jQuery(pref_id).val(item.pref);
816				jQuery(addr_id).val(item.addr);
817				jQuery(addr2_id).val(item.addr2);
818				jQuery('ul.js-ziplist').remove();
819				jQuery(zip_id).blur();
820				jQuery(pref_id).change();
821				jQuery(addr_id).focus();
822				jQuery(addr2_id).blur().focus();
823				return false;
824			});
825			ul.append(li);
826		});
827		if ((searchCount == 1) && (zipcache_lookupzip_.replace("-", "").length == 7)) {
828			// 新規登録画面(#zip_autofill_enabled が存在する)の場合のã
828¿è‡ªå‹•補完
829			if (jQuery('#zip_autofill_enabled').length === 0) { return false; }
830			jQuery(zip_id).blur().focus();
831			//IMEの入力を確定させた後に値を詰めなおし
832			setTimeout(function(){
833				jQuery(zip_id).val(tempzip);
834				jQuery(pref_id).val(temppref);
835				jQuery(addr_id).val(tempaddr);
836				jQuery(addr2_id).val(tempaddr2);
837				jQuery('ul.js-ziplist').remove();
838				jQuery(pref_id).change();
839				jQuery(addr_id).focus();
840				jQuery(addr2_id).focus();
841			}, 0);
842			return false;
843		} else if (searchCount != 0) {
844			jQuery(document.body).append(ul);
845		}
846	}, 'json');
847})
848
849	/*!
850	 * 非推奨ブラウザ警告表示
851	 * @requires module:js.cookie.js
852	 * @requires module:modernizr-custom.js
853	 */
854	jQuery(document).ready(function () {
855
856		/* スマートフォンでは非推奨ブラウザを警告しない */
857		if (ecblib.sys.isModeSmartPhone()) return;
858
859		if (Cookies.get("confirmOldbrowserBanner") == "true") {
860			return;
861		}
862
863		if (isOldIE()) {
864			_ui.showHeaderWarning(ecblib.msg.ui.TOO_OLD_BROWSER, {
865				quit: function (act) {
866					Cookies.set("confirmOldbrowserBanner", "true", {
867						expires: 365,
868						path: '/'
869					});
870				}
871			});
872		}
873
874		/* IE <= 10の場合、trueが返却される */
875		function isOldIE() {
876			var userAgent = window.navigator.userAgent.toLowerCase();
877			return userAgent.indexOf('msie') >= 0;
878		}
879
880	});
881
882
883	/** private method.... */
884
885	/* センタースクリーン取得 */
886	function getCenterScreen($obj) {
887		var x = ((jQuery(window).width() - $obj.outerWidth()) / 2) + jQuery(window).scrollLeft();
888		var y = ((jQuery(window).height() - $obj.outerHeight()) / 2);
889		if (x < 0) x = 0;
890		if (y < 0) y = 0;
891		return {
892			x: x, y: y
893		};
894	}
895
896	/* ユニークIDを取得する */
897	function getUUID() {
898		var randam = Math.floor(Math.random() * 1000);
899		return randam + new Date().getTime().toString();
900	}
901
902	/* 背景を固定する */
903	var _currentScrolltop = 0;
904	function setBackGroundFixed(isFixed) {
905		var $wrapper = jQuery('body').children('.wrapper');
906		if (isFixed) {
907			if ($wrapper.css('position') === 'fixed') { return; }
908			_currentScrolltop = jQuery(window).scrollTop();
909			$wrapper.css('position', 'fixed').css({ 'top': -_currentScrolltop, 'width': '100%'});
910		} else {
911			if ($wrapper.css('position') !== 'fixed') { return; }
912			$wrapper.css({'position': '', 'width': ''});
913			jQuery('html, body').prop({ scrollTop: _currentScrolltop });
914		}
915	}
916
917	/*!
918	 * ローディング(読み込み中)イメージ
919	 */
920	_ui.loadingImage = function () {
921		var result = '<div class="block-loading">'
922					+ '<div class="block-loading--balls">'
923					+ '<span class="block-loading--ball block-loading--ball-1"></span>'
924					+ '<span class="block-loading--ball block-loading--ball-2"></span>'
925					+ '<span class="block-loading--ball block-loading--ball-3"></span>'
926					+ '<span class="block-loading--ball block-loading--ball-4"></span>'
927					+ '<span class="block-loading--ball block-loading--ball-5"></span>'
928					+ '<span class="block-loading--ball block-loading--ball-6"></span>'
929					+ '<span class="block-loading--ball block-loading--ball-7"></span>'
930					+ '<span class="block-loading--ball block-loading--ball-8"></span>'
931					+ '</div>' 
932					+ '</div>';
933		return result;
934	};
935
936	/*!
937	 * ローディング(読み込み中)小サイズ イメージ
938	 */
939	_ui.loadingImageMin = function () {
940		var result = '<div class="block-loading-min">'
941					+ '<div class="block-loading-min--balls">'
942					+ '<span class="block-loading-min--ball block-loading-min--ball-1"></span>'
943					+ '<span class="block-loading-min--ball block-loading-min--ball-2"></span>'
944					+ '<span class="block-loading-min--ball block-loading-min--ball-3"></span>'
945					+ '<span class="block-loading-min--ball block-loading-min--ball-4"></span>'
946					+ '<span class="block-loading-min--ball block-loading-min--ball-5"></span>'
947					+ '<span class="block-loading-min--ball block-loading-min--ball-6"></span>'
948					+ '<span class="block-loading-min--ball block-loading-min--ball-7"></span>'
949					+ '<span class="block-loading-min--ball block-loading-min--ball-8"></span>'
950					+ '</div>' 
951					+ '</div>';
952		return result;
953	};
954})();

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.