Move old version notice into template with .hidden

This commit is contained in:
object-Object 2023-09-05 20:33:26 -04:00
parent fbce5b421e
commit e2a5025ec8
3 changed files with 12 additions and 12 deletions

View file

@ -17,8 +17,10 @@
progression. Alternatively, click <a href="?nospoiler">here</a> to get a version with all spoilers showing.
</p>
{% if not is_bleeding_edge %}
<div id="old-version-notice"></div>
{% endif %}
{# conditionally revealed using js #}
<span id="old-version-notice" class="hidden">
<br />
<i>The past is a foreign country; they do things differently there.</i>
</span>
</blockquote>
</div>

View file

@ -109,6 +109,11 @@ canvas.spell-viz {
white-space: nowrap;
}
.hidden {
display: none;
visibility: hidden;
}
@media (min-width: 40rem) {
.book-body {
width: 70%;

View file

@ -370,17 +370,10 @@ function sortSitemapVersions(sitemap) {
function addDropdowns(sitemap) {
let [branches, versions] = sortSitemapVersions(sitemap);
// set the "old version" message if this page is a version number, but not the latest one
// reveal the "old version" message if this page is a version number, but not the latest one
// this isn't a dropdown, but it's here since we have the data anyway
if (versions.slice(1).includes(VERSION)) {
// thanks for the idea petra
let oldVersionNotice = document.createElement("i");
oldVersionNotice.textContent = "The past is a foreign country; they do things differently there.";
document.getElementById("old-version-notice").append(
document.createElement("br"),
oldVersionNotice,
);
document.getElementById("old-version-notice").classList.remove("hidden")
}
// versions