mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-10-29 09:15:33 +00:00
A lot of stuff related to parsing; index page input validation
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user