_includes/custom/search.html in minimaJake-1.0.4 vs _includes/custom/search.html in minimaJake-1.0.10
- old
+ new
@@ -12,10 +12,11 @@
json: '/assets/js/posts.json',
templateMiddleware: function(prop, value, template) {
if (prop === "title" || prop === "excerpt") {
value = value.replace(/&/g, "&");
}
+ if (prop === "url") { return value }
return value.replace(
new RegExp(document.getElementById('search-input').value, "gi"),
'<span class="highlight">$&</span>'
)
},
@@ -48,10 +49,12 @@
window.addEventListener('load', function() {
var searchParam = new URLSearchParams(window.location.search).get("q")
if (searchParam != null) {
document.getElementById('search-input').value = searchParam
- sjs.search(searchParam)
+ setTimeout(() => {
+ sjs.search(searchParam)
+ }, 100);
}
document.getElementById('search-input').placeholder = "Type your search here..."
}, false);
</script>
\ No newline at end of file