Remove unnecessary DOM query

This commit is contained in:
Cohee 2024-05-20 21:58:45 +03:00
parent ad3f677a9e
commit 549b2d52a4

View File

@ -68,9 +68,8 @@ export class Popup {
if (allowHorizontalScrolling) dlg.classList.add('horizontal_scrolling_dialogue_popup'); if (allowHorizontalScrolling) dlg.classList.add('horizontal_scrolling_dialogue_popup');
if (allowVerticalScrolling) dlg.classList.add('vertical_scrolling_dialogue_popup'); if (allowVerticalScrolling) dlg.classList.add('vertical_scrolling_dialogue_popup');
const localeDataHolder = $('#shadow_popup_template');
this.ok.textContent = okButton ?? 'OK'; this.ok.textContent = okButton ?? 'OK';
this.cancel.textContent = cancelButton ?? localeDataHolder.attr('popup_text_cancel'); this.cancel.textContent = cancelButton ?? template.getAttribute('popup_text_cancel');
switch (type) { switch (type) {
case POPUP_TYPE.TEXT: { case POPUP_TYPE.TEXT: {
@ -80,13 +79,13 @@ export class Popup {
} }
case POPUP_TYPE.CONFIRM: { case POPUP_TYPE.CONFIRM: {
this.input.style.display = 'none'; this.input.style.display = 'none';
this.ok.textContent = okButton ?? localeDataHolder.attr('popup_text_yes'); this.ok.textContent = okButton ?? template.getAttribute('popup_text_yes');
this.cancel.textContent = cancelButton ?? localeDataHolder.attr('popup_text_no'); this.cancel.textContent = cancelButton ?? template.getAttribute('popup_text_no');
break; break;
} }
case POPUP_TYPE.INPUT: { case POPUP_TYPE.INPUT: {
this.input.style.display = 'block'; this.input.style.display = 'block';
this.ok.textContent = okButton ?? localeDataHolder.attr('popup_text_save'); this.ok.textContent = okButton ?? template.getAttribute('popup_text_save');
break; break;
} }
default: { default: {