Spaces:
Running
Running
Download components/settings.js from Amamia/grademaster-pro: direct link, hf CLI and curl.
- Browser
- Download file 2.48 kB
-
https://huggingface.co/spaces/Amamia/grademaster-pro/resolve/main/components/settings.js
- Command line
-
hf download hf://spaces/Amamia/grademaster-pro/components/settings.js
-
curl -L -o settings.js https://huggingface.co/spaces/Amamia/grademaster-pro/resolve/main/components/settings.js
2.48 kB
| class CustomSettings extends HTMLElement { | |
| constructor() { | |
| super(); | |
| this.attachShadow({ mode: 'open' }); | |
| this.wallpapers = [ | |
| 'http://static.photos/nature/1200x630/42', | |
| 'http://static.photos/cityscape/1200x630/23', | |
| 'http://static.photos/abstract/1200x630/15', | |
| 'http://static.photos/workspace/1200x630/7' | |
| ]; | |
| } | |
| connectedCallback() { | |
| this.render(); | |
| this.setupEventListeners(); | |
| } | |
| render() { | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| :host { | |
| display: block; | |
| position: fixed; | |
| top: 50%; | |
| left: 50%; | |
| transform: translate(-50%, -50%); | |
| width: 500px; | |
| height: 400px; | |
| background: white; | |
| border-radius: 8px; | |
| box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); | |
| z-index: 100; | |
| padding: 20px; | |
| } | |
| h2 { | |
| margin-top: 0; | |
| color: #333; | |
| } | |
| .wallpaper-grid { | |
| display: grid; | |
| grid-template-columns: repeat(2, 1fr); | |
| gap: 15px; | |
| margin-top: 20px; | |
| } | |
| .wallpaper-item { | |
| height: 120px; | |
| background-size: cover; | |
| background-position: center; | |
| border-radius: 4px; | |
| cursor: pointer; | |
| border: 2px solid transparent; | |
| } | |
| .wallpaper-item:hover { | |
| border-color: #4f46e5; | |
| } | |
| .close-btn { | |
| position: absolute; | |
| top: 15px; | |
| right: 15px; | |
| background: none; | |
| border: none; | |
| cursor: pointer; | |
| } | |
| </style> | |
| <button class="close-btn"> | |
| <i data-feather="x"></i> | |
| </button> | |
| <h2>Настройки системы</h2> | |
| <h3>Обои рабочего стола</h3> | |
| <div class="wallpaper-grid"> | |
| ${this.wallpapers.map(wp => ` | |
| <div class="wallpaper-item" style="background-image: url(${wp})" data-url="${wp}"></div> | |
| `).join('')} | |
| </div> | |
| `; | |
| feather.replace(); | |
| } | |
| setupEventListeners() { | |
| this.shadowRoot.querySelectorAll('.wallpaper-item').forEach(item => { | |
| item.addEventListener('click', () => { | |
| const desktop = document.querySelector('custom-desktop'); | |
| desktop.setWallpaper(item.dataset.url); | |
| }); | |
| }); | |
| this.shadowRoot.querySelector('.close-btn').addEventListener('click', () => { | |
| this.remove(); | |
| }); | |
| } | |
| } | |
| customElements.define('custom-settings', CustomSettings); |