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.