Skip to content

Commit

Permalink
Updated rising-stars func/var/meta names + paths + comments
Browse files Browse the repository at this point in the history
  • Loading branch information
adamlui committed Jan 30, 2025
1 parent 727feff commit b2c6efa
Show file tree
Hide file tree
Showing 34 changed files with 265 additions and 261 deletions.
32 changes: 16 additions & 16 deletions amazongpt/greasemonkey/amazongpt.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// @description Adds the magic of AI to Amazon shopping
// @author KudoAI
// @namespace https://kudoai.com
// @version 2025.1.29.11
// @version 2025.1.29.12
// @license MIT
// @icon https://amazongpt.kudoai.com/assets/images/icons/amazongpt/black-gold-teal/icon48.png?v=0fddfc7
// @icon64 https://amazongpt.kudoai.com/assets/images/icons/amazongpt/black-gold-teal/icon64.png?v=0fddfc7
Expand Down Expand Up @@ -71,8 +71,8 @@
// @resource amzgptLSlogo https://amazongpt.kudoai.com/assets/images/logos/amazongpt/black-gold/logo509x74.png.b64?v=1ac5561#sha256-wSW1EtGtscP0ZcUweFBqKfswt3NzEjbKxn5COYyihVA=
// @resource amzgptDSlogo https://amazongpt.kudoai.com/assets/images/logos/amazongpt/white-teal/logo509x74.png.b64?v=1ac5561#sha256-EWstwtlU8+gXSM98gpr6OR3OZ63ttHVNp/NQ7IMzFDA=
// @resource hljsCSS https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/dark.min.css#sha256-v0N76BFFkH0dCB8bUr4cHSVN8A/zCaOopMuSmJWV/5w=
// @resource brsCSS https://assets.aiwebextensions.com/styles/rising-stars/dist/black.min.css?v=3289404#sha256-CTj6Ndngq+TsPlNpQ6Ej39PQKSDpmxyKUFohhc91ruQ=
// @resource wrsCSS https://assets.aiwebextensions.com/styles/rising-stars/dist/white.min.css?v=3289404#sha256-tOOIvIe6O5/x2A5E7s9kP4+zw0d4EEDfRgXQLq2KwLs=
// @resource brpCSS https://assets.aiwebextensions.com/styles/rising-particles/dist/black.min.css?v=727feff#sha256-7ycEGqwB5zKKoaW3olhaFP8yj0KEXe+Ks2kS/4iRGZM=
// @resource wrpCSS https://assets.aiwebextensions.com/styles/rising-particles/dist/white.min.css?v=727feff#sha256-6xBXczm7yM1MZ/v0o1KVFfJGehHk47KJjq8oTktH4KE=
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_deleteValue
Expand Down Expand Up @@ -408,7 +408,7 @@
}})

// Export DEPENDENCIES to dom.js
dom.imports.import({ config, env }) // for config.bgAnimationsDisabled + env.ui.app.scheme in dom.fillStarryBg()
dom.imports.import({ config, env }) // for config.bgAnimationsDisabled + env.ui.app.scheme in dom.addRisingParticles()

// Define MENU functions

Expand Down Expand Up @@ -600,7 +600,7 @@
}

