Skip to content

Commit 1f6be5d

Browse files
committed
Added dom.js as dependency
1 parent a724796 commit 1f6be5d

File tree

8 files changed

+32
-232
lines changed

8 files changed

+32
-232
lines changed

amazongpt/eslint.config.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export default [
1515
ecmaVersion: 'latest', sourceType: 'script',
1616
globals: {
1717
...globals.browser, ...globals.greasemonkey, chatgpt: 'readonly', CryptoJS: 'readonly',
18-
cryptoUtils: 'readonly', GM_cookie: 'readonly', hljs: 'readonly', ipv4: 'readonly', marked: 'readonly',
19-
renderMathInElement: 'readonly'
18+
cryptoUtils: 'readonly', dom: 'readonly', GM_cookie: 'readonly', hljs: 'readonly', ipv4: 'readonly',
19+
marked: 'readonly', renderMathInElement: 'readonly'
2020
}
2121
},
2222
plugins: { 'import': importPlugin, 'js-styles': stylisticJS, regexp },

amazongpt/greasemonkey/amazongpt.user.js

Lines changed: 6 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// @description Adds the magic of AI to Amazon shopping
44
// @author KudoAI
55
// @namespace https://kudoai.com
6-
// @version 2025.1.26.16
6+
// @version 2025.1.26.17
77
// @license MIT
88
// @icon https://amazongpt.kudoai.com/assets/images/icons/amazongpt/black-gold-teal/icon48.png?v=0fddfc7
99
// @icon64 https://amazongpt.kudoai.com/assets/images/icons/amazongpt/black-gold-teal/icon64.png?v=0fddfc7
@@ -61,6 +61,7 @@
6161
// @require https://cdn.jsdelivr.net/npm/@kudoai/[email protected]/dist/chatgpt.min.js#sha256-+C0x4BOFQc38aZB3pvUC2THu+ZSvuCxRphGdtRLjCDg=
6262
// @require https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.2.0/crypto-js.min.js#sha256-dppVXeVTurw1ozOPNE3XqhYmDJPOosfbKQcHyQSE58w=
6363
// @require https://assets.aiwebextensions.com/lib/crypto-utils.js/dist/crypto-utils.min.js?v=9e1e11d#sha256-bx3N1EAkmOTOFXxeyalh+IJnadXqVFHMBIPjRczmnEk=
64+
// @require https://assets.aiwebextensions.com/lib/dom.js/dist/dom.min.js?v=a724796#sha256-oP9HSQKyQERkYfYRaQYxM3FIO9KXkgl/4tW55zjbGeE=
6465
// @require https://cdn.jsdelivr.net/npm/[email protected]/dist/generate-ip.min.js#sha256-aQQKAQcMgCu8IpJp9HKs387x0uYxngO+Fb4pc5nSF4I=
6566
// @require https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js#sha256-g3pvpbDHNrUrveKythkPMF2j/J7UFoHbUyFQcFe1yEY=
6667
// @require https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js#sha256-n0UwfFeU7SR6DQlfOmLlLvIhWmeyMnIDp/2RmVmuedE=
@@ -408,6 +409,9 @@
408409
suggestOpenAI: `${app.msgs.alert_try} ${app.msgs.alert_switchingOff} ${app.msgs.mode_proxy}`
409410
}})
410411

412+
// Export DEPENDENCIES to dom.js
413+
dom.imports.import({ config, env }) // for config.bgAnimationsDisabled + env.ui.scheme in dom.fillStarryBg()
414+
411415
// Define MENU functions
412416

413417
const menu = {
@@ -1865,7 +1869,7 @@
18651869
Object.entries(headerElems).forEach(([key, elem]) => {
18661870
if (elem && key == 'byline' && getComputedStyle(elem).display == 'none')
18671871
elem.style.cssText += forceDisplayStyles // override hidden byline display style to measure width
1868-
widths[key] = dom.getComputedWidth(elem)
1872+
widths[key] = dom.get.computedWidth(elem)
18691873
if (elem?.style?.cssText.includes(forceDisplayStyles)) // restore display style for hidden byline
18701874
elem.style.cssText = elem.style.cssText.replace(forceDisplayStyles, '')
18711875
})
@@ -3024,60 +3028,6 @@
30243028
}
30253029
}
30263030

