Skip to content

Commit dcac2ed

Browse files
committed
Centralized x-padding offset in update.bylineVisibility() to availSpace init, renamed .kudoai to .byline ↞ [auto-sync from https://github.com/adamlui/ai-web-extensions/tree/main/amazongpt]
1 parent 92572c2 commit dcac2ed

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

greasemonkey/amazongpt.user.js

+8-8
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.4.11.6
6+
// @version 2025.4.12
77
// @license MIT
88
// @icon https://cdn.jsdelivr.net/gh/KudoAI/amazongpt@0fddfc7/assets/images/icons/amazongpt/black-gold-teal/icon48.png
99
// @icon64 https://cdn.jsdelivr.net/gh/KudoAI/amazongpt@0fddfc7/assets/images/icons/amazongpt/black-gold-teal/icon64.png
@@ -1750,7 +1750,7 @@
17501750

17511751
appBottomPos() { appDiv.style.bottom = `${ config.minimized ? 55 - appDiv.offsetHeight : -7 }px` },
17521752

1753-
appStyle() {
1753+
appStyle() { // used in toggle.animations() + update.scheme() + main's app init
17541754
const isParticlizedDS = env.ui.app.scheme == 'dark' && !config.bgAnimationsDisabled
17551755
modals.stylize() // update modal styles
17561756
app.styles.innerText = (
@@ -1831,12 +1831,12 @@
18311831
+ `.${app.slug}-name, .${app.slug}-name:hover {`
18321832
+ 'font-size: 1.5rem ; font-weight: 700 ; text-decoration: none ;'
18331833
+ `color: ${ env.ui.app.scheme == 'dark' ? 'white' : 'black' }}`
1834-
+ '.kudoai {' // header byline
1834+
+ '.byline {' // header byline
18351835
+ `position: relative ; bottom: -1px ; margin-left: 8px ; color: #aaa ;
18361836
--kudoai-transition: 0.15s ease-in-out ; transition: var(--kudoai-transition) ;
18371837
-webkit-transition: var(--kudoai-transition) ; -moz-transition: var(--kudoai-transition) ;
18381838
-o-transition: var(--kudoai-transition) ; -ms-transition: var(--kudoai-transition) }`
1839-
+ '.kudoai a, .kudoai a:visited { color: #aaa ; text-decoration: none !important } '
1839+
+ '.byline a, .kudoai a:visited { color: #aaa ; text-decoration: none !important } '
18401840
+ `.kudoai a:hover {
18411841
color: ${ env.ui.app.scheme == 'dark' ? 'white' : 'black' };
18421842
transition: var(--kudoai-transition) ;
@@ -2048,7 +2048,7 @@
20482048
if (env.browser.isPhone) return // since byline hidden by app.styles
20492049

20502050
// Init header elems
2051-
const headerElems = { byline: appDiv.querySelector('.kudoai') }
2051+
const headerElems = { byline: appDiv.querySelector('.byline') }
20522052
if (!headerElems.byline) return // since in loading state
20532053
Object.assign(headerElems, {
20542054
btns: appDiv.querySelectorAll(`#${app.slug}-header-btns > btn`),
@@ -2064,8 +2064,8 @@
20642064
Object.entries(headerElems).forEach(([key, elem]) => widths[key] = dom.get.computedWidth(elem))
20652065

20662066
// Hide/show byline based on space available
2067-
const availSpace = widths.appDiv - widths.appDivXpadding - widths.logo - widths.btns
2068-
Object.assign(headerElems.byline.style, (widths.byline +10) > availSpace ?
2067+
const availSpace = widths.appDiv - widths.appDivXpadding - widths.logo - widths.btns -10
2068+
Object.assign(headerElems.byline.style, widths.byline > availSpace ?
20692069
{ position: 'absolute', left: '-9999px', opacity: 0 } // hide using position to support transition
20702070
: { position: '', left: '', opacity: 1 } // show
20712071
)
@@ -3094,7 +3094,7 @@
30943094
addListeners.btns.appHeader()
30953095

30963096
// Create/append 'by KudoAI'
3097-
const kudoAIspan = dom.create.elem('span', { class: 'kudoai no-user-select' })
3097+
const kudoAIspan = dom.create.elem('span', { class: 'byline no-user-select' })
30983098
kudoAIspan.textContent = 'by '
30993099
kudoAIspan.append(dom.create.anchor(app.urls.publisher, 'KudoAI'))
31003100
appDiv.querySelector(`.${app.slug}-name`).insertAdjacentElement('afterend', kudoAIspan)

0 commit comments

Comments
 (0)