async function setup() { const hi = setInterval(() => { const header = document.getElementById("xrk-header"); if (header) { const html = `

Menu

XR Kaigiに参加する`; header.innerHTML = html; const current = header.getAttribute('current-page'); if (current && document.getElementById("xrk-h-pc-"+current)) { document.getElementById("xrk-h-pc-"+current).classList.add("xrk-h-current") } clearInterval(hi); } else { // console.log("!!! no header"); } },300); const fi = setInterval(() => { const footer = document.getElementById("xrk-footer"); if (footer) { // console.log(">>> footer found") footer.innerHTML = `

公式アカウントをフォローして、最新情報をチェック!

`; clearInterval(fi); } else { // console.log("!!! no footer"); } },300); const informationSection = document.getElementsByClassName("container widget-header"); if (informationSection.length === 1) { const section = informationSection[0].parentNode.parentNode section.id = "xrk-information"; section.classList.add("xrk-base"); const childSection = informationSection[0].parentNode childSection.classList.add("xrk-container") const dateTexts = section.getElementsByClassName("information-date__text") Object.values(dateTexts).forEach(dt => { const dateArr = dt.innerText.split(".") dt.innerText = dateArr.join("/") }) } } function topStop() { const isPC = window.innerWidth > 768; const header = document.getElementById(isPC ? "xrk-h-pc" : "xrk-h-sp-fix"); const ann = document.getElementById("xrk-announce-bar") if (ann.getBoundingClientRect().bottom <= 0 && !header.classList.contains("top-stop")) { header.classList.add("top-stop") addMargin(header, true) } else if (ann.getBoundingClientRect().bottom > 0 && header.classList.contains("top-stop")){ header.classList.remove("top-stop") addMargin(header, false) } } function addMargin(header, needsMargin) { const nextDOM = document.getElementsByClassName("top-stop-margin") if (nextDOM.length === 1) { if (needsMargin) { nextDOM[0].style = `margin-top: ${header.offsetHeight}px`; } else { nextDOM[0].style = ""; } } } window.addEventListener("resize", () => { if (window.innerWidth > 768) { const ann = document.getElementById("xrk-announce-bar") if (ann.getBoundingClientRect().bottom <= 0) { addMargin(true) } else { addMargin(false) } } }) window.addEventListener("scroll", topStop)