Spaces:
Running
Running
| document.addEventListener('DOMContentLoaded', () => { | |
| // Initialize tool data | |
| const tools = [ | |
| { icon: 'code', title: 'HTML Formatter', category: 'Developer' }, | |
| { icon: 'image', title: 'Image Compressor', category: 'Media' }, | |
| { icon: 'file-text', title: 'PDF to Word', category: 'Documents' }, | |
| { icon: 'link', title: 'URL Shortener', category: 'Web' }, | |
| { icon: 'lock', title: 'Password Generator', category: 'Security' }, | |
| { icon: 'hash', title: 'Base64 Encoder', category: 'Developer' }, | |
| { icon: 'calendar', title: 'Date Calculator', category: 'Utilities' }, | |
| { icon: 'dollar-sign', title: 'Currency Converter', category: 'Finance' }, | |
| // Add more tools as needed | |
| ]; | |
| // Theme toggle functionality | |
| const themeToggle = document.getElementById('theme-toggle'); | |
| if (themeToggle) { | |
| themeToggle.addEventListener('click', () => { | |
| document.documentElement.classList.toggle('dark'); | |
| localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); | |
| }); | |
| } | |
| // Check for saved theme preference | |
| if (localStorage.getItem('theme') === 'dark' || (!localStorage.getItem('theme') && window.matchMedia('(prefers-color-scheme: dark)').matches)) { | |
| document.documentElement.classList.add('dark'); | |
| } else { | |
| document.documentElement.classList.remove('dark'); | |
| } | |
| }); |