Spaces:
Running
Running
Download components/os-taskbar.js from Amamia/gradegenius-pro: direct link, hf CLI and curl.
- Browser
- Download file 2.22 kB
-
https://huggingface.co/spaces/Amamia/gradegenius-pro/resolve/main/components/os-taskbar.js
- Command line
-
hf download hf://spaces/Amamia/gradegenius-pro/components/os-taskbar.js
-
curl -L -o os-taskbar.js https://huggingface.co/spaces/Amamia/gradegenius-pro/resolve/main/components/os-taskbar.js
2.22 kB
| class OSTaskbar extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| :host { | |
| display: block; | |
| position: fixed; | |
| bottom: 0; | |
| left: 0; | |
| right: 0; | |
| height: 48px; | |
| background: rgba(32, 32, 32, 0.8); | |
| backdrop-filter: blur(10px); | |
| z-index: 100; | |
| display: flex; | |
| align-items: center; | |
| padding: 0 16px; | |
| } | |
| .taskbar-app { | |
| width: 32px; | |
| height: 32px; | |
| margin-right: 8px; | |
| border-radius: 4px; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| color: white; | |
| cursor: pointer; | |
| transition: all 0.2s; | |
| } | |
| .taskbar-app:hover { | |
| background: rgba(255,255,255,0.1); | |
| } | |
| .taskbar-app i { | |
| width: 16px; | |
| height: 16px; | |
| } | |
| .time { | |
| margin-left: auto; | |
| color: white; | |
| font-size: 12px; | |
| } | |
| </style> | |
| <div class="taskbar-app" data-app="browser"> | |
| <i data-feather="globe"></i> | |
| </div> | |
| <div class="taskbar-app" data-app="terminal"> | |
| <i data-feather="terminal"></i> | |
| </div> | |
| <div class="taskbar-app" data-app="settings"> | |
| <i data-feather="settings"></i> | |
| </div> | |
| <div class="time" id="clock">00:00</div> | |
| `; | |
| // Update clock | |
| const updateClock = () => { | |
| const now = new Date(); | |
| this.shadowRoot.getElementById('clock').textContent = | |
| `${now.getHours().toString().padStart(2, '0')}:${now.getMinutes().toString().padStart(2, '0')}`; | |
| }; | |
| updateClock(); | |
| setInterval(updateClock, 60000); | |
| this.shadowRoot.querySelectorAll('.taskbar-app').forEach(icon => { | |
| icon.addEventListener('click', () => { | |
| const app = icon.getAttribute('data-app'); | |
| this.dispatchEvent(new CustomEvent('open-app', { | |
| detail: { app }, | |
| bubbles: true, | |
| composed: true | |
| })); | |
| }); | |
| }); | |
| setTimeout(() => feather.replace(), 100); | |
| } | |
| } | |
| customElements.define('os-taskbar', OSTaskbar); |