Updates
This commit is contained in:
parent
f0e1a953b3
commit
3d2ff01e78
223 changed files with 4819 additions and 127381 deletions
47
Libraries/js/app.js
Normal file
47
Libraries/js/app.js
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
let currentDisplayMode = "dark";
|
||||
|
||||
const updateDisplayModeIcons = () => {
|
||||
document.querySelectorAll(".display-mode-icon").forEach((el) => {
|
||||
if (currentDisplayMode == "dark") {
|
||||
el.innerHTML = "🌙";
|
||||
} else if (currentDisplayMode == "moonlight") {
|
||||
el.innerHTML = "☀️";
|
||||
} else {
|
||||
el.innerHTML = "🌑";
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const toggleDisplayMode = () => {
|
||||
if (currentDisplayMode == "dark") {
|
||||
window.localStorage.setItem("displayMode", "moonlight");
|
||||
currentDisplayMode = "moonlight";
|
||||
document.getElementById("themekit-css").href = "/Libraries/css/themekit/main-moonlight.css";
|
||||
} else if (currentDisplayMode == "moonlight") {
|
||||
window.localStorage.setItem("displayMode", "light");
|
||||
currentDisplayMode = "light";
|
||||
document.getElementById("themekit-css").href = "/Libraries/css/themekit/main-light.css";
|
||||
} else {
|
||||
window.localStorage.setItem("displayMode", "dark");
|
||||
currentDisplayMode = "dark";
|
||||
document.getElementById("themekit-css").href = "/Libraries/css/themekit/main-dark.css";
|
||||
}
|
||||
updateDisplayModeIcons();
|
||||
};
|
||||
|
||||
window.addEventListener("DOMContentLoaded", (evt) => {
|
||||
if (window.localStorage.getItem("displayMode") != null) {
|
||||
currentDisplayMode = window.localStorage.getItem("displayMode");
|
||||
} else {
|
||||
window.localStorage.setItem("displayMode", "dark");
|
||||
}
|
||||
|
||||
if (currentDisplayMode == "dark") {
|
||||
document.getElementById("themekit-css").href = "/Libraries/css/themekit/main-dark.css";
|
||||
} else if (currentDisplayMode == "moonlight") {
|
||||
document.getElementById("themekit-css").href = "/Libraries/css/themekit/main-moonlight.css";
|
||||
} else {
|
||||
document.getElementById("themekit-css").href = "/Libraries/css/themekit/main-light.css";
|
||||
}
|
||||
updateDisplayModeIcons();
|
||||
});
|
||||
63
Libraries/js/themekit/menu.js
Normal file
63
Libraries/js/themekit/menu.js
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/**
|
||||
* Uses ZERO Jquery!!
|
||||
*/
|
||||
|
||||
let menuOpen = false;
|
||||
|
||||
const toggleSubMenu = (el) => {
|
||||
|
||||
let icon = el.querySelector("i.fa");
|
||||
let isOpen = icon.hasAttribute("submenuOpen") ? parseInt(icon.getAttribute("submenuOpen")) : 0;
|
||||
|
||||
|
||||
document.querySelectorAll(`[for=${el.getAttribute("from")}]`).forEach((elSearched) => {
|
||||
if (isOpen == 1) {
|
||||
elSearched.classList.remove("visible");
|
||||
} else {
|
||||
elSearched.classList.add("visible");
|
||||
}
|
||||
});
|
||||
|
||||
if (isOpen == 1) {
|
||||
icon.style.transition = "transform ease-in-out 250ms";
|
||||
icon.style.transform = "rotate(0deg)";
|
||||
icon.setAttribute("submenuOpen", 0);
|
||||
} else { // Not open..
|
||||
icon.style.transition = "transform ease-in-out 250ms";
|
||||
icon.style.transform = "rotate(90deg)";
|
||||
icon.setAttribute("submenuOpen", 1);
|
||||
}
|
||||
};
|
||||
|
||||
const toggleMenu = () => {
|
||||
let menu = document.querySelector(".mobile-menu");
|
||||
menuOpen = !menuOpen;
|
||||
|
||||
if (menuOpen) {
|
||||
menu.classList.add("visible");
|
||||
document.body.classList.add("no-scroll");
|
||||
} else {
|
||||
menu.classList.remove("visible");
|
||||
document.body.classList.remove("no-scroll");
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener("DOMContentLoaded", (evt) => {
|
||||
document.querySelectorAll(".compact.submenu.item").forEach((el) => {
|
||||
let id = `subMenu_${new Date().getMilliseconds()}`;
|
||||
el.setAttribute("from", id);
|
||||
|
||||
let subMenuItems = [];
|
||||
|
||||
el.querySelectorAll(".compact.sub.item").forEach((child) => {
|
||||
subMenuItems.push(child);
|
||||
});
|
||||
|
||||
subMenuItems.reverse();
|
||||
|
||||
subMenuItems.forEach((child) => {
|
||||
child.setAttribute("for", id);
|
||||
el.parentElement.insertBefore(child, el.nextSibling);
|
||||
});
|
||||
});
|
||||
});
|
||||
43
Libraries/js/themekit/modal.js
Normal file
43
Libraries/js/themekit/modal.js
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
window.addEventListener("DOMContentLoaded", (evt) => {
|
||||
window.onclick = (event) => {
|
||||
if (event.target.classList.contains("modal")) {
|
||||
let modal = event.target;
|
||||
modal.classList.remove("visible");
|
||||
modal.removeAttribute("active");
|
||||
document.body.classList.remove("modal-no-scroll");
|
||||
}
|
||||
};
|
||||
|
||||
document.querySelectorAll(".modal .close").forEach((closeBtn) => {
|
||||
closeBtn.addEventListener('click', (evt) => {
|
||||
let modal = closeBtn.parentElement.parentElement;
|
||||
modal.classList.remove("visible");
|
||||
modal.removeAttribute("active");
|
||||
document.body.classList.remove("modal-no-scroll");
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelectorAll("[for-modal]").forEach((modalTrigerEl) => {
|
||||
modalTrigerEl.addEventListener('click', (evt) => {
|
||||
let modal = document.getElementById(modalTrigerEl.getAttribute("for-modal"));
|
||||
modal.classList.add("visible");
|
||||
modal.setAttribute("active", "");
|
||||
document.body.classList.add("modal-no-scroll");
|
||||
});
|
||||
});
|
||||
|
||||
// document.querySelectorAll("[for-modal]").forEach((modalTrigerEl) => {
|
||||
// let modal = document.getElementById(modalTrigerEl.getAttribute("for-modal"));
|
||||
// modal.classList.remove("visible");
|
||||
// modal.removeAttribute("active");
|
||||
// });
|
||||
|
||||
document.body.addEventListener('keydown', (evt) => {
|
||||
if (evt.key == "Escape") {
|
||||
let modal = document.querySelector(".modal[active]");
|
||||
modal.classList.remove("visible");
|
||||
modal.removeAttribute("active");
|
||||
document.body.classList.remove("modal-no-scroll");
|
||||
}
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue