2024-12-24 12:15:45 +02:00
|
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
|
|
const themeStylesheet = document.getElementById("theme-stylesheet");
|
2024-10-19 19:33:40 +02:00
|
|
|
|
|
|
|
// Load saved theme from local storage
|
2024-12-24 12:15:45 +02:00
|
|
|
const savedTheme = localStorage.getItem("theme");
|
2024-10-19 19:33:40 +02:00
|
|
|
if (savedTheme) {
|
2025-01-06 16:02:10 +00:00
|
|
|
const safeTheme = ((savedTheme != 'default') ? encodeURIComponent(savedTheme) : encodeURIComponent('..'));
|
|
|
|
themeStylesheet.href = `styles/themes/${safeTheme}/bootstrap-min.css`;
|
2024-10-19 19:33:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Initialize Select2 on all select elements with the 'select2' class
|
2024-12-24 12:15:45 +02:00
|
|
|
$(".select2").select2({
|
|
|
|
theme: "bootstrap-5",
|
|
|
|
width: $(this).data("width")
|
|
|
|
? $(this).data("width")
|
|
|
|
: $(this).hasClass("w-100")
|
|
|
|
? "100%"
|
|
|
|
: "style",
|
|
|
|
placeholder: $(this).data("placeholder"),
|
2024-10-19 19:33:40 +02:00
|
|
|
});
|
|
|
|
});
|