This repository has been archived on 2023-12-10. You can view files and clone it, but cannot push or open issues or pull requests.
mmp-site/public/en.search.min.0c8af0cffc76d081a5a819e52dfdb147c344002d63293b8ad6697c1cbe08a5f2.js

1 line
1.2 KiB
JavaScript
Raw Permalink Normal View History

2022-04-17 15:29:50 +01:00
'use strict';(function(){const e=document.querySelector("#book-search-input"),t=document.querySelector("#book-search-results");if(!e)return;e.addEventListener("focus",n),e.addEventListener("keyup",s),document.addEventListener("keypress",i);function i(t){if(e===document.activeElement)return;const n=String.fromCharCode(t.charCode);if(!a(n))return;e.focus(),t.preventDefault()}function a(t){const n=e.getAttribute("data-hotkeys")||'';return n.indexOf(t)>=0}function n(){e.removeEventListener("focus",n),e.required=!0,o("/flexsearch.min.js"),o("/en.search-data.min.eb69b2118acfaac98ee24dc1c9669fd89d83622a4a30912bb3bebc54f94e6bac.js",function(){e.required=!1,s()})}function s(){for(;t.firstChild;)t.removeChild(t.firstChild);if(!e.value)return;const n=window.bookSearchIndex.search(e.value,10);n.forEach(function(e){const n=r("<li><a href></a><small></small></li>"),s=n.querySelector("a"),o=n.querySelector("small");s.href=e.href,s.textContent=e.title,o.textContent=e.section,t.appendChild(n)})}function o(t,n){const e=document.createElement("script");e.defer=!0,e.async=!1,e.src=t,e.onload=n,document.head.appendChild(e)}function r(t){const e=document.createElement("div");return e.innerHTML=t,e.firstChild}})()