Skip to content

Commit 846cf1a

Browse files
committed
Update Perplexity selectors to fix file upload confirmation and response copying
1 parent 7412f31 commit 846cf1a

1 file changed

Lines changed: 20 additions & 26 deletions

File tree

  • packages/browser/src/content-scripts/send-prompt-content-script/chatbots

‎packages/browser/src/content-scripts/send-prompt-content-script/chatbots/perplexity.ts‎

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@ import {
99
} from '../utils/report-initialization-error'
1010

1111
export const perplexity: Chatbot = {
12-
wait_until_ready: async () => {
13-
await new Promise((resolve) => {
14-
const check_for_element = () => {
15-
if (
16-
document.querySelector(
17-
'path[d="M8 8a3.5 3 0 0 1 3.5 -3h1a3.5 3 0 0 1 3.5 3a3 3 0 0 1 -2 3a3 4 0 0 0 -2 4"]'
18-
)
19-
) {
20-
resolve(null)
21-
} else {
22-
setTimeout(check_for_element, 100)
23-
}
24-
}
25-
check_for_element()
26-
})
27-
},
12+
// wait_until_ready: async () => {
13+
// await new Promise((resolve) => {
14+
// const check_for_element = () => {
15+
// if (
16+
// document.querySelector(
17+
// 'path[d="M8 8a3.5 3 0 0 1 3.5 -3h1a3.5 3 0 0 1 3.5 3a3 3 0 0 1 -2 3a3 4 0 0 0 -2 4"]'
18+
// )
19+
// ) {
20+
// resolve(null)
21+
// } else {
22+
// setTimeout(check_for_element, 100)
23+
// }
24+
// }
25+
// check_for_element()
26+
// })
27+
// },
2828
enter_message_and_send: async (params) => {
2929
let instructions = params.message
3030
if (params.message.includes('<files>')) {
@@ -55,7 +55,7 @@ export const perplexity: Chatbot = {
5555
await new Promise((r) => requestAnimationFrame(r))
5656
await new Promise((resolve) => {
5757
const check_for_element = () => {
58-
if (document.querySelector('svg.tabler-icon-file-text')) {
58+
if (document.querySelector('div[data-testid="file-type-icon"]')) {
5959
resolve(null)
6060
} else {
6161
setTimeout(check_for_element, 100)
@@ -116,15 +116,9 @@ export const perplexity: Chatbot = {
116116
footer,
117117
get_chat_turn: (f) => f.closest('.max-w-threadContentWidth'),
118118
perform_copy: (f) => {
119-
const buttons = f.querySelectorAll('button')
120-
const copy_button = Array.from(buttons).find((button) => {
121-
const path = button.querySelectorAll('path')
122-
return Array.from(path).some(
123-
(p) =>
124-
p.getAttribute('d') ==
125-
'M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1'
126-
)
127-
}) as HTMLElement
119+
const copy_button = f.querySelector(
120+
'button:nth-child(4)'
121+
) as HTMLButtonElement
128122
if (!copy_button) {
129123
report_initialization_error({
130124
function_name: 'perplexity.perform_copy',

0 commit comments

Comments
 (0)