From feba8a23298856d71b4a033e722a6da6d7018060 Mon Sep 17 00:00:00 2001 From: Marc Foley Date: Mon, 9 Jun 2025 10:51:31 +0100 Subject: [PATCH] tags.html: add filter, sort and search to url --- .ci/tags.html | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/.ci/tags.html b/.ci/tags.html index 93af6d32a..a903d3a61 100644 --- a/.ci/tags.html +++ b/.ci/tags.html @@ -354,6 +354,15 @@ function axesCombos(axes) { currentCategory(newCategory) { this.updateURL(); }, + tagFilter(newFilter) { + this.updateURL(); + }, + sortMethod(newSort) { + this.updateURL(); + }, + reverseTags(newReverse) { + this.updateURL(); + }, }, async created() { await this.getFamilyData() @@ -364,10 +373,24 @@ function axesCombos(axes) { mounted() { const urlParams = new URLSearchParams(window.location.search); const category = urlParams.get('category'); + const filter = urlParams.get('filter'); + const sort_ = urlParams.get('sort'); + const reverse = urlParams.get('reverse'); if (category) { this.currentCategory = category; } const commit = urlParams.get('commit'); + if (filter) { + this.tagFilter = filter; + } + if (sort_) { + this.sortMethod = sort_; + } + if (reverse === "true") { + this.reverseTags = true; + } else { + this.reverseTags = false; + } if (commit) { this.commit = commit; this.loadCSV(); @@ -510,6 +533,21 @@ function axesCombos(axes) { } else { url.searchParams.delete('category'); } + if (this.tagFilter !== "") { + url.searchParams.set('filter', this.tagFilter); + } else { + url.searchParams.delete('filter'); + } + if (this.sortMethod !== "") { + url.searchParams.set('sort', this.sortMethod); + } else { + url.searchParams.delete('sort'); + } + if (this.reverseTags !== "") { + url.searchParams.set('reverse', this.reverseTags); + } else { + url.searchParams.delete('reverse'); + } history.pushState(null, '', url); }, familyPangram(family) { -- 2.47.2