Function.noop = () => {}; function MessageBox(title, body, buttons, callbacks) { if(u(".ovk-diag-cont").length > 0) return false; let dialog = u( `
${title}
${body}
`); u("body").addClass("dimmed").append(dialog); buttons.forEach((text, callback) => { u(".ovk-diag-action").append(u(``)); let button = u(u(".ovk-diag-action > button.button").last()); button.on("click", function(e) { let __closeDialog = () => { u("body").removeClass("dimmed"); u(".ovk-diag-cont").remove(); }; Reflect.apply(callbacks[callback], { closeDialog: () => __closeDialog(), $dialog: () => u(".ovk-diag-cont") }, [e]); __closeDialog(); }); }); return u(".ovk-diag-cont"); }