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