PageSourceSearch

https://primo-color.jp/wp-content/themes/SumahoDeHoken/js/consultation.js?ver=1.0.8

js primo-color.jp collected 2026-10-04 03:33:48 UTC 3,944 bytes, 106 lines download raw bytes

1document.addEventListener("DOMContentLoaded", function () {
2	const checkboxes = document.querySelectorAll('input[name="chance[data][]"]');
3	const nextButton = document.querySelector(".form-button");
4	const backButton = document.querySelector(".common-button.white.inputpage"); // 戻るボタン
5	const step1 = document.getElementById("step1");
6	const step2 = document.getElementById("step2");
7	const contactForm = document.getElementById("contact-form");
8
9	function toggleButton() {
10		const isChecked = Array.from(checkboxes).some(checkbox => checkbox.checked);
11		if (isChecked) {
12			nextButton.classList.add("active");
13			nextButton.style.pointerEvents = "auto";
14			nextButton.style.opacity = "1";
15		} else {
16			nextButton.classList.remove("active");
17			nextButton.style.pointerEvents = "none";
18			nextButton.style.opacity = "0.5";
19		}
20	}
21
22	checkboxes.forEach(checkbox => {
23		checkbox.addEventListener("change", toggleButton);
24	});
25
26	toggleButton();
27
28	// ページ読み込み時にチェック済みの項目があれば step2 を表示しスクロール
29	const isAlreadyChecked = Array.from(checkboxes).some(checkbox => checkbox.checked);
30	if (isAlreadyChecked && step1 && step2 && contactForm) {
31		step1.style.display = "none";
32		step2.style.display = "block";
33		setTimeout(() => {
34			contactForm.scrollIntoView({ behavior: "smooth" });
35		}, 100);
36	}
37
38	// 次へボタンをクリックで step1 -> step2 に遷移
39	nextButton.addEventListener("click", function (event) {
40		event.preventDefault();
41		if (step1 && step2 && contactForm) {
42			step1.style.display = "none";
43			step2.style.display = "block";
44			setTimeout(() => {
45				contactForm.scrollIntoView({ behavior: "smooth" });
46			}, 100);
47		}
48	});
49
50	// 戻るボタンをクリックで step2 -> step1 に戻る
51	backButton.addEventListener("click", function () {
52		if (step1 && step2) {
53			step2.style.display = "none";
54			step1.style.display = "block";
55			setTimeout(() => {
56				step1.scrollIntoView({ behavior: "smooth" });
57			}, 100);
58		}
59	});
60});
61
62$(document).ready(function() {
63    // Add or remove the 'active' class based on scroll position
64    $(window).on('scroll', function() {
65        const scrollTop = $(window).scrollTop();
66        const contactTop = $('#contact-form').offset().top;
67        const contactHeight = $('#contact-form').outerHeight(); // 高さを取得
68
69        // 200pxスクロールしたらactiveを付与し、contact-formが表示されたら削除
70        if (scrollTop > 200 && scrollTop < (contactTop - contactHeight)) {
71            $('#cart').addClass('active');
72        } else {
73            $('#cart').removeClass('active');
74        }
75    });
76});
77
78// 月曜をカレンダーから選択不可にする
79jQuery(function($) {
80    var holidays = [];
81
82    // 日本の祝日APIからデータを取得
83    fetch("https://holidays-jp.github.io/api/v1/date.json")
84        .then(response => response.json())
85        .then(data => {
86            // APIのキー(祝日の日付)を取得し、配列に格納
87            holidays = Object.keys(data);
88
89            $(".hasDatepicker").datepicker("option", {
90                firstDay: 0, // 最初の曜日を日曜日に設定(0 = 日曜日)
91                beforeShowDay: function(date) {
92                    var day = date.getDay();
93                    var dateString = date.getFullYear() + '-' + 
94                        ('0' + (date.getMonth() + 1)).slice(-2) + '-' + 
95                        ('0' + date.getDate()).slice(-2);
96
97                    var isWeekend = (day === 0 || day === 6); // 土日
98                    var isHoliday = holidays.includes(dateString); // APIから取得した祝日
99
100                    return [(!isWeekend && !isHoliday)]; // 土日・祝日を無効化
101                },
102                minDate: 0 // 今日以降のみ選択可能
103            });
104        })
105        .catch(error => console.error("祝日データの取得に失敗しました", error));
106});

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.