3027-
// Define DOM utilities
3028-
3029-
const dom = {
3030-
3031-
create: {
3032-
anchor(linkHref, displayContent, attrs = {}) {
3033-
const anchor = document.createElement('a'),
3034-
defaultAttrs = { href: linkHref, target: '_blank', rel: 'noopener' },
3035-
finalAttrs = { ...defaultAttrs, ...attrs }
3036-
Object.entries(finalAttrs).forEach(([attr, value]) => anchor.setAttribute(attr, value))
3037-
if (displayContent) anchor.append(displayContent)
3038-
return anchor
3039-
},
3040-
3041-
style(content) {
3042-
const style = document.createElement('style')
3043-
if (content) style.innerText = content
3044-
return style
3045-
},
3046-
3047-
svgElem(type, attrs) {
3048-
const elem = document.createElementNS('http://www.w3.org/2000/svg', type)
3049-
for (const attr in attrs) elem.setAttributeNS(null, attr, attrs[attr])
3050-
return elem
3051-
}
3052-
},
3053-
3054-
fillStarryBG(targetNode) { // requires https://assets.aiwebextensions.com/styles/rising-stars/css/<black|white>.min.css
3055-
if (targetNode.querySelector('[id*=stars]')) return
3056-
const starsDivsContainer = document.createElement('div')
3057-
starsDivsContainer.style.cssText = 'position: absolute ; top: 0 ; left: 0 ;' // hug targetNode's top-left corner
3058-
+ 'height: 100% ; width: 100% ; border-radius: 15px ; overflow: clip ;' // bound innards exactly by targetNode
3059-
+ 'z-index: -1'; // allow interactive elems to be clicked
3060-
['sm', 'med', 'lg'].forEach(starSize => {
3061-
const starsDiv = document.createElement('div')
3062-
starsDiv.id = config.bgAnimationsDisabled ? `stars-${starSize}-off`
3063-
: `${ env.ui.app.scheme == 'dark' ? 'white' : 'black' }-stars-${starSize}`
3064-
starsDivsContainer.append(starsDiv)
3065-
})
3066-
targetNode.prepend(starsDivsContainer)
3067-
},
3068-
3069-
getComputedWidth(...elems) { // including margins
3070-
let totalWidth = 0
3071-
elems.map(arg => arg instanceof NodeList ? [...arg] : arg).flat().forEach(elem => {
3072-
if (!(elem instanceof Element)) return
3073-
const elemStyle = getComputedStyle(elem) ; if (elemStyle.display == 'none') return
3074-
totalWidth += elem.getBoundingClientRect().width + parseFloat(elemStyle.marginLeft)
3075-
+ parseFloat(elemStyle.marginRight)
3076-
})
3077-
return totalWidth
3078-
}
3079-
}
3080-
30813031
// Run MAIN routine
30823032

30833033
menu.register()

bravegpt/eslint.config.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export default [
1515
ecmaVersion: 'latest', sourceType: 'script',
1616
globals: {
1717
...globals.browser, ...globals.greasemonkey, chatgpt: 'readonly', CryptoJS: 'readonly',
18-
cryptoUtils: 'readonly', GM_cookie: 'readonly', hljs: 'readonly', ipv4: 'readonly', marked: 'readonly',
19-
renderMathInElement: 'readonly'
18+
cryptoUtils: 'readonly', dom: 'readonly', GM_cookie: 'readonly', hljs: 'readonly', ipv4: 'readonly',
19+
marked: 'readonly', renderMathInElement: 'readonly'
2020
}
2121
},
2222
plugins: { 'import': importPlugin, 'js-styles': stylisticJS, regexp },

bravegpt/greasemonkey/bravegpt.user.js

