Prettified Code!

This commit is contained in:
DJ2LS 2023-03-16 07:28:47 +00:00 committed by GitHub Action
parent d76aa1d46f
commit 534b3af3d9
3 changed files with 42 additions and 52 deletions

View file

@ -144,29 +144,30 @@ updateAllChat(false);
// WINDOW LISTENER
window.addEventListener("DOMContentLoaded", () => {
// theme selector
if (config.theme != "default" && config.theme != "default_light" && config.theme != "default_dark" && config.theme != "default_auto") {
if (
config.theme != "default" &&
config.theme != "default_light" &&
config.theme != "default_dark" &&
config.theme != "default_auto"
) {
var theme_path =
"../node_modules/bootswatch/dist/" + config.theme + "/bootstrap.min.css";
document.getElementById("bootstrap_theme").href = escape(theme_path);
} else if (config.theme == "default" || config.theme == "default_light"){
} else if (config.theme == "default" || config.theme == "default_light") {
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
document.getElementById("bootstrap_theme").href = escape(theme_path);
document.documentElement.setAttribute('data-bs-theme','light')
document.documentElement.setAttribute("data-bs-theme", "light");
} else if (config.theme == "default_dark") {
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
document.getElementById("bootstrap_theme").href = escape(theme_path);
document.querySelector("html").setAttribute('data-bs-theme','dark')
document.querySelector("html").setAttribute("data-bs-theme", "dark");
} else if (config.theme == "default_auto") {
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
document.getElementById("bootstrap_theme").href = escape(theme_path);
} else {
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
document.getElementById("bootstrap_theme").href = escape(theme_path);
document.documentElement.setAttribute('data-bs-theme','light')
document.documentElement.setAttribute("data-bs-theme", "light");
}
const userInfoFields = [

View file

@ -338,45 +338,40 @@ window.addEventListener("DOMContentLoaded", () => {
}
// theme selector
if (config.theme != "default" && config.theme != "default_light" && config.theme != "default_dark" && config.theme != "default_auto") {
if (
config.theme != "default" &&
config.theme != "default_light" &&
config.theme != "default_dark" &&
config.theme != "default_auto"
) {
var theme_path =
"../node_modules/bootswatch/dist/" + config.theme + "/bootstrap.min.css";
document.getElementById("theme_selector").value = config.theme;
document.getElementById("bootstrap_theme").href = escape(theme_path);
} else if (config.theme == "default" || config.theme == "default_light"){
} else if (config.theme == "default" || config.theme == "default_light") {
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
document.getElementById("theme_selector").value = "default_light";
document.getElementById("bootstrap_theme").href = escape(theme_path);
document.documentElement.setAttribute('data-bs-theme','light')
document.documentElement.setAttribute("data-bs-theme", "light");
} else if (config.theme == "default_dark") {
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
document.getElementById("theme_selector").value = "default_dark";
document.getElementById("bootstrap_theme").href = escape(theme_path);
document.querySelector("html").setAttribute('data-bs-theme','dark')
document.querySelector("html").setAttribute("data-bs-theme", "dark");
} else if (config.theme == "default_auto") {
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
document.getElementById("theme_selector").value = "default_auto";
document.getElementById("bootstrap_theme").href = escape(theme_path);
} else {
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
document.getElementById("theme_selector").value = "default_light";
document.getElementById("bootstrap_theme").href = escape(theme_path);
document.documentElement.setAttribute('data-bs-theme','light')
document.documentElement.setAttribute("data-bs-theme", "light");
}
// Update channel selector
document.getElementById("update_channel_selector").value =
config.update_channel;
@ -1191,7 +1186,7 @@ window.addEventListener("DOMContentLoaded", () => {
// Theme selector clicked
document.getElementById("theme_selector").addEventListener("change", () => {
/*
/*
var theme = document.getElementById("theme_selector").value;
if (theme != "default") {
var theme_path =
@ -1200,36 +1195,30 @@ window.addEventListener("DOMContentLoaded", () => {
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
}
*/
var theme = document.getElementById("theme_selector").value;
if (theme != "default" && theme != "default_light" && theme != "default_dark" && theme != "default_auto") {
var theme_path =
var theme = document.getElementById("theme_selector").value;
if (
theme != "default" &&
theme != "default_light" &&
theme != "default_dark" &&
theme != "default_auto"
) {
var theme_path =
"../node_modules/bootswatch/dist/" + theme + "/bootstrap.min.css";
} else if (theme == "default" || theme == "default_light") {
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
} else if (theme == "default" || theme == "default_light"){
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
document.documentElement.setAttribute('data-bs-theme','light')
} else if (theme == "default_dark") {
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
document.querySelector("html").setAttribute('data-bs-theme','dark')
} else if (theme == "default_auto") {
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
} else {
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
document.documentElement.setAttribute('data-bs-theme','light')
}
document.documentElement.setAttribute("data-bs-theme", "light");
} else if (theme == "default_dark") {
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
document.querySelector("html").setAttribute("data-bs-theme", "dark");
} else if (theme == "default_auto") {
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
} else {
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
document.documentElement.setAttribute("data-bs-theme", "light");
}
//update path to css file
document.getElementById("bootstrap_theme").href = escape(theme_path);

View file

@ -105,5 +105,5 @@ https://stackoverflow.com/a/9622873
}
/* default dark theme mods */
[data-bs-theme="dark"] {
/* default dark theme mods */
/* default dark theme mods */
}