Skip to content

Commit

Permalink
Add a way to fold the apworld tables
Browse files Browse the repository at this point in the history
  • Loading branch information
Eijebong committed May 21, 2024
1 parent 4e3c0c2 commit e286ec5
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion static/css/base.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/css/base.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions static/sass/base.sass
Original file line number Diff line number Diff line change
Expand Up @@ -760,3 +760,13 @@ dialog::backdrop
body:has(dialog[open])
overflow: hidden
scrollbar-gutter: stable

.clickable
cursor: pointer

.hidden-table
display: none
margin-bottom: 10em

.visible-table
display: table
36 changes: 29 additions & 7 deletions templates/apworlds.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
{% block menu %}
{% endblock %}

{% macro apworlds_table(apworlds) %}

<table class="styled yamls">
{% macro apworlds_table(apworlds, id) %}
<table class="styled yamls" id="{{id}}">
<thead>
<tr>
<td>World</td>
Expand Down Expand Up @@ -59,13 +58,36 @@

{% endif %}
</table>
<h6><a href="{{ index.common.archipelago_repo }}">Official apworlds</a></h6>
{% call apworlds_table(supported_apworlds) %}
<h6>Unofficial apworlds <i class="fa fa-warning" title="Those are unsupported apworlds, please always be careful when generating with them"></i></h6>
{% call apworlds_table(unsupported_apworlds) %}
<h6 style="margin-bottom: 1em;"><a href="{{ index.common.archipelago_repo }}">Official apworlds ({{index.common.archipelago_version}})</a> <span id="official-visibility" class="clickable">(Hide)</span></h6>
{% call apworlds_table(supported_apworlds, "official") %}

<h6 style="margin-bottom: 1em;">Unofficial apworlds <i class="fa fa-warning" title="Those are unsupported apworlds, please always be careful when generating with them"></i> <span id="unsupported-visibility" class="clickable">(Hide)</span></h6>
{% call apworlds_table(unsupported_apworlds, "unsupported") %}
{%endblock%}

{% block scripts %}
<script>
function setupHideableTable(spanId, tableId) {
const span = document.getElementById(spanId);
const table = document.getElementById(tableId);

span.onclick = () => {
if (table.className.includes("hidden-table")) {
span.innerText = "(Hide)";
table.className = "styled yamls visible-table";
} else {
span.innerText = "(Show)";
table.className = "styled yamls hidden-table";
}
}
}

setupHideableTable("official-visibility", "official");
setupHideableTable("unsupported-visibility", "unsupported");

const officialSpan = document.getElementById("official-visibility").click()
</script>

{% endblock %}

{% block styles %}
Expand Down

0 comments on commit e286ec5

Please sign in to comment.