From 737374de291793b60e8a4bf801e0b7bb58a94354 Mon Sep 17 00:00:00 2001 From: nate smith Date: Tue, 13 Feb 2024 22:14:51 -0800 Subject: [PATCH] warn on quit if pinned line --- assets/main.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/assets/main.js b/assets/main.js index 12f0d19..9ff293d 100644 --- a/assets/main.js +++ b/assets/main.js @@ -1,6 +1,7 @@ // nostalgia for a simpler, more complicated time const $ = document.querySelector.bind(document); const $$ = document.querySelectorAll.bind(document); + const initialLines = 10; class Button extends HTMLButtonElement { @@ -136,6 +137,11 @@ class Lines extends HTMLDivElement { this.add(); } this.connected = true + addEventListener("beforeunload", (e) => { + if ($$("div.linecontainer:not(.unpinned)").length > 0) { + e.preventDefault(); + } + }); } add() {