diff --git a/static/koboldai.css b/static/koboldai.css index 57c990d0..453f235e 100644 --- a/static/koboldai.css +++ b/static/koboldai.css @@ -649,6 +649,25 @@ input[type="range"]::-ms-fill-upper { filter: brightness(85%); } +/* Tweaks */ +.tweak-container { + display: flex; + align-items: center; + justify-content: space-between; + + color: var(--setting_text); + background-color: var(--setting_background); + border-radius: var(--radius_settings_background); + padding: 10px 8px; + margin-bottom: 5px; + width: 100%; +} + +#Tweaks { + /* Don't add space under last tweak-container. Also, CSS, why no last-of-class!?!? */ + margin-bottom: 0px; +} + /*----------------RIGHT FLYOUT MENU------------------*/ .right_menu_icon { position: fixed; @@ -1140,6 +1159,8 @@ body { } #random_game_prompt{ + display: flex; + flex-direction: column; grid-area: textarea; } @@ -1555,7 +1576,8 @@ input { resize: none; border-color: white; border-width: 1px; - border-style:solid; + border-style: solid; + outline: none; } .action_button { @@ -1607,6 +1629,7 @@ button.disabled { textarea { background-color: var(--input_background); color: var(--text); + outline: none; } .pulse { diff --git a/static/koboldai.js b/static/koboldai.js index c28871de..dc4c599d 100644 --- a/static/koboldai.js +++ b/static/koboldai.js @@ -400,7 +400,7 @@ function do_presets(data) { //add our blank option var option = document.createElement("option"); option.value=""; - option.text="presets"; + option.text="Presets"; select.append(option); presets = data.value; @@ -2812,4 +2812,46 @@ $(document).ready(function(){ } preserve_game_space(!(getCookie("preserve_game_space") == "false")); options_on_right(!(getCookie("options_on_right") == "false")); -}); \ No newline at end of file + + + // 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)); + } + + + 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"); + let id = `tweak-${path}`; + + if (this.checked) { + let style = document.createElement("link"); + style.rel = "stylesheet"; + style.href = `/themes/tweaks/${path}.css`; + style.id = id; + document.head.appendChild(style); + } else { + document.getElementById(id).remove(); + } + + saveTweaks(); + }); + + if (enabledTweaks.includes(path)) toggle.click(); + } +}); diff --git a/templates/index_new.html b/templates/index_new.html index e1ef5b50..0afad93e 100644 --- a/templates/index_new.html +++ b/templates/index_new.html @@ -70,8 +70,9 @@