Update Tester.HTML
This commit is contained in:
parent
ff756ffafd
commit
813788bcc1
1 changed files with 4 additions and 12 deletions
16
Tester.HTML
16
Tester.HTML
|
@ -38,22 +38,14 @@
|
||||||
if (results.length === 0) {
|
if (results.length === 0) {
|
||||||
searchResultsDiv.textContent = 'No results found.';
|
searchResultsDiv.textContent = 'No results found.';
|
||||||
} else {
|
} else {
|
||||||
let resultList = document.createElement('ul');
|
|
||||||
results.forEach(result => {
|
results.forEach(result => {
|
||||||
let listItem = document.createElement('li');
|
|
||||||
let link = document.createElement('a');
|
let link = document.createElement('a');
|
||||||
link.textContent = `${result.title} (${result.year})`;
|
link.textContent = `${result.title} (${result.year})`;
|
||||||
link.href = result.link ? result.link : '#'; // If link is not available, set href to '#'
|
link.href = result.link;
|
||||||
link.onclick = function() {
|
link.style.display = 'block';
|
||||||
if (result.link) {
|
link.style.marginBottom = '10px';
|
||||||
window.location.href = result.link;
|
searchResultsDiv.appendChild(link);
|
||||||
}
|
|
||||||
};
|
|
||||||
console.log("Link:", result.link); // Log link to console for debugging
|
|
||||||
listItem.appendChild(link);
|
|
||||||
resultList.appendChild(listItem);
|
|
||||||
});
|
});
|
||||||
searchResultsDiv.appendChild(resultList);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Add table
Reference in a new issue