From f96419d14c6e9db35e806c7b0e6223d069e9ad68 Mon Sep 17 00:00:00 2001 From: FlorianZahn Date: Sun, 25 Sep 2022 04:40:56 +0200 Subject: [PATCH] popup votebuttons disappear fix (#1493) Co-authored-by: Ajay --- src/popup.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/popup.ts b/src/popup.ts index ece79a66..4e4f499b 100644 --- a/src/popup.ts +++ b/src/popup.ts @@ -83,6 +83,9 @@ async function runThePopup(messageListener?: MessageListener): Promise { let segmentTab = SegmentTab.Segments; let port: chrome.runtime.Port = null; + //saves which detail elemts are opened, by saving the uuids + const openedUUIDs: SegmentUUID[] = []; + const PageElements: PageElements = {}; [ @@ -603,6 +606,18 @@ async function runThePopup(messageListener?: MessageListener): Promise { const votingButtons = document.createElement("details"); votingButtons.classList.add("votingButtons"); + votingButtons.id = "votingButtons" + UUID; + votingButtons.addEventListener("toggle", () => { + if (votingButtons.open) { + openedUUIDs.push(UUID); + } else { + const index = openedUUIDs.indexOf(UUID); + if (index !== -1) { + openedUUIDs.splice(openedUUIDs.indexOf(UUID), 1); + } + } + }); + votingButtons.open = openedUUIDs.some((u) => u === UUID); //thumbs up and down buttons const voteButtonsContainer = document.createElement("div");