Files
dotfilesv2/BraveSoftware/Brave-Browser/Default/Extensions/gcknhkkoolaabfmlnjonogaaifnjlfnp/9.2_0/content/options-popup.js
2026-03-28 16:48:16 +00:00

24 lines
560 B
JavaScript

export class Popup {
static {
this.popup = document.querySelector('.popup');
[this.close, this.textarea] = this.popup.children;
this.close.addEventListener('click', () => this.hide());
}
static show(text) {
this.textarea.value += text + '\n';
this.popup.classList.add('on');
}
static hide() {
this.popup.classList.remove('on');
this.textarea.value = '';
[...this.popup.children].forEach(i => {
if (i.nodeName === 'SELECT') {
i.selectedIndex = 0;
i.classList.remove('on');
}
});
}
}