From dafbc049729eadb92b07787f73eecba2ec0655e6 Mon Sep 17 00:00:00 2001 From: qcrao Date: Wed, 10 Jul 2024 21:12:06 +0800 Subject: [PATCH] opt handleBulkArchive --- popup.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/popup.js b/popup.js index 17d1b08..0b2b55f 100644 --- a/popup.js +++ b/popup.js @@ -33,9 +33,8 @@ function initializeButtons() { bulkArchiveButton.addEventListener("click", handleBulkArchive); } +const storageKey = "BulkDeleteChatGPT_isPaid"; async function checkMembershipStatus() { - const storageKey = "BulkDeleteChatGPT_isPaid"; - const localIsPaid = localStorage.getItem(storageKey) === "true"; updateBulkArchiveButton(localIsPaid); @@ -74,6 +73,19 @@ function updateBulkArchiveButton(isPaid) { } async function handleBulkArchive() { + const localIsPaid = localStorage.getItem(storageKey) === "true"; + if (localIsPaid) { + chrome.tabs.query({ active: true, currentWindow: true }, ([tab]) => { + if (tab) { + chrome.scripting.executeScript({ + target: { tabId: tab.id }, + files: ["bulkArchiveConversations.js"], + }); + } + }); + return; + } + const userInfo = await getUserInfo(); if (!userInfo) { console.error("Unable to get user info");