From 9425ab5921705ff4cfb7dec10380c33212632e2b Mon Sep 17 00:00:00 2001 From: Vinta Chen Date: Tue, 24 Mar 2026 13:37:35 +0800 Subject: [PATCH] refactor(js): replace var with const for immutable bindings Co-Authored-By: Claude --- website/static/main.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/website/static/main.js b/website/static/main.js index d5ee75ae..7353ff2c 100644 --- a/website/static/main.js +++ b/website/static/main.js @@ -1,4 +1,4 @@ -var reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)"); +const reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)"); function getScrollBehavior() { return reducedMotion.matches ? "auto" : "smooth"; @@ -105,7 +105,7 @@ rows.forEach(function (row, i) { function collapseAll() { if (!tbody) return; - var openRows = tbody.querySelectorAll("tr.row.open"); + const openRows = tbody.querySelectorAll("tr.row.open"); openRows.forEach(function (row) { row.classList.remove("open"); row.setAttribute("aria-expanded", "false"); @@ -122,7 +122,7 @@ function applyFilters() { let show = true; if (activeFilter) { - var rowTags = row.dataset.tags; + const rowTags = row.dataset.tags; show = rowTags ? rowTags.split("||").includes(activeFilter) : false; } @@ -236,7 +236,7 @@ function sortRows() { applyFilters(); } -var sortHeaders = document.querySelectorAll("th[data-sort]"); +const sortHeaders = document.querySelectorAll("th[data-sort]"); function updateSortIndicators() { sortHeaders.forEach(function (th) {