Changed textarea to input as @JeLuF suggested, implemented System that should reduce the amount of times the error screen would be shown

This commit is contained in:
ManInDark 2023-08-13 22:03:57 +02:00
parent b836fd5d0e
commit 79f58881f1
No known key found for this signature in database
GPG Key ID: 72EC12A5B2D62779
2 changed files with 10 additions and 7 deletions

View File

@ -519,11 +519,11 @@
<div id="tab-content-gallery" class="tab-content"> <div id="tab-content-gallery" class="tab-content">
<div id="gallery-search"> <div id="gallery-search">
<button class="primaryButton" onclick="decrementGalleryPage()"><i class="fa-solid fa-arrow-left"></i></button> <button class="primaryButton" onclick="decrementGalleryPage()"><i class="fa-solid fa-arrow-left"></i></button>
<textarea id="gallery-prompt-search" onkeydown="gallery_keyDown_handler(event)" placeholder="Search for a prompt..."></textarea> <input id="gallery-prompt-search" type="text" onkeydown="gallery_keyDown_handler(event)" placeholder="Search for a prompt..."></input>
<textarea id="gallery-model-search" onkeydown="gallery_keyDown_handler(event)" placeholder="Search for a model..."></textarea> <input id="gallery-model-search" type="text" onkeydown="gallery_keyDown_handler(event)" placeholder="Search for a model..."></input>
<label for="gallery-page">Page:</label> <label for="gallery-page">Page:</label>
<input id="gallery-page" name="Page" value="0" size="1" onkeypress="gallery_keyDown_handler(event)"> <input id="gallery-page" name="Page" value="0" size="1" onkeypress="gallery_keyDown_handler(event)">
<button class="primaryButton" id="gallery-refresh" onclick="refreshGallery()">Load</button> <button class="primaryButton" id="gallery-refresh" onclick="refreshGallery(true)">Load</button>
<button class="primaryButton" onclick="incrementGalleryPage()"><i class="fa-solid fa-arrow-right"></i></button> <button class="primaryButton" onclick="incrementGalleryPage()"><i class="fa-solid fa-arrow-right"></i></button>
</div> </div>
<div class="gallery"> <div class="gallery">

View File

@ -3108,7 +3108,10 @@ function galleryImage(item) {
return div return div
} }
function refreshGallery() { function refreshGallery(newsearch = false) {
if (newsearch) {
document.getElementById("gallery-page").value = 0
}
let container = document.getElementById("imagecontainer") let container = document.getElementById("imagecontainer")
let params = new URLSearchParams({ let params = new URLSearchParams({
prompt: document.getElementById("gallery-prompt-search").value, prompt: document.getElementById("gallery-prompt-search").value,
@ -3134,17 +3137,17 @@ function refreshGallery() {
function decrementGalleryPage() { function decrementGalleryPage() {
let page = Math.max(document.getElementById("gallery-page").value - 1, 0) let page = Math.max(document.getElementById("gallery-page").value - 1, 0)
document.getElementById("gallery-page").value = page document.getElementById("gallery-page").value = page
refreshGallery() refreshGallery(false)
} }
function incrementGalleryPage() { function incrementGalleryPage() {
document.getElementById("gallery-page").value++ document.getElementById("gallery-page").value++
refreshGallery() refreshGallery(false)
} }
function gallery_keyDown_handler(event) { function gallery_keyDown_handler(event) {
if (event.key === 'Enter') { if (event.key === 'Enter') {
event.preventDefault() event.preventDefault()
refreshGallery() refreshGallery(true)
} }
} }