PageSourceSearch

https://higashikoganei-uro.com/js/common.js

js higashikoganei-uro.com collected 2026-10-06 08:09:47 UTC 3,437 bytes, 113 lines download raw bytes

1// Global ----------------------------------------
2const windowSm = 768; // ブレイクポイント
3const mql = window.matchMedia(`(min-width:${windowSm}px)`);
4
5
6// 電話番号 ----------------------------------------
7if (/iPhone|iPad|Android|Mobile/.test(navigator.userAgent)) {
8	$('.js-tel').each(function() {
9		const $this = $(this);
10		const img = $this.children('img');
11		const telNumber = img.length > 0
12			? img.attr('alt')?.replace(/-/g, '')
13			: $this.text().replace(/-/g, '').trim();
14
15		if (telNumber) {
16			const link = $('<a>').attr('href', 'tel:' + telNumber);
17			img.length > 0 ? link.append(img) : link.text($this.html());
18			$this.html(link);
19		} else {
20			console.error('電話番号が不正または未定義です。');
21		}
22	});
23}
24
25
26// Gナビ ----------------------------------------
27$(function() {
28	const gNav = $('#global_nav'),
29		spModal = $('.js-sp_modal'),
30		spBtn = gNav.children('.js-sp_btn'),
31		spMenu = gNav.children('.js-sp_box'),
32    menuBtn =  gNav.find('.js-menu_btn'),
33    menuBox =  gNav.find('.js-menu_box');
34
35	const spReset = function(){
36		$('html, body').removeClass('spnav_modal');
37		spBtn.removeClass('close');
38		spMenu.removeClass('is_open');
39	};
40	spBtn.on('click', function(){
41		$('html, body').toggleClass('spnav_modal');
42		$(this).toggleClass('close').next(spMenu).toggleClass('is_open');
43		if (!$(this).hasClass('close')) spReset();
44		return false;
45	});
46	spModal.on('click', function(evt){
47		if ($('html, body').hasClass('spnav_modal') && !$(evt.target).closest(spMenu).length) spReset();
48	});
49	menuBtn.on('click', function(){
50		$(this).toggleClass('is_open').next(menuBox).slideToggle();
51		menuBtn.each(function() {
52			if (this !== event.currentTarget) {
53				$(this).removeClass('is_open').next(menuBox).slideUp();
54			}
55		});
56		return false;
57	});
58
59	const currentPath = window.location.pathname;
60	const gNavHref = $('a', gNav);
61	gNavHref.each(function(index, value) {
62			const linkPath = new URL(value.href).pathname;
63			if (linkPath === currentPath) {
64					gNavHref.removeClass('is_current').eq(index).addClass('is_current');
65			}
66	});
67
68	// レスポンシブ処理
69  const respNav = function(event) {
70    if (event.matches) {
71      spReset();
72      $(window).on('click', function() {
73        menuBtn.removeClass('is_open').next(menuBox).slideUp();
74      });
75    }
76  };
77	mql.addEventListener('change', respNav);
78	respNav(mql);
79});
80
81
82// アコーディオン(dt,dd) ----------------------------------------
83
84$(function() {
85	const $news = $('.js-accordion');
86	const $newsHead = $news.find('dt');
87	$newsHead.on('click', function() {
88		const $this = $(this);
89		$this.toggleClass('is_open').next('dd').stop(true, true).slideToggle();
90	});
91});
92
93
94// フッターパーツ( SP固定 / ページTOPボタン ) ----------------------------------------
95
96$(function() {
97  const screenHeight = $(window).height() - 20;
98  const fixedBar = $('.js-floating');
99  const btnPageTop = $('.js-pageup');
100  btnPageTop.click(function () {
101    $('html, body').animate({ scrollTop: 0 }, 500);
102    return false;
103  });
104  $(window).on('load scroll', function() {
105    if ($(this).scrollTop() > screenHeight) {
106      fixedBar.addClass('is_active');
107      btnPageTop.addClass('is_active');
108    } else {
109      fixedBar.removeClass('is_active');
110      btnPageTop.removeClass('is_active');
111    }
112  });
113});

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.