PUBLISH: Improved Homepage

This commit is contained in:
Campbell Alden 2022-08-31 12:57:24 +09:00
parent ea0d2ad97b
commit 8318d8dca5
12 changed files with 130 additions and 16 deletions

13
docs/search.js Normal file
View file

@ -0,0 +1,13 @@
const searchInput = document.getElementById('movie-search');
const datalist = document.getElementById('movies');
const dataitems = new Map();
Array.from(datalist.children).forEach(function (ch) {
dataitems.set(ch.value, ch.getAttribute('data-value'));
});
searchInput.addEventListener('change', function(e) {
const targetLocation = dataitems.get(e.target.value);
if (targetLocation) {
window.location.href = targetLocation;
}
});