This commit is contained in:
Gaspard Jankowiak 2026-10-28 12:26:31 +01:00
commit 3daa151896

39
common.js Normal file
View file

@ -0,0 +1,39 @@
const Common = {};
const HTTPP = document.location.protocol + "//" + document.location.host;
var currentGroupName = "";
// helpers
const $C = (e, opts = {}) => {
const elem = document.createElement(e);
for (const key in opts) {
if (key == "classList") {
const cl = opts[key];
if (typeof (cl) == "string") {
elem.classList.add(cl);
} else {
elem.classList.add(...cl);
}
continue;
} else if (key == "children") {
elem.append(...opts[key]);
continue;
} else if (key == "title") {
elem.setAttribute(key, opts[key]);
continue;
}
elem[key] = opts[key];
}
return elem;
}
const $G = (e) => document.getElementById(e);
const $S = (s) => document.querySelector(s);
Common.$G = $G;
Common.$C = $C;
Common.initializeModal = initializeModal;
// vim: ts=2 sts=2 sw=2