A lot of stuff related to parsing; index page input validation

This commit is contained in:
Simon Martens
2023-09-17 15:29:51 +02:00
parent d86d508786
commit b15ce8793c
23 changed files with 294 additions and 60 deletions

View File

@@ -155,7 +155,7 @@
}
.ha-index .ha-indexbody .ha-filterlist {
@apply hidden md:flex flex-col gap-y-9 pb-4 float-right max-w-lg basis-1/3 min-w-0 shrink
@apply hidden md:flex flex-col gap-y-5 pb-4 float-right max-w-lg basis-1/3 min-w-0 shrink
}
.ha-index .ha-indexbody .ha-filterlist .ha-filtertitle {
@@ -194,6 +194,7 @@
@apply float-right inline-block px-2 border bg-slate-50 disabled:bg-gray-200 border-slate-200 hover:border-black disabled:hover:border-slate-200 disabled:text-gray-600
}
.ha-index .ha-indexbody .ha-filterlist .ha-zhsearchfilter .ha-zhform {
@apply py-1 pl-1 pr-2
}
@@ -213,6 +214,10 @@
.ha-index .ha-indexbody .ha-filterlist .ha-zhsearchfilter .ha-zhform select {
@apply px-1
}
.ha-index .ha-indexbody .ha-filterlist .ha-searchfilter {
@apply mb-5
}
.ha-index .ha-indexbody .ha-filterlist .ha-searchfilter .ha-searchform {
@apply py-1 pl-1 pr-2 flex flex-row gap-x-2

File diff suppressed because one or more lines are too long

View File

@@ -1,19 +1,49 @@
function encode(e){return e.replace(/[^]/g,function(e){return"&#"+e.charCodeAt(0)+";"})}
const ACTIVATEGOTOFILTER = function(filter, button) {
let f = filter.value;
let gotoinfo = document.getElementById("ha-gotoinfo");
if (f === "") {
if (gotoinfo != null && !gotoinfo.classList.contains("opacity-0")) gotoinfo.classList.add("opacity-0");
button.disabled = true;
return;
}
if (typeof AvailableLetters !== 'undefined' && AvailableLetters != null && !AvailableLetters.has(f)) {
if (gotoinfo != null) {
gotoinfo.classList.remove("opacity-0");
gotoinfo.innerHTML = "Brief Nr. " + encode(f) + " gibt es nicht.";
}
button.disabled = true;
return;
}
if (gotoinfo != null && !gotoinfo.classList.contains("opacity-0")) gotoinfo.classList.add("opacity-0");
button.disabled = false;
}
const ACTIVATEZHSEARCH = function(volume, page, button) {
let vol = volume.options[volume.selectedIndex].value;
let pg = page.value;
let gotoinfo = document.getElementById("ha-zhsearchinfo");
if (pg === "") {
if (gotoinfo != null && !gotoinfo.classList.contains("opacity-0")) gotoinfo.classList.add("opacity-0");
button.disabled = true;
return;
}
if (typeof AvailablePages !== 'undefined' && AvailablePages != null && AvailablePages[vol] != null && !(AvailablePages[vol].indexOf(pg) >= 0)) {
if (gotoinfo != null) {
gotoinfo.classList.remove("opacity-0");
gotoinfo.innerHTML = "ZH Bd. " + encode(vol) + ", S. " + encode(pg) + " gibt es nicht.";
}
button.disabled = true;
return;
}
if (gotoinfo != null && !gotoinfo.classList.contains("opacity-0")) gotoinfo.classList.add("opacity-0");
button.disabled = false;
}

View File

@@ -22,5 +22,5 @@ if (document.getElementById("ha-scrollbutton") !== null) {
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
})
// TODO: workaround, bc window does not recieve scroll events anymore
setInterval(() => scrollFunction(), 2500);
setInterval(() => scrollFunction(), 1500);
}