mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-29 00:55:32 +00:00
added views
This commit is contained in:
22
views/assets/scripts.js
Normal file
22
views/assets/scripts.js
Normal file
@@ -0,0 +1,22 @@
|
||||
function a() {
|
||||
document.querySelectorAll("template[simple]").forEach((l) => {
|
||||
let s = l.getAttribute("id"), n = l.content;
|
||||
customElements.define(s, class extends HTMLElement {
|
||||
constructor() {
|
||||
super(), this.appendChild(n.cloneNode(!0)), this.slots = this.querySelectorAll("slot");
|
||||
}
|
||||
connectedCallback() {
|
||||
let o = [];
|
||||
this.slots.forEach((e) => {
|
||||
let r = e.getAttribute("name"), t = this.querySelector(`[slot="${r}"]`);
|
||||
t && (e.replaceWith(t.cloneNode(!0)), o.push(t));
|
||||
}), o.forEach((e) => {
|
||||
e.remove();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
export {
|
||||
a as setup
|
||||
};
|
||||
Reference in New Issue
Block a user