@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user