PageSourceSearch

https://www.spiral.co.jp/wp-content/themes/spiral/js/detail.js

js spiral.co.jp collected 2026-10-02 03:27:19 UTC 8,126 bytes, 282 lines download raw bytes

1$(function() {
2	$('.mainImg .phoList').each(function(){
3		if($(this).find('li').length == 1){
4			$(this).addClass('no-slick');
5		}
6		$(this).slick({
7			dots: true,
8			arrows: true,
9			autoplay: true,
10			pauseOnHover: false,
11			pauseOnFocus: false,
12		}).on('touchend',function(){
13			$(this).slick('slickPlay');
14		});
15	});
16
17	$('#detailPage .figureBox').each(function(){
18		if($(this).find('.item').length > 1){
19			$(this).slick({
20				dots: true,
21				arrows: true,
22				autoplay: false,
23				pauseOnHover: false,
24				pauseOnFocus: false,
25			}).on('touchend',function(){
26				$(this).slick('slickPlay');
27			});
28		}else{
29			$(this).addClass('no-slick');
30		}
31	});
32
33	$('#detailPage .scrollBox').each(function(){
34		let $this = $(this);
35		$this.find('.moreBtn a').on('click',function(){
36			$this.toggleClass('open');
37			$this.find('.hideBox').stop().slideToggle();
38			return false;
39		});
40	});
41
42	$('#detailPage .detailBox .two-colums.small').each(function(){
43		if($(this).find('.column').length == 1){
44			$(this).css('justify-content','center');
45		}
46	});
47
48	$('#detailPage .bgBox').each(function(){
49		if($(this).next().hasClass('bgBox') && $(this).prev().hasClass('bgBox')){
50			$(this).css('padding-top','1px');
51			$(this).css('padding-bottom','1px');
52			$(this).next().css('padding-top','1px');
53			$(this).prev().css('padding-bottom','1px');
54		}
55	});
56
57	$('#detailPage .detailBox dl').each(function(){
58		let is_num = true;
59		let is_nodt = true;
60		$(this).find('dt').each(function(){
61			let txt = $(this).text();
62			if(!$(this).hasClass('empty')){
63				is_nodt = false;
64				if(!isNumber(txt) || $(this)[0].textContent.trim().length == 4){
65					is_num = false;
66				}
67			}else{
68				is_num = false;
69			}
70		});
71		if(is_num){
72			$(this).addClass('numberList');
73			$(this).find('dt').each(function(){
74				let html = $(this).html();
75				$(this).html('<span class="number">'+html+'.</span>');
76			});
77		}
78		if(is_nodt){
79			$(this).addClass('nodtList');
80		}
81	});
82
83	wrapConsecutiveComBtns();
84
85	$('#detailPage .detailBox dl a:not([href^="#"],[href^="tel:"],[href^="mailto:"])').each(function(){
86		if(!$(this).parents('.comBtn,comBtn02').length){
87			let html = $(this).html();
88			let href = $(this).attr('href');
89			let target = $(this).attr('target')?$(this).attr('target'):'_self';
90			let div = '';
91			if(href.indexOf(".pdf") != -1){
92				div = '<span class="comBtn pdf" style="margin-bottom: 0!important;"><a href="' + href + '" target="' + target + '"><span class="icon" data-stt-ignore></span>' + html + '</a></span>';
93			}else{
94				div = '<span class="comBtn"><a href="' + href + '" target="' + target + '" style="margin-bottom: 0!important;"><span class="icon" data-stt-ignore></span>' + html + '</a></span>';
95			}
96			$(this).after(div);
97			$(this).remove();
98		}
99	});
100
101	if($('.pagePath .tax_shoplistcat').length > 1){
102		$('.pagePath .tax_shoplistcat a').each(function(){
103			if($(this).text() == 'Spiral'){
104				$(this).parents('.tax_shoplistcat').remove();
105			}
106		})
107	}
108
109	pageLink();
110
111	$(window).on('resize',function(){
112		$('#detailPage .detailBox dl').each(function(){
113			let dlwidth = 0;
114			$(this).find('dt').each(function(){
115				if($(this).find('.jsSpan').length){
116					if($(this).find('.jsSpan')[0].scrollWidth > dlwidth){
117						dlwidth = $(this).find('.jsSpan')[0].scrollWidth;
118					}
119				}else{
120					let html = $(this).html();
121					$(this).html('<span class="jsSpan" style="display: inline-block;">'+html+'</span>');
122					if($(this).find('.jsSpan')[0].scrollWidth > dlwidth){
123						dlwidth = $(this).find('.jsSpan')[0].scrollWidth;
124					}
125				}
126			});
127			$(this).css('--dtwidth',dlwidth+'px');
128		});
129		$('#detailPage .detailBox .figureBox,#detailPage .phoList').each(function(){
130			if($(this).find('.slick-list').length){
131				let imgH = $(this).find('.slick-list img').eq(0).outerHeight();
132				$(this).find('.slick-list img').each(function(){
133					if($(this).outerHeight() > imgH){
134						imgH = $(this).outerHeight();
135					}
136				});
137				$(this).css('--imgH',imgH+'px');
138			}
139		});
140		$('#detailPage .detailBox dl table').each(function(){
141			let dlwidth = 0;
142			$(this).find('td:first-child:not([colspan])').each(function(){
143				if($(this).find('.jsSpan').length){
144					if($(this).find('.jsSpan').outerWidth() > dlwidth){
145						dlwidth = $(this).find('.jsSpan').outerWidth();
146					}
147				}else{
148					let html = $(this).html();
149					$(this).html('<span style="display:inline-block;" class="jsSpan">'+html+'</span>');
150					if($(this).find('.jsSpan').outerWidth() > dlwidth){
151						dlwidth = $(this).find('.jsSpan').outerWidth();
152					}
153				}
154			});
155			if(window.innerWidth > 999){
156				$(this).css('--dtwidth','calc(2rem + '+dlwidth+'px)');
157			}else{
158				$(this).css('--dtwidth','calc(1.5rem + '+dlwidth+'px)');
159			}
160		});
161		$('#detailPage .detailBox dl dd').each(function(){
162			if($(this).text() == ''){
163				if(window.innerWidth > 999 || $('html').hasClass('htmlpad')){
164					$(this).css('padding-bottom','1.5rem');
165				}else{
166					$(this).css('padding-bottom','0.5rem');
167				}
168			}
169		});
170
171		if($('#detailPage #listPage .secBox .comBtn.flexLink').length){
172			if(window.innerWidth > 999){
173				let height = $('#detailPage #listPage .secBox .comBtn.flexLink').outerHeight();
174				$('#detailPage #listPage .secBox .catTtl').css('min-height', 'calc(1.4rem + ' + height + 'px)');
175			}else{
176				$('#detailPage #listPage .secBox .catTtl').css('min-height','auto');
177			}
178		}
179	}).trigger('resize');
180
181	$('#detailPage .detailBox').each(function(){
182		if(!$(this).next('#listPage').find('.secBox').length && !$(this).next('.secBox').length){
183			$(this).css('padding-bottom','0');
184			$(this).css('border-bottom','none');
185		}
186	});
187
188	$('#detailPage.pageAccess .detailBox a').each(function(){
189		if(!$(this).parents('.comBtn,.comBtn02').length){
190			let url = $(this).attr('href');
191			if(url.indexOf('//maps.app.goo.gl/') != -1){
192				$(this).addClass('googleMap');
193			}
194		}
195	});
196
197	$('#detailPage .detailBox .two-colums .column').each(function(){
198		if($(this).html() == ''){
199			$(this).remove();
200		}
201	});
202
203	$('#detailPage .contsWidth').each(function(){
204		if($(this).children().last().is('h1,h2,h3,h4,h5,h6') && !$(this).next('.contsWidth').length){
205			$(this).css('margin-bottom','0');
206			$(this).next().css('margin-top','0');
207		}
208	});
209
210	$('#detailPage .imgBox .photo').each(function(){
211		let hide = true;
212		if($(this).find('img').attr('src') != ''){
213			hide = false;
214		}
215		if(hide){
216			$(this).remove();
217		}
218	})
219});
220$(window).on('load',function(){
221	$(window).on('scroll',function(){
222		$('#detailPage .figureBox,#detailPage .phoList').each(function(){
223			if($(this).find('.slick-list').length){
224				if($(window).scrollTop() > $(this).offset().top - window.innerHeight){
225					$(this).slick('slickPlay');
226					let imgH = $(this).find('.slick-list img').eq(0).outerHeight();
227					$(this).find('.slick-list img').each(function(){
228						if($(this).outerHeight() > imgH){
229							imgH = $(this).outerHeight();
230						}
231					});
232					$(this).css('--imgH',imgH+'px');
233				}
234			}
235		});
236		$(window).trigger('resize');
237	}).trigger('scroll');
238});
239
240function isNumber(value) {
241    return !isNaN(parseFloat(value)) && isFinite(value);
242}
243
244function wrapConsecutiveComBtns() {
245	const allComBtns = document.querySelectorAll('.contsWidth .comBtn02');
246	const parents = new Set([...allComBtns].map(btn => btn.parentNode));
247
248	parents.forEach(parent => {
249		const children = Array.from(parent.children);
250		const groups = [];
251		let currentStart = -1;
252
253		for (let i = 0; i < children.length; i++) {
254			const child = children[i];
255			if (child.classList.contains('comBtn02')) {
256				if (currentStart === -1) currentStart = i;
257			} else {
258				if (currentStart !== -1) {
259				groups.push({ start: currentStart, end: i - 1 });
260				currentStart = -1;
261				}
262			}
263		}
264		
265		if (currentStart !== -1) {
266		groups.push({ start: currentStart, end: children.length - 1 });
267		}
268
269		groups
270		.filter(g => g.end - g.start + 1 >= 2)
271		.reverse()
272		.forEach(g => {
273			const elements = children.slice(g.start, g.end + 1);
274			const btnBox = document.createElement('div');
275			btnBox.className = 'btnBox';
276			
277			
278			parent.insertBefore(btnBox, children[g.start]);
279			elements.forEach(el => btnBox.appendChild(el));
280		});
281	});
282}

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.