mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-12-16 14:35:32 +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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user