Skip to content

Commit

Permalink
Updated rising-stars func/var/meta names + paths + comments ↞ [auto-s…
Browse files Browse the repository at this point in the history
  • Loading branch information
kudo-sync-bot committed Jan 30, 2025
1 parent e277057 commit 8c5f610
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 41 deletions.
6 changes: 3 additions & 3 deletions chromium/extension/components/modals.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@ window.modals = {
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`)
dom.fillStarryBG(modal) // add starry bg
dom.addRisingParticles(modal)
},

stylize() {
Expand Down
6 changes: 3 additions & 3 deletions chromium/extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,11 @@

update.style.tweaks() ; document.head.append(tweaksStyle);

// Add STARS styles
// Add RISING PARTICLES styles
['black', 'white'].forEach(color => document.head.append(
dom.create.elem('link', { rel: 'stylesheet',
href: `https://assets.aiwebextensions.com/styles/rising-stars/dist/${
color}.min.css?v=0cde30f9ae3ce99ae998141f6e7a36de9b0cc2e7`
href: `https://assets.aiwebextensions.com/styles/rising-particles/dist/${
color}.min.css?v=727feff`
})))

// Create WIDESCREEN style
Expand Down
18 changes: 9 additions & 9 deletions chromium/extension/lib/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ window.dom = {
.replace(/^| /g, '.') // prefix w/ dot, convert spaces to dots
},

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.env.ui.scheme == 'dark' ? 'white' : 'black' }-stars-${starSize}`
starsDivsContainer.append(starsDiv)
['sm', 'med', 'lg'].forEach(particleSize => {
const particlesDiv = document.createElement('div')
particlesDiv.id = `${ this.imports.env.ui.scheme == 'dark' ? 'white' : 'black' }-particles-${particleSize}`
particlesDivsContainer.append(particlesDiv)
})
targetNode.prepend(starsDivsContainer)
targetNode.prepend(particlesDivsContainer)
},

getLoadedElem(selector, timeout = null) {
Expand Down
6 changes: 3 additions & 3 deletions firefox/extension/components/modals.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@ window.modals = {
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`)
dom.fillStarryBG(modal) // add starry bg
dom.addRisingParticles(modal)
},

stylize() {
Expand Down
6 changes: 3 additions & 3 deletions firefox/extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,11 @@

update.style.tweaks() ; document.head.append(tweaksStyle);

// Add STARS styles
// Add RISING PARTICLES styles
['black', 'white'].forEach(color => document.head.append(
dom.create.elem('link', { rel: 'stylesheet',
href: `https://assets.aiwebextensions.com/styles/rising-stars/dist/${
color}.min.css?v=0cde30f9ae3ce99ae998141f6e7a36de9b0cc2e7`
href: `https://assets.aiwebextensions.com/styles/rising-particles/dist/${
color}.min.css?v=727feff`
})))

// Create WIDESCREEN style
Expand Down
18 changes: 9 additions & 9 deletions firefox/extension/lib/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ window.dom = {
.replace(/^| /g, '.') // prefix w/ dot, convert spaces to dots
},

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.env.ui.scheme == 'dark' ? 'white' : 'black' }-stars-${starSize}`
starsDivsContainer.append(starsDiv)
['sm', 'med', 'lg'].forEach(particleSize => {
const particlesDiv = document.createElement('div')
particlesDiv.id = `${ this.imports.env.ui.scheme == 'dark' ? 'white' : 'black' }-particles-${particleSize}`
particlesDivsContainer.append(particlesDiv)
})
targetNode.prepend(starsDivsContainer)
targetNode.prepend(particlesDivsContainer)
},

getLoadedElem(selector, timeout = null) {
Expand Down
10 changes: 5 additions & 5 deletions greasemonkey/chatgpt-widescreen-mode.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@
// @description:zu Thuthukisa iChatGPT ngemodi zesikrini ezibanzi/egcwele/ephezulu + imodi yokuvimbela i-spam. Futhi isebenza ku-perplexity.ai + poe.com!
// @author Adam Lui
// @namespace https://github.com/adamlui
// @version 2025.1.29.1
// @version 2025.1.29.2
// @license MIT
// @icon https://assets.chatgptwidescreen.com/images/icons/widescreen-robot-emoji/icon48.png?v=844b16e
// @icon64 https://assets.chatgptwidescreen.com/images/icons/widescreen-robot-emoji/icon64.png?v=844b16e
Expand All @@ -259,8 +259,8 @@
// @require https://cdn.jsdelivr.net/gh/adamlui/chatgpt-widescreen@bbd0ea4/chromium/extension/lib/settings.js#sha256-zmX98Pku2DFY9SI0KBy6Ix6lUJIh8FNtqbAO8nnFE6k=
// @require https://cdn.jsdelivr.net/gh/adamlui/chatgpt-widescreen@bbd0ea4/chromium/extension/components/buttons.js#sha256-cf8uqPcLdpEPM21OSeh2Xj2mi987eeGtg+wXR1EmHlI=
// @require https://cdn.jsdelivr.net/gh/adamlui/chatgpt-widescreen@6fc65c4/chromium/extension/components/modals.js#sha256-qQtlKpnAqUAwoTAxVtKStahUlbwcDYrqTBbfYfqOIzc=
// @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 @@ -791,8 +791,8 @@

update.style.tweaks() ; document.head.append(tweaksStyle);

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

// Create WIDESCREEN style
const wideScreenStyle = dom.create.style()
Expand Down
13 changes: 7 additions & 6 deletions utils/bump/resources.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node

// Bumps @require'd JS + rising-stars CSS @resource's in userscript
// Bumps @require'd JS + rising-particles CSS @resource's in userscript
// NOTE: Doesn't git commit to allow script editing from breaking changes

(async () => {
Expand Down Expand Up @@ -107,10 +107,11 @@
const resURLs = [...userJScontent.matchAll(reResURL)].map(match => match[1] || match[2])
log.success(`${resURLs.length} potentially bumpable resource(s) found.`)

// Fetch latest commit hash for adamlui/ai-web-extensions/assets/styles/rising-stars
const risingStarsPath = 'assets/styles/rising-stars'
log.working(`\nFetching latest commit hash for ${risingStarsPath}...\n`)
const latestCommitHashes = { risingStars: await getLatestCommitHash('adamlui/ai-web-extensions', risingStarsPath) }
// Fetch latest commit hash for adamlui/ai-web-extensions/assets/styles/rising-particles
const risingParticlesPath = 'assets/styles/rising-particles'
log.working(`\nFetching latest commit hash for ${risingParticlesPath}...\n`)
const latestCommitHashes = {
risingParticles: await getLatestCommitHash('adamlui/ai-web-extensions', risingParticlesPath) }

log.working('\nProcessing resource(s)...\n')
let urlsUpdatedCnt = 0
Expand All @@ -127,7 +128,7 @@
const resName = rePatterns.resName.exec(resURL)?.[0] || 'resource' // dir/filename for logs

// Compare/update commit hash
let resLatestCommitHash = latestCommitHashes[resURL.includes(repoName) ? 'chromium' : 'risingStars']
let resLatestCommitHash = latestCommitHashes[resURL.includes(repoName) ? 'chromium' : 'risingParticles']
if (resLatestCommitHash.startsWith( // compare hashes
rePatterns.commitHash.exec(resURL)?.[2] || '')) { // commit hash didn't change...
console.log(`${resName} already up-to-date!`) ; log.endedWithLineBreak = false
Expand Down

0 comments on commit 8c5f610

Please sign in to comment.