// Hack BG
dom.fillStarryBG(modal)
dom.addRisingParticles(modal)
setTimeout(() => { // dim bg
modal.parentNode.style.backgroundColor = `rgba(67,70,72,${
env.ui.app.scheme == 'dark' ? 0.62 : 0.33 })`
Expand Down Expand Up @@ -1633,7 +1633,7 @@
appBottomPos() { appDiv.style.bottom = `${ config.minimized ? 55 - appDiv.offsetHeight : -7 }px` },

appStyle() {
const isStarryDM = env.ui.app.scheme == 'dark' && !config.bgAnimationsDisabled
const isParticlizedDS = env.ui.app.scheme == 'dark' && !config.bgAnimationsDisabled
modals.stylize() // update modal styles
app.styles.innerText = (
':root {' // vars
Expand Down Expand Up @@ -1673,7 +1673,7 @@
+ ( config.bgAnimationsDisabled ? // classic flat bg
`background: var(--app-bg-color-${env.ui.app.scheme}-scheme) ;`
+ `color: var(--font-color-${env.ui.app.scheme}-scheme) ;`
: `background-image: linear-gradient(180deg, ${ // gradient bg to match stars
: `background-image: linear-gradient(180deg, ${ // gradient bg to match rising particles
env.ui.app.scheme == 'dark' ? '#99a8a6 -245px, black 185px'
: '#b6ebff -163px, white 65px' }) ;` )
+ 'transition: var(--app-transition) ;'
Expand Down Expand Up @@ -1747,7 +1747,7 @@
+ 'float: left ; left: 7px ; margin: 1.89em -14px 0 0 ;' // positioning
+ 'border-bottom-style: solid ; border-bottom-width: 16px ; border-top: 0 ; border-bottom-color:'
+ `${ // hide reply tip for terminal aesthetic
isStarryDM ? '#0000' : `var(--pre-bg-color-${env.ui.app.scheme}-scheme)` }}`
isParticlizedDS ? '#0000' : `var(--pre-bg-color-${env.ui.app.scheme}-scheme)` }}`
+ `#${app.slug} > pre {`
+ `font-size: ${config.fontSize}px ; white-space: pre-wrap ; min-width: 0 ;`
+ `line-height: ${ config.fontSize * config.lineHeightRatio }px ; overscroll-behavior: contain ;`
Expand Down Expand Up @@ -1899,15 +1899,15 @@
log.caller = `update.scheme('${newScheme}')`
log.debug(`Updating ${app.name} scheme to ${log.toTitleCase(newScheme)}...`)
env.ui.app.scheme = newScheme ; logos.amzgpt.update() ; icons.amzgpt.update() ; update.appStyle()
update.stars() ; update.replyPrefix() ; toggle.btnGlow() ; modals.settings.updateSchemeStatus()
update.risingParticles() ; update.replyPrefix() ; toggle.btnGlow() ; modals.settings.updateSchemeStatus()
log.debug(`Success! ${app.name} updated to ${log.toTitleCase(newScheme)} scheme`)
},

stars() {
risingParticles() {
['sm', 'med', 'lg'].forEach(size =>
document.querySelectorAll(`[id*=stars-${size}]`).forEach(starsDiv =>
starsDiv.id = config.bgAnimationsDisabled ? `stars-${size}-off`
: `${ env.ui.app.scheme == 'dark' ? 'white' : 'black' }-stars-${size}`
document.querySelectorAll(`[id*=particles-${size}]`).forEach(particlesDiv =>
particlesDiv.id = config.bgAnimationsDisabled ? `particles-${size}-off`
: `${ env.ui.app.scheme == 'dark' ? 'white' : 'black' }-particles-${size}`
))
}
}
Expand Down Expand Up @@ -2280,7 +2280,7 @@
animations(layer) {
const configKey = `${layer}AnimationsDisabled`
settings.save(configKey, !config[configKey])
update.appStyle() ; if (layer == 'bg') { update.stars() ; update.replyPrefix() }
update.appStyle() ; if (layer == 'bg') { update.risingParticles() ; update.replyPrefix() }
if (layer == 'fg' && modals.settings.get()) {

// Toggle ticker-scroll of About status label
Expand Down Expand Up @@ -2867,7 +2867,7 @@
// Build answer interface up to reply section if missing
if (!appDiv.querySelector('pre')) {
appDiv.textContent = ''
dom.fillStarryBG(appDiv) // add stars
dom.addRisingParticles(appDiv)

// Create/append title
const appHeaderLogo = logos.amzgpt.create()
Expand Down Expand Up @@ -3053,7 +3053,7 @@
appDiv.classList.add('anchored', 'fade-in') ; addListeners.appDiv()
if (config.expanded) appDiv.classList.add('expanded')
app.styles = dom.create.style() ; update.appStyle() ; document.head.append(app.styles);
['brs', 'wrs', 'hljs'].forEach(cssType => // black rising stars, white rising stars, code highlighting
['brp', 'wrp', 'hljs'].forEach(cssType => // black rising particles, white rising particles, code highlighting
document.head.append(dom.create.style(GM_getResourceText(`${cssType}CSS`))))

// Create/stylize TOOLTIPs
Expand Down
2 changes: 1 addition & 1 deletion assets/lib/dom.js/dist/dom.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions assets/lib/dom.js/src/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,20 @@ window.dom = {
}
},

fillStarryBG(targetNode) { // requires https://assets.aiwebextensions.com/styles/rising-stars/css/<black|white>.min.css
if (targetNode.querySelector('[id*=stars]')) return
const starsDivsContainer = document.createElement('div')
starsDivsContainer.style.cssText = 'position: absolute ; top: 0 ; left: 0 ;' // hug targetNode's top-left corner
addRisingParticles(targetNode) { // requires https://assets.aiwebextensions.com/styles/rising-particles/dist/<black|white>.min.css
if (targetNode.querySelector('[id*=particles]')) return
const particlesDivsContainer = document.createElement('div')
particlesDivsContainer.style.cssText = 'position: absolute ; top: 0 ; left: 0 ;' // hug targetNode's top-left corner
+ 'height: 100% ; width: 100% ; border-radius: 15px ; overflow: clip ;' // bound innards exactly by targetNode
+ 'z-index: -1'; // allow interactive elems to be clicked
['sm', 'med', 'lg'].forEach(starSize => {
const starsDiv = document.createElement('div')
starsDiv.id = this.imports.config?.bgAnimationsDisabled ? `stars-${starSize}-off`
['sm', 'med', 'lg'].forEach(particleSize => {
const particlesDiv = document.createElement('div')
particlesDiv.id = this.imports.config?.bgAnimationsDisabled ? `particles-${particleSize}-off`
: `${( this.imports.env?.ui?.scheme || this.imports.env?.ui?.app?.scheme ) == 'dark' ? 'white'
: 'black' }-stars-${starSize}`
starsDivsContainer.append(starsDiv)
: 'black' }-particles-${particleSize}`
particlesDivsContainer.append(particlesDiv)
})
targetNode.prepend(starsDivsContainer)
targetNode.prepend(particlesDivsContainer)
},

get: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
// @description:zu Ziba itshala lokucabanga okuzoshintshwa ngokuzenzakalelayo uma ukubuka chatgpt.com
// @author Adam Lui
// @namespace https://github.com/adamlui
// @version 2025.1.29.1
// @version 2025.1.29.2
// @license MIT
// @icon https://assets.autoclearchatgpt.com/images/icons/openai/black/icon48.png?v=f461c06
// @icon64 https://assets.autoclearchatgpt.com/images/icons/openai/black/icon64.png?v=f461c06
Expand All @@ -243,8 +243,8 @@
// @connect gm.autoclearchatgpt.com
// @connect raw.githubusercontent.com
// @require https://cdn.jsdelivr.net/npm/@kudoai/[email protected]/dist/chatgpt.min.js#sha256-+C0x4BOFQc38aZB3pvUC2THu+ZSvuCxRphGdtRLjCDg=
// @resource brsCSS https://assets.aiwebextensions.com/styles/rising-stars/dist/black.min.css?v=3289404#sha256-CTj6Ndngq+TsPlNpQ6Ej39PQKSDpmxyKUFohhc91ruQ=
// @resource wrsCSS https://assets.aiwebextensions.com/styles/rising-stars/dist/white.min.css?v=3289404#sha256-tOOIvIe6O5/x2A5E7s9kP4+zw0d4EEDfRgXQLq2KwLs=
// @resource brpCSS https://assets.aiwebextensions.com/styles/rising-particles/dist/black.min.css?v=727feff#sha256-7ycEGqwB5zKKoaW3olhaFP8yj0KEXe+Ks2kS/4iRGZM=
// @resource wrpCSS https://assets.aiwebextensions.com/styles/rising-particles/dist/white.min.css?v=727feff#sha256-6xBXczm7yM1MZ/v0o1KVFfJGehHk47KJjq8oTktH4KE=
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_registerMenuCommand
Expand Down Expand Up @@ -499,22 +499,22 @@
alert(title = '', msg = '', btns = '', checkbox = '', width = '') { // generic one from chatgpt.alert()
const alertID = chatgpt.alert(title, msg, btns, checkbox, width),
alert = document.getElementById(alertID).firstChild
this.init(alert) // add classes + starry bg
this.init(alert) // add classes + rising particles bg
return alert
},

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

init(modal) {
if (!this.styles) this.stylize() // to init/append stylesheet
modal.classList.add('no-user-select', this.class) ; modal.parentNode.classList.add(`${this.class}-bg`)
fillStarryBG(modal) // add starry bg
addRisingParticles(modal)
},

stylize() {
Expand Down Expand Up @@ -753,18 +753,18 @@
return style
}

function fillStarryBG(targetNode) { // requires https://assets.aiwebextensions.com/styles/rising-stars/css/<black|white>.min.css
if (targetNode.querySelector('[id*=stars]')) return
const starsDivsContainer = document.createElement('div')
starsDivsContainer.style.cssText = 'position: absolute ; top: 0 ; left: 0 ;' // hug targetNode's top-left corner
function addRisingParticles(targetNode) { // requires https://assets.aiwebextensions.com/styles/rising-particles/dist/<black|white>.min.css
if (targetNode.querySelector('[id*=particles]')) return
const particlesDivsContainer = document.createElement('div')
particlesDivsContainer.style.cssText = 'position: absolute ; top: 0 ; left: 0 ;' // hug targetNode's top-left corner
+ 'height: 100% ; width: 100% ; border-radius: 15px ; overflow: clip ;' // bound innards exactly by targetNode
+ 'z-index: -1'; // allow interactive elems to be clicked
['sm', 'med', 'lg'].forEach(starSize => {
const starsDiv = document.createElement('div')
starsDiv.id = `${ env.ui.scheme == 'dark' ? 'white' : 'black' }-stars-${starSize}`
starsDivsContainer.append(starsDiv)
['sm', 'med', 'lg'].forEach(particleSize => {
const particlesDiv = document.createElement('div')
particlesDiv.id = `${ env.ui.scheme == 'dark' ? 'white' : 'black' }-particles-${particleSize}`
particlesDivsContainer.append(particlesDiv)
})
targetNode.prepend(starsDivsContainer)
targetNode.prepend(particlesDivsContainer)
}

const toggles = {
Expand Down Expand Up @@ -929,8 +929,8 @@
await chatgpt.sidebar.isLoaded()
env.ui.firstLink = chatgpt.getNewChatLink();

// Add STARS styles
['brs', 'wrs'].forEach(cssType => document.head.append(createStyle(GM_getResourceText(`${cssType}CSS`))))
// Add RISING PARTICLES styles
['brp', 'wrp'].forEach(cssType => document.head.append(createStyle(GM_getResourceText(`${cssType}CSS`))))

toggles.sidebar.insert()

Expand Down
Loading

0 comments on commit b2c6efa

Please sign in to comment.