diff --git a/bulkArchiveConversations.js b/bulkArchiveConversations.js index d4997d2..b84fa69 100644 --- a/bulkArchiveConversations.js +++ b/bulkArchiveConversations.js @@ -49,7 +49,19 @@ async function archiveConversation(checkbox) { }); console.log("1. Hovering over conversation...", conversationElement); - conversationElement.dispatchEvent(hoverEvent); + + const interactiveElement = conversationElement.querySelector("[draggable=\"true\"]"); + if (!interactiveElement) { + console.log("Skipping conversation - no interactive elements found"); + // Show notification to user + const title = + conversationElement.querySelector(Selectors.TITLE_SELECTOR) + ?.textContent || "this conversation"; + alert(`Unable to archive the conversation: "${title}".`); + return false; + } + + interactiveElement.dispatchEvent(hoverEvent); await delay(200); const pointerDownEvent = new PointerEvent("pointerdown", { diff --git a/bulkDeleteConversations.js b/bulkDeleteConversations.js index f4cb21e..22760b9 100644 --- a/bulkDeleteConversations.js +++ b/bulkDeleteConversations.js @@ -62,17 +62,15 @@ async function deleteConversation(checkbox) { console.log("conversationElement", conversationElement); - // Look for hoverable element within the conversation element - const hoverableDiv = conversationElement.querySelector( - "div.can-hover\\:group-hover\\:visible" - ); - if (!hoverableDiv) { - console.log("Skipping conversation - no hoverable element found"); + // Look for interactive element within the conversation element + const interactiveElement = conversationElement.querySelector("[draggable=\"true\"]"); + if (!interactiveElement) { + console.log("Skipping conversation - no interactive elements found"); // Show notification to user const title = conversationElement.querySelector(Selectors.TITLE_SELECTOR) ?.textContent || "this conversation"; - alert(`Unable to delete unread conversation: "${title}".`); + alert(`Unable to delete the conversation: "${title}".`); return false; } @@ -83,7 +81,7 @@ async function deleteConversation(checkbox) { }); console.log("1. Hovering over conversation...", conversationElement); - conversationElement.dispatchEvent(hoverEvent); + interactiveElement.dispatchEvent(hoverEvent); await delay(200); // Try to find the three dot button diff --git a/manifest.json b/manifest.json index 5ebcecd..f8839eb 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "ChatGPT Bulk Delete", - "version": "5.8", + "version": "5.9", "description": "A Chrome extension to bulk delete ChatGPT conversations", "icons": { "48": "icon48.png"