/
githubmirror
/
text-generation-webui
Обзор
Документация
Войти
/
githubmirror
/
text-generation-webui
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v3.21
js/dark_theme.js
20 строк
797 B
oobabooga
Minor optimization after
e976a5d
10 июн 2025, 04:40
10 июн 2025, 04:40
d085dc6
Код
Авторство
О чём код?
function toggleDarkMode() { document.body.classList.toggle("dark"); var 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() { const messageBodies = document.getElementById("chat").querySelectorAll(".message-body"); messageBodies.forEach((messageBody) => { const codeBlocks = messageBody.querySelectorAll("pre code"); codeBlocks.forEach((codeBlock) => { hljs.highlightElement(codeBlock); }); }); }; }