Remove unnecessary explicit jQuery parameter

This commit is contained in:
Johannes Loher 2021-05-13 22:09:38 +02:00
parent 549669e9e2
commit b71adefc65

View file

@ -119,42 +119,39 @@ async function askGmModifier(
const renderedHtml = await renderTemplate(usedTemplate, templateData); const renderedHtml = await renderTemplate(usedTemplate, templateData);
const dialogPromise = new Promise<HTMLFormElement>((resolve) => { const dialogPromise = new Promise<HTMLFormElement>((resolve) => {
new Dialog( new Dialog({
{ title: usedTitle,
title: usedTitle, content: renderedHtml,
content: renderedHtml, buttons: {
buttons: { ok: {
ok: { icon: '<i class="fas fa-check"></i>',
icon: '<i class="fas fa-check"></i>', label: game.i18n.localize("DS4.GenericOkButton"),
label: game.i18n.localize("DS4.GenericOkButton"), callback: (html) => {
callback: (html) => { if (!("jquery" in html)) {
if (!("jquery" in html)) { throw new Error(
game.i18n.format("DS4.ErrorUnexpectedHtmlType", {
exType: "JQuery",
realType: "HTMLElement",
}),
);
} else {
const innerForm = html[0].querySelector("form");
if (!innerForm) {
throw new Error( throw new Error(
game.i18n.format("DS4.ErrorUnexpectedHtmlType", { game.i18n.format("DS4.ErrorCouldNotFindHtmlElement", { htmlElement: "form" }),
exType: "JQuery",
realType: "HTMLElement",
}),
); );
} else {
const innerForm = html[0].querySelector("form");
if (!innerForm) {
throw new Error(
game.i18n.format("DS4.ErrorCouldNotFindHtmlElement", { htmlElement: "form" }),
);
}
resolve(innerForm);
} }
}, resolve(innerForm);
}, }
cancel: {
icon: '<i class="fas fa-times"></i>',
label: game.i18n.localize("DS4.GenericCancelButton"),
}, },
}, },
default: "ok", cancel: {
icon: '<i class="fas fa-times"></i>',
label: game.i18n.localize("DS4.GenericCancelButton"),
},
}, },
{ jQuery: true }, default: "ok",
).render(true); }).render(true);
}); });
const dialogForm = await dialogPromise; const dialogForm = await dialogPromise;
return parseDialogFormData(dialogForm); return parseDialogFormData(dialogForm);