feat(dossiers-ngi): inject-editions-bar.sh for freeze HTML missing include
This commit is contained in:
parent
27c7f4e37e
commit
52e5c1d328
9 changed files with 218 additions and 46 deletions
|
|
@ -44,10 +44,10 @@
|
|||
var buildSec = row.build_seconds;
|
||||
var parts = [];
|
||||
if (tip) parts.push(esc("@" + tip));
|
||||
if (tipTime) parts.push(esc("tip " + shortTime(tipTime)));
|
||||
if (tipTime) parts.push(esc(shortTime(tipTime)));
|
||||
if (buildSec != null && buildSec !== "")
|
||||
parts.push(esc("build " + fmtBuildSec(buildSec)));
|
||||
if (builtAt) parts.push(esc("at " + shortTime(builtAt)));
|
||||
parts.push(esc(fmtBuildSec(buildSec)));
|
||||
if (builtAt) parts.push(esc(shortTime(builtAt)));
|
||||
// vs parent: +grün / −rot (omit when no parent)
|
||||
var plus = row.vs_parent_plus;
|
||||
var minus = row.vs_parent_minus;
|
||||
|
|
@ -111,6 +111,17 @@
|
|||
return parts.join("\n");
|
||||
}
|
||||
|
||||
function pinBar(timingMsg) {
|
||||
var bar = document.getElementById("cascade-bar");
|
||||
if (!bar) return;
|
||||
if (timingMsg) {
|
||||
bar.setAttribute("data-timing", timingMsg);
|
||||
bar.setAttribute("title", timingMsg);
|
||||
}
|
||||
var h = bar.offsetHeight || 0;
|
||||
document.documentElement.style.setProperty("--cascade-pad", h + "px");
|
||||
}
|
||||
|
||||
function markActive(root, edition) {
|
||||
var links = root.querySelectorAll("a[data-edition]");
|
||||
for (var i = 0; i < links.length; i++) {
|
||||
|
|
@ -190,6 +201,7 @@
|
|||
timingEl.parentNode.removeChild(timingEl);
|
||||
}
|
||||
markActive(mount, cookieEdition());
|
||||
pinBar(t);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -199,6 +211,7 @@
|
|||
var list = (data && data.branches) || [];
|
||||
if (!list.length) {
|
||||
mount.textContent = "No branches in branch-status.json";
|
||||
pinBar();
|
||||
return;
|
||||
}
|
||||
if (soft && mount.getAttribute("data-structure") === structureKey(list)) {
|
||||
|
|
@ -251,6 +264,7 @@
|
|||
mount.innerHTML = html.join("");
|
||||
mount.setAttribute("data-structure", structureKey(list));
|
||||
markActive(mount, cookieEdition());
|
||||
pinBar(t);
|
||||
}
|
||||
|
||||
function loadStatus(soft) {
|
||||
|
|
@ -269,6 +283,7 @@
|
|||
'<a class="cascade-tree-row" href="/_cascade/use/flask" data-edition="flask" data-branch="flask"><code>flask</code></a>' +
|
||||
'<span class="tip"> (branch-status unavailable)</span>';
|
||||
markActive(mount, cookieEdition());
|
||||
pinBar();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -277,4 +292,7 @@
|
|||
setInterval(function () {
|
||||
loadStatus(true);
|
||||
}, POLL_MS);
|
||||
window.addEventListener("resize", function () {
|
||||
pinBar();
|
||||
});
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue