summaryrefslogtreecommitdiff
path: root/WebInterface/NodeJSServer/src/modules/ui/modal.js
diff options
context:
space:
mode:
authorTrueDoctor <d-kobert@web.de>2018-10-01 02:28:52 +0200
committerTrueDoctor <d-kobert@web.de>2018-10-01 02:28:52 +0200
commit4ddde4c2e793c7d4cc240c90d5fcb0bc1ddf7a4b (patch)
treead9e45b40bfdb2175e6edca26541e3ea68984616 /WebInterface/NodeJSServer/src/modules/ui/modal.js
parent6285967d1cf6e9322f584de761eea31ade32b3e5 (diff)
parent71783b20dbddd018d2ea140bced59048c7baf0a4 (diff)
Merge branch 'WebApi' of https://github.com/TrueDoctor/DiscoBot into WebApi
Diffstat (limited to 'WebInterface/NodeJSServer/src/modules/ui/modal.js')
-rw-r--r--WebInterface/NodeJSServer/src/modules/ui/modal.js17
1 files changed, 13 insertions, 4 deletions
diff --git a/WebInterface/NodeJSServer/src/modules/ui/modal.js b/WebInterface/NodeJSServer/src/modules/ui/modal.js
index e1aa8a2..55e38bd 100644
--- a/WebInterface/NodeJSServer/src/modules/ui/modal.js
+++ b/WebInterface/NodeJSServer/src/modules/ui/modal.js
@@ -13,6 +13,7 @@ export default class Modal {
title.textContent = titleString;
modal.appendChild(title);
+ modal.appendChild(body);
modalBackground.appendChild(modal);
document.body.appendChild(modalBackground);
@@ -25,11 +26,19 @@ export default class Modal {
}
registerEvents() {
+ this.modal.addEventListener('click', (e) => {
+ e.stopPropagation();
+ });
+
this.bg.addEventListener('click', () => {
- this.bg.classList.add('hidden');
- this.bg.addEventListener('transitionend', () => {
- document.body.removeChild(this.bg);
- });
+ this.close();
+ });
+ }
+
+ close() {
+ this.bg.classList.add('hidden');
+ this.bg.addEventListener('transitionend', () => {
+ document.body.removeChild(this.bg);
});
}