mirror of
https://github.com/aljazceru/awesome-nostr.git
synced 2025-12-08 14:38:49 +00:00
fix script to handle when select dropdown commented out
This commit is contained in:
@@ -44,9 +44,9 @@
|
|||||||
<i class="fas fa-search"></i>
|
<i class="fas fa-search"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="theme-controls">
|
<div class="theme-controls">
|
||||||
|
<!-- Color theme select dropdown commented out as requested
|
||||||
<select id="colorThemeSelect" class="theme-select" aria-label="Select color theme">
|
<select id="colorThemeSelect" class="theme-select" aria-label="Select color theme">
|
||||||
<option value="cyberpunk">Default</option>
|
<option value="cyberpunk">Default</option>
|
||||||
<!--
|
|
||||||
<option value="purple">Purple Dream</option>
|
<option value="purple">Purple Dream</option>
|
||||||
<option value="nature">Nature's Touch</option>
|
<option value="nature">Nature's Touch</option>
|
||||||
<option value="sunset">Sunset Vibes</option>
|
<option value="sunset">Sunset Vibes</option>
|
||||||
@@ -58,10 +58,8 @@
|
|||||||
<option value="pastel">Pastel Pop</option>
|
<option value="pastel">Pastel Pop</option>
|
||||||
<option value="oceanic">Oceanic Breeze</option>
|
<option value="oceanic">Oceanic Breeze</option>
|
||||||
<option value="dracula">Dracula</option>
|
<option value="dracula">Dracula</option>
|
||||||
-->
|
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
-->
|
||||||
<button id="darkModeToggle" class="theme-toggle" aria-label="Toggle dark mode">
|
<button id="darkModeToggle" class="theme-toggle" aria-label="Toggle dark mode">
|
||||||
<i class="fas fa-moon"></i>
|
<i class="fas fa-moon"></i>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -296,21 +296,27 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Color theme initialization
|
// Color theme initialization
|
||||||
const colorThemeSelect = document.getElementById('colorThemeSelect');
|
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
|
||||||
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;
|
colorThemeSelect.value = initialTheme;
|
||||||
|
}
|
||||||
applyColorTheme(initialTheme);
|
applyColorTheme(initialTheme);
|
||||||
|
|
||||||
// Color theme change event listener
|
// Color theme change event listener
|
||||||
|
// Only add the event listener if the element exists
|
||||||
|
if (colorThemeSelect) {
|
||||||
colorThemeSelect.addEventListener('change', (e) => {
|
colorThemeSelect.addEventListener('change', (e) => {
|
||||||
const selectedTheme = e.target.value;
|
const selectedTheme = e.target.value;
|
||||||
localStorage.setItem('colorTheme', selectedTheme);
|
localStorage.setItem('colorTheme', selectedTheme);
|
||||||
applyColorTheme(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