PageSourceSearch

https://e-butsudan.com/build/assets/calendar-BWFDT0ub.js

js e-butsudan.com collected 2026-10-02 17:41:30 UTC 3,878 bytes, 13 lines download raw bytes

1class L{constructor(t){this.selectedDate=null,this.currentDate=new Date,this.input=document.getElementById(t.inputId),this.calendar=document.getElementById(t.calendarId),this.onSelect=t.onSelect,this.regularHolidays=t.regularHolidays||[],this.temporaryHolidays=t.temporaryHolidays||[],this.init()}init(){if(!this.input||!this.calendar)return;this.calendar.innerHTML=`
2      <div class="calendar-header">
3        <div class="calendar-nav">
4          <button type="button" class="prev-month">◀</button>
5          <div class="calendar-month"></div>
6          <button type="button" class="next-month">▶</button>
7        </div>
8      </div>
9      <div class="calendar-weekdays">
10        <div>日</div><div>月</div><div>火</div><div>水</div><div>木</div><div>金</div><div>土</div>
11      </div>
12      <div class="calendar-days"></div>
13    `,this.input.addEventListener("click",s=>{s.preventDefault(),this.calendar.classList.toggle("active"),this.render()});const t=this.calendar.querySelector(".prev-month");t&&t.addEventListener("click",()=>{const s=new Date;(this.currentDate.getFullYear()>s.getFullYear()||this.currentDate.getFullYear()===s.getFullYear()&&this.currentDate.getMonth()>s.getMonth())&&(this.currentDate.setMonth(this.currentDate.getMonth()-1),this.render())});const e=this.calendar.querySelector(".next-month");e&&e.addEventListener("click",()=>{this.currentDate.setMonth(this.currentDate.getMonth()+1),this.render()}),document.addEventListener("click",s=>{!this.calendar.contains(s.target)&&!this.input.contains(s.target)&&this.calendar.classList.contains("active")&&this.calendar.classList.remove("active")})}render(){if(!this.calendar||!this.input)return;const t=this.currentDate.getFullYear(),e=this.currentDate.getMonth(),s=new Date,h=["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],r=this.calendar.querySelector(".calendar-month");r&&(r.textContent=`${t}年 ${h[e]}`);const i=this.calendar.querySelector(".calendar-days");if(!i)return;i.innerHTML="";const c=new Date(t,e,1).getDay(),d=new Date(t,e+1,0).getDate(),u=new Date(t,e,0).getDate(),l=new Date;for(let n=c-1;n>=0;n--){const a=document.createElement("div");a.classList.add("calendar-day","disabled"),a.textContent=`${u-n}`,i.appendChild(a)}for(let n=1;n<=d;n++){const a=document.createElement("div");a.classList.add("calendar-day"),a.textContent=`${n}`,t===l.getFullYear()&&e===l.getMonth()&&n===l.getDate()&&a.classList.add("today"),this.selectedDate&&t===this.selectedDate.getFullYear()&&e===this.selectedDate.getMonth()&&n===this.selectedDate.getDate()&&a.classList.add("selected");const v=new Date(t,e,n),g=`${t}-${(e+1).toString().padStart(2,"0")}-${n.toString().padStart(2,"0")}`;this.temporaryHolidays.includes(g)?(a.classList.add("is-disabled-holiday","is-temporary-holiday","disabled"),a.title="臨時休業日"):this.isRegularHoliday(t,e,n)?(a.classList.add("is-disabled-holiday","is-regular-holiday","disabled"),a.title="定休日"):v<new Date(l.getFullYear(),l.getMonth(),l.getDate())?a.classList.add("disabled"):a.addEventListener("click",()=>{this.selectedDate=new Date(t,e,n);const D=(e+1).toString().padStart(2,"0"),m=n.toString().padStart(2,"0"),p=`${t}-${D}-${m}`;this.input.value=p,this.calendar.classList.remove("active"),this.onSelect()}),i.appendChild(a)}const y=42-(c+d);for(let n=1;n<=y;n++){const a=document.createElement("div");a.classList.add("calendar-day","disabled"),a.textContent=`${n}`,i.appendChild(a)}const o=this.calendar.querySelector(".prev-month");o&&(t<s.getFullYear()||t===s.getFullYear()&&e<=s.getMonth()?o.disabled=!0:o.disabled=!1)}updateHolidays(t,e){this.regularHolidays=t,this.temporaryHolidays=e,this.render()}isRegularHoliday(t,e,s){const r=new Date(t,e,s).getDay();let i=0;for(let d=1;d<=s;d++)new Date(t,e,d).getDay()===r&&i++;const c=(i-1)*7+r+1;return this.regularHolidays.includes(c)}}export{L as C};

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.