Skip to content

Commit ea4318b

Browse files
committed
Refactored chatbarElem init to wait til load (fixes #183) ↞ [auto-sync from https://github.com/adamlui/ai-web-extensions/tree/main/chatgpt-widescreen]
1 parent a5019b5 commit ea4318b

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

chromium/extension/content.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
;({ app: window.app } = await chrome.storage.local.get('app'))
3939
;({ sites: window.sites } = await chrome.storage.local.get('sites'))
4040

41-
const chatbarElem = document.querySelector(env.site == 'chatgpt' ? 'main form' : sites[env.site].selectors.input)
41+
const chatbarElem = await dom.get.loadedElem(env.site == 'chatgpt' ? 'main form' : sites[env.site].selectors.input)
4242
chatbar.nativeWidth = dom.get.computedWidth(chatbarElem) // for ChatGPT WCB + styles.widescreen.css math
4343
chatbar.nativeHeight = dom.get.computedHeight(chatbarElem) // for TCB math
4444

firefox/extension/content.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
;({ app: window.app } = await chrome.storage.local.get('app'))
3939
;({ sites: window.sites } = await chrome.storage.local.get('sites'))
4040

41-
const chatbarElem = document.querySelector(env.site == 'chatgpt' ? 'main form' : sites[env.site].selectors.input)
41+
const chatbarElem = await dom.get.loadedElem(env.site == 'chatgpt' ? 'main form' : sites[env.site].selectors.input)
4242
chatbar.nativeWidth = dom.get.computedWidth(chatbarElem) // for ChatGPT WCB + styles.widescreen.css math
4343
chatbar.nativeHeight = dom.get.computedHeight(chatbarElem) // for TCB math
4444

greasemonkey/chatgpt-widescreen-mode.user.js

Lines changed: 2 additions & 2 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.16
238+
// @version 2025.6.16.1
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
@@ -359,7 +359,7 @@
359359
onload: resp => resolve(JSON5.parse(resp.responseText))
360360
})))
361361

362-
const chatbarElem = document.querySelector(env.site == 'chatgpt' ? 'main form' : sites[env.site].selectors.input)
362+
const chatbarElem = await dom.get.loadedElem(env.site == 'chatgpt' ? 'main form' : sites[env.site].selectors.input)
363363
chatbar.nativeWidth = dom.get.computedWidth(chatbarElem) // for ChatGPT WCB + styles.widescreen.css math
364364
chatbar.nativeHeight = dom.get.computedHeight(chatbarElem) // for TCB math
365365

0 commit comments

Comments
 (0)