Skip to content

Commit a5019b5

Browse files
committed
Refined conditions for updating styles ↞ [auto-sync from https://github.com/adamlui/ai-web-extensions/tree/main/chatgpt-widescreen]
1 parent 56735f1 commit a5019b5

File tree

3 files changed

+13
-19
lines changed

3 files changed

+13
-19
lines changed

chromium/extension/content.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,9 @@
235235
const sidebarObserver = new ResizeObserver( // sync config.fullWindow ⇆ sidebar width + update styles
236236
async () => {
237237
if ((config.fullWindow ^ await ui.isFullWin()) && !config.modeSynced) sync.mode('fullWindow')
238-
if (env.site != 'poe') setTimeout(() => {
238+
if (env.site != 'poe' && config.widescreen) setTimeout(() => {
239239
styles.update({ key: 'widescreen' }) // for new window.wsMaxWidth
240-
if (sites[env.site].availFeatures.includes('widerChatbox') && config.widerChatbox)
241-
styles.update({ key: 'chatbar' })
240+
if (config.widerChatbox) styles.update({ key: 'chatbar' })
242241
}, env.site == 'perplexity' ? 100 : 0)
243242
}
244243
)
@@ -270,9 +269,8 @@
270269
} else if (!config.fullscreen && fullscreenState) // entering full screen
271270
sync.mode('fullscreen')
272271
if (config.widescreen) {
273-
styles.update({ key: 'widescreen' })
274-
if (sites[env.site].availFeatures.includes('widerChatbox') && config.widerChatbox)
275-
styles.update({ key: 'chatbar' })
272+
styles.update({ key: 'widescreen' }) // for new window.wsMaxWidth
273+
if (config.widerChatbox) styles.update({ key: 'chatbar' })
276274
}
277275
if (env.site == 'chatgpt') chatbar.tweak() // update chatgpt.com chatbar inner width
278276
})

firefox/extension/content.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,9 @@
235235
const sidebarObserver = new ResizeObserver( // sync config.fullWindow ⇆ sidebar width + update styles
236236
async () => {
237237
if ((config.fullWindow ^ await ui.isFullWin()) && !config.modeSynced) sync.mode('fullWindow')
238-
if (env.site != 'poe') setTimeout(() => {
238+
if (env.site != 'poe' && config.widescreen) setTimeout(() => {
239239
styles.update({ key: 'widescreen' }) // for new window.wsMaxWidth
240-
if (sites[env.site].availFeatures.includes('widerChatbox') && config.widerChatbox)
241-
styles.update({ key: 'chatbar' })
240+
if (config.widerChatbox) styles.update({ key: 'chatbar' })
242241
}, env.site == 'perplexity' ? 100 : 0)
243242
}
244243
)
@@ -270,9 +269,8 @@
270269
} else if (!config.fullscreen && fullscreenState) // entering full screen
271270
sync.mode('fullscreen')
272271
if (config.widescreen) {
273-
styles.update({ key: 'widescreen' })
274-
if (sites[env.site].availFeatures.includes('widerChatbox') && config.widerChatbox)
275-
styles.update({ key: 'chatbar' })
272+
styles.update({ key: 'widescreen' }) // for new window.wsMaxWidth
273+
if (config.widerChatbox) styles.update({ key: 'chatbar' })
276274
}
277275
if (env.site == 'chatgpt') chatbar.tweak() // update chatgpt.com chatbar inner width
278276
})

greasemonkey/chatgpt-widescreen-mode.user.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@
235235
// @description:zu Thuthukisa iChatGPT ngemodi zesikrini ezibanzi/egcwele/ephezulu + imodi yokuvimbela i-spam. Futhi isebenza ku-perplexity.ai + poe.com!
236236
// @author Adam Lui
237237
// @namespace https://github.com/adamlui
238-
// @version 2025.6.15.1
238+
// @version 2025.6.16
239239
// @license MIT
240240
// @icon https://assets.chatgptwidescreen.com/images/icons/widescreen-robot-emoji/icon48.png?v=844b16e
241241
// @icon64 https://assets.chatgptwidescreen.com/images/icons/widescreen-robot-emoji/icon64.png?v=844b16e
@@ -787,10 +787,9 @@
787787
const sidebarObserver = new ResizeObserver( // sync config.fullWindow ⇆ sidebar width + update styles
788788
async () => {
789789
if ((config.fullWindow ^ await ui.isFullWin()) && !config.modeSynced) sync.mode('fullWindow')
790-
if (env.site != 'poe') setTimeout(() => {
790+
if (env.site != 'poe' && config.widescreen) setTimeout(() => {
791791
styles.update({ key: 'widescreen' }) // for new window.wsMaxWidth
792-
if (sites[env.site].availFeatures.includes('widerChatbox') && config.widerChatbox)
793-
styles.update({ key: 'chatbar' })
792+
if (config.widerChatbox) styles.update({ key: 'chatbar' })
794793
}, env.site == 'perplexity' ? 100 : 0)
795794
}
796795
)
@@ -822,9 +821,8 @@
822821
} else if (!config.fullscreen && fullscreenState) // entering full screen
823822
sync.mode('fullscreen')
824823
if (config.widescreen) {
825-
styles.update({ key: 'widescreen' })
826-
if (sites[env.site].availFeatures.includes('widerChatbox') && config.widerChatbox)
827-
styles.update({ key: 'chatbar' })
824+
styles.update({ key: 'widescreen' }) // for new window.wsMaxWidth
825+
if (config.widerChatbox) styles.update({ key: 'chatbar' })
828826
}
829827
if (env.site == 'chatgpt') chatbar.tweak() // update chatgpt.com chatbar inner width
830828
})

0 commit comments

Comments
 (0)