PageSourceSearch

https://www.ctc-g.co.jp/bestengine/common/js/base.js

js ctc-g.co.jp collected 2026-09-24 08:53:29 UTC 5,017 bytes, 179 lines download raw bytes

1/* PAGE TOP */
2$(function() {
3	var $footer = $('footer');
4	var $pagetop = $('#pagetop');
5	var defaultPagetopBottom = 20;
6	$pagetop.on('click', function(e) {
7		e.preventDefault();
8		$('html, body').animate({
9			scrollTop: 0
10		}, 500);
11	});
12	$(window).on('scroll', function() {
13		var scrollPos = $(window).scrollTop();
14		var windowHeight = $(window).height();
15		var footerOffsetTop = $footer.offset().top;
16		var pagetopHeight = $pagetop.outerHeight();
17		if (scrollPos > 50) {
18			$pagetop.css("right", 10);
19		} else {
20			$pagetop.css("right", "");
21		}
22		var pagetopStopPoint = footerOffsetTop - pagetopHeight - defaultPagetopBottom;
23		if ((scrollPos + windowHeight) > pagetopStopPoint + pagetopHeight + defaultPagetopBottom) {
24			var newBottom = (scrollPos + windowHeight) - footerOffsetTop + defaultPagetopBottom;
25			$pagetop.css('bottom', newBottom + 'px');
26		} else {
27			$pagetop.css('bottom', defaultPagetopBottom + 'px');
28		}
29	});
30	$(window).trigger('scroll');
31});
32
33
34/* nav */
35$(window).on('load', function() {
36	const $navWraperElement = $('header > div');
37	const $navElement = $('nav');
38	const $toggleBtn = $('header > div > p');
39	const $nav = $('header > nav');
40	let isNavVisible = false;
41	let lastWidth = $(window).width();
42
43	if ($navElement.length) {
44		let menuHeight = $navElement.outerHeight();
45		$nav.css("top", (menuHeight * -1) + "px");
46
47		setTimeout(function() {
48			menuHeight = $navElement.outerHeight();
49			$nav.css("top", (menuHeight * -1) + "px");
50		}, 150);
51
52		// 横幅が変わった時のみリサイズ
53		$(window).on('resize', function() {
54			let currentWidth = $(window).width();
55			if (currentWidth !== lastWidth) {
56				lastWidth = currentWidth;
57				menuHeight = $navElement.outerHeight();
58				if (isNavVisible) {
59					$nav.css("top", $navWraperElement.outerHeight() + "px");
60					$toggleBtn.addClass("underArrow");
61				} else {
62					$nav.css("top", (menuHeight * -1) + "px");
63					$toggleBtn.removeClass("underArrow");
64				}
65			}
66		});
67
68		// トグルボタン
69		$toggleBtn.on("click", function() {
70			const navHeight = $navWraperElement.outerHeight();
71			menuHeight = $navElement.outerHeight();
72
73			// searchAreaが開いている場合は閉じてメニューを開く
74			if ($(".searchArea").hasClass("showInput")) {
75				$(".searchArea").removeClass("showInput");
76				$nav.css("top", navHeight + "px");
77				$toggleBtn.addClass("underArrow");
78				isNavVisible = true;
79				return;
80			}
81
82			// 通常トグル
83			if (isNavVisible) {
84				$nav.css("top", (navHeight - menuHeight * 1.2) + "px");
85				$toggleBtn.removeClass("underArrow");
86			} else {
87				$nav.css("top", navHeight + "px");
88				$toggleBtn.addClass("underArrow");
89			}
90			isNavVisible = !isNavVisible;
91
92			$(".searchArea").removeClass("showInput");
93		});
94
95		$(document).on('click', '.kw_button', function() {
96			setTimeout(function() {
97				const menuHeight = $('nav').outerHeight();
98				$('header > nav').css("top", (menuHeight * -1) + "px");
99				$('header > div > p').removeClass("underArrow");
100				isNavVisible = false;
101			}, 250);
102		});
103	}
104
105	$(".searchArea > p").on('click', function() {
106		const navHeight = $navWraperElement.outerHeight();
107		const menuHeight = $navElement.outerHeight();
108		$(".searchArea").toggleClass("showInput");
109		$(".mf-search-box").css("top", navHeight + "px");
110		$toggleBtn.removeClass("underArrow");
111		$nav.css("top", (navHeight - menuHeight * 1.2) + "px");
112		isNavVisible = false;
113	});
114});
115
116
117/* nav tab */
118$(function(){
119	$(document).on("click", "header > nav div.tabArea p", function() {
120		if ($(this).hasClass("current")) {
121			return;
122		}
123		$(".tabArea p").removeClass("current");
124		$(this).addClass("current");
125		if ($(this).index() === 0) {
126			$("#kw10").css("display", "flex");
127			$("#kw20").css("display", "none");
128		}
129		else if ($(this).index() === 1) {
130			$("#kw10").css("display", "none");
131			$("#kw20").css("display", "flex");
132		}
133	});
134	if ($(".tabArea p:first-child").hasClass("current")) {
135		$("#kw10").css("display", "flex");
136		$("#kw20").css("display", "none");
137	}
138	else if ($(".tabArea p:nth-child(2)").hasClass("current")) {
139		$("#kw10").css("display", "none");
140		$("#kw20").css("display", "flex");
141	}
142});
143
144
145
146/* Slider */
147$(".slide_area").slick({
148	slidesToShow: 2,
149	arrows: false,
150	swipe: false,
151	responsive:[{
152		breakpoint: 500,
153		settings:{
154			slidesToShow: 1,
155			centerPadding: "10px",
156			autoplay: true,
157			autoplaySpeed: 3000,
158			dots: true,
159			swipe: true,
160			pauseOnFocus: false,
161			pauseOnHover: false,
162			pauseOnDotsHover: false
163		}
164	}]
165});
166$(function(){
167	function checkSlideLength(){
168		const slideLength = document.querySelectorAll(".slick-slide").length;
169		if (slideLength === 1){
170			$(".slick-dots").css("display","none");
171		}else{
172			$(".slick-dots").css("display","");
173		}
174	}
175	checkSlideLength();
176	$(window).on("resize orientationchange",function(){
177		setTimeout(checkSlideLength, 50);
178	});
179});

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.