Lines changed: 6 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
// @description:zu Yengeza izimpendulo ze-AI ku-Brave Search (inikwa amandla yi-GPT-4o!)
149149
// @author KudoAI
150150
// @namespace https://kudoai.com
151-
// @version 2025.1.26.16
151+
// @version 2025.1.26.17
152152
// @license MIT
153153
// @icon https://assets.bravegpt.com/images/icons/bravegpt/icon48.png?v=df624b0
154154
// @icon64 https://assets.bravegpt.com/images/icons/bravegpt/icon64.png?v=df624b0
@@ -183,6 +183,7 @@
183183
// @require https://cdn.jsdelivr.net/npm/@kudoai/[email protected]/dist/chatgpt.min.js#sha256-+C0x4BOFQc38aZB3pvUC2THu+ZSvuCxRphGdtRLjCDg=
184184
// @require https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.2.0/crypto-js.min.js#sha256-dppVXeVTurw1ozOPNE3XqhYmDJPOosfbKQcHyQSE58w=
185185
// @require https://assets.aiwebextensions.com/lib/crypto-utils.js/dist/crypto-utils.min.js?v=9e1e11d#sha256-bx3N1EAkmOTOFXxeyalh+IJnadXqVFHMBIPjRczmnEk=
186+
// @require https://assets.aiwebextensions.com/lib/dom.js/dist/dom.min.js?v=a724796#sha256-oP9HSQKyQERkYfYRaQYxM3FIO9KXkgl/4tW55zjbGeE=
186187
// @require https://cdn.jsdelivr.net/npm/[email protected]/dist/generate-ip.min.js#sha256-aQQKAQcMgCu8IpJp9HKs387x0uYxngO+Fb4pc5nSF4I=
187188
// @require https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js#sha256-g3pvpbDHNrUrveKythkPMF2j/J7UFoHbUyFQcFe1yEY=
188189
// @require https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js#sha256-n0UwfFeU7SR6DQlfOmLlLvIhWmeyMnIDp/2RmVmuedE=
@@ -580,6 +581,9 @@
580581
suggestOpenAI: `${app.msgs.alert_try} ${app.msgs.alert_switchingOff} ${app.msgs.mode_proxy}`
581582
}})
582583

584+
// Export DEPENDENCIES to dom.js
585+
dom.imports.import({ config, env }) // for config.bgAnimationsDisabled + env.ui.scheme in dom.fillStarryBg()
586+
583587
// Define MENU functions
584588

585589
const menu = {
@@ -2331,7 +2335,7 @@
23312335
Object.entries(headerElems).forEach(([key, elem]) => {
23322336
if (elem && key == 'byline' && getComputedStyle(elem).display == 'none')
23332337
elem.style.cssText += forceDisplayStyles // override hidden byline display style to measure width
2334-
widths[key] = dom.getComputedWidth(elem)
2338+
widths[key] = dom.get.computedWidth(elem)
23352339
if (elem?.style?.cssText.includes(forceDisplayStyles)) // restore display style for hidden byline
23362340
elem.style.cssText = elem.style.cssText.replace(forceDisplayStyles, '')
23372341
})
@@ -3911,60 +3915,6 @@
39113915
}
39123916
}
39133917

3914-
// Define DOM utilities
3915-
3916-
const dom = {
3917-
3918-
create: {
3919-
anchor(linkHref, displayContent, attrs = {}) {
3920-
const anchor = document.createElement('a'),
3921-
defaultAttrs = { href: linkHref, target: '_blank', rel: 'noopener' },
3922-
finalAttrs = { ...defaultAttrs, ...attrs }
3923-
Object.entries(finalAttrs).forEach(([attr, value]) => anchor.setAttribute(attr, value))
3924-
if (displayContent) anchor.append(displayContent)
3925-
return anchor
3926-
},
3927-
3928-
style(content) {
3929-
const style = document.createElement('style')
3930-
if (content) style.innerText = content
3931-
return style
3932-
},
3933-
3934-
svgElem(type, attrs) {
3935-
const elem = document.createElementNS('http://www.w3.org/2000/svg', type)
3936-
for (const attr in attrs) elem.setAttributeNS(null, attr, attrs[attr])
3937-
return elem
3938-
}
3939-
},
3940-
3941-
fillStarryBG(targetNode) { // requires https://assets.aiwebextensions.com/styles/rising-stars/css/<black|white>.min.css
3942-
if (targetNode.querySelector('[id*=stars]')) return
3943-
const starsDivsContainer = document.createElement('div')
3944-
starsDivsContainer.style.cssText = 'position: absolute ; top: 0 ; left: 0 ;' // hug targetNode's top-left corner
3945-
+ 'height: 100% ; width: 100% ; border-radius: 15px ; overflow: clip ;' // bound innards exactly by targetNode
3946-
+ 'z-index: -1'; // allow interactive elems to be clicked
3947-
['sm', 'med', 'lg'].forEach(starSize => {
3948-
const starsDiv = document.createElement('div')
3949-
starsDiv.id = config.bgAnimationsDisabled ? `stars-${starSize}-off`
3950-
: `${ env.ui.app.scheme == 'dark' ? 'white' : 'black' }-stars-${starSize}`
3951-
starsDivsContainer.append(starsDiv)
3952-
})
3953-
targetNode.prepend(starsDivsContainer)
3954-
},
3955-
3956-
getComputedWidth(...elems) { // including margins
3957-
let totalWidth = 0
3958-
elems.map(arg => arg instanceof NodeList ? [...arg] : arg).flat().forEach(elem => {
3959-
if (!(elem instanceof Element)) return
3960-
const elemStyle = getComputedStyle(elem) ; if (elemStyle.display == 'none') return
3961-
totalWidth += elem.getBoundingClientRect().width + parseFloat(elemStyle.marginLeft)
3962-
+ parseFloat(elemStyle.marginRight)
3963-
})
3964-
return totalWidth
3965-
}
3966-
}
3967-
39683918
// Run MAIN routine
39693919

