PageSourceSearch

https://nippon1.jp/js/common.js?1784785402

js nippon1.jp collected 2026-09-24 09:04:49 UTC 10,557 bytes, 299 lines download raw bytes

1let globalSubNavActive = false;
2let globalSubNavActiveElement = null;
3let globalNavContainerHoverElement = null;
4
5/* --------------------------------------------------------------------------------
6 ページ(HTML)読み込み完了時の処理
7-------------------------------------------------------------------------------- */
8$(function () {
9	// 初期化
10	// initSlick();
11	initPage();
12});
13
14/* --------------------------------------------------------------------------------
15 全てのファイル読み込み完了イベント
16-------------------------------------------------------------------------------- */
17$(window).on("load", function() {
18});
19
20/* --------------------------------------------------------------------------------
21 スクロールイベント
22-------------------------------------------------------------------------------- */
23$(window).on("scroll", scrollEvent);
24function scrollEvent() {
25	let pageTopBtn = $(".pagetop-button");
26	if ($(window).scrollTop() > 100) {
27		pageTopBtn.addClass("show");
28	}
29	else {
30		pageTopBtn.removeClass("show");
31	}
32
33	// ピックアップキャンペーン
34	let pickupCampaign = $(".pickup_campain");
35	if ($(window).scrollTop() > 100 && $(window).scrollTop() + $(window).height() < $("footer").offset().top) {
36		pickupCampaign.addClass("show");
37	}
38	else {
39		pickupCampaign.removeClass("show");
40	}
41}
42
43/* --------------------------------------------------------------------------------
44 リサイズイベント
45-------------------------------------------------------------------------------- */
46$(window).on('resize',resizeEvent);
47function resizeEvent() {
48	initColorBox();
49};
50
51/* --------------------------------------------------------------------------------
52 ページトップボタン
53-------------------------------------------------------------------------------- */
54$(document).on("click", ".pagetop-button", function(e) {
55	e.preventDefault();
56	$("body,html").animate({
57		scrollTop: 0
58	}, 600, "swing");
59});
60
61/* --------------------------------------------------------------------------------
62 グローバルナビゲーションのマウスオーバーイベント(PC向け)
63-------------------------------------------------------------------------------- */
64$(".global .global-nav-container").hover(function () {
65	if (isSP()) { return false; }
66
67	globalNavContainerHoverElement = $(this);
68	setTimeout(function () {
69		if (globalNavContainerHoverElement == null) { return; }
70		
71		showGlobalSubNav(globalNavContainerHoverElement);
72	}, 100);
73}, function () {
74	if (isSP()) { return false; }
75
76	globalNavContainerHoverElement = null;
77	hideGlobalSubNav();
78});
79
80/* --------------------------------------------------------------------------------
81 グローバルナビゲーションのクリックイベント(SP向け)
82-------------------------------------------------------------------------------- */
83$(document).on("click", ".global .global-nav-container", function(e) {
84	if (isSP()) {
85		if (e.target.closest(".global-sub_nav-wrapper") != null) { return; }
86
87		if ($(this).find(".global-sub_nav-wrapper").length) {
88			e.preventDefault();
89			
90			if (globalSubNavActive && $(this).index() == globalSubNavActiveElement.closest(".global-nav-container").index()) {
91				hideGlobalSubNav();
92			}
93			else {
94				showGlobalSubNav($(this));
95			}
96		}
97	}
98});
99
100function showGlobalSubNav(element) {
101	if (element.find(".global-sub_nav-wrapper").length) {
102		$(".global-filter").addClass("show");
103
104		if (globalSubNavActiveElement != null) {
105			globalSubNavActiveElement.removeClass("show");
106		}
107		globalSubNavActiveElement = element.find(".global-sub_nav-wrapper");
108		globalSubNavActiveElement.addClass("show");
109
110		if (!$(".global-nav-button.show").length) {
111			let height = element.find(".global-sub_nav-wrapper").outerHeight();
112			$(".global-sub_nav-bg").css("height", height);
113			globalSubNavActive = true;
114		}
115	}
116	else {
117		globalSubNavActive = false;
118	}
119	setTimeout(function () {
120		if (!globalSubNavActive) {
121			$(".global-filter").removeClass("show");
122			$(".global-sub_nav-bg").css("height", 0);
123			if (globalSubNavActiveElement != null) {
124				globalSubNavActiveElement.removeClass("show");
125				globalSubNavActiveElement = null;
126			}
127		}
128	}, 500);
129}
130
131function hideGlobalSubNav(delay = null) {
132	if (!$(".global-nav-button.show").length) {
133		globalSubNavActive = false;
134		if (delay == null) { delay = isSP() ? 0 : 500; }
135
136		setTimeout(function () {
137			if (!globalSubNavActive) {
138				$(".global-filter").removeClass("show");
139				$(".global-sub_nav-bg").css("height", 0);
140				if (globalSubNavActiveElement != null) {
141					globalSubNavActiveElement.removeClass("show");
142					globalSubNavActiveElement = null;
143				}
144			}
145		}, delay);
146	}
147}
148
149/* --------------------------------------------------------------------------------
150 グローバルナビゲーション黒フィルターのクリックイベント
151-------------------------------------------------------------------------------- */
152$(document).on("click", ".global-filter.show", function(e) {
153	hideGlobalSubNav();
154});
155
156/* --------------------------------------------------------------------------------
157 ヘッダーサブナビゲーションのクリックイベント
158-------------------------------------------------------------------------------- */
159$(document).on("click", ".global-sub_nav-container a", function(e) {
160	let from = location.origin + location.pathname + location.search;
161	let to = $(this).prop("href");
162
163	// 同じページ内の場合のみ対応
164	if (from == to.substring(0, to.indexOf("#"))) {
165		e.preventDefault();
166		
167		// ショートカットの指定があったらページの表示前にスクロールさせておく
168		let href = $(this).attr("href");
169		let index = href.indexOf("#");
170		let hash = href.substring(index);
171		if ($(hash).length) {
172			let offset = ($(".global-sp-header").is(':visible')) ? 0 : $(".global-scroll").outerHeight();
173			$("body,html").animate({
174				scrollTop: $(hash).offset().top - offset
175			}, 600, "swing");
176
177			// スマホならメニューを閉じる
178			if ($(".global-nav-button.show").length) {
179				$("body > .global-nav-button").click();
180			}
181		}
182	}
183});
184
185/* --------------------------------------------------------------------------------
186 ヘッダーサブナビゲーション 閉じるボタンのクリックイベント
187-------------------------------------------------------------------------------- */
188$(document).on("click", ".global-sub_nav-close", function(e) {
189	hideGlobalSubNav(0);
190});
191
192/* --------------------------------------------------------------------------------
193 フッターナビゲーションのクリックイベント
194-------------------------------------------------------------------------------- */
195$(document).on("click", ".footer-link-container h6", function(e) {
196	$(this).next().slideToggle();
197});
198
199/* --------------------------------------------------------------------------------
200 Slickナビゲーションのクリックイベント
201-------------------------------------------------------------------------------- */
202$(document).on("click", ".slick-nav button", function(e) {
203	e.preventDefault();
204
205	let index = $(".slick-nav li").index($(this).parent());
206	$(".slick-slider").slick("slickGoTo", index);
207});
208
209/* --------------------------------------------------------------------------------
210 ページの初期化
211-------------------------------------------------------------------------------- */
212function initPage() {
213	initColorBox();
214
215	// ショートカットの指定があったらページの表示前にスクロールさせておく
216	let href = "" + location;
217	let index = href.indexOf("#");
218	if (index != -1) {
219		let hash = href.substring(index);
220		if ($(hash).length) {
221			let offset = ($(".global-sp-header").is(':visible')) ? 0 : $(".global-scroll").outerHeight();
222			window.scrollTo(0, $(hash).offset().top - offset);
223		}
224	}
225}
226
227/* --------------------------------------------------------------------------------
228 Colorboxの初期化
229-------------------------------------------------------------------------------- */
230function initColorBox() {
231	$(".popup-image").colorbox({
232		maxWidth: "80%",
233		maxHeight: "80%",
234		transition: "fade",
235		speed: 400,
236		scrolling: false,
237		fixed: true,
238		opacity: 0.75,
239		overlayClose: true,
240	});
241
242	let aspect = $(window).width() / $(window).height();
243	let width = (aspect < 16 / 9) ? $(window).width() * 1 : $(window).height() * 0.8 * 16 / 9;
244	let height = (aspect < 16 / 9) ? $(window).width() * 1 * 9 / 16 : $(window).height() * 0.8;
245	$(".popup-movie").colorbox({
246		iframe: true,
247		transition: "fade",
248		speed: 400,
249		scrolling: false,
250		fixed: true,
251		opacity: 0.75,
252		overlayClose: true,
253		innerWidth: width,
254		innerHeight: height,
255	});
256}
257
258/* --------------------------------------------------------------------------------
259 Slickの初期化
260-------------------------------------------------------------------------------- */
261// function initSlick() {
262// 	$(".slick-slider").not('.slick-initialized').slick({
263// 		infinite: true,
264// 		dots: false,
265// 		fade: true,
266// 		//centerMode: true,
267// 		//centerPadding: '5%',
268// 		autoplay: true,
269// 	}).on("beforeChange", function(event, slick, currentSlide, nextSlide) {
270// 		// $(".slick-nav").removeClass().addClass("view"+(nextSlide+1));
271// 		// var navX = -178 * nextSlide;
272// 		$(".slick-nav li").each(function() {
273// 			$(this).removeClass("selected");
274// 		});
275// 		$(".slick-nav li").eq(nextSlide).addClass("selected");
276// 	});
277// }
278
279/* --------------------------------------------------------------------------------
280 URLクエリパラメータの取得
281-------------------------------------------------------------------------------- */
282function getQueryParam(name, url) {
283	if (!url) {
284		url = window.location.href;
285	}
286	name = name.replace(/[\[\]]/g, "\\$&");
287	let regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)");
288	let results = regex.exec(url);
289	if (!results) return null;
290	if (!results[2]) return '';
291	return decodeURIComponent(results[2].replace(/\+/g, " "));
292}
293
294/* --------------------------------------------------------------------------------
295 スマホ判定
296-------------------------------------------------------------------------------- */
297function isSP() {
298	return window.matchMedia( "(max-width: 979px)" ).matches;
299}

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.