File size: 1,110 Bytes
69e8107
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Initialize the application
document.addEventListener('DOMContentLoaded', function() {
    // Add any initialization code here
    console.log('MindMeld Marvels initialized');
    
    // Example of adding a new thought
    const addThoughtButton = document.getElementById('add-thought');
    if (addThoughtButton) {
        addThoughtButton.addEventListener('click', function() {
            alert('Add new thought functionality would go here!');
        });
    }
});

// Function to handle search
function handleSearch(event) {
    event.preventDefault();
    const searchTerm = document.getElementById('search-input').value;
    console.log('Searching for:', searchTerm);
    // Implement search functionality here
}

// Function to toggle dark mode
function toggleDarkMode() {
    document.body.classList.toggle('dark');
    // Save preference to localStorage
    const isDark = document.body.classList.contains('dark');
    localStorage.setItem('darkMode', isDark);
}

// Check for saved dark mode preference
if (localStorage.getItem('darkMode') === 'true') {
    document.body.classList.add('dark');
}