Skip to content

Commit a2b8fb1

Browse files
committed
Moved non-div check from modals.init() to .open() to support .observeRemoval() too ↞ [auto-sync from https://github.com/adamlui/ai-web-extensions/tree/main/chatgpt-widescreen]
1 parent c5280ce commit a2b8fb1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

chrome/extension/components/modals.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ window.modals = {
3131

3232
open(modalType, modalSubType) {
3333
const modal = modalSubType ? this[modalType][modalSubType]() : this[modalType]() // show modal
34+
if (!modal) return // since no div returned
3435
this.stack.unshift(modalSubType ? `${modalType}_${modalSubType}` : modalType) // add to stack
3536
this.init(modal) // add classes + starry bg
3637
this.observeRemoval(modal, modalType, modalSubType) // to maintain stack for proper nav
3738
},
3839

3940
init(modal) {
40-
if (!modal) return // to support non-div this.open()s
4141
if (!this.styles) this.stylize() // to init/append stylesheet
4242
modal.classList.add('no-user-select', this.class) ; modal.parentNode.classList.add(`${this.class}-bg`)
4343
dom.fillStarryBG(modal) // add starry bg

firefox/extension/components/modals.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ window.modals = {
3131

3232
open(modalType, modalSubType) {
3333
const modal = modalSubType ? this[modalType][modalSubType]() : this[modalType]() // show modal
34+
if (!modal) return // since no div returned
3435
this.stack.unshift(modalSubType ? `${modalType}_${modalSubType}` : modalType) // add to stack
3536
this.init(modal) // add classes + starry bg
3637
this.observeRemoval(modal, modalType, modalSubType) // to maintain stack for proper nav
3738
},
3839

3940
init(modal) {
40-
if (!modal) return // to support non-div this.open()s
4141
if (!this.styles) this.stylize() // to init/append stylesheet
4242
modal.classList.add('no-user-select', this.class) ; modal.parentNode.classList.add(`${this.class}-bg`)
4343
dom.fillStarryBG(modal) // add starry bg

0 commit comments

Comments
 (0)