mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Make club loading nicer
This commit is contained in:
@@ -4900,6 +4900,7 @@ function updateTitle() {
|
||||
}
|
||||
|
||||
function openClubImport() {
|
||||
$el("#aidgpromptnum").value = "";
|
||||
openPopup("aidg-import-popup");
|
||||
}
|
||||
|
||||
@@ -5736,4 +5737,27 @@ function deleteConfirmation(sFormatted, confirmText, denyText, confirmCallback,
|
||||
}
|
||||
|
||||
openPopup("confirm-delete-dialog");
|
||||
}
|
||||
}
|
||||
|
||||
function attemptClubLoad() {
|
||||
const input = $el("#aidgpromptnum");
|
||||
let val = input.value;
|
||||
if (!/^\d+$/.test(val)) {
|
||||
// Not an id, is it a full URL?
|
||||
const matches = val.match(/aetherroom\.club\/([0-9]+)/)
|
||||
if (!matches) {
|
||||
reportError("Malformed club import", "That doesn't look like a valid club URL or ID. Please check your input and try again.");
|
||||
return;
|
||||
}
|
||||
val = matches[1];
|
||||
}
|
||||
socket.emit("load_aidg_club", val);
|
||||
closePopups();
|
||||
}
|
||||
|
||||
|
||||
$el("#aidgpromptnum").addEventListener("keydown", function(event) {
|
||||
if (event.key !== "Enter") return;
|
||||
attemptClubLoad();
|
||||
event.preventDefault();
|
||||
});
|
@@ -122,10 +122,10 @@
|
||||
<br/>
|
||||
<div style="text-align: center;"><a href="https://aetherroom.club/" target="_blank" rel="noopener noreferrer">https://aetherroom.club/</a></div>
|
||||
<br/>
|
||||
<input autocomplete="off" class="form-control" type="text" placeholder="Prompt Number (4-digit number at the end of aetherroom.club URL)" id="aidgpromptnum">
|
||||
<input autocomplete="off" class="form-control focus-on-me" type="text" placeholder="Prompt ID or URL" id="aidgpromptnum">
|
||||
</div>
|
||||
<div class="popup_load_cancel">
|
||||
<button type="button" class="btn btn-primary popup_load_cancel_button" onclick="socket.emit('load_aidg_club', document.getElementById('aidgpromptnum').value);closePopups();">Accept</button>
|
||||
<button type="button" class="btn btn-primary popup_load_cancel_button" onclick="attemptClubLoad();">Accept</button>
|
||||
<button type="button" class="btn btn-primary popup_load_cancel_button" onclick="closePopups();">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user