Skip to content

Commit c1d805f

Browse files
liujuntao123josStorer
authored andcommitted
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
1 parent 70fd775 commit c1d805f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/content-script/index.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async function mountComponent(siteConfig, userConfig) {
4848
else await new Promise((r) => setTimeout(r, 500))
4949
}
5050
}
51-
document.querySelectorAll('.chatgptbox-container').forEach((e) => {
51+
document.querySelectorAll('.chatgptbox-container,#chatgptbox-container').forEach((e) => {
5252
unmountComponentAtNode(e)
5353
e.remove()
5454
})
@@ -57,12 +57,12 @@ async function mountComponent(siteConfig, userConfig) {
5757
if (userConfig.inputQuery) question = await getInput([userConfig.inputQuery])
5858
if (!question && siteConfig) question = await getInput(siteConfig.inputQuery)
5959

60-
document.querySelectorAll('.chatgptbox-container').forEach((e) => {
60+
document.querySelectorAll('.chatgptbox-container,#chatgptbox-container').forEach((e) => {
6161
unmountComponentAtNode(e)
6262
e.remove()
6363
})
6464
const container = document.createElement('div')
65-
container.className = 'chatgptbox-container'
65+
container.id='chatgptbox-container'
6666
render(
6767
<DecisionCard
6868
session={initSession()}

src/content-script/styles.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@
4343
margin-left: 60px;
4444
}
4545

46-
.chatgptbox-container * {
46+
.chatgptbox-container,#chatgptbox-container * {
4747
font-family: 'Cairo', sans-serif;
4848
font-size: 14px;
4949
}
5050

51-
.chatgptbox-container {
51+
.chatgptbox-container,#chatgptbox-container {
5252
width: 100%;
5353
flex-basis: 0;
5454
flex-grow: 1;

0 commit comments

Comments
 (0)