mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-08-20 13:47:46 +02:00
Force dark mode on update notifications
This commit is contained in:
parent
0c072c56b5
commit
7c34373e76
@ -45,6 +45,25 @@ function setMode(mode) {
|
|||||||
tables.forEach((table) => {
|
tables.forEach((table) => {
|
||||||
table.classList.add("table-dark");
|
table.classList.add("table-dark");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Handle dynamically created accordion elements
|
||||||
|
var accordionItems = document.querySelectorAll(".accordion-item");
|
||||||
|
accordionItems.forEach((item) => {
|
||||||
|
item.style.color = "var(--md-sys-color-on-surface)";
|
||||||
|
item.style.backgroundColor = "var(--md-sys-color-surface-5)";
|
||||||
|
item.style.border = "1px solid var(--md-sys-color-outline-variant)";
|
||||||
|
});
|
||||||
|
var accordionButtons = document.querySelectorAll(".accordion-button");
|
||||||
|
accordionButtons.forEach((button) => {
|
||||||
|
button.style.color = "var(--md-sys-color-on-surface)";
|
||||||
|
button.style.backgroundColor = "var(--md-sys-color-surface-5)";
|
||||||
|
button.style.borderColor = "var(--md-sys-color-outline-variant)";
|
||||||
|
});
|
||||||
|
var accordionBodies = document.querySelectorAll(".accordion-body");
|
||||||
|
accordionBodies.forEach((body) => {
|
||||||
|
body.style.color = "var(--md-sys-color-on-surface)";
|
||||||
|
body.style.backgroundColor = "var(--md-sys-color-surface-5)";
|
||||||
|
});
|
||||||
} else if (mode === "off") {
|
} else if (mode === "off") {
|
||||||
if (elements && elements.darkModeIcon) {
|
if (elements && elements.darkModeIcon) {
|
||||||
elements.darkModeIcon.textContent = "light_mode";
|
elements.darkModeIcon.textContent = "light_mode";
|
||||||
|
@ -309,6 +309,18 @@ async function showUpdateModal() {
|
|||||||
// Update modal with full information
|
// Update modal with full information
|
||||||
const modalBody = document.getElementById('updateModalBody');
|
const modalBody = document.getElementById('updateModalBody');
|
||||||
if (fullUpdateInfo && fullUpdateInfo.new_versions) {
|
if (fullUpdateInfo && fullUpdateInfo.new_versions) {
|
||||||
|
// Check if dark mode is active
|
||||||
|
const isDarkMode = localStorage.getItem("dark-mode") === "on";
|
||||||
|
const darkClasses = isDarkMode ? {
|
||||||
|
accordionItem: 'bg-dark border-secondary text-light',
|
||||||
|
accordionButton: 'bg-dark text-light border-secondary',
|
||||||
|
accordionBody: 'bg-dark text-light'
|
||||||
|
} : {
|
||||||
|
accordionItem: '',
|
||||||
|
accordionButton: '',
|
||||||
|
accordionBody: ''
|
||||||
|
};
|
||||||
|
|
||||||
const detailedVersionsHtml = `
|
const detailedVersionsHtml = `
|
||||||
<div class="detailed-versions mt-4">
|
<div class="detailed-versions mt-4">
|
||||||
<h6>Available Updates:</h6>
|
<h6>Available Updates:</h6>
|
||||||
@ -349,6 +361,27 @@ async function showUpdateModal() {
|
|||||||
spinner.parentElement.remove();
|
spinner.parentElement.remove();
|
||||||
}
|
}
|
||||||
modalBody.insertAdjacentHTML('beforeend', detailedVersionsHtml);
|
modalBody.insertAdjacentHTML('beforeend', detailedVersionsHtml);
|
||||||
|
|
||||||
|
// Apply dark mode styling if active
|
||||||
|
if (isDarkMode) {
|
||||||
|
var accordionItems = document.querySelectorAll("#versionsAccordion .accordion-item");
|
||||||
|
accordionItems.forEach((item) => {
|
||||||
|
item.style.color = "var(--md-sys-color-on-surface)";
|
||||||
|
item.style.backgroundColor = "var(--md-sys-color-surface-5)";
|
||||||
|
item.style.border = "1px solid var(--md-sys-color-outline-variant)";
|
||||||
|
});
|
||||||
|
var accordionButtons = document.querySelectorAll("#versionsAccordion .accordion-button");
|
||||||
|
accordionButtons.forEach((button) => {
|
||||||
|
button.style.color = "";
|
||||||
|
button.style.backgroundColor = "";
|
||||||
|
button.style.borderColor = "";
|
||||||
|
});
|
||||||
|
var accordionBodies = document.querySelectorAll("#versionsAccordion .accordion-body");
|
||||||
|
accordionBodies.forEach((body) => {
|
||||||
|
body.style.color = "var(--md-sys-color-on-surface)";
|
||||||
|
body.style.backgroundColor = "var(--md-sys-color-surface-5)";
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Remove loading spinner if failed to load
|
// Remove loading spinner if failed to load
|
||||||
const spinner = document.getElementById('loadingSpinner');
|
const spinner = document.getElementById('loadingSpinner');
|
||||||
|
Loading…
Reference in New Issue
Block a user