From d04d4a2c1748a3967f37cbcfc05fa5964ac4ff6e Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Fri, 10 Dec 2021 18:15:42 -0700 Subject: [PATCH] begin dynamic error modal --- scripts/modal/common/error.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 scripts/modal/common/error.js diff --git a/scripts/modal/common/error.js b/scripts/modal/common/error.js new file mode 100644 index 0000000..e2c7fd0 --- /dev/null +++ b/scripts/modal/common/error.js @@ -0,0 +1,18 @@ +const preModal = require("../pre"); +const postModal = require('../post'); + +module.exports = (name, text, after = () => {}) => { + preModal('error-modal'); + let modal = document.createElement('div'); + modal.className = 'modal'; + modal.id = 'error-modal'; + document.body.appendChild(modal); + let title = document.createElement('h2'); + title.innerHTML = `Error - ${name}`; + modal.appendChild(title); + let err = document.createElement('p'); + err.innerHTML = text; + modal.appendChild(err); + after('error-modal'); + postModal(); +}; \ No newline at end of file