koopa-admin-log/sites/dossiers.ngi.hacktivism.ch/_cascade/bar.js
2026-09-30 13:01:15 +02:00

24 lines
774 B
JavaScript

(function () {
var nodes = document.querySelectorAll(".cascade-bar [data-tip]");
if (!nodes.length) return;
fetch("/branch-status.json", { cache: "no-store" })
.then(function (res) {
if (!res.ok) throw new Error("status");
return res.json();
})
.then(function (data) {
var tips = {};
var list = (data && data.branches) || [];
for (var i = 0; i < list.length; i++) {
var row = list[i];
if (row && row.branch && row.tip) tips[row.branch] = row.tip;
}
for (var j = 0; j < nodes.length; j++) {
var el = nodes[j];
var name = el.getAttribute("data-tip");
var tip = tips[name];
if (tip) el.textContent = name + " @ " + tip;
}
})
.catch(function () {});
})();