39703920
menu.register()

duckduckgpt/eslint.config.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export default [
1515
ecmaVersion: 'latest', sourceType: 'script',
1616
globals: {
1717
...globals.browser, ...globals.greasemonkey, chatgpt: 'readonly', CryptoJS: 'readonly',
18-
cryptoUtils: 'readonly', GM_cookie: 'readonly', hljs: 'readonly', ipv4: 'readonly', marked: 'readonly',
19-
renderMathInElement: 'readonly'
18+
cryptoUtils: 'readonly', dom: 'readonly', GM_cookie: 'readonly', hljs: 'readonly', ipv4: 'readonly',
19+
marked: 'readonly', renderMathInElement: 'readonly'
2020
}
2121
},
2222
plugins: { 'import': importPlugin, 'js-styles': stylisticJS, regexp },

duckduckgpt/greasemonkey/duckduckgpt.user.js

Lines changed: 6 additions & 56 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.1.26.17
151+
// @version 2025.1.26.18
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
@@ -184,6 +184,7 @@
184184
// @require https://cdn.jsdelivr.net/npm/@kudoai/[email protected]/dist/chatgpt.min.js#sha256-+C0x4BOFQc38aZB3pvUC2THu+ZSvuCxRphGdtRLjCDg=
185185
// @require https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.2.0/crypto-js.min.js#sha256-dppVXeVTurw1ozOPNE3XqhYmDJPOosfbKQcHyQSE58w=
186186
// @require https://assets.aiwebextensions.com/lib/crypto-utils.js/dist/crypto-utils.min.js?v=9e1e11d#sha256-bx3N1EAkmOTOFXxeyalh+IJnadXqVFHMBIPjRczmnEk=
187+
// @require https://assets.aiwebextensions.com/lib/dom.js/dist/dom.min.js?v=a724796#sha256-oP9HSQKyQERkYfYRaQYxM3FIO9KXkgl/4tW55zjbGeE=
187188
// @require https://cdn.jsdelivr.net/npm/[email protected]/dist/generate-ip.min.js#sha256-aQQKAQcMgCu8IpJp9HKs387x0uYxngO+Fb4pc5nSF4I=
188189
// @require https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js#sha256-g3pvpbDHNrUrveKythkPMF2j/J7UFoHbUyFQcFe1yEY=
189190
// @require https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js#sha256-n0UwfFeU7SR6DQlfOmLlLvIhWmeyMnIDp/2RmVmuedE=
@@ -589,6 +590,9 @@
589590
suggestOpenAI: `${app.msgs.alert_try} ${app.msgs.alert_switchingOff} ${app.msgs.mode_proxy}`
590591
}})
591592

593+
// Export DEPENDENCIES to dom.js
594+
dom.imports.import({ config, env }) // for config.bgAnimationsDisabled + env.ui.scheme in dom.fillStarryBg()
595+
592596
// Define MENU functions
593597

