Added support for hiding versions from selector

This commit is contained in:
squidfunk 2024-03-13 17:42:16 +07:00
parent babc9950db
commit 2f1b2e9500
No known key found for this signature in database
GPG Key ID: 5ED40BC4F9C436DF
4 changed files with 15 additions and 6 deletions

View File

@ -249,7 +249,7 @@
</script> </script>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script src="{{ 'assets/javascripts/bundle.c8d2eff1.min.js' | url }}"></script> <script src="{{ 'assets/javascripts/bundle.bd41221c.min.js' | url }}"></script>
{% for script in config.extra_javascript %} {% for script in config.extra_javascript %}
{{ script | script_tag }} {{ script | script_tag }}
{% endfor %} {% endfor %}

View File

@ -27,6 +27,13 @@ import { h } from "~/utilities"
* Types * Types
* ------------------------------------------------------------------------- */ * ------------------------------------------------------------------------- */
/**
* Version properties
*/
export interface VersionProperties {
hidden?: boolean /* Version is hidden */
}
/** /**
* Version * Version
*/ */
@ -34,6 +41,7 @@ export interface Version {
version: string /* Version identifier */ version: string /* Version identifier */
title: string /* Version title */ title: string /* Version title */
aliases: string[] /* Version aliases */ aliases: string[] /* Version aliases */
properties?: VersionProperties /* Version properties */
} }
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
@ -76,6 +84,7 @@ function renderVersion(version: Version): HTMLElement {
export function renderVersionSelector( export function renderVersionSelector(
versions: Version[], active: Version versions: Version[], active: Version
): HTMLElement { ): HTMLElement {
versions = versions.filter(version => !version.properties?.hidden)
return ( return (
<div class="md-version"> <div class="md-version">
<button <button