Molodetz blogrol volgens DPP-template
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
import "./components/index.js";
|
||||
import { ContentEnhancer } from "./utils/ContentEnhancer.js";
|
||||
import { FormManager } from "./utils/FormManager.js";
|
||||
import { Http } from "./utils/Http.js";
|
||||
import { LocalTime } from "./utils/LocalTime.js";
|
||||
import { MobileNav } from "./utils/MobileNav.js";
|
||||
import { ModalManager } from "./utils/ModalManager.js";
|
||||
import { PresenceManager } from "./utils/PresenceManager.js";
|
||||
import { ScrollMemory } from "./utils/ScrollMemory.js";
|
||||
import { Tabs } from "./utils/Tabs.js";
|
||||
import { TermsGate } from "./utils/TermsGate.js";
|
||||
import { Toast } from "./utils/Toast.js";
|
||||
|
||||
export class Application {
|
||||
constructor() {
|
||||
this.dialog = document.querySelector("dp-dialog") || document.body.appendChild(document.createElement("dp-dialog"));
|
||||
this.toastHost = document.querySelector("dp-toast");
|
||||
this.http = Http;
|
||||
this.termsGate = new TermsGate(this.dialog);
|
||||
Http.termsGate = this.termsGate;
|
||||
this.forms = new FormManager(this.dialog);
|
||||
this.modals = new ModalManager();
|
||||
this.time = new LocalTime();
|
||||
this.nav = new MobileNav();
|
||||
this.tabs = new Tabs();
|
||||
this.scroll = new ScrollMemory();
|
||||
this.presence = new PresenceManager();
|
||||
this.enhancer = new ContentEnhancer();
|
||||
this.wireCopy();
|
||||
}
|
||||
|
||||
toast(message, kind = "info") {
|
||||
if (this.toastHost?.show) {
|
||||
this.toastHost.show(message, kind);
|
||||
}
|
||||
}
|
||||
|
||||
wireCopy() {
|
||||
document.querySelectorAll("[data-copy]").forEach((node) => {
|
||||
node.title = "Klik om te kopi\u00ebren";
|
||||
node.addEventListener("click", async () => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(node.textContent.trim());
|
||||
this.toast("Gekopieerd");
|
||||
} catch {
|
||||
Toast.flash(node, "Kopi\u00ebren mislukt", 1500);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
window.app = new Application();
|
||||
document.documentElement.dataset.app = "ready";
|
||||
Reference in New Issue
Block a user