594598
const menu = {
@@ -2328,7 +2332,7 @@
23282332
Object.entries(headerElems).forEach(([key, elem]) => {
23292333
if (elem && key == 'byline' && getComputedStyle(elem).display == 'none')
23302334
elem.style.cssText += forceDisplayStyles // override hidden byline display style to measure width
2331-
widths[key] = dom.getComputedWidth(elem)
2335+
widths[key] = dom.get.computedWidth(elem)
23322336
if (elem?.style?.cssText.includes(forceDisplayStyles)) // restore display style for hidden byline
23332337
elem.style.cssText = elem.style.cssText.replace(forceDisplayStyles, '')
23342338
})
@@ -3788,60 +3792,6 @@
37883792
}
37893793
}
37903794

3791-
// Define DOM utilities
3792-
3793-
const dom = {
3794-
3795-
create: {
3796-
anchor(linkHref, displayContent, attrs = {}) {
3797-
const anchor = document.createElement('a'),
3798-
defaultAttrs = { href: linkHref, target: '_blank', rel: 'noopener' },
3799-
finalAttrs = { ...defaultAttrs, ...attrs }
3800-
Object.entries(finalAttrs).forEach(([attr, value]) => anchor.setAttribute(attr, value))
3801-
if (displayContent) anchor.append(displayContent)
3802-
return anchor
3803-
},
3804-
3805-
style(content) {
3806-
const style = document.createElement('style')
3807-
if (content) style.innerText = content
3808-
return style
3809-
},
3810-
3811-
svgElem(type, attrs) {
3812-
const elem = document.createElementNS('http://www.w3.org/2000/svg', type)
3813-
for (const attr in attrs) elem.setAttributeNS(null, attr, attrs[attr])
3814-
return elem
3815-
}
3816-
},
3817-
3818-
fillStarryBG(targetNode) { // requires https://assets.aiwebextensions.com/styles/rising-stars/css/<black|white>.min.css
3819-
if (targetNode.querySelector('[id*=stars]')) return
3820-
const starsDivsContainer = document.createElement('div')
3821-
starsDivsContainer.style.cssText = 'position: absolute ; top: 0 ; left: 0 ;' // hug targetNode's top-left corner
3822-
+ 'height: 100% ; width: 100% ; border-radius: 15px ; overflow: clip ;' // bound innards exactly by targetNode
3823-
+ 'z-index: -1'; // allow interactive elems to be clicked
3824-
['sm', 'med', 'lg'].forEach(starSize => {
3825-
const starsDiv = document.createElement('div')
3826-
starsDiv.id = config.bgAnimationsDisabled ? `stars-${starSize}-off`
3827-
: `${ env.ui.app.scheme == 'dark' ? 'white' : 'black' }-stars-${starSize}`
3828-
starsDivsContainer.append(starsDiv)
3829-
})
3830-
targetNode.prepend(starsDivsContainer)
3831-
},
3832-
3833-
getComputedWidth(...elems) { // including margins
3834-
let totalWidth = 0
3835-
elems.map(arg => arg instanceof NodeList ? [...arg] : arg).flat().forEach(elem => {
3836-
if (!(elem instanceof Element)) return
3837-
const elemStyle = getComputedStyle(elem) ; if (elemStyle.display == 'none') return
3838-
totalWidth += elem.getBoundingClientRect().width + parseFloat(elemStyle.marginLeft)
3839-
+ parseFloat(elemStyle.marginRight)
3840-
})
3841-
return totalWidth
3842-
}
3843-
}
3844-
38453795
// Run MAIN routine
38463796

38473797
menu.register()

googlegpt/eslint.config.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export default [
1515
ecmaVersion: 'latest', sourceType: 'script',
1616
globals: {
1717
...globals.browser, ...globals.greasemonkey, chatgpt: 'readonly', CryptoJS: 'readonly',
18-
cryptoUtils: 'readonly', GM_cookie: 'readonly', hljs: 'readonly', ipv4: 'readonly', marked: 'readonly',
19-
renderMathInElement: 'readonly'
18+
cryptoUtils: 'readonly', dom: 'readonly', GM_cookie: 'readonly', hljs: 'readonly', ipv4: 'readonly',
19+
marked: 'readonly', renderMathInElement: 'readonly'
2020
}
2121
},
2222
plugins: { 'import': importPlugin, 'js-styles': stylisticJS, regexp },

0 commit comments

Comments
 (0)