From: Marc Foley Date: Mon, 9 Jun 2025 09:51:31 +0000 (+0100) Subject: tags.html: add filter, sort and search to url X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F9543%2Fhead;p=thirdparty%2Fgoogle%2Ffonts.git tags.html: add filter, sort and search to url --- 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) {