2025-04-09 11:48:24 -04:00
|
|
|
let config;
|
|
|
|
let debug = false;
|
|
|
|
|
|
|
|
function initToggleConfig() {
|
|
|
|
const configurationElement = document.getElementById("configuration");
|
|
|
|
if (configurationElement) {
|
|
|
|
config = configurationElement;
|
2025-04-09 08:09:03 -04:00
|
|
|
hideConfig();
|
2025-04-09 11:48:24 -04:00
|
|
|
} else if (debug) {
|
|
|
|
console.error("Configuration element not found.");
|
|
|
|
}
|
2025-04-09 08:09:03 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
function hideConfig() {
|
2025-04-09 11:48:24 -04:00
|
|
|
if (config) {
|
2025-04-09 08:09:03 -04:00
|
|
|
config.style.display = "none";
|
2025-04-09 11:48:24 -04:00
|
|
|
} else if (debug && !document.querySelector("#expandConfig")) {
|
|
|
|
console.error("ExpandConfig link element not found.");
|
|
|
|
}
|
2025-04-09 08:09:03 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
function showConfig() {
|
2025-04-09 11:48:24 -04:00
|
|
|
if (document.querySelector("#collapseConfig")) {
|
2025-04-09 08:09:03 -04:00
|
|
|
config.style.display = "block";
|
2025-04-09 11:48:24 -04:00
|
|
|
} else if (debug) {
|
|
|
|
console.error("CollapseConfig link element not found.");
|
|
|
|
}
|
2025-04-09 08:09:03 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
function clean() {
|
2025-04-09 11:48:24 -04:00
|
|
|
const expandConfigElement = document.getElementById("expandConfig");
|
|
|
|
const collapseConfigElement = document.getElementById("collapseConfig");
|
|
|
|
|
|
|
|
if (expandConfigElement) {
|
|
|
|
expandConfigElement.remove();
|
2025-04-09 08:09:03 -04:00
|
|
|
}
|
2025-04-09 11:48:24 -04:00
|
|
|
|
|
|
|
if (collapseConfigElement) {
|
|
|
|
collapseConfigElement.remove();
|
2025-04-09 08:09:03 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function expand() {
|
|
|
|
clean();
|
2025-04-09 11:48:24 -04:00
|
|
|
const x = document.createElement("link");
|
|
|
|
x.type = "text/css";
|
|
|
|
x.rel = "stylesheet";
|
|
|
|
x.href = "/prometheus/resources/expand.css";
|
2025-04-09 08:09:03 -04:00
|
|
|
x.setAttribute("id", "expandConfig");
|
|
|
|
document.head.appendChild(x);
|
|
|
|
showConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
function collapse() {
|
|
|
|
clean();
|
2025-04-09 11:48:24 -04:00
|
|
|
const c = document.createElement("link");
|
|
|
|
c.type = "text/css";
|
|
|
|
c.rel = "stylesheet";
|
|
|
|
c.href = "/prometheus/resources/collapse.css";
|
2025-04-09 08:09:03 -04:00
|
|
|
c.setAttribute("id", "collapseConfig");
|
|
|
|
document.head.appendChild(c);
|
|
|
|
hideConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
function copyText() {
|
2025-04-09 11:48:24 -04:00
|
|
|
navigator.clipboard.writeText("Some text to copy").then(
|
|
|
|
() => console.log('Copy successful'),
|
|
|
|
err => console.error('Copy failed: ', err)
|
|
|
|
);
|
2025-04-09 08:09:03 -04:00
|
|
|
}
|
|
|
|
|
2025-04-09 11:48:24 -04:00
|
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
|
|
initToggleConfig();
|
2025-04-09 08:09:03 -04:00
|
|
|
}, true);
|