mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-06-21 02:18:24 +02:00
Gallery Page Buttons now get disabled (and look different) when you can't go any further
This commit is contained in:
parent
2dc8d8dd35
commit
a3b97c2b47
@ -1899,6 +1899,9 @@ div#enlarge-buttons {
|
|||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
button:disabled {
|
||||||
|
background-color: var(--secondary-button-background);
|
||||||
|
}
|
||||||
|
|
||||||
#gallery-search {
|
#gallery-search {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -3257,6 +3257,7 @@ function layoutGallery() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function refreshGallery(newsearch = false) {
|
function refreshGallery(newsearch = false) {
|
||||||
|
let BUTTONS = [...document.getElementById("gallery-search").children].filter(x => x.tagName === "BUTTON")
|
||||||
if (newsearch) {
|
if (newsearch) {
|
||||||
document.getElementById("gallery-page").value = 0
|
document.getElementById("gallery-page").value = 0
|
||||||
}
|
}
|
||||||
@ -3294,6 +3295,20 @@ function refreshGallery(newsearch = false) {
|
|||||||
layoutGallery()
|
layoutGallery()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
fetch('/all_images?images_per_page=1&page=' + (parseInt(document.getElementById("gallery-page").value) + 1) * 50) // 50 has to be replaced if custom images per page is implemented
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(json => {
|
||||||
|
if (json.length == 0) {
|
||||||
|
BUTTONS[2].disabled = true
|
||||||
|
} else {
|
||||||
|
BUTTONS[2].disabled = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (document.getElementById("gallery-page").value == 0) {
|
||||||
|
BUTTONS[0].disabled = true
|
||||||
|
} else {
|
||||||
|
BUTTONS[0].disabled = false
|
||||||
|
}
|
||||||
document.getElementById("gallery-refresh").innerText = "Refresh"
|
document.getElementById("gallery-refresh").innerText = "Refresh"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user