From 3ff46d6f60ac941cf686156adfd86c40fe733d65 Mon Sep 17 00:00:00 2001 From: Will Willems Date: Thu, 9 Jan 2025 12:43:27 +0100 Subject: [PATCH 1/3] Fix DOM changes --- src/uiStuff.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uiStuff.js b/src/uiStuff.js index 0b29ddd..49651cc 100644 --- a/src/uiStuff.js +++ b/src/uiStuff.js @@ -94,13 +94,13 @@ function createGptFooter(footer, mainNode) { const newFooter = footer.cloneNode(true); // div containing 2 childdivs: the buttons-div (containing another div for each button) and the textfield-div (which also contains a div for the speechbutton) - let mainFooterContainerDiv = newFooter.childNodes[0].childNodes[0].childNodes[1].childNodes[0]; + let mainFooterContainerDiv = newFooter.childNodes[0].childNodes[0].childNodes[0].childNodes[0]; const gptButtonObject = createGptButton(); // copies the button container with the smiley etc. and use that as the container for the new buttons at the end: const buttonContainer = mainFooterContainerDiv.childNodes[0]; buttonContainer.removeChild(buttonContainer.firstChild) - buttonContainer.removeChild(buttonContainer.firstChild) + // buttonContainer.removeChild(buttonContainer.firstChild) const newButtonContainer = buttonContainer.cloneNode() mainFooterContainerDiv.appendChild(newButtonContainer) // mainFooterContainerDiv.removeChild(mainFooterContainerDiv.firstChild) @@ -113,7 +113,7 @@ function createGptFooter(footer, mainNode) { }); - const speechbutton = newFooter.querySelectorAll('.svlsagor[data-testid="ptt-ready-btn"]')[0]; + const speechbutton = newFooter.querySelectorAll('button[aria-label="Voice message"]')[0]; const speechButtonParent = speechbutton.parentNode speechButtonParent.remove() From a18a4668e34abf91a45a8ae74b164fe36a6036b8 Mon Sep 17 00:00:00 2001 From: Will Willems Date: Thu, 9 Jan 2025 12:44:54 +0100 Subject: [PATCH 2/3] Fix query selector --- src/parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parser.js b/src/parser.js index 88ef623..7a541df 100644 --- a/src/parser.js +++ b/src/parser.js @@ -22,7 +22,7 @@ function parseHtml(main) { const main2 = main; const chatHistory = []; // console.log(main2) - let msgContainers = main2.querySelectorAll("div[data-testid='msg-container']"); + let msgContainers = main2.querySelectorAll('div[role="row"] .message-out, div[role="row"] .message-in'); const linkedSet = new LinkedSet(); msgContainers = Array.from(msgContainers).slice(-10); From 98c18602a90397d4e68fd70e857ceb7da84f3cb4 Mon Sep 17 00:00:00 2001 From: Will Willems Date: Thu, 9 Jan 2025 12:55:06 +0100 Subject: [PATCH 3/3] Fix button removal --- src/uiStuff.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/uiStuff.js b/src/uiStuff.js index 49651cc..859dd31 100644 --- a/src/uiStuff.js +++ b/src/uiStuff.js @@ -99,8 +99,9 @@ function createGptFooter(footer, mainNode) { // copies the button container with the smiley etc. and use that as the container for the new buttons at the end: const buttonContainer = mainFooterContainerDiv.childNodes[0]; - buttonContainer.removeChild(buttonContainer.firstChild) - // buttonContainer.removeChild(buttonContainer.firstChild) + const textfieldContainer = mainFooterContainerDiv.childNodes[1]; + buttonContainer.removeChild(buttonContainer.firstChild) // remove plus button + textfieldContainer.firstChild.removeChild(textfieldContainer.firstChild.firstChild) // remove emoji button const newButtonContainer = buttonContainer.cloneNode() mainFooterContainerDiv.appendChild(newButtonContainer) // mainFooterContainerDiv.removeChild(mainFooterContainerDiv.firstChild)