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 = `
Настройки системы
Обои рабочего стола
${this.wallpapers.map(wp => `
`).join('')}
`;
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);