Remove the checks from the CSS, and remove all the JavaScript

This commit is contained in:
TheFrenchGhosty 2022-02-14 22:56:44 +01:00
parent 37b60251a0
commit d7c92604ae
7 changed files with 2 additions and 154 deletions

View File

@ -5,7 +5,7 @@
<meta name=viewport content="width=device-width,initial-scale=1,shrink-to-fit=no">
<link rel=preload as=font href=/fonts/vendor/jost/jost-v4-latin-regular.woff2 type=font/woff2 crossorigin>
<link rel=preload as=font href=/fonts/vendor/jost/jost-v4-latin-700.woff2 type=font/woff2 crossorigin>
<link rel=stylesheet href=/main.d17fe0563148e9c30d2b5e0b895b5e53d2e2ce015dca3cc38eca8304aef1ebaa26916979cf3060bbed2e8554a0cd0b44c68d4541c31c3a1418e0aa6d99f1727c.css integrity="sha512-0X/gVjFI6cMNK14LiVteU9LizgFdyjzDjsqDBK7x66omkWl5zzBgu+0uhVSgzQtExo1FQcMcOhQY4KptmfFyfA==" crossorigin=anonymous>
<link rel=stylesheet href=/main.d17fe0563148e9c30d2b5e0b895b5e53d2e2ce015dca3cc38eca8304aef1ebaa26916979cf3060bbed2e8554a0cd0b44c68d4541c31c3a1418e0aa6d99f1727c.css>
<noscript><style>img.lazyload{display:none}</style></noscript>
<meta name=robots content="index, follow">
<meta name=googlebot content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1">
@ -101,9 +101,5 @@
</div>
</div>
</footer>
<script src=/js/bootstrap.min.586171fec3966d1a44fa8aa2edb24b861dc3a72be8cc24aa4e0dabe4c312a0dae5fe1eaa7c93180a6211fa4d7c5461b0d228fdf741be2eae279a376dfa1e7d81.js integrity="sha512-WGFx/sOWbRpE+oqi7bJLhh3DpyvozCSqTg2r5MMSoNrl/h6qfJMYCmIR+k18VGGw0ij990G+Lq4nmjdt+h59gQ==" crossorigin=anonymous defer></script>
<script src=/js/highlight.min.e13cfba4c5524e30386cb9ea71f0f191f39d15b25b222f4b67549689f7c076158f42a2282446044f5cdacc76a6d003efbfa252a84aea0116703803b6339ae35f.js integrity="sha512-4Tz7pMVSTjA4bLnqcfDxkfOdFbJbIi9LZ1SWiffAdhWPQqIoJEYET1zazHam0APvv6JSqErqARZwOAO2M5rjXw==" crossorigin=anonymous defer></script>
<script src=/main.min.9e62c9b0c5dc8279689cc9cb693a32c8ea1d19032f574f98c782ff59a0417d3662ff94b1a7755ab72a7a1862644bf00a58492c65aa0adabbc58080f4018c61bc.js integrity="sha512-nmLJsMXcgnlonMnLaToyyOodGQMvV0+Yx4L/WaBBfTZi/5Sxp3Vatyp6GGJkS/AKWEksZaoK2rvFgID0AYxhvA==" crossorigin=anonymous defer></script>
<script src=/index.min.177e5d23ef2cca9f490939925b2e6d748d9bb8005b5423f0c2075bde603b8249fe761b3e8b5d7e3e477b2cf7e73cba3c80e7809e0c3845646c2ca14ee2220663.js integrity="sha512-F35dI+8syp9JCTmSWy5tdI2buABbVCPwwgdb3mA7gkn+dhs+i11+Pkd7LPfnPLo8gOeAngw4RWRsLKFO4iIGYw==" crossorigin=anonymous defer></script>
</body>
</html>

View File

@ -5,7 +5,7 @@
<meta name=viewport content="width=device-width,initial-scale=1,shrink-to-fit=no">
<link rel=preload as=font href=/fonts/vendor/jost/jost-v4-latin-regular.woff2 type=font/woff2 crossorigin>
<link rel=preload as=font href=/fonts/vendor/jost/jost-v4-latin-700.woff2 type=font/woff2 crossorigin>
<link rel=stylesheet href=/main.d17fe0563148e9c30d2b5e0b895b5e53d2e2ce015dca3cc38eca8304aef1ebaa26916979cf3060bbed2e8554a0cd0b44c68d4541c31c3a1418e0aa6d99f1727c.css integrity="sha512-0X/gVjFI6cMNK14LiVteU9LizgFdyjzDjsqDBK7x66omkWl5zzBgu+0uhVSgzQtExo1FQcMcOhQY4KptmfFyfA==" crossorigin=anonymous>
<link rel=stylesheet href=/main.d17fe0563148e9c30d2b5e0b895b5e53d2e2ce015dca3cc38eca8304aef1ebaa26916979cf3060bbed2e8554a0cd0b44c68d4541c31c3a1418e0aa6d99f1727c.css>
<noscript><style>img.lazyload{display:none}</style></noscript>
<meta name=robots content="index, follow">
<meta name=googlebot content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1">
@ -155,9 +155,5 @@
</div>
</div>
</footer>
<script src=/js/bootstrap.min.586171fec3966d1a44fa8aa2edb24b861dc3a72be8cc24aa4e0dabe4c312a0dae5fe1eaa7c93180a6211fa4d7c5461b0d228fdf741be2eae279a376dfa1e7d81.js integrity="sha512-WGFx/sOWbRpE+oqi7bJLhh3DpyvozCSqTg2r5MMSoNrl/h6qfJMYCmIR+k18VGGw0ij990G+Lq4nmjdt+h59gQ==" crossorigin=anonymous defer></script>
<script src=/js/highlight.min.e13cfba4c5524e30386cb9ea71f0f191f39d15b25b222f4b67549689f7c076158f42a2282446044f5cdacc76a6d003efbfa252a84aea0116703803b6339ae35f.js integrity="sha512-4Tz7pMVSTjA4bLnqcfDxkfOdFbJbIi9LZ1SWiffAdhWPQqIoJEYET1zazHam0APvv6JSqErqARZwOAO2M5rjXw==" crossorigin=anonymous defer></script>
<script src=/main.min.9e62c9b0c5dc8279689cc9cb693a32c8ea1d19032f574f98c782ff59a0417d3662ff94b1a7755ab72a7a1862644bf00a58492c65aa0adabbc58080f4018c61bc.js integrity="sha512-nmLJsMXcgnlonMnLaToyyOodGQMvV0+Yx4L/WaBBfTZi/5Sxp3Vatyp6GGJkS/AKWEksZaoK2rvFgID0AYxhvA==" crossorigin=anonymous defer></script>
<script src=/index.min.177e5d23ef2cca9f490939925b2e6d748d9bb8005b5423f0c2075bde603b8249fe761b3e8b5d7e3e477b2cf7e73cba3c80e7809e0c3845646c2ca14ee2220663.js integrity="sha512-F35dI+8syp9JCTmSWy5tdI2buABbVCPwwgdb3mA7gkn+dhs+i11+Pkd7LPfnPLo8gOeAngw4RWRsLKFO4iIGYw==" crossorigin=anonymous defer></script>
</body>
</html>

View File

@ -1,141 +0,0 @@
var suggestions = document.getElementById('suggestions');
var userinput = document.getElementById('userinput');
document.addEventListener('keydown', inputFocus);
function inputFocus(e) {
if (e.keyCode === 191 ) {
e.preventDefault();
userinput.focus();
}
if (e.keyCode === 27 ) {
userinput.blur();
suggestions.classList.add('d-none');
}
}
document.addEventListener('click', function(event) {
var isClickInsideElement = suggestions.contains(event.target);
if (!isClickInsideElement) {
suggestions.classList.add('d-none');
}
});
/*
Source:
- https://dev.to/shubhamprakash/trap-focus-using-javascript-6a3
*/
document.addEventListener('keydown',suggestionFocus);
function suggestionFocus(e){
const focusableSuggestions= suggestions.querySelectorAll('a');
const focusable= [...focusableSuggestions];
const index = focusable.indexOf(document.activeElement);
let nextIndex = 0;
if (e.keyCode === 38) {
e.preventDefault();
nextIndex= index > 0 ? index-1 : 0;
focusableSuggestions[nextIndex].focus();
}
else if (e.keyCode === 40) {
e.preventDefault();
nextIndex= index+1 < focusable.length ? index+1 : index;
focusableSuggestions[nextIndex].focus();
}
}
/*
Source:
- https://github.com/nextapps-de/flexsearch#index-documents-field-search
- https://raw.githack.com/nextapps-de/flexsearch/master/demo/autocomplete.html
*/
(function(){
var index = new FlexSearch.Document({
tokenize: "forward",
cache: 100,
document: {
id: 'id',
store: [
"href", "title", "description"
],
index: ["title", "description", "content"]
}
});
// Not yet supported: https://github.com/nextapps-de/flexsearch#complex-documents
/*
var docs = [
];
*/
// https://discourse.gohugo.io/t/range-length-or-last-element/3803/2
index.add(
;
userinput.addEventListener('input', show_results, true);
suggestions.addEventListener('click', accept_suggestion, true);
function show_results(){
var value = this.value;
var results = index.search(value, { limit: 5, index: ["content"], enrich: true });
var entry, childs = suggestions.childNodes;
var i = 0, len = results.length;
suggestions.classList.remove('d-none');
results.forEach(function(results) {
entry = document.createElement('div');
entry.innerHTML = '<a href><span></span><span></span></a>';
a = entry.querySelector('a'),
t = entry.querySelector('span:first-child'),
d = entry.querySelector('span:nth-child(2)');
// console.log(results);
a.href = results.result[i].doc.href;
t.textContent = results.result[i].doc.title;
d.textContent = results.result[i].doc.description;
suggestions.appendChild(entry);
});
while(childs.length > len){
suggestions.removeChild(childs[i])
}
}
function accept_suggestion(){
while(suggestions.lastChild){
suggestions.removeChild(suggestions.lastChild);
}
return false;
}
}());

View File