Skip to content

Commit

Permalink
Alphabetized dom.js methods for readability ↞ [auto-sync from https:/…
Browse files Browse the repository at this point in the history
  • Loading branch information
kudo-sync-bot committed Jan 30, 2025
1 parent 130a1ff commit 51c638e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
28 changes: 14 additions & 14 deletions chromium/extension/lib/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ window.dom = {
for (const depName in deps) this[depName] = deps[depName] }
},

addRisingParticles(targetNode) { // requires https://assets.aiwebextensions.com/styles/rising-particles/dist/<gray|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(particleSize => {
const particlesDiv = document.createElement('div')
particlesDiv.id = `${ this.imports.env.ui.scheme == 'dark' ? 'white' : 'gray' }-particles-${particleSize}`
particlesDivsContainer.append(particlesDiv)
})
targetNode.prepend(particlesDivsContainer)
},

create: {
elem(elemType, attrs = {}) {
const elem = document.createElement(elemType)
Expand All @@ -23,19 +37,5 @@ window.dom = {
for (const attr in attrs) elem.setAttributeNS(null, attr, attrs[attr])
return elem
}
},

addRisingParticles(targetNode) { // requires https://assets.aiwebextensions.com/styles/rising-particles/dist/<gray|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(particleSize => {
const particlesDiv = document.createElement('div')
particlesDiv.id = `${ this.imports.env.ui.scheme == 'dark' ? 'white' : 'gray' }-particles-${particleSize}`
particlesDivsContainer.append(particlesDiv)
})
targetNode.prepend(particlesDivsContainer)
}
};
28 changes: 14 additions & 14 deletions firefox/extension/lib/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ window.dom = {
for (const depName in deps) this[depName] = deps[depName] }
},

addRisingParticles(targetNode) { // requires https://assets.aiwebextensions.com/styles/rising-particles/dist/<gray|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(particleSize => {
const particlesDiv = document.createElement('div')
particlesDiv.id = `${ this.imports.env.ui.scheme == 'dark' ? 'white' : 'gray' }-particles-${particleSize}`
particlesDivsContainer.append(particlesDiv)
})
targetNode.prepend(particlesDivsContainer)
},

create: {
elem(elemType, attrs = {}) {
const elem = document.createElement(elemType)
Expand All @@ -23,19 +37,5 @@ window.dom = {
for (const attr in attrs) elem.setAttributeNS(null, attr, attrs[attr])
return elem
}
},

addRisingParticles(targetNode) { // requires https://assets.aiwebextensions.com/styles/rising-particles/dist/<gray|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(particleSize => {
const particlesDiv = document.createElement('div')
particlesDiv.id = `${ this.imports.env.ui.scheme == 'dark' ? 'white' : 'gray' }-particles-${particleSize}`
particlesDivsContainer.append(particlesDiv)
})
targetNode.prepend(particlesDivsContainer)
}
};

0 comments on commit 51c638e

Please sign in to comment.