mirror of
https://github.com/miniflux/v2.git
synced 2025-08-06 17:41:00 +00:00
Refactor assets bundler and split Javascript files
This commit is contained in:
parent
e1c56b2e53
commit
53deb0b8cd
49 changed files with 2837 additions and 2000 deletions
31
ui/static/js/modal_handler.js
Normal file
31
ui/static/js/modal_handler.js
Normal file
|
@ -0,0 +1,31 @@
|
|||
class ModalHandler {
|
||||
static exists() {
|
||||
return document.getElementById("modal-container") !== null;
|
||||
}
|
||||
|
||||
static open(fragment) {
|
||||
if (ModalHandler.exists()) {
|
||||
return;
|
||||
}
|
||||
|
||||
let container = document.createElement("div");
|
||||
container.id = "modal-container";
|
||||
container.appendChild(document.importNode(fragment, true));
|
||||
document.body.appendChild(container);
|
||||
|
||||
let closeButton = document.querySelector("a.btn-close-modal");
|
||||
if (closeButton !== null) {
|
||||
closeButton.onclick = (event) => {
|
||||
event.preventDefault();
|
||||
ModalHandler.close();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static close() {
|
||||
let container = document.getElementById("modal-container");
|
||||
if (container !== null) {
|
||||
container.parentNode.removeChild(container);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue