From 10366e05b791916b450c0383372851f7c5953ff9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Lui=20=E5=88=98=E5=B1=95=E9=B9=8F?= Date: Wed, 1 May 2024 00:30:36 -0700 Subject: [PATCH] Condensed DOM routine in `chatgpt.clearChats()`, added semicolons --- chatgpt.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/chatgpt.js b/chatgpt.js index 6457c70c5..8b07728d5 100644 --- a/chatgpt.js +++ b/chatgpt.js @@ -426,15 +426,14 @@ const chatgpt = { // eslint-disable-line no-redeclare if (method == 'dom') { try { await chatgpt.getChatData(); } catch { return; } // check if chat history exists - chatgpt.menu.open(); - setTimeout(() => { + chatgpt.menu.open(); setTimeout(() => { // open settings const settingsBtn = document.querySelector( - 'a[role="menuitem"] svg path[d*="M11.6439 3C10.9352"]').parentNode.parentNode - if (settingsBtn) settingsBtn.click() + 'a[role="menuitem"] svg path[d*="M11.6439 3C10.9352"]').parentNode.parentNode; + if (settingsBtn) settingsBtn.click(); setTimeout(() => { // clear chats const settingsBtns = document.querySelectorAll('[id*=radix] button'), deleteBtn = settingsBtns[settingsBtns.length - 1]; - if (deleteBtn) deleteBtn.click() + if (deleteBtn) deleteBtn.click(); setTimeout(() => { // confirm clear document.querySelector('button[class*="danger"').click(); }, 10); }, 333); }, 10);