From 3703e72073f17faf200545202d9f68f768857951 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Sun, 19 May 2024 03:13:54 +0200 Subject: Add dark mode config, slide system prompt --- g4f/gui/client/static/js/chat.v1.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'g4f/gui/client/static/js/chat.v1.js') diff --git a/g4f/gui/client/static/js/chat.v1.js b/g4f/gui/client/static/js/chat.v1.js index 1d0b0dce..47bfdd3b 100644 --- a/g4f/gui/client/static/js/chat.v1.js +++ b/g4f/gui/client/static/js/chat.v1.js @@ -1108,8 +1108,11 @@ async function on_api() { await load_settings_storage() const hide_systemPrompt = document.getElementById("hide-systemPrompt") + const slide_systemPrompt_icon = document.querySelector(".slide-systemPrompt i"); if (hide_systemPrompt.checked) { systemPrompt.classList.add("hidden"); + slide_systemPrompt_icon.classList.remove("fa-angles-up"); + slide_systemPrompt_icon.classList.add("fa-angles-down"); } hide_systemPrompt.addEventListener('change', async (event) => { if (event.target.checked) { @@ -1118,6 +1121,13 @@ async function on_api() { systemPrompt.classList.remove("hidden"); } }); + document.querySelector(".slide-systemPrompt")?.addEventListener("click", () => { + hide_systemPrompt.click(); + let checked = hide_systemPrompt.checked; + systemPrompt.classList[checked ? "add": "remove"]("hidden"); + slide_systemPrompt_icon.classList[checked ? "remove": "add"]("fa-angles-up"); + slide_systemPrompt_icon.classList[checked ? "add": "remove"]("fa-angles-down"); + }); const messageInputHeight = document.getElementById("message-input-height"); if (messageInputHeight) { if (messageInputHeight.value) { @@ -1127,6 +1137,19 @@ async function on_api() { messageInput.style.maxHeight = `${messageInputHeight.value}px`; }); } + const darkMode = document.getElementById("darkMode"); + if (darkMode) { + if (!darkMode.checked) { + document.body.classList.add("white"); + } + darkMode.addEventListener('change', async (event) => { + if (event.target.checked) { + document.body.classList.remove("white"); + } else { + document.body.classList.add("white"); + } + }); + } } async function load_version() { -- cgit v1.2.3