]> git.ipfire.org Git - thirdparty/google/fonts.git/commitdiff
tags.html: add filter, sort and search to url 9543/head
authorMarc Foley <m.foley.88@gmail.com>
Mon, 9 Jun 2025 09:51:31 +0000 (10:51 +0100)
committerMarc Foley <m.foley.88@gmail.com>
Mon, 9 Jun 2025 09:51:31 +0000 (10:51 +0100)
.ci/tags.html

index 93af6d32a8218632f93fc4c2d0931f0dc11e00ff..a903d3a612374853183295d85d1ce348ae072078 100644 (file)
@@ -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) {