PageSourceSearch

https://kiond-hiroshima.com/wordpress/wp-content/themes/kiond-hiroshima/assets/js/calendar.js?ver=1.0.0

js kiond-hiroshima.com collected 2026-10-08 05:44:15 UTC 3,115 bytes, 86 lines download raw bytes

1jQuery(function ($) {
2  //初期表示の年月
3  $(window).on("load", function () {
4    showCalendar("", "")
5  })
6
7  //前月、次月のリンククリック時
8  $(document).on("click", ".js-button-calendar", function (e) {
9    const year = $(this).attr("data-year")
10    const month = $(this).attr("data-month")
11    showCalendar(year, month)
12  })
13
14  const showCalendar = function (eventYear, eventMonth) {
15    const baseUrl = window.location.protocol + "//" + window.location.host
16    $.ajax({
17      type: "GET",
18      url: `${baseUrl}/wp-json/wp/kiond/calendar_api?_jsonp=callback&eventYear=${eventYear}&eventMonth=${eventMonth}`, //コールバック関数名を指定する。
19      dataType: "jsonp", // クロスドメインリクエストを可能にする
20      jsonpCallback: "callback", //コールバック関数名を指定する。
21      success: function (jsonp) {
22        //console.log("jsonp:" + JSON.stringify(jsonp, null, 2));
23        $("#applyCalendar").html(jsonp.calendar)
24        $("#modals").html(jsonp.modals)
25        $("#yearMonthLabel").html(jsonp.label)
26        $("#prevLink").attr({
27          "data-year": jsonp.prevLink.eventYear,
28          "data-month": jsonp.prevLink.eventMonth,
29        })
30        $("#nextLink").attr({
31          "data-year": jsonp.nextLink.eventYear,
32          "data-month": jsonp.nextLink.eventMonth,
33        })
34
35        const year = jsonp.prevLink.eventYear
36        const month = jsonp.prevLink.eventMonth
37
38        //現在の年月取得
39        const now = new Date()
40        const nowYear = now.getFullYear()
41        const nowMonth = now.getMonth()
42
43        //先月の年月の場合は#prevLinkを非表示
44        if (year == nowYear && month == nowMonth) {
45          //非表示にする前に空要素を挿入
46          $("#prevLink").before(
47            "<div id='prevLinkSpace' style='width: 40px;'></div>"
48          )
49          $("#prevLink").css("display", "none")
50        } else {
51          //非表示要素があれば削除
52          if ($("#prevLinkSpace").length) {
53            $("#prevLinkSpace").remove()
54          }
55          $("#prevLink").css("display", "block")
56        }
57
58        //1年後の年と月を取得
59        const nextYear = parseInt(nowYear) + 1
60        const nextMonth = parseInt(nowMonth)
61        // if (nextMonth > 12) {
62        //   nextYear = nextYear + 1
63        //   nextMonth = nextMonth - 12
64        // }
65
66        //#nextLink のdata-uear と data-month が1年後の年月なら要素を非表示
67        if (nextYear == year && nextMonth == month) {
68          //非表示にする前に空要素を挿入
69          $("#nextLink").before(
70            "<div id='nextLinkSpace' style='width: 40px;'></div>"
71          )
72          $("#nextLink").css("display", "none")
73        } else {
74          //非表示要素があれば削除
75          if ($("#nextLinkSpace").length) {
76            $("#nextLinkSpace").remove()
77          }
78          $("#nextLink").css("display", "block")
79        }
80      },
81      error: function (xhr, status, error) {
82        console.error("Ajax error:", status, error)
83      },
84    })
85  }
86})

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.