Skip to content

Commit 6f17e5c

Browse files
committed
improve NotificationForChatGPTWeb (#710)
1 parent 74e8c1f commit 6f17e5c

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

src/components/MarkdownRender/Hyperlink.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ export function Hyperlink({ href, children }) {
1212
<span
1313
{...linkProperties}
1414
onClick={() => {
15+
const url = new URL(href)
16+
url.searchParams.set('chatgptbox_notification', 'true')
1517
Browser.runtime.sendMessage({
1618
type: 'NEW_URL',
1719
data: {
18-
url: href,
20+
url: url.toString(),
1921
pinned: false,
2022
saveAsChatgptConfig: true,
2123
},

src/components/NotificationForChatGPTWeb/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const NotificationForChatGPTWeb = () => {
7171
style={{
7272
width: '440px',
7373
}}
74-
position="top-right"
74+
position="top-center"
7575
autoClose={7000}
7676
newestOnTop={false}
7777
closeOnClick={false}

src/content-script/index.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,11 @@ async function prepareForForegroundRequests() {
324324

325325
if (!chatgptWebModelKeys.some((model) => userConfig.activeApiModes.includes(model))) return
326326

327-
if (chatgptWebModelKeys.includes(userConfig.modelName)) {
327+
const url = new URL(window.location.href)
328+
if (
329+
url.searchParams.has('chatgptbox_notification') &&
330+
chatgptWebModelKeys.includes(userConfig.modelName)
331+
) {
328332
const div = document.createElement('div')
329333
document.body.append(div)
330334
render(<NotificationForChatGPTWeb container={div} />, div)

0 commit comments

Comments
 (0)