PageSourceSearch

https://cfc.or.jp/wp-content/themes/cfc/js/script.js?ver=1.1.5

js cfc.or.jp collected 2026-10-02 04:58:52 UTC 9,460 bytes, 295 lines download raw bytes

1jQuery(function ($) {
2  // ----- page-top-btn -----
3  $(function () {
4    $(".page-top").click(function () {
5      $("body,html").animate(
6        {
7          scrollTop: 0,
8        },
9        500 //移動時間
10      );
11      return false;
12    });
13  });
14
15  // ---- hamburger-menu -----
16  $(function () {
17    var btn = ".header__menu-btn";
18    var btnText = ".header__menu-btn-text";
19    var btnTextBefore = "MENU";
20    var btnTextAfter = "CLOSE";
21    var content = ".h-menu";
22    var menuBg = ".page-wrapper";
23    var scrollPosition;
24    // アクティブ時の動き
25    function activeSetting() {
26      scrollPosition = $(window).scrollTop();
27      $(btn).attr("aria-expanded", true);
28      $(btnText).text(btnTextAfter);
29      $(menuBg).attr("tabindex", "0");
30      // 背景固定
31      $("body").addClass("no-scroll").css({ top: -scrollPosition });
32    }
33    // 非アクティブ時共通の動き
34    function inactiveSetting() {
35      $(btn).attr("aria-expanded", false);
36      $(btnText).text(btnTextBefore);
37      $(menuBg).removeAttr("tabindex");
38      // 背景固定解除
39      $("body").removeClass("no-scroll").css({ top: 0 });
40      $("html").css({ "scroll-behavior": "auto" });
41      setTimeout(function () {
42        $("html").css({ "scroll-behavior": "smooth" });
43      }, 1);
44      $(window).scrollTop(scrollPosition);
45    }
46    // 【ボタンがクリックされたら】
47    $(".header__menu-btn, .h-menu__close-btn").click(function () {
48      $(btn).toggleClass("open");
49      $(content).toggleClass("open");
50      if ($(btn).hasClass("open")) {
51        // アクティブになったら
52        activeSetting();
53      } else {
54        // 非アクティブになったら
55        inactiveSetting();
56      }
57    });
58    // 【キーボードでEscが押されたら】
59    $(window).keyup(function (e) {
60      if (e.key === "Escape" || e.key === "Esc" || e.keyCode === 27) {
61        $(btn).removeClass("open");
62        $(content).removeClass("open");
63        inactiveSetting();
64      }
65    });
66    // 【フォーカスが背景に移ったらメニューボタンに戻す】
67    $(menuBg).on("focus", function () {
68      $(btn).focus();
69    });
70  });
71
72  // ----- hamburger-menu accordion -----
73  $(function () {
74    var title = ".h-menu__nav-item-title";
75    var content = ".h-menu__accordion-content";
76    // ボタンの動作
77    $(title).click(function () {
78      $(this).toggleClass("open");
79      $(this).next(content).slideToggle();
80      if ($(this).hasClass("open")) {
81        $(this).attr("aria-expanded", true);
82      } else {
83        $(this).attr("aria-expanded", false);
84      }
85    });
86    // PCデザインのときはメニュー見出しのbuttonを無効化、aria-expandedを削除
87    $(window).on("load resize", function () {
88      if (window.matchMedia("(min-width: 1200px)").matches) {
89        $(title).prop("disabled", true);
90        $(title).removeAttr("aria-expanded");
91      } else {
92        $(title).prop("disabled", false);
93        $(title).not(".open").attr("aria-expanded", false);
94      }
95    });
96  });
97
98  // ----- top fade-in -----
99  function fadeInAnime() {
100    $(".fade-in").each(function () {
101      var scroll = $(window).scrollTop();
102      var blockPosition = $(this).offset().top;
103      var windowHeight = $(window).height();
104      if (scroll > blockPosition - windowHeight + 150) {
105        $(this).addClass("active");
106      }
107    });
108  }
109  $(function () {
110    $(document).scroll(function () {
111      fadeInAnime();
112    });
113    fadeInAnime();
114  });
115
116  // ----- finance accordion -----
117  $(function () {
118    var btnWrapper = ".finance__archive-small-title";
119    var btn = ".finance__archive-small-button";
120    var content = ".finance__archive-small-list";
121    $(btnWrapper).click(function () {
122      $(this).toggleClass("open");
123      $(this).next(content).slideToggle();
124      if ($(this).hasClass("open")) {
125        $(this).children(btn).attr("aria-expanded", true);
126      } else {
127        $(this).children(btn).attr("aria-expanded", false);
128      }
129    });
130  });
131
132  // ----- media accordion -----
133  $(function () {
134    var btnWrapper = ".media__year";
135    var btn = ".media__button";
136    var content = ".media__content";
137    $(btnWrapper).eq(0).addClass("open");
138    $(btnWrapper).click(function () {
139      $(this).toggleClass("open");
140      $(this).next(content).slideToggle();
141      if ($(this).hasClass("open")) {
142        $(this).children(btn).attr("aria-expanded", true);
143      } else {
144        $(this).children(btn).attr("aria-expanded", false);
145      }
146    });
147  });
148
149  // ----- helloculture accordion -----
150  $(function () {
151    $(".helloculture-message__partner-comment-btn").click(function () {
152      $(this).toggleClass("open");
153      $(this)
154        .next(".helloculture-message__partner-comment-detail")
155        .slideToggle();
156    });
157  });
158
159  // ----- form join-company -----
160  // 「CFCサポート会員を希望する」にチェックが入ったら「寄付金額」「入金予定日」を入力不可にする、エラー表示を消す
161  $("#00NIR000009ZQhO").change(function () {
162    var input = $("#00N100000072R7E, #00N10000008pGzo");
163    if ($(this).is(":checked")) {
164      $(input).prop("disabled", true);
165      $(input).val("");
166      $(input).removeClass("error");
167      $(input).next("label").remove();
168    } else {
169      $(input).prop("disabled", false);
170    }
171  });
172
173  // ----- form join-kouza -----
174  // 「海外在住」にチェックが入ったら郵便番号と住所を入力不可にする、エラー表示を消す
175  $(".form__check-btn--abroad").change(function () {
176    var input = $(
177      ".form__input--postcode, .form__select--pref, .form__input--locality, .form__input--extended"
178    );
179    var label = $(".form__label--address");
180    if ($(this).is(":checked")) {
181      $(input).prop("disabled", true);
182      $(input).val("");
183      $(input).removeClass("error");
184      $(input).next("label").remove();
185      $(label).removeClass("form__label--required");
186    } else {
187      $(input).prop("disabled", false);
188      $(label).addClass("form__label--required");
189    }
190  });
191  // 入会を決めたきっかけが「その他」以外の場合、フリー入力欄を入力不可にする&エラー表示を消す
192  $("#00N100000072Q2r").on("change", function () {
193    var input = $(".form__input--reason");
194    if ($(this).val() != "その他") {
195      $(input).prop("disabled", true);
196      $(input).val("");
197      $(input).removeClass("error");
198      $(input).next("label").remove();
199    } else {
200      $(input).prop("disabled", false);
201    }
202  });
203  // 生年月日入力中にスラッシュを自動挿入する
204  $(function () {
205    $('input[name="00N10000006rsqc"]').on("input", function () {
206      // 半角数値以外の入力を削除
207      var date_val = $(this).val().replace(/\D/g, "");
208      // 8桁を超えた場合その入力値を削除
209      if (date_val.length > 8) {
210        date_val = date_val.substring(0, 8);
211      }
212      // 4桁目と5桁目の間にスラッシュ(/)を入れる
213      if (date_val.length > 4) {
214        date_val = date_val.substring(0, 4) + "/" + date_val.substring(4);
215      }
216      // 7桁目と8桁目の間にスラッシュ(/)を入れる
217      if (date_val.length > 7) {
218        date_val = date_val.substring(0, 7) + "/" + date_val.substring(7);
219      }
220      // 入力した値をフィールドにセット
221      $(this).val(date_val);
222    });
223  });
224
225  // ----- inherit fixed button -----
226  $(function () {
227    var button = ".inherit__fixed";
228    var $button = $(button);
229
230    if ($button.length) {
231      $(window).on("scroll load", function () {
232        var scroll = $(window).scrollTop();
233        var windowHeight = $(window).height();
234
235        if (scroll >= windowHeight) {
236          $button.addClass("is-scrolled");
237        } else {
238          $button.removeClass("is-scrolled");
239        }
240      });
241    }
242  });
243
244  // ----- faq accordion -----
245  $(function () {
246    var btnWrapper = ".faq__q";
247    var btn = ".faq__q-button";
248    var content = ".faq__a";
249    $(btnWrapper).click(function () {
250      $(this).toggleClass("open");
251      $(this).next(content).slideToggle();
252      if ($(this).hasClass("open")) {
253        $(this).children(btn).attr("aria-expanded", true);
254      } else {
255        $(this).children(btn).attr("aria-expanded", false);
256      }
257    });
258  });
259
260  // ----- inherit features tabs -----
261  $(function () {
262    var tabs = ".inherit__what-features-tabs-item";
263    var panels = ".inherit__what-features-panels-item";
264    $(tabs).click(function () {
265      $(tabs).removeClass("is-active");
266      $(panels).removeClass("is-active");
267      $(this).addClass("is-active");
268      var index = $(tabs).index(this);
269      $(panels).eq(index).addClass("is-active");
270    });
271  });
272
273  // ----- inherit features tabs -----
274  $(function () {
275    var tabs = ".inherit__flow-tabs-item";
276    var panels = ".inherit__flow-panels-item";
277    $(tabs).click(function () {
278      $(tabs).removeClass("is-active");
279      $(panels).removeClass("is-active");
280      $(this).addClass("is-active");
281      var index = $(tabs).index(this);
282      $(panels).eq(index).addClass("is-active");
283    });
284  });
285  
286  // ----- inherit faq -----
287  $(function () {
288    var faqItems = ".inherit__faq-list-item";
289    var faqAnswers = ".inherit__faq-list-item-answer";
290    $(faqItems).click(function () {
291      $(this).toggleClass("open");
292      $(this).children(faqAnswers).slideToggle();
293    });
294  });
295});

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.