Skip to content

Commit b7fe977

Browse files
committed
Moved app elems/props into app
1 parent 8228bf5 commit b7fe977

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

duckduckgpt/greasemonkey/duckduckgpt.user.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
// @description:zu Yengeza izimpendulo ze-AI ku-DuckDuckGo (inikwa amandla yi-GPT-4o!)
149149
// @author KudoAI
150150
// @namespace https://kudoai.com
151-
// @version 2025.5.17.18
151+
// @version 2025.5.17.19
152152
// @license MIT
153153
// @icon https://assets.ddgpt.com/images/icons/duckduckgpt/icon48.png?v=06af076
154154
// @icon64 https://assets.ddgpt.com/images/icons/duckduckgpt/icon64.png?v=06af076
@@ -2842,23 +2842,23 @@
28422842
update.footerContent()
28432843

28442844
// APPEND DDGPT + footer to DDG
2845-
const appElems = [app.div, app.footer]
2846-
const appDivParentSelector = env.browser.isMobile || env.ui.site.isCentered ? '[data-area*=mainline]'
2847-
: '[class*=sidebar]'
2848-
const appDivParent = await new Promise(resolve => {
2849-
const appDivParent = document.querySelector(appDivParentSelector)
2845+
app.elems = [app.div, app.footer]
2846+
app.div.parent = {
2847+
selector: env.browser.isMobile || env.ui.site.isCentered ? '[data-area*=mainline]' : '[class*=sidebar]' }
2848+
app.div.parent.div = await new Promise(resolve => {
2849+
const appDivParent = document.querySelector(app.div.parent.selector)
28502850
if (appDivParent) resolve(appDivParent)
28512851
else new MutationObserver((_, obs) => {
2852-
const appDivParent = document.querySelector(appDivParentSelector)
2852+
const appDivParent = document.querySelector(app.div.parent.selector)
28532853
if (appDivParent) { obs.disconnect() ; resolve(appDivParent) }
28542854
}).observe(document.body, { childList: true, subtree: true })
28552855
})
2856-
appDivParent.prepend(...appElems)
2857-
appElems.forEach((elem, idx) => // fade in staggered
2856+
app.div.parent.div.prepend(...app.elems)
2857+
app.elems.forEach((elem, idx) => // fade in staggered
28582858
setTimeout(() => elem.classList.add('active'), idx * 550 - 200))
28592859

28602860
// REPLACE appDivParent max-width w/ min-width for better UI
2861-
if (!env.browser.isMobile) Object.assign(appDivParent.style, { maxWidth: '', minWidth: '448px' })
2861+
if (!env.browser.isMobile) Object.assign(app.div.parent.div.style, { maxWidth: '', minWidth: '448px' })
28622862

28632863
// REFERRALIZE links to support author
28642864
setTimeout(() => document.querySelectorAll('a[href^="https://www.amazon."]').forEach(anchor => {
@@ -2901,10 +2901,10 @@
29012901

29022902
// Observe sidebar for need to RAISE DDGPT as other extensions inject into it
29032903
const sidebarObserver = new MutationObserver(() => {
2904-
if (appDivParent.firstChild != app.div) {
2905-
appDivParent.prepend(...appElems) ; sidebarObserver.disconnect() }
2904+
if (app.div.parent.div.firstChild != app.div) {
2905+
app.div.parent.div.prepend(...app.elems) ; sidebarObserver.disconnect() }
29062906
})
2907-
sidebarObserver.observe(appDivParent, { subtree: true, childList: true })
2907+
sidebarObserver.observe(app.div.parent.div, { subtree: true, childList: true })
29082908
setTimeout(() => sidebarObserver.disconnect(), 5000) // don't observe forever
29092909

29102910
})()

0 commit comments

Comments
 (0)