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

@@ -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;
}