mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Prettified Code!
This commit is contained in:
parent
d76aa1d46f
commit
534b3af3d9
3 changed files with 42 additions and 52 deletions
|
@ -144,29 +144,30 @@ updateAllChat(false);
|
||||||
// WINDOW LISTENER
|
// WINDOW LISTENER
|
||||||
window.addEventListener("DOMContentLoaded", () => {
|
window.addEventListener("DOMContentLoaded", () => {
|
||||||
// theme selector
|
// 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 =
|
var theme_path =
|
||||||
"../node_modules/bootswatch/dist/" + config.theme + "/bootstrap.min.css";
|
"../node_modules/bootswatch/dist/" + config.theme + "/bootstrap.min.css";
|
||||||
document.getElementById("bootstrap_theme").href = escape(theme_path);
|
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";
|
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
|
||||||
document.getElementById("bootstrap_theme").href = escape(theme_path);
|
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") {
|
} else if (config.theme == "default_dark") {
|
||||||
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
|
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
|
||||||
document.getElementById("bootstrap_theme").href = escape(theme_path);
|
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") {
|
} else if (config.theme == "default_auto") {
|
||||||
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
|
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
|
||||||
document.getElementById("bootstrap_theme").href = escape(theme_path);
|
document.getElementById("bootstrap_theme").href = escape(theme_path);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
|
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
|
||||||
document.getElementById("bootstrap_theme").href = escape(theme_path);
|
document.getElementById("bootstrap_theme").href = escape(theme_path);
|
||||||
document.documentElement.setAttribute('data-bs-theme','light')
|
document.documentElement.setAttribute("data-bs-theme", "light");
|
||||||
}
|
}
|
||||||
|
|
||||||
const userInfoFields = [
|
const userInfoFields = [
|
||||||
|
|
|
@ -338,45 +338,40 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
}
|
}
|
||||||
// theme selector
|
// 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 =
|
var theme_path =
|
||||||
"../node_modules/bootswatch/dist/" + config.theme + "/bootstrap.min.css";
|
"../node_modules/bootswatch/dist/" + config.theme + "/bootstrap.min.css";
|
||||||
document.getElementById("theme_selector").value = config.theme;
|
document.getElementById("theme_selector").value = config.theme;
|
||||||
document.getElementById("bootstrap_theme").href = escape(theme_path);
|
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";
|
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
|
||||||
document.getElementById("theme_selector").value = "default_light";
|
document.getElementById("theme_selector").value = "default_light";
|
||||||
document.getElementById("bootstrap_theme").href = escape(theme_path);
|
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") {
|
} else if (config.theme == "default_dark") {
|
||||||
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
|
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
|
||||||
document.getElementById("theme_selector").value = "default_dark";
|
document.getElementById("theme_selector").value = "default_dark";
|
||||||
document.getElementById("bootstrap_theme").href = escape(theme_path);
|
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") {
|
} else if (config.theme == "default_auto") {
|
||||||
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
|
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
|
||||||
document.getElementById("theme_selector").value = "default_auto";
|
document.getElementById("theme_selector").value = "default_auto";
|
||||||
document.getElementById("bootstrap_theme").href = escape(theme_path);
|
document.getElementById("bootstrap_theme").href = escape(theme_path);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
|
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
|
||||||
document.getElementById("theme_selector").value = "default_light";
|
document.getElementById("theme_selector").value = "default_light";
|
||||||
document.getElementById("bootstrap_theme").href = escape(theme_path);
|
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
|
// Update channel selector
|
||||||
document.getElementById("update_channel_selector").value =
|
document.getElementById("update_channel_selector").value =
|
||||||
config.update_channel;
|
config.update_channel;
|
||||||
|
@ -1191,7 +1186,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
// Theme selector clicked
|
// Theme selector clicked
|
||||||
|
|
||||||
document.getElementById("theme_selector").addEventListener("change", () => {
|
document.getElementById("theme_selector").addEventListener("change", () => {
|
||||||
/*
|
/*
|
||||||
var theme = document.getElementById("theme_selector").value;
|
var theme = document.getElementById("theme_selector").value;
|
||||||
if (theme != "default") {
|
if (theme != "default") {
|
||||||
var theme_path =
|
var theme_path =
|
||||||
|
@ -1200,37 +1195,31 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
|
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
var theme = document.getElementById("theme_selector").value;
|
var theme = document.getElementById("theme_selector").value;
|
||||||
if (theme != "default" && theme != "default_light" && theme != "default_dark" && theme != "default_auto") {
|
if (
|
||||||
|
theme != "default" &&
|
||||||
|
theme != "default_light" &&
|
||||||
|
theme != "default_dark" &&
|
||||||
|
theme != "default_auto"
|
||||||
|
) {
|
||||||
var theme_path =
|
var theme_path =
|
||||||
"../node_modules/bootswatch/dist/" + theme + "/bootstrap.min.css";
|
"../node_modules/bootswatch/dist/" + theme + "/bootstrap.min.css";
|
||||||
|
} else if (theme == "default" || theme == "default_light") {
|
||||||
} else if (theme == "default" || theme == "default_light"){
|
|
||||||
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
|
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") {
|
} else if (theme == "default_dark") {
|
||||||
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
|
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
|
||||||
|
|
||||||
document.querySelector("html").setAttribute('data-bs-theme','dark')
|
document.querySelector("html").setAttribute("data-bs-theme", "dark");
|
||||||
|
|
||||||
} else if (theme == "default_auto") {
|
} else if (theme == "default_auto") {
|
||||||
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
|
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
var theme_path = "../node_modules/bootstrap/dist/css/bootstrap.min.css";
|
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");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//update path to css file
|
//update path to css file
|
||||||
document.getElementById("bootstrap_theme").href = escape(theme_path);
|
document.getElementById("bootstrap_theme").href = escape(theme_path);
|
||||||
|
|
||||||
|
|
|
@ -105,5 +105,5 @@ https://stackoverflow.com/a/9622873
|
||||||
}
|
}
|
||||||
/* default dark theme mods */
|
/* default dark theme mods */
|
||||||
[data-bs-theme="dark"] {
|
[data-bs-theme="dark"] {
|
||||||
/* default dark theme mods */
|
/* default dark theme mods */
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue