/
githubmirror
/
text-generation-webui
Обзор
Документация
Войти
/
githubmirror
/
text-generation-webui
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v4.3
js/dark_theme.js
18 строк
750 B
oobabooga
Several small code simplifications
31 мар 2026, 05:36
31 мар 2026, 05:36
6382fbe
Код
Авторство
О чём код?
function toggleDarkMode() { document.body.classList.toggle("dark"); const currentCSS = document.getElementById("highlight-css"); if (currentCSS.getAttribute("href") === "file/css/highlightjs/github-dark.min.css") { currentCSS.setAttribute("href", "file/css/highlightjs/github.min.css"); } else { currentCSS.setAttribute("href", "file/css/highlightjs/github-dark.min.css"); } // Re-highlight all code blocks once stylesheet loads currentCSS.onload = function() { // Clear data-highlighted so hljs will re-process with the new theme document.querySelectorAll("#chat .message-body pre code[data-highlighted]").forEach((codeBlock) => { delete codeBlock.dataset.highlighted; }); doSyntaxHighlighting(); }; }