Skip to content

Commit 99efd5d

Browse files
committed
Improved dom.addRisingParticles()
± Added option to pass color of generated particles ± Shortened `particlesDivsContainer` to `particlesDivsWrapper` ↞ [auto-sync from https://github.com/adamlui/ai-web-extensions/tree/main/chatgpt-auto-refresh]
1 parent 36be645 commit 99efd5d

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

chatgpt/chatgpt-auto-refresh/chatgpt-auto-refresh.user.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@
220220
// @description:zu *NGOKUPHEPHA* susa ukusetha kabusha ingxoxo yemizuzu eyi-10 + amaphutha enethiwekhi ahlala njalo + Ukuhlolwa kwe-Cloudflare ku-ChatGPT.
221221
// @author Adam Lui
222222
// @namespace https://github.com/adamlui
223-
// @version 2025.1.30.4
223+
// @version 2025.1.30.5
224224
// @license MIT
225225
// @icon https://assets.chatgptautorefresh.com/images/icons/openai/black/icon48.png?v=f11a0a8
226226
// @icon64 https://assets.chatgptautorefresh.com/images/icons/openai/black/icon64.png?v=f11a0a8
@@ -787,18 +787,21 @@
787787
return style
788788
}
789789

790-
function addRisingParticles(targetNode) { // requires https://assets.aiwebextensions.com/styles/rising-particles/dist/<gray|white>.min.css
790+
function addRisingParticles(targetNode, { lightScheme = 'gray', darkScheme = 'white' } = {}) {
791+
// Requires https://assets.aiwebextensions.com/styles/rising-particles/dist/<lightScheme|darkScheme>.min.css
792+
791793
if (targetNode.querySelector('[id*=particles]')) return
792-
const particlesDivsContainer = document.createElement('div')
793-
particlesDivsContainer.style.cssText = 'position: absolute ; top: 0 ; left: 0 ;' // hug targetNode's top-left corner
794+
const particlesDivsWrapper = document.createElement('div')
795+
particlesDivsWrapper.style.cssText = (
796+
'position: absolute ; top: 0 ; left: 0 ;' // hug targetNode's top-left corner
794797
+ 'height: 100% ; width: 100% ; border-radius: 15px ; overflow: clip ;' // bound innards exactly by targetNode
795-
+ 'z-index: -1'; // allow interactive elems to be clicked
798+
+ 'z-index: -1' ); // allow interactive elems to be clicked
796799
['sm', 'med', 'lg'].forEach(particleSize => {
797800
const particlesDiv = document.createElement('div')
798-
particlesDiv.id = `${ env.ui.scheme == 'dark' ? 'white' : 'gray' }-particles-${particleSize}`
799-
particlesDivsContainer.append(particlesDiv)
801+
particlesDiv.id = `${ env.ui.scheme == 'dark' ? darkScheme : lightScheme }-particles-${particleSize}`
802+
particlesDivsWrapper.append(particlesDiv)
800803
})
801-
targetNode.prepend(particlesDivsContainer)
804+
targetNode.prepend(particlesDivsWrapper)
802805
}
803806

804807
const toggles = {

0 commit comments

Comments
 (0)