Skip to content

Commit 0f36b1c

Browse files
authored
editor animations -- hijack addon modals [EVIL]
1 parent 74d44ee commit 0f36b1c

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/addons/addons/editor-animations/userscript.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,38 @@ export default async function({ addon }) {
428428
ogInitButton.call(this, ...args);
429429
queueMicrotask(() => compileClasses());
430430
}
431+
432+
/* addon modal API */
433+
const ogAddonPrompt = addon.tab.prompt;
434+
addon.tab.prompt = function(...args) {
435+
const modal = ogAddonPrompt.call(this, ...args);
436+
handleOpenAnimation("modal");
437+
attachCloseHijack("modal");
438+
return modal;
439+
}
440+
const ogAddonConfirm = addon.tab.confirm;
441+
addon.tab.confirm = function(...args) {
442+
const modal = ogAddonConfirm.call(this, ...args);
443+
handleOpenAnimation("modal");
444+
attachCloseHijack("modal");
445+
return modal;
446+
}
447+
const ogAddonCreateModal = addon.tab.createModal;
448+
addon.tab.createModal = function(...args) {
449+
const modal = ogAddonCreateModal.call(this, ...args);
450+
handleOpenAnimation("modal");
451+
attachCloseHijack("modal");
452+
return modal;
453+
}
454+
}
455+
456+
confirm (...args) {
457+
return modal.confirm(this, ...args);
458+
}
459+
460+
prompt (...args) {
461+
return modal.prompt(this, ...args);
462+
}
431463
});
432464
}
433465

0 commit comments

Comments
 (0)