PageSourceSearch

https://local-prime.com/wp/wp-content/themes/local_prime/js/mm-inner.js?7e5c3476

js local-prime.com collected 2026-10-05 03:39:46 UTC 6,318 bytes, 199 lines download raw bytes

1$(document).ready(function() {
2
3  "use strict";
4
5  var ua = navigator.userAgent.toLowerCase();
6  var isTouch = ('ontouchstart' in window) || navigator.maxTouchPoints > 0;
7  var isiPad = ua.indexOf("ipad") !== -1 || 
8               (ua.indexOf("macintosh") !== -1 && isTouch);
9
10  window.mb = false;
11  window.sp = false;
12  window.tb = false;
13
14  if (isTouch) {
15      if (isiPad) {
16          window.tb = true;
17          window.mb = true;
18      } else {
19          var width = window.innerWidth;
20          if (width <= 767) {
21              window.sp = true;
22              window.mb = true;
23          } else {
24              window.tb = true;
25              window.mb = true;
26          }
27      }
28  }
29
30  $(function() {
31    $(".indexBox a").on("click", function(e) {
32      e.preventDefault();
33      const targetId = $(this).attr("href");
34      const $target = $(targetId);
35      if ($target.length) {
36        const targetPos = $target.offset().top;
37        const currentPos = window.scrollY || window.pageYOffset;
38        const distance = Math.abs(targetPos - currentPos);
39        const baseSpeed = 2000;
40        const duration = distance / baseSpeed;
41        gsap.to(window, {
42          scrollTo: { y: targetPos, autoKill: false },
43          duration: duration,
44          ease: "power3.out"
45        });
46      }
47    });
48
49    document.querySelector('.searchForm').addEventListener('submit', function(e) {
50      e.preventDefault();
51
52      const params = new URLSearchParams();
53
54      const region = Array.from(document.querySelectorAll('input[name="r[]"]:checked'));
55      if (region.length > 0) {
56        params.append('r', region.map(v => v.value).join(' '));
57      }
58
59      const area = Array.from(document.querySelectorAll('input[name="a[]"]:checked'));
60      if (area.length > 0) {
61        params.append('a', area.map(v => v.value).join(' '));
62      }
63
64      const dateType = Array.from(document.querySelectorAll('input[name="dt[]"]:checked'));
65      if (dateType.length > 0) {
66        params.append('dt', dateType.map(v => v.value).join(' '));
67      }
68
69      const date = document.querySelector('input[name="d"]');
70      if (date) {
71        const d = date.value.trim();
72        if (d) {
73          params.append('d', d);
74        }
75      }
76
77      const tags = Array.from(document.querySelectorAll('input[name="t[]"]:checked'));
78      if (tags.length > 0) {
79        params.append('t', tags.map(v => v.value).join(' '));
80      }
81
82      const priceRange = Array.from(document.querySelectorAll('input[name="pr[]"]:checked'));
83      if (priceRange.length > 0) {
84        params.append('pr', priceRange.map(v => v.value).join(' '));
85      }
86
87      const keyword = document.querySelector('input[name="k"]');
88      if (keyword) {
89        const k = keyword.value.trim();
90        if (k) {
91          params.append('k', k);
92        }
93      }
94
95      const queryString = params.toString();
96      const newUrl = this.action + (queryString ? '?' + queryString : '');
97
98      window.location.href = newUrl;
99    });
100  });
101
102  // 祝日キャッシュ
103  const holidaysCache = {};
104  async function fetchHolidays(year) {
105    if (holidaysCache[year]) return holidaysCache[year];
106    try {
107      const res = await fetch(`https://holidays-jp.github.io/api/v1/${year}/date.json`);
108      const data = await res.json();
109      const dates = Object.keys(data);
110      holidaysCache[year] = dates;
111      return dates;
112    } catch (err) {
113      console.error("祝日データ取得失敗:", err);
114      return [];
115    }
116  }
117
118  if (typeof flatpickr !== 'undefined') {
119    flatpickr("#calendarWrap", {
120      wrap: true,
121      dateFormat: "Y-m-d",
122      locale: "ja",
123      allowInput: false,
124      static: false,
125      appendTo: document.body,
126      onReady: function(selectedDates, dateStr, instance) {
127        const clearBtn = document.createElement("div");
128        clearBtn.textContent = "指定をリセット";
129        clearBtn.className = "flatpickr-clear";
130        clearBtn.style.display = "none";
131
132        clearBtn.addEventListener("click", () => {
133          instance.clear();
134          instance.close();
135          instance._input.textContent = "日付指定なし";
136          const realInput = document.getElementById("calendarInput");
137          realInput.disabled = true;
138          clearBtn.style.display = "none";
139        });
140
141        instance.calendarContainer.appendChild(clearBtn);
142
143        const realInput = document.getElementById("calendarInput");
144        if (!selectedDates.length) realInput.disabled = true;
145      },
146      onChange: function(selectedDates, dateStr, instance) {
147        const clearBtn = instance.calendarContainer.querySelector(".flatpickr-clear");
148        const realInput = document.getElementById("calendarInput");
149
150        if (selectedDates.length) {
151          const d = selectedDates[0];
152          const formatted = `${d.getFullYear()}年${d.getMonth() + 1}月${d.getDate()}日`;
153          instance._input.textContent = formatted;
154          realInput.disabled = false;
155          realInput.value = dateStr;
156          clearBtn.style.display = "block";
157        } else {
158          instance._input.textContent = "日付指定なし";
159          realInput.disabled = true;
160          realInput.value = "";
161          clearBtn.style.display = "none";
162        }
163      },
164
165      onDayCreate: async function(dObj, dStr, fp, dayElem) {
166        const date = dayElem.dateObj;
167        const day = date.getDay(); // 0:日曜, 6:土曜
168        const ymd = fp.formatDate(date, "Y-m-d");
169
170        if (day === 0) dayElem.classList.add("flatpickr-sunday");
171        if (day === 6) dayElem.classList.add("flatpickr-saturday");
172
173        const year = date.getFullYear();
174        const holidays = await fetchHolidays(year);
175        if (holidays.includes(ymd)) dayElem.classList.add("flatpickr-holiday");
176      },
177
178      onMonthChange: async function(month) {
179        const year = this.currentYear;
180        await fetchHolidays(year);
181      },
182      onYearChange: async function(year) {
183        await fetchHolidays(year);
184      }
185    });
186  }
187
188  $('.articleBtn a').on('mouseenter', function(){
189    if(!mb){
190      gsap.to($(this), { backgroundColor:'#fc9147', duration: 0.3 });
191    }
192  });
193  $('.articleBtn a').on('mouseleave', function(){
194    if(!mb){
195      gsap.to($(this), { backgroundColor:'#696969', duration: 0.2, overwrite: true });
196    }
197  });
198
199});

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.