mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Merge branch 'UI2' of https://github.com/ebolam/KoboldAI into UI2
This commit is contained in:
@@ -42,6 +42,7 @@ var world_info_data = {};
|
||||
var world_info_folder_data = {};
|
||||
var saved_settings = {};
|
||||
var finder_selection_index = -1;
|
||||
var on_colab;
|
||||
|
||||
// name, desc, icon, func
|
||||
const finder_actions = [
|
||||
@@ -2016,8 +2017,31 @@ function send_world_info(uid) {
|
||||
socket.emit("edit_world_info", world_info_data[uid]);
|
||||
}
|
||||
|
||||
function save_tweaks() {
|
||||
let out = [];
|
||||
|
||||
for (const tweakContainer of document.getElementsByClassName("tweak-container")) {
|
||||
let toggle = tweakContainer.querySelector("input");
|
||||
let path = tweakContainer.getAttribute("tweak-path");
|
||||
if (toggle.checked) out.push(path);
|
||||
}
|
||||
|
||||
if (on_colab) {
|
||||
socket.emit("save_tweaks", JSON.stringify(out));
|
||||
} else {
|
||||
setCookie("enabledTweaks", JSON.stringify(out));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function load_tweaks(data) {
|
||||
|
||||
let enabledTweaks = JSON.parse(data);
|
||||
|
||||
for (const tweakContainer of document.getElementsByClassName("tweak-container")) {
|
||||
let toggle = tweakContainer.querySelector("input");
|
||||
let path = tweakContainer.getAttribute("tweak-path");
|
||||
if (enabledTweaks.includes(path)) $(toggle).bootstrapToggle("on");
|
||||
}
|
||||
}
|
||||
|
||||
function toggle_adventure_mode(button) {
|
||||
@@ -3357,6 +3381,8 @@ function open_finder() {
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
on_colab = document.getElementById("on_colab").textContent == "true";
|
||||
|
||||
create_theming_elements();
|
||||
document.onkeydown = detect_key_down;
|
||||
document.onkeyup = detect_key_up;
|
||||
@@ -3376,28 +3402,8 @@ $(document).ready(function(){
|
||||
|
||||
|
||||
// Tweak registering
|
||||
let enabledTweaks = JSON.parse(getCookie("enabledTweaks", "[]"));
|
||||
|
||||
function saveTweaks() {
|
||||
let out = [];
|
||||
|
||||
// TODO: Better saving
|
||||
for (const tweakContainer of document.getElementsByClassName("tweak-container")) {
|
||||
let toggle = tweakContainer.querySelector("input");
|
||||
let path = tweakContainer.getAttribute("tweak-path");
|
||||
if (toggle.checked) out.push(path);
|
||||
}
|
||||
|
||||
setCookie("enabledTweaks", JSON.stringify(out));
|
||||
if (document.getElementById("on_colab").textContent == "true") {
|
||||
socket.emit("save_tweaks", JSON.stringify(out));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (const tweakContainer of document.getElementsByClassName("tweak-container")) {
|
||||
let toggle = tweakContainer.querySelector("input");
|
||||
let path = tweakContainer.getAttribute("tweak-path");
|
||||
|
||||
$(toggle).change(function(e) {
|
||||
let path = $(this).closest(".tweak-container")[0].getAttribute("tweak-path");
|
||||
@@ -3414,12 +3420,13 @@ $(document).ready(function(){
|
||||
if (el) el.remove();
|
||||
}
|
||||
|
||||
saveTweaks();
|
||||
save_tweaks();
|
||||
});
|
||||
|
||||
if (enabledTweaks.includes(path)) $(toggle).bootstrapToggle("on");
|
||||
}
|
||||
|
||||
// Load tweaks from cookies if not on Colab; Colab uses the server for persistant storage.
|
||||
if (!on_colab) load_tweaks(getCookie("enabledTweaks", "[]"));
|
||||
|
||||
$("#context-viewer-close").click(function() {
|
||||
document.getElementById("context-viewer-container").classList.add("hidden");
|
||||
});
|
||||
@@ -3494,7 +3501,6 @@ $(document).ready(function(){
|
||||
const finderContainer = document.getElementById("finder-container");
|
||||
const finderInput = document.getElementById("finder-input");
|
||||
const finder = document.getElementById("finder");
|
||||
let lastInput;
|
||||
|
||||
finderInput.addEventListener("keyup", updateSearchListings);
|
||||
finderInput.addEventListener("keydown", function(event) {
|
||||
|
@@ -110,7 +110,7 @@
|
||||
/* Side Menus */
|
||||
--tab_color: var(--gruvbox-dark2);
|
||||
|
||||
--flyout_background: var(--layer1_palette);
|
||||
--flyout_background: var(--gruvbox-dark0-soft);
|
||||
--flyout_background_pinned: var(--gruvbox-dark0-soft);
|
||||
|
||||
--setting_background: var(--gruvbox-dark1);
|
||||
|
Reference in New Issue
Block a user