From 1e7c84f91fad1a1d93923abf18a3d35ffc24f403 Mon Sep 17 00:00:00 2001 From: biss Date: Wed, 17 Jun 2026 20:47:07 +0800 Subject: [PATCH] =?UTF-8?q?url=20=E4=BC=A0=E5=8F=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 2000s/js/certs-index.js | 11 ++++++----- 2000s/js/ticket-index.js | 11 ++++++----- js/certs-index.js | 11 ++++++----- js/ticket-index.js | 11 ++++++----- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/2000s/js/certs-index.js b/2000s/js/certs-index.js index f8eef54..22e6e57 100644 --- a/2000s/js/certs-index.js +++ b/2000s/js/certs-index.js @@ -220,7 +220,7 @@ const SUPABASE_URL = 'https://chixssrphfgxvqqigkzo.supabase.co'; window.location.href = `certificate.html?id=${id}`; } - function initializeSearchTermFromUrl() { + function applyQueryParams() { const params = new URLSearchParams(window.location.search); const presetTerm = params.get('searchTerm') || @@ -236,13 +236,14 @@ const SUPABASE_URL = 'https://chixssrphfgxvqqigkzo.supabase.co'; params.get('q') || ''; - if (presetTerm) { - document.getElementById('searchTerm').value = presetTerm; - } + if (!presetTerm || !presetTerm.trim()) return; + + document.getElementById('searchTerm').value = presetTerm.trim(); + handleSearch(); } document.getElementById('searchBtn').addEventListener('click', handleSearch); document.getElementById('searchTerm').addEventListener('keypress', e => { if (e.key === 'Enter') handleSearch(); }); - initializeSearchTermFromUrl(); + applyQueryParams(); diff --git a/2000s/js/ticket-index.js b/2000s/js/ticket-index.js index fde5d83..e2ea208 100644 --- a/2000s/js/ticket-index.js +++ b/2000s/js/ticket-index.js @@ -116,7 +116,7 @@ const SUPABASE_URL = 'https://chixssrphfgxvqqigkzo.supabase.co'; resultsDiv.innerHTML = html; } - function initializeSearchTermFromUrl() { + function applyQueryParams() { const params = new URLSearchParams(window.location.search); const presetTerm = params.get('searchTerm') || @@ -128,10 +128,11 @@ const SUPABASE_URL = 'https://chixssrphfgxvqqigkzo.supabase.co'; params.get('q') || ''; - if (presetTerm) { - document.getElementById('searchTerm').value = presetTerm; - } + if (!presetTerm || !presetTerm.trim()) return; + + document.getElementById('searchTerm').value = presetTerm.trim(); + handleSearch(); } document.getElementById('searchBtn').addEventListener('click', handleSearch); - initializeSearchTermFromUrl(); + applyQueryParams(); diff --git a/js/certs-index.js b/js/certs-index.js index 92aa3c0..8f3fcc3 100644 --- a/js/certs-index.js +++ b/js/certs-index.js @@ -230,7 +230,7 @@ const SUPABASE_URL = 'https://chixssrphfgxvqqigkzo.supabase.co'; window.location.href = `certificate.html?id=${id}`; } - function initializeSearchTermFromUrl() { + function applyQueryParams() { const params = new URLSearchParams(window.location.search); const presetTerm = params.get('searchTerm') || @@ -246,13 +246,14 @@ const SUPABASE_URL = 'https://chixssrphfgxvqqigkzo.supabase.co'; params.get('q') || ''; - if (presetTerm) { - document.getElementById('searchTerm').value = presetTerm; - } + if (!presetTerm || !presetTerm.trim()) return; + + document.getElementById('searchTerm').value = presetTerm.trim(); + handleSearch(); } document.getElementById('searchBtn').addEventListener('click', handleSearch); document.getElementById('searchTerm').addEventListener('keypress', e => { if (e.key === 'Enter') handleSearch(); }); - initializeSearchTermFromUrl(); + applyQueryParams(); diff --git a/js/ticket-index.js b/js/ticket-index.js index 6530fc7..691e49b 100644 --- a/js/ticket-index.js +++ b/js/ticket-index.js @@ -135,7 +135,7 @@ const SUPABASE_URL = 'https://chixssrphfgxvqqigkzo.supabase.co'; resultsDiv.innerHTML = html; } - function initializeSearchTermFromUrl() { + function applyQueryParams() { const params = new URLSearchParams(window.location.search); const presetTerm = params.get('searchTerm') || @@ -147,10 +147,11 @@ const SUPABASE_URL = 'https://chixssrphfgxvqqigkzo.supabase.co'; params.get('q') || ''; - if (presetTerm) { - document.getElementById('searchTerm').value = presetTerm; - } + if (!presetTerm || !presetTerm.trim()) return; + + document.getElementById('searchTerm').value = presetTerm.trim(); + handleSearch(); } document.getElementById('searchBtn').addEventListener('click', handleSearch); - initializeSearchTermFromUrl(); + applyQueryParams();