mirror of
https://github.com/matrix-org/matrix-spec
synced 2026-04-30 14:14:09 +02:00
Compare commits
5 commits
9ad2cde1b4
...
2dd6625339
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2dd6625339 | ||
|
|
77b37cb9a9 | ||
|
|
9170eacfcd | ||
|
|
eea13b0ff2 | ||
|
|
5fe78ced53 |
|
|
@ -14,9 +14,27 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// This oddity is an attempt at producing a readable Hugo template while avoiding
|
||||
// JS syntax errors in your IDE
|
||||
const currentVersion = `{{ if eq .Site.Params.version.status "unstable" }}
|
||||
{{- /**/ -}}
|
||||
unstable
|
||||
{{- /**/ -}}
|
||||
{{ else }}
|
||||
{{- /**/ -}}
|
||||
{{ printf "v%s.%s" .Site.Params.version.major .Site.Params.version.minor }}
|
||||
{{- /**/ -}}
|
||||
{{ end }}`;
|
||||
|
||||
function appendVersion(parent, name, url) {
|
||||
// The list item
|
||||
const li = document.createElement("li");
|
||||
if (name === currentVersion) {
|
||||
li.classList.add("selected")
|
||||
}
|
||||
if (name === "unstable") {
|
||||
li.classList.add("unstable")
|
||||
}
|
||||
parent.appendChild(li);
|
||||
|
||||
// The link
|
||||
|
|
@ -74,5 +92,5 @@ fetch("/versions.json")
|
|||
}
|
||||
|
||||
// For historical versions, simply link to the changelog
|
||||
appendVersion(ul, "historical", "/changelog/historical/");
|
||||
appendVersion(ul, "historical", '{{ (site.GetPage "changelog/historical").RelPermalink }}');
|
||||
});
|
||||
|
|
@ -50,6 +50,20 @@ Custom SCSS for the Matrix spec
|
|||
a {
|
||||
color: $black;
|
||||
}
|
||||
|
||||
/* Make the version dropdown scroll if its too large */
|
||||
ul#version-selector {
|
||||
max-height: 80vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
ul#version-selector li.selected a {
|
||||
color: $secondary;
|
||||
}
|
||||
|
||||
ul#version-selector li.unstable:not(.selected) a {
|
||||
color: $warning;
|
||||
}
|
||||
}
|
||||
|
||||
/* Styles for the sidebar nav */
|
||||
|
|
|
|||
|
|
@ -8,5 +8,10 @@
|
|||
*/}}
|
||||
{{ $toc := resources.Get "js/toc.js" -}}
|
||||
<script defer src="{{ $toc.RelPermalink }}"></script>
|
||||
{{ $versions := resources.Get "js/versions.js" -}}
|
||||
<script defer src="{{ $versions.RelPermalink }}"></script>
|
||||
|
||||
{{- /* Load the versions script template, run and publish it */ -}}
|
||||
{{ with resources.Get "js/versions.template.js" }}
|
||||
{{ with resources.ExecuteAsTemplate "js/versions.js" $ . }}
|
||||
<script defer src="{{ .RelPermalink }}"></script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,6 @@
|
|||
All Versions
|
||||
</a>
|
||||
<ul class="dropdown-menu" id="version-selector">
|
||||
{{- /* The menu is built by version.js */ -}}
|
||||
{{- /* The menu is built by versions.template.js */ -}}
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue