forked from extern/easydiffusion
Add event listener beforeunload
When closing the window, a warning is shown if there are any render results.
This commit is contained in:
parent
3f26d03166
commit
5a06946469
@ -1417,4 +1417,17 @@ document.querySelectorAll(".tab").forEach(tab => {
|
||||
})
|
||||
})
|
||||
|
||||
window.addEventListener("beforeunload", function(e) {
|
||||
const msg = "Unsaved pictures will be lost!";
|
||||
|
||||
let elementList = document.getElementsByClassName("imageTaskContainer");
|
||||
if (elementList.length != 0) {
|
||||
e.preventDefault();
|
||||
(e || window.event).returnValue = msg;
|
||||
return msg;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
createCollapsibles()
|
||||
|
Loading…
Reference in New Issue
Block a user