Implemented suggestions by @JeLuF

This commit is contained in:
ManInDark 2023-08-14 19:04:00 +02:00
parent a3b97c2b47
commit 76604d22de
No known key found for this signature in database
GPG Key ID: 72EC12A5B2D62779

View File

@ -3257,7 +3257,7 @@ function layoutGallery() {
} }
function refreshGallery(newsearch = false) { function refreshGallery(newsearch = false) {
let BUTTONS = [...document.getElementById("gallery-search").children].filter(x => x.tagName === "BUTTON") let buttons = document.querySelectorAll("#gallery-search button")
if (newsearch) { if (newsearch) {
document.getElementById("gallery-page").value = 0 document.getElementById("gallery-page").value = 0
} }
@ -3299,15 +3299,15 @@ function refreshGallery(newsearch = false) {
.then(response => response.json()) .then(response => response.json())
.then(json => { .then(json => {
if (json.length == 0) { if (json.length == 0) {
BUTTONS[2].disabled = true buttons[2].disabled = true
} else { } else {
BUTTONS[2].disabled = false buttons[2].disabled = false
} }
}) })
if (document.getElementById("gallery-page").value == 0) { if (document.getElementById("gallery-page").value == 0) {
BUTTONS[0].disabled = true buttons[0].disabled = true
} else { } else {
BUTTONS[0].disabled = false buttons[0].disabled = false
} }
document.getElementById("gallery-refresh").innerText = "Refresh" document.getElementById("gallery-refresh").innerText = "Refresh"
} }