warn on quit if pinned line

This commit is contained in:
nate smith 2024-02-13 22:14:51 -08:00
parent 6ff9bbff4f
commit 737374de29

View File

@ -1,6 +1,7 @@
// nostalgia for a simpler, more complicated time // nostalgia for a simpler, more complicated time
const $ = document.querySelector.bind(document); const $ = document.querySelector.bind(document);
const $$ = document.querySelectorAll.bind(document); const $$ = document.querySelectorAll.bind(document);
const initialLines = 10; const initialLines = 10;
class Button extends HTMLButtonElement { class Button extends HTMLButtonElement {
@ -136,6 +137,11 @@ class Lines extends HTMLDivElement {
this.add(); this.add();
} }
this.connected = true this.connected = true
addEventListener("beforeunload", (e) => {
if ($$("div.linecontainer:not(.unpinned)").length > 0) {
e.preventDefault();
}
});
} }
add() { add() {