Spaces:
Running
Running
Download script.js from GenBO/chromaswitch-deluxe: direct link, hf CLI and curl.
- Browser
- Download file 2.13 kB
-
https://huggingface.co/spaces/GenBO/chromaswitch-deluxe/resolve/main/script.js
- Command line
-
hf download hf://spaces/GenBO/chromaswitch-deluxe/script.js
-
curl -L -o script.js https://huggingface.co/spaces/GenBO/chromaswitch-deluxe/resolve/main/script.js
2.13 kB
| // Hacking tools functionality | |
| const setupHackingTools = () => { | |
| document.addEventListener('click', (e) => { | |
| if (e.target.matches('#port-scan-btn')) { | |
| alert('Port Scanner launched (simulated)'); | |
| } else if (e.target.matches('#ddos-btn')) { | |
| alert('DDoS Simulator launched (simulated)'); | |
| } else if (e.target.matches('#cracker-btn')) { | |
| alert('Password Cracker launched (simulated)'); | |
| } else if (e.target.matches('#sniffer-btn')) { | |
| alert('Network Sniffer launched (simulated)'); | |
| } | |
| }); | |
| }; | |
| // Theme switcher functionality | |
| document.addEventListener('DOMContentLoaded', () => { | |
| setupHackingTools(); | |
| // Check for saved theme preference or use system preference | |
| const savedTheme = localStorage.getItem('theme') || | |
| (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'); | |
| document.documentElement.classList.add(savedTheme); | |
| // Set up theme toggle button (in navbar component) | |
| const themeToggle = document.getElementById('theme-toggle'); | |
| if (themeToggle) { | |
| themeToggle.addEventListener('click', () => { | |
| const html = document.documentElement; | |
| const isDark = html.classList.contains('dark'); | |
| if (isDark) { | |
| html.classList.remove('dark'); | |
| localStorage.setItem('theme', 'light'); | |
| feather.replace(); | |
| } else { | |
| html.classList.add('dark'); | |
| localStorage.setItem('theme', 'dark'); | |
| feather.replace(); | |
| } | |
| }); | |
| } | |
| // Enhanced theme detection with system preference watching | |
| const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)'); | |
| const handleSystemThemeChange = (e) => { | |
| if (!localStorage.getItem('theme')) { | |
| document.documentElement.classList.toggle('dark', e.matches); | |
| feather.replace(); | |
| } | |
| }; | |
| mediaQuery.addListener(handleSystemThemeChange); | |
| // Update icon based on current theme | |
| const updateThemeIcon = () => { | |