Fix ESLint

This commit is contained in:
Cohee 2024-04-13 15:24:49 +03:00
parent f79f335491
commit de8339f77b

View File

@ -71,7 +71,7 @@ export class Popup {
this.ok.textContent = okButton ?? 'OK'; this.ok.textContent = okButton ?? 'OK';
this.cancel.textContent = cancelButton ?? 'Cancel'; this.cancel.textContent = cancelButton ?? 'Cancel';
switch(type) { switch (type) {
case POPUP_TYPE.TEXT: { case POPUP_TYPE.TEXT: {
this.input.style.display = 'none'; this.input.style.display = 'none';
this.cancel.style.display = 'none'; this.cancel.style.display = 'none';
@ -107,16 +107,16 @@ export class Popup {
// illegal argument // illegal argument
} }
this.input.addEventListener('keydown', (evt)=>{ this.input.addEventListener('keydown', (evt) => {
if (evt.key != 'Enter' || evt.altKey || evt.ctrlKey || evt.shiftKey) return; if (evt.key != 'Enter' || evt.altKey || evt.ctrlKey || evt.shiftKey) return;
evt.preventDefault(); evt.preventDefault();
evt.stopPropagation(); evt.stopPropagation();
this.completeAffirmative(); this.completeAffirmative();
}); });
this.ok.addEventListener('click', ()=>this.completeAffirmative()); this.ok.addEventListener('click', () => this.completeAffirmative());
this.cancel.addEventListener('click', ()=>this.completeNegative()); this.cancel.addEventListener('click', () => this.completeNegative());
const keyListener = (evt)=>{ const keyListener = (evt) => {
switch (evt.key) { switch (evt.key) {
case 'Escape': { case 'Escape': {
evt.preventDefault(); evt.preventDefault();
@ -134,7 +134,7 @@ export class Popup {
async show() { async show() {
document.body.append(this.dom); document.body.append(this.dom);
this.dom.style.display = 'block'; this.dom.style.display = 'block';
switch(this.type) { switch (this.type) {
case POPUP_TYPE.INPUT: { case POPUP_TYPE.INPUT: {
this.input.focus(); this.input.focus();
break; break;
@ -203,7 +203,7 @@ export class Popup {
duration: animation_duration, duration: animation_duration,
easing: animation_easing, easing: animation_easing,
}); });
delay(animation_duration).then(()=>{ delay(animation_duration).then(() => {
this.dom.remove(); this.dom.remove();
}); });