diff --git a/assets/js/lib/nav-collapse.js b/assets/js/lib/nav-collapse.js index 386eafe..68e0c73 100644 --- a/assets/js/lib/nav-collapse.js +++ b/assets/js/lib/nav-collapse.js @@ -5,10 +5,6 @@ function toggleMenu() { } document.querySelector("#menushow").addEventListener("click", toggleMenu); -document.querySelectorAll(".menu__nav-item").forEach(menu => - menu.addEventListener("click", toggleMenu) -); -document.getElementById("darkMode").addEventListener("click", toggleMenu); var nav = document.querySelector('.site-header'); var feed = document.querySelector('main'); diff --git a/assets/js/lib/search.js b/assets/js/lib/search.js index 7da5901..342ba8c 100644 --- a/assets/js/lib/search.js +++ b/assets/js/lib/search.js @@ -6,15 +6,19 @@ async function searchPosts(query) { var data = await fetch(apiEndpoint + queryString + query + pageString + page) var search = await data.json(); - var result = search.result.map(x => { - return ` + var result = ""; + if (search.result) { + result = search.result.map(x => { + return `
`; - }).join(""); + }).join(""); + } + document.getElementById("search-count").innerHTML = search.total + " results found"; document.getElementById("search-results").innerHTML = result; } @@ -24,11 +28,14 @@ if (window.yurikoSearchEndpoint != undefined) { el.addEventListener("input", function (e) { var val = el.value; if (val !== "") { - document.getElementById("nav-menu").classList.add("menu__item--hidden") + document.getElementById("site-header").classList.add("search-enabled") + document.getElementById("nav").classList.add("hidden") searchPosts(val); } else { - document.getElementById("nav-menu").classList.remove("menu__item--hidden") + document.getElementById("site-header").classList.remove("search-enabled") + document.getElementById("nav").classList.remove("hidden") + document.getElementById("search-count").innerHTML = ``; document.getElementById("search-results").innerHTML = ``; } }); diff --git a/gulpfile.js b/gulpfile.js index b76f080..7727633 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -37,7 +37,7 @@ function js() { .pipe(livereload()); } -const cssWatcher = () => watch('assets/css/**', css); +const cssWatcher = () => watch(['assets/css/**','node_modules/@damillora/shian/dist/**'], css); const jsWatcher = () => watch('assets/js/**.js', js); const hbsWatcher = () => watch(['*.hbs', 'partials/**/*.hbs'], hbs); const watcher = parallel(cssWatcher, hbsWatcher, jsWatcher); diff --git a/partials/navigation.hbs b/partials/navigation.hbs index b1944a8..dcf7447 100644 --- a/partials/navigation.hbs +++ b/partials/navigation.hbs @@ -1,22 +1,21 @@