Skip to content

Commit

Permalink
Condensed DOM routine in chatgpt.clearChats(), added semicolons
Browse files Browse the repository at this point in the history
  • Loading branch information
adamlui authored May 1, 2024
1 parent 24936cc commit 10366e0
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions chatgpt.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 10366e0

Please sign in to comment.