mirror of
https://github.com/matrix-org/matrix-spec
synced 2026-05-02 07:04:09 +02:00
Compare commits
1 commit
2dd6625339
...
9ad2cde1b4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9ad2cde1b4 |
|
|
@ -14,27 +14,9 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
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) {
|
function appendVersion(parent, name, url) {
|
||||||
// The list item
|
// The list item
|
||||||
const li = document.createElement("li");
|
const li = document.createElement("li");
|
||||||
if (name === currentVersion) {
|
|
||||||
li.classList.add("selected")
|
|
||||||
}
|
|
||||||
if (name === "unstable") {
|
|
||||||
li.classList.add("unstable")
|
|
||||||
}
|
|
||||||
parent.appendChild(li);
|
parent.appendChild(li);
|
||||||
|
|
||||||
// The link
|
// The link
|
||||||
|
|
@ -92,5 +74,5 @@ fetch("/versions.json")
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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", "/changelog/historical/");
|
||||||
});
|
});
|
||||||
|
|
@ -50,20 +50,6 @@ Custom SCSS for the Matrix spec
|
||||||
a {
|
a {
|
||||||
color: $black;
|
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 */
|
/* Styles for the sidebar nav */
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,5 @@
|
||||||
*/}}
|
*/}}
|
||||||
{{ $toc := resources.Get "js/toc.js" -}}
|
{{ $toc := resources.Get "js/toc.js" -}}
|
||||||
<script defer src="{{ $toc.RelPermalink }}"></script>
|
<script defer src="{{ $toc.RelPermalink }}"></script>
|
||||||
|
{{ $versions := resources.Get "js/versions.js" -}}
|
||||||
{{- /* Load the versions script template, run and publish it */ -}}
|
<script defer src="{{ $versions.RelPermalink }}"></script>
|
||||||
{{ 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
|
All Versions
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu" id="version-selector">
|
<ul class="dropdown-menu" id="version-selector">
|
||||||
{{- /* The menu is built by versions.template.js */ -}}
|
{{- /* The menu is built by version.js */ -}}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue