|
3 | 3 | // @description Adds the magic of AI to Amazon shopping
|
4 | 4 | // @author KudoAI
|
5 | 5 | // @namespace https://kudoai.com
|
6 |
| -// @version 2025.4.11.6 |
| 6 | +// @version 2025.4.12 |
7 | 7 | // @license MIT
|
8 | 8 | // @icon https://cdn.jsdelivr.net/gh/KudoAI/amazongpt@0fddfc7/assets/images/icons/amazongpt/black-gold-teal/icon48.png
|
9 | 9 | // @icon64 https://cdn.jsdelivr.net/gh/KudoAI/amazongpt@0fddfc7/assets/images/icons/amazongpt/black-gold-teal/icon64.png
|
|
1750 | 1750 |
|
1751 | 1751 | appBottomPos() { appDiv.style.bottom = `${ config.minimized ? 55 - appDiv.offsetHeight : -7 }px` },
|
1752 | 1752 |
|
1753 |
| - appStyle() { |
| 1753 | + appStyle() { // used in toggle.animations() + update.scheme() + main's app init |
1754 | 1754 | const isParticlizedDS = env.ui.app.scheme == 'dark' && !config.bgAnimationsDisabled
|
1755 | 1755 | modals.stylize() // update modal styles
|
1756 | 1756 | app.styles.innerText = (
|
|
1831 | 1831 | + `.${app.slug}-name, .${app.slug}-name:hover {`
|
1832 | 1832 | + 'font-size: 1.5rem ; font-weight: 700 ; text-decoration: none ;'
|
1833 | 1833 | + `color: ${ env.ui.app.scheme == 'dark' ? 'white' : 'black' }}`
|
1834 |
| - + '.kudoai {' // header byline |
| 1834 | + + '.byline {' // header byline |
1835 | 1835 | + `position: relative ; bottom: -1px ; margin-left: 8px ; color: #aaa ;
|
1836 | 1836 | --kudoai-transition: 0.15s ease-in-out ; transition: var(--kudoai-transition) ;
|
1837 | 1837 | -webkit-transition: var(--kudoai-transition) ; -moz-transition: var(--kudoai-transition) ;
|
1838 | 1838 | -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 } ' |
1840 | 1840 | + `.kudoai a:hover {
|
1841 | 1841 | color: ${ env.ui.app.scheme == 'dark' ? 'white' : 'black' };
|
1842 | 1842 | transition: var(--kudoai-transition) ;
|
|
2048 | 2048 | if (env.browser.isPhone) return // since byline hidden by app.styles
|
2049 | 2049 |
|
2050 | 2050 | // Init header elems
|
2051 |
| - const headerElems = { byline: appDiv.querySelector('.kudoai') } |
| 2051 | + const headerElems = { byline: appDiv.querySelector('.byline') } |
2052 | 2052 | if (!headerElems.byline) return // since in loading state
|
2053 | 2053 | Object.assign(headerElems, {
|
2054 | 2054 | btns: appDiv.querySelectorAll(`#${app.slug}-header-btns > btn`),
|
|
2064 | 2064 | Object.entries(headerElems).forEach(([key, elem]) => widths[key] = dom.get.computedWidth(elem))
|
2065 | 2065 |
|
2066 | 2066 | // 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 ? |
2069 | 2069 | { position: 'absolute', left: '-9999px', opacity: 0 } // hide using position to support transition
|
2070 | 2070 | : { position: '', left: '', opacity: 1 } // show
|
2071 | 2071 | )
|
|
3094 | 3094 | addListeners.btns.appHeader()
|
3095 | 3095 |
|
3096 | 3096 | // 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' }) |
3098 | 3098 | kudoAIspan.textContent = 'by '
|
3099 | 3099 | kudoAIspan.append(dom.create.anchor(app.urls.publisher, 'KudoAI'))
|
3100 | 3100 | appDiv.querySelector(`.${app.slug}-name`).insertAdjacentElement('afterend', kudoAIspan)
|
|
0 commit comments