PageSourceSearch

https://pusupusu.jp/function.js

js pusupusu.jp collected 2026-10-06 13:50:57 UTC 3,236 bytes, 93 lines download raw bytes

1$(function() {
2    $('.hamburger__icon').click(function() {
3      $(this).toggleClass('active');
4  
5      if ($(this).hasClass('active')) {
6        $('.hanburger__sp-menu').addClass('active');
7        $('body').addClass('active');
8      } else { 
9        $('.hanburger__sp-menu').removeClass('active');
10        $('body').removeClass('active');
11      }
12    });
13  
14
15    $('.hanburger__sp-menu').click(function(event) {
16      if (!$(event.target).closest('.hanburger__sp-menu__inner').length) {
17        $('.hamburger__icon').removeClass('active');
18        $(this).removeClass('active');
19        $('body').removeClass('active');
20      }
21    });
22
23    $('.hanburger__sp-menu__inner').click(function(event) {
24
25      if ($(event.target).closest('.hanburger__sp-menu__inner').length) {
26        $('.hamburger__icon').removeClass('active');
27        $('.hanburger__sp-menu').removeClass('active');
28        $('body').removeClass('active');
29      }
30    });
31  });
32
33
34  window.addEventListener('DOMContentLoaded', function () {
35    const cartButtons = document.querySelectorAll('input[type="submit"][value="カートに入れる"]');
36    cartButtons.forEach(function(button) {
37      button.value = '注文する';
38    });
39  });
40
41  // お知らせ: GASのWebアプリ(スプレッドシート連携)から取得して.notice__wrapperに差し込む
42  // 応答が来るまでは.notice__wrapperは空(帯とpaddingのみ)のまま
43  const NOTICE_GAS_URL = 'https://script.google.com/macros/s/AKfycbw_igdv149rr_17lK8SxRobk58z3efORjkferB6V2oU-GhNEO2CV3nEFlXLTTjz64o/exec';
44
45  function escapeHtml(str) {
46    return String(str)
47      .replace(/&/g, '&')
48      .replace(/</g, '&lt;')
49      .replace(/>/g, '&gt;')
50      .replace(/"/g, '&quot;')
51      .replace(/'/g, '&#39;');
52  }
53
54  function renderNotice(notice) {
55    const bodyHtml = escapeHtml(notice.body)
56      .split(/\n{2,}/)
57      .map(function (paragraph) {
58        return '<p>' + paragraph.replace(/\n/g, '<br>') + '</p>';
59      })
60      .join('');
61
62    const dateHtml = notice.date
63      ? '<span class="notice__box__date">' + escapeHtml(notice.date) + '</span>'
64      : '';
65
66    return (
67      '<details class="notice__box red-line-box">' +
68        '<summary class="notice__box__title font-size-M bold red">' + dateHtml + escapeHtml(notice.title) + '</summary>' +
69        '<div class="notice__box__body font-size-14px">' + bodyHtml + '</div>' +
70      '</details>'
71    );
72  }
73
74  async function loadNotices() {
75    const wrapper = document.querySelector('.notice__wrapper');
76    if (!wrapper || NOTICE_GAS_URL.includes('★')) return;
77
78    // 取得成功かつ1件以上ある場合以外は中身を空にする
79    // (.notice__wrapperの帯とpaddingはレイアウト用に残るので消えない)
80    try {
81      const res = await fetch(NOTICE_GAS_URL, { cache: 'no-store' });
82      if (!res.ok) throw new Error('HTTP ' + res.status);
83      const data = await res.json();
84      wrapper.innerHTML = (data.notices && data.notices.length)
85        ? data.notices.map(renderNotice).join('')
86        : '';
87    } catch (e) {
88      console.error('お知らせの取得に失敗しました', e);
89      wrapper.innerHTML = '';
90    }
91  }
92
93  window.addEventListener('DOMContentLoaded', loadNotices);

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.