Skip to content

Commit d9acdda

Browse files
committed
improve google search sidebar
1 parent a03fcec commit d9acdda

File tree

5 files changed

+15
-7
lines changed

5 files changed

+15
-7
lines changed

src/content-script/index.jsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,14 @@ import { generateAnswersWithChatgptWebApi } from '../services/apis/chatgpt-web.m
3232
import WebJumpBackNotification from '../components/WebJumpBackNotification'
3333

3434
/**
35+
* @param {string} siteName
3536
* @param {SiteConfig} siteConfig
3637
*/
37-
async function mountComponent(siteConfig) {
38+
async function mountComponent(siteName, siteConfig) {
39+
if (siteName === 'github' && location.href.includes('/wiki')) {
40+
return
41+
}
42+
3843
const userConfig = await getUserConfig()
3944

4045
if (!userConfig.alwaysFloatingSidebar) {
@@ -110,6 +115,9 @@ async function mountComponent(siteConfig) {
110115

111116
const container = document.createElement('div')
112117
container.id = 'chatgptbox-container'
118+
if (siteName === 'google' || siteName === 'kagi') {
119+
container.style.width = '350px'
120+
}
113121
render(
114122
<DecisionCard
115123
session={initSession({
@@ -337,7 +345,7 @@ async function prepareForStaticCard() {
337345
}
338346
}
339347

340-
if (initSuccess) mountComponent(siteConfig[siteName])
348+
if (initSuccess) mountComponent(siteName, siteConfig[siteName])
341349
}
342350
}
343351

src/content-script/site-adapters/baidu/index.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default {
1414
) {
1515
const searchValue = await getInput(config.baidu.inputQuery)
1616
if (searchValue) {
17-
mountComponent(config.baidu)
17+
mountComponent('baidu', config.baidu)
1818
}
1919
}
2020
})

src/content-script/site-adapters/bilibili/index.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default {
1414
const newPath = getVideoPath()
1515
if (newPath !== oldPath) {
1616
oldPath = newPath
17-
mountComponent(config.bilibili)
17+
mountComponent('bilibili', config.bilibili)
1818
}
1919
}
2020
window.setInterval(checkPathChange, 500)

src/content-script/site-adapters/github/index.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,13 @@ export default {
130130
if (location.href !== oldUrl) {
131131
oldUrl = location.href
132132
if (isPull() || isIssue()) {
133-
mountComponent(config.github)
133+
mountComponent('github', config.github)
134134
return
135135
}
136136

137137
const patchUrl = await getPatchUrl()
138138
if (patchUrl) {
139-
mountComponent(config.github)
139+
mountComponent('github', config.github)
140140
}
141141
}
142142
}

src/content-script/site-adapters/youtube/index.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default {
1414
const checkUrlChange = async () => {
1515
if (location.href !== oldUrl) {
1616
oldUrl = location.href
17-
mountComponent(config.youtube)
17+
mountComponent('youtube', config.youtube)
1818
}
1919
}
2020
window.setInterval(checkUrlChange, 500)

0 commit comments

Comments
 (0)