From c1d805ffd637678cc9b8b75174690096f3efba53 Mon Sep 17 00:00:00 2001 From: liujuntao Date: Tue, 25 Apr 2023 16:24:21 +0800 Subject: [PATCH] fix a bug: I am considering replacing the 'class' attribute of the chatGptBox with the 'id' attribute because some unknown scripts in the Bing International search web page are automatically blocking elements with the 'class' attribute when they are prepended. However, elements with the 'id' attribute are not blocked. Therefore, the chatGptBox may disappear from the search page --- src/content-script/index.jsx | 6 +++--- src/content-script/styles.scss | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/content-script/index.jsx b/src/content-script/index.jsx index aa59b9e..6eb0f1e 100644 --- a/src/content-script/index.jsx +++ b/src/content-script/index.jsx @@ -48,7 +48,7 @@ async function mountComponent(siteConfig, userConfig) { else await new Promise((r) => setTimeout(r, 500)) } } - document.querySelectorAll('.chatgptbox-container').forEach((e) => { + document.querySelectorAll('.chatgptbox-container,#chatgptbox-container').forEach((e) => { unmountComponentAtNode(e) e.remove() }) @@ -57,12 +57,12 @@ async function mountComponent(siteConfig, userConfig) { if (userConfig.inputQuery) question = await getInput([userConfig.inputQuery]) if (!question && siteConfig) question = await getInput(siteConfig.inputQuery) - document.querySelectorAll('.chatgptbox-container').forEach((e) => { + document.querySelectorAll('.chatgptbox-container,#chatgptbox-container').forEach((e) => { unmountComponentAtNode(e) e.remove() }) const container = document.createElement('div') - container.className = 'chatgptbox-container' + container.id='chatgptbox-container' render(