Main website; deployed on jae.fi; uses GoHugo.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
staticweb/layouts/shortcodes/juche.html

38 lines
1.1 KiB

<script type="text/javascript">
const template = document.createElement("template");
template.innerHTML = `<span id="ctx"></span>`;
class JucheCalendar extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: "open" });
this.shadowRoot.appendChild(template.content.cloneNode(true));
let currentDate = new Date();
let currentYear = currentDate.getFullYear() + 1;
let currentMonth = currentDate.getMonth() + 1;
let currentDay = currentDate.getDay() + 1;
let jucheYear = currentYear - 1912;
console.log(jucheYear);
const content = `
<p class="phead">Juche ${jucheYear} ${currentMonth}.${currentDay}</p>
`;
this.shadowRoot
.querySelector("#ctx")
.insertAdjacentHTML("afterbegin", content);
}
}
window.customElements.define("juche-calendar", JucheCalendar);
</script>
<noscript>
You need to have JavaScript enabled to see the calendar widget
</noscript>
<juche-calendar>
If you see this, there has been a problem in the initialization. Reload the page or try again later.
</juche-calendar>