mirror of
https://github.com/aljazceru/awesome-nostr.git
synced 2025-12-10 14:48:49 +00:00
js fix
This commit is contained in:
19
script.js
19
script.js
@@ -295,28 +295,13 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
applyColorTheme(currentColorTheme);
|
applyColorTheme(currentColorTheme);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Color theme initialization
|
// Color theme initialization - color theme select is commented out in HTML
|
||||||
const colorThemeSelect = document.getElementById('colorThemeSelect'); // This will be null since we commented it out
|
|
||||||
const savedColorTheme = localStorage.getItem('colorTheme');
|
const savedColorTheme = localStorage.getItem('colorTheme');
|
||||||
const defaultTheme = 'default';
|
const defaultTheme = 'default';
|
||||||
|
|
||||||
// Validate saved theme exists
|
// Validate saved theme exists and apply it
|
||||||
const initialTheme = colorThemes[savedColorTheme] ? savedColorTheme : defaultTheme;
|
const initialTheme = colorThemes[savedColorTheme] ? savedColorTheme : defaultTheme;
|
||||||
// Only set the value if the element exists
|
|
||||||
if (colorThemeSelect) {
|
|
||||||
colorThemeSelect.value = initialTheme;
|
|
||||||
}
|
|
||||||
applyColorTheme(initialTheme);
|
applyColorTheme(initialTheme);
|
||||||
|
|
||||||
// Color theme change event listener
|
|
||||||
// Only add the event listener if the element exists
|
|
||||||
if (colorThemeSelect) {
|
|
||||||
colorThemeSelect.addEventListener('change', (e) => {
|
|
||||||
const selectedTheme = e.target.value;
|
|
||||||
localStorage.setItem('colorTheme', selectedTheme);
|
|
||||||
applyColorTheme(selectedTheme);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test if marked is loaded
|
// Test if marked is loaded
|
||||||
if (typeof marked === 'undefined') {
|
if (typeof marked === 'undefined') {
|
||||||
|
|||||||
Reference in New Issue
Block a user