This commit is contained in:
lol
2026-06-13 20:42:03 +02:00
commit 58720611f7
12 changed files with 911 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
const TEMPLATE = document.createElement("template");
TEMPLATE.innerHTML = `<span class="hours">--</span><span class="deux-points">:</span><span class="minutes">--</span>`
class ClockElement extends HTMLElement {
constructor(){
super()
setInterval(this.updateContent.bind(this), 1000);
}
connectedCallback(){
this.replaceChildren(TEMPLATE.content.cloneNode(true))
this.updateContent()
}
updateContent(){
if(!this.querySelector(".hours"))
return
let now = new Date();
this.querySelector(".hours").textContent = now.getHours().toString().padStart(2, "0")
this.querySelector(".minutes").textContent = now.getMinutes().toString().padStart(2, "0")
this.setAttribute("datetime", now.toISOString())
}
}
customElements.define("gavle-clock", ClockElement)
+34
View File
@@ -0,0 +1,34 @@
const TEMPLATE = document.createElement("template");
class NextBusElement extends HTMLElement {
#stop
get stopId(){
return this.#stop
}
set stopId(value){
this.#stop = value
this.updateContent()
}
connectedCallback(){
this.replaceChildren(TEMPLATE.content.cloneNode(true))
}
updateContent(){
}
static observedAttributes = ["stop-id"]
attributeChangedCallback(name, oldVal, newVal){
switch(name){
case "stop-id":
this.stopId = newVal
break;
}
}
}
customElements.define("camp-next-bus", NextBusElement);