mirror of
https://github.com/matrix-org/matrix-spec
synced 2026-04-28 21:34:09 +02:00
Compare commits
5 commits
e698268fb6
...
e4df2002a0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e4df2002a0 | ||
|
|
54944e2866 | ||
|
|
13aa6e83ae | ||
|
|
705240da72 | ||
|
|
4dbe080570 |
|
|
@ -40,14 +40,14 @@ const currentSegment = segmentMatches ? segmentMatches[0] : undefined;
|
||||||
// fall back to the version as defined in Hugo.
|
// fall back to the version as defined in Hugo.
|
||||||
const selected = currentSegment ?? currentVersion;
|
const selected = currentSegment ?? currentVersion;
|
||||||
|
|
||||||
function appendVersion(parent, name, url) {
|
function appendVersion(parent, name, segment, url) {
|
||||||
// The list item
|
// The list item
|
||||||
const li = document.createElement("li");
|
const li = document.createElement("li");
|
||||||
if (name === selected) {
|
if (segment === selected) {
|
||||||
li.classList.add("selected");
|
li.classList.add("version-picker-selected");
|
||||||
}
|
}
|
||||||
if (name === "latest") {
|
if (segment === "latest") {
|
||||||
li.classList.add("latest");
|
li.classList.add("version-picker-latest");
|
||||||
}
|
}
|
||||||
parent.appendChild(li);
|
parent.appendChild(li);
|
||||||
|
|
||||||
|
|
@ -74,7 +74,7 @@ function appendVersion(parent, name, url) {
|
||||||
// Otherwise, stop further event handling and replace the segment
|
// Otherwise, stop further event handling and replace the segment
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
window.location.href = href.replace(`/${currentSegment}/`, `/${name}/`);
|
window.location.href = href.replace(`/${currentSegment}/`, `/${segment}/`);
|
||||||
});
|
});
|
||||||
|
|
||||||
// The link text
|
// The link text
|
||||||
|
|
@ -100,14 +100,15 @@ fetch(url)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a entries for the unstable version and the "latest" shortcut
|
// Add a entries for the unstable version and the "latest" shortcut
|
||||||
appendVersion(ul, "unstable", "https://spec.matrix.org/unstable");
|
appendVersion(ul, "unstable", "unstable", "https://spec.matrix.org/unstable");
|
||||||
appendVersion(ul, "latest", "https://spec.matrix.org/latest");
|
const latestName = versions?.length ? `latest (${versions[0].name})` : "latest";
|
||||||
|
appendVersion(ul, latestName, "latest", "https://spec.matrix.org/latest");
|
||||||
|
|
||||||
// Add an entry for each proper version
|
// Add an entry for each proper version
|
||||||
for (const version of versions) {
|
for (const version of versions) {
|
||||||
appendVersion(ul, version.name, `https://spec.matrix.org/${version.name}`);
|
appendVersion(ul, version.name, version.name, `https://spec.matrix.org/${version.name}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// For historical versions, simply link to the changelog
|
// For historical versions, simply link to the changelog
|
||||||
appendVersion(ul, "historical", '{{ (site.GetPage "changelog/historical").RelPermalink }}');
|
appendVersion(ul, "historical", "historical", '{{ (site.GetPage "changelog/historical").RelPermalink }}');
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -51,17 +51,17 @@ Custom SCSS for the Matrix spec
|
||||||
color: $black;
|
color: $black;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make the version dropdown scroll if its too large */
|
/* Make the version dropdown scroll if it's too large */
|
||||||
ul#version-selector {
|
ul#version-selector {
|
||||||
max-height: 80vh;
|
max-height: 80vh;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul#version-selector li.selected a {
|
ul#version-selector li.version-picker-selected a {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul#version-selector li.latest a {
|
ul#version-selector li.version-picker-latest a {
|
||||||
color: $secondary;
|
color: $secondary;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
1
changelogs/internal/newsfragments/2260.clarification
Normal file
1
changelogs/internal/newsfragments/2260.clarification
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Add version picker in the navbar.
|
||||||
1
changelogs/internal/newsfragments/2261.clarification
Normal file
1
changelogs/internal/newsfragments/2261.clarification
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Add version picker in the navbar.
|
||||||
1
changelogs/internal/newsfragments/2264.clarification
Normal file
1
changelogs/internal/newsfragments/2264.clarification
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Add version picker in the navbar.
|
||||||
1
changelogs/internal/newsfragments/2268.clarification
Normal file
1
changelogs/internal/newsfragments/2268.clarification
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Add version picker in the navbar.
|
||||||
|
|
@ -16,6 +16,9 @@ const purgecss = require('@fullhuman/postcss-purgecss')({
|
||||||
extensions: ["json"],
|
extensions: ["json"],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
// As these classes are only applied by JavaScript, PurgeCSS doesn't see them
|
||||||
|
// in the source code and removes them unless we explicitly tell it not to.
|
||||||
|
safelist: ['version-picker-selected', 'version-picker-latest']
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue