From efec4bf7354ccebf5faf96d78003c048a509ae20 Mon Sep 17 00:00:00 2001 From: biss Date: Sun, 26 Apr 2026 10:33:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0url=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- certs/index.html | 18 ++++++++++++++++++ ticket/index.html | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/certs/index.html b/certs/index.html index 1864fc6..460e987 100644 --- a/certs/index.html +++ b/certs/index.html @@ -202,10 +202,28 @@ window.location.href = `certificate.html?id=${id}`; } + function initializeSearchTermFromUrl() { + const params = new URLSearchParams(window.location.search); + const presetTerm = + params.get('searchTerm') || + params.get('term') || + params.get('keyword') || + params.get('cert_number') || + params.get('certNumber') || + params.get('number') || + params.get('q') || + ''; + + if (presetTerm) { + document.getElementById('searchTerm').value = presetTerm; + } + } + document.getElementById('searchBtn').addEventListener('click', handleSearch); document.getElementById('searchTerm').addEventListener('keypress', e => { if (e.key === 'Enter') handleSearch(); }); + initializeSearchTermFromUrl(); diff --git a/ticket/index.html b/ticket/index.html index 10df9ca..a4d46b5 100644 --- a/ticket/index.html +++ b/ticket/index.html @@ -203,7 +203,25 @@ resultsDiv.innerHTML = html; } + function initializeSearchTermFromUrl() { + const params = new URLSearchParams(window.location.search); + const presetTerm = + params.get('searchTerm') || + params.get('term') || + params.get('keyword') || + params.get('ticket_number') || + params.get('ticketNumber') || + params.get('number') || + params.get('q') || + ''; + + if (presetTerm) { + document.getElementById('searchTerm').value = presetTerm; + } + } + document.getElementById('searchBtn').addEventListener('click', handleSearch); + initializeSearchTermFromUrl();