39 lines
858 B
JavaScript
39 lines
858 B
JavaScript
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
|