refactor(js): replace var with const for immutable bindings

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Vinta Chen 2026-03-24 13:37:35 +08:00
parent 7b6829c26e
commit 9425ab5921
No known key found for this signature in database
GPG Key ID: B93DE4F003C33630

View File

@ -1,4 +1,4 @@
var reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)"); const reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)");
function getScrollBehavior() { function getScrollBehavior() {
return reducedMotion.matches ? "auto" : "smooth"; return reducedMotion.matches ? "auto" : "smooth";
@ -105,7 +105,7 @@ rows.forEach(function (row, i) {
function collapseAll() { function collapseAll() {
if (!tbody) return; if (!tbody) return;
var openRows = tbody.querySelectorAll("tr.row.open"); const openRows = tbody.querySelectorAll("tr.row.open");
openRows.forEach(function (row) { openRows.forEach(function (row) {
row.classList.remove("open"); row.classList.remove("open");
row.setAttribute("aria-expanded", "false"); row.setAttribute("aria-expanded", "false");
@ -122,7 +122,7 @@ function applyFilters() {
let show = true; let show = true;
if (activeFilter) { if (activeFilter) {
var rowTags = row.dataset.tags; const rowTags = row.dataset.tags;
show = rowTags ? rowTags.split("||").includes(activeFilter) : false; show = rowTags ? rowTags.split("||").includes(activeFilter) : false;
} }
@ -236,7 +236,7 @@ function sortRows() {
applyFilters(); applyFilters();
} }
var sortHeaders = document.querySelectorAll("th[data-sort]"); const sortHeaders = document.querySelectorAll("th[data-sort]");
function updateSortIndicators() { function updateSortIndicators() {
sortHeaders.forEach(function (th) { sortHeaders.forEach(function (th) {