From e2c269cc63b41eb6b3f96f81123f2e59f1599f3c Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Thu, 5 Dec 2024 01:20:26 +0100 Subject: Add cookies to HuggingChat provider --- g4f/gui/client/static/css/style.css | 12 +++++------- g4f/gui/client/static/js/chat.v1.js | 30 ++---------------------------- 2 files changed, 7 insertions(+), 35 deletions(-) (limited to 'g4f/gui/client/static') diff --git a/g4f/gui/client/static/css/style.css b/g4f/gui/client/static/css/style.css index d5546f48..6105223b 100644 --- a/g4f/gui/client/static/css/style.css +++ b/g4f/gui/client/static/css/style.css @@ -92,6 +92,10 @@ body { height: 100vh; } +a:-webkit-any-link { + color: var(--accent); +} + .row { display: flex; gap: 10px; @@ -124,7 +128,7 @@ body { .new_version a { color: var(--colour-4); - text-decoration: underline dotted; + text-decoration: underline; } .conversations { @@ -975,11 +979,6 @@ ul { display: flex; } - -a:-webkit-any-link { - color: var(--accent); -} - .conversation .user-input textarea { font-size: 15px; width: 100%; @@ -1021,7 +1020,6 @@ a:-webkit-any-link { background-image: url('data:image/svg+xml;utf-8,'); background-repeat: no-repeat; background-position: center; - transition: background-color 200ms ease, transform 200ms ease-out } .hljs-copy-button:hover { diff --git a/g4f/gui/client/static/js/chat.v1.js b/g4f/gui/client/static/js/chat.v1.js index d1fd886d..834a5de9 100644 --- a/g4f/gui/client/static/js/chat.v1.js +++ b/g4f/gui/client/static/js/chat.v1.js @@ -1065,6 +1065,7 @@ async function hide_sidebar() { sidebar_button.classList.remove("rotated"); settings.classList.add("hidden"); chat.classList.remove("hidden"); + log_storage.classList.add("hidden"); if (window.location.pathname == "/menu/" || window.location.pathname == "/settings/") { history.back(); } @@ -1182,31 +1183,6 @@ const say_hello = async () => { } } -// Theme storage for recurring viewers -const storeTheme = function (theme) { - appStorage.setItem("theme", theme); -}; - -// set theme when visitor returns -const setTheme = function () { - const activeTheme = appStorage.getItem("theme"); - colorThemes.forEach((themeOption) => { - if (themeOption.id === activeTheme) { - themeOption.checked = true; - } - }); - // fallback for no :has() support - document.documentElement.className = activeTheme; -}; - -colorThemes.forEach((themeOption) => { - themeOption.addEventListener("click", () => { - storeTheme(themeOption.id); - // fallback for no :has() support - document.documentElement.className = themeOption.id; - }); -}); - function count_tokens(model, text) { if (model) { if (window.llamaTokenizer) @@ -1273,7 +1249,6 @@ window.addEventListener('pywebviewready', async function() { }); async function on_load() { - setTheme(); count_input(); if (/\/chat\/.+/.test(window.location.href)) { @@ -1290,8 +1265,7 @@ async function on_api() { if (prompt_lock) return; // If not mobile - if (!window.matchMedia("(pointer:coarse)").matches) - if (evt.keyCode === 13 && !evt.shiftKey) { + if (!window.matchMedia("(pointer:coarse)").matches && evt.keyCode === 13 && !evt.shiftKey) { evt.preventDefault(); console.log("pressed enter"); prompt_lock = true; -- cgit v1.2.3