Skip to content

Commit

Permalink
Stripped unneeded quotes from CSS selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
adamlui committed Dec 21, 2024
1 parent e178a7f commit 98da65d
Show file tree
Hide file tree
Showing 32 changed files with 220 additions and 220 deletions.
50 changes: 25 additions & 25 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 2024.12.21
// @version 2024.12.21.1
// @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 @@ -654,7 +654,7 @@
modal.onwheel = modal.ontouchmove = event => event.preventDefault() // disable wheel/swipe scrolling
modal.onmousedown = modals.handlers.drag.mousedown // enable click-dragging
if (!modal.parentNode.className.includes('chatgpt-modal')) { // enable click-dismissing native modals
const dismissElems = [modal.parentNode, modal.querySelector('[class*="-close-btn"]')]
const dismissElems = [modal.parentNode, modal.querySelector('[class*=-close-btn]')]
dismissElems.forEach(elem => elem.onclick = modals.handlers.click)
}

Expand Down Expand Up @@ -702,30 +702,30 @@
+ '.chatgpt-modal button:hover {'
+ 'background-color: #00cfff !important ; color: black !important }' ) : '' )
+ `.${modals.class} { display: grid ; place-items: center }` // for centered icon/logo
+ '[class*="modal-close-btn"] {'
+ '[class*=modal-close-btn] {'
+ 'position: absolute !important ; float: right ; top: 14px !important ; right: 16px !important ;'
+ 'cursor: pointer ; width: 33px ; height: 33px ; border-radius: 20px }'
+ `[class*="modal-close-btn"] path {${ env.ui.app.scheme == 'dark' ? 'stroke: white ; fill: white'
+ `[class*=modal-close-btn] path {${ env.ui.app.scheme == 'dark' ? 'stroke: white ; fill: white'
: 'stroke: #9f9f9f ; fill: #9f9f9f' }}`
+ ( env.ui.app.scheme == 'dark' ? // invert dark mode hover paths
'[class*="modal-close-btn"]:hover path { stroke: black ; fill: black }' : '' )
+ '[class*="modal-close-btn"]:hover { background-color: #f2f2f2 }' // hover underlay
+ '[class*="modal-close-btn"] svg { margin: 11.5px }' // center SVG for hover underlay
+ '[class*="-modal"] h2 {'
'[class*=modal-close-btn]:hover path { stroke: black ; fill: black }' : '' )
+ '[class*=modal-close-btn]:hover { background-color: #f2f2f2 }' // hover underlay
+ '[class*=modal-close-btn] svg { margin: 11.5px }' // center SVG for hover underlay
+ '[class*=-modal] h2 {'
+ 'font-size: 27px ; font-weight: bold ; line-height: 32px ; padding: 0 ;'
+ 'margin: 9px 0 22px !important ;'
+ `${ env.browser.isMobile ? 'text-align: center' // center on mobile
: 'justify-self: start' }}` // left-align on desktop
+ '[class*="-modal"] p { justify-self: start ; font-size: 20px }'
+ '[class*="-modal"] button { font-size: 14px }'
+ '[class*="-modal-bg"] {'
+ '[class*=-modal] p { justify-self: start ; font-size: 20px }'
+ '[class*=-modal] button { font-size: 14px }'
+ '[class*=-modal-bg] {'
+ 'pointer-events: auto ;' // override any disabling from site modals
+ 'position: fixed ; top: 0 ; left: 0 ; width: 100% ; height: 100% ;' // expand to full view-port
+ 'transition: background-color .25s ease !important ;' // speed to show bg dim
+ 'display: flex ; justify-content: center ; align-items: center ; z-index: 9999 }' // align
+ '[class*="-modal-bg"].animated > div {'
+ '[class*=-modal-bg].animated > div {'
+ 'z-index: 13456 ; opacity: 0.98 ; transform: translateX(0) translateY(0) }'
+ '[class$="-modal"] {' // native modals + chatgpt.alert()s
+ '[class$=-modal] {' // native modals + chatgpt.alert()s
+ 'position: absolute ;' // to be click-draggable
+ 'opacity: 0 ;' // to fade-in
+ `background-image: linear-gradient(180deg, ${
Expand All @@ -736,8 +736,8 @@
+ 'transition: opacity 0.65s cubic-bezier(.165,.84,.44,1),' // for fade-ins
+ 'transform 0.55s cubic-bezier(.165,.84,.44,1) !important }' // for move-ins
+ ( config.fgAnimationsDisabled || env.browser.isMobile ? '' : (
'[class$="-modal"] button { transition: transform 0.15s ease }'
+ '[class$="-modal"] button:hover { transform: scale(1.055) }' ))
'[class$=-modal] button { transition: transform 0.15s ease }'
+ '[class$=-modal] button:hover { transform: scale(1.055) }' ))

// Glowing modal btns
+ ':root { --glow-color: hsl(186 100% 69%); }'
Expand Down Expand Up @@ -866,8 +866,8 @@
click(event) { // to dismiss native modals
log.caller = 'modals.handlers.click()'
const clickedElem = event.target
if (clickedElem == event.currentTarget || clickedElem.closest('[class*="-close-btn]')) {
const modal = (clickedElem.closest('[class*="-modal-bg"]') || clickedElem).firstChild
if (clickedElem == event.currentTarget || clickedElem.closest('[class*=-close-btn]')) {
const modal = (clickedElem.closest('[class*=-modal-bg]') || clickedElem).firstChild
log.debug(`Dismiss element of div#${modal?.id} clicked`)
modals.hide(modal)
}
Expand Down Expand Up @@ -908,7 +908,7 @@
log.caller = 'modals.handlers.key()'
if (event.key.startsWith('Esc') || event.keyCode == 27) {
log.debug('Escape pressed')
const modal = document.querySelector('[class$="-modal"]')
const modal = document.querySelector('[class$=-modal]')
if (modal) modals.hide(modal)
}
}
Expand Down Expand Up @@ -1739,7 +1739,7 @@

stars() {
['sm', 'med', 'lg'].forEach(size =>
document.querySelectorAll(`[id*="stars-${size}"]`).forEach(starsDiv =>
document.querySelectorAll(`[id*=stars-${size}]`).forEach(starsDiv =>
starsDiv.id = config.bgAnimationsDisabled ? `stars-${size}-off`
: `${ env.ui.app.scheme == 'dark' ? 'white' : 'black' }-stars-${size}`
))
Expand Down Expand Up @@ -1939,7 +1939,7 @@
// Define UI functions

function fillStarryBG(targetNode) { // requires https://assets.aiwebextensions.com/styles/rising-stars/css/<black|white>.min.css
if (targetNode.querySelector('[id*="stars"]')) return
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
+ 'height: 100% ; width: 100% ; border-radius: 15px ; overflow: clip ;' // bound innards exactly by targetNode
Expand All @@ -1959,7 +1959,7 @@
appDiv.addEventListener(inputEvents.down, event => { // to dismiss visible font size slider
if (event.button != 0) return // prevent non-left-click dismissal
if (document.getElementById(`${app.cssPrefix}-font-size-slider-track`) // slider is visible
&& !event.target.closest('[id*="font-size"]') // not clicking slider elem
&& !event.target.closest('[id*=font-size]') // not clicking slider elem
&& getComputedStyle(event.target).cursor != 'pointer') // ...or other interactive elem
fontSizeSlider.toggle('off')
})
Expand Down Expand Up @@ -2280,7 +2280,7 @@

btnGlow(state = '') {
const removeCondition = state == 'off' || env.ui.app.scheme != 'dark' || config.fgAnimationsDisabled
document.querySelectorAll('[class*="-modal"] button').forEach((btn, idx) => {
document.querySelectorAll('[class*=-modal] button').forEach((btn, idx) => {
setTimeout(() => btn.classList[removeCondition ? 'remove' : 'add']('glowing-btn'),
(idx +1) *50 *chatgpt.randomFloat()) // to unsync flickers
let btnTextSpan = btn.querySelector('span')
Expand Down Expand Up @@ -2333,8 +2333,8 @@
notify(`${app.msgs.menuLabel_proxyAPImode} ${menu.state.words[+config.proxyAPIenabled]}`)
menu.refresh()
if (modals.settings.get()) { // update visual states of Settings toggles
const proxyToggle = document.querySelector('[id*="proxy"][id*="menu-entry"] input'),
streamingToggle = document.querySelector('[id*="streaming"][id*="menu-entry"] input')
const proxyToggle = document.querySelector('[id*=proxy][id*=menu-entry] input'),
streamingToggle = document.querySelector('[id*=streaming][id*=menu-entry] input')
if (proxyToggle.checked != config.proxyAPIenabled) // Proxy state out-of-sync (from using toolbar menu)
modals.settings.toggle.switch(proxyToggle)
if (streamingToggle.checked && !config.proxyAPIenabled // Streaming checked but OpenAI mode
Expand Down Expand Up @@ -3047,7 +3047,7 @@
// Exit on specific pages
if (location.pathname == '/message-us')
return log.debug('Exited from support bot')
else if (document.querySelector('form[action*="Captcha"]'))
else if (document.querySelector('form[action*=Captcha]'))
return log.debug('Exited from Captcha page')
else if (document.querySelector('a > img[src*="/error"]'))
return log.debug('Exited from 404 page')
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 2024.12.21
// @version 2024.12.21.1
// @license MIT
// @icon https://media.autoclearchatgpt.com/images/icons/openai/black/icon48.png?a8868ef
// @icon64 https://media.autoclearchatgpt.com/images/icons/openai/black/icon64.png?a8868ef
Expand Down Expand Up @@ -517,16 +517,16 @@
+ `color: ${ env.scheme == 'dark' ? 'white' : 'black' } !important ;`
+ `background-image: linear-gradient(180deg, ${
env.scheme == 'dark' ? '#99a8a6 -200px, black 200px' : '#b6ebff -296px, white 171px' }) }`
+ `.${this.class} [class*="modal-close-btn"] {`
+ `.${this.class} [class*=modal-close-btn] {`
+ 'position: absolute !important ; float: right ; top: 14px !important ; right: 16px !important ;'
+ 'cursor: pointer ; width: 33px ; height: 33px ; border-radius: 20px }'
+ `.${this.class} [class*="modal-close-btn"] svg { height: 10px }`
+ `.${this.class} [class*="modal-close-btn"] path {`
+ `.${this.class} [class*=modal-close-btn] svg { height: 10px }`
+ `.${this.class} [class*=modal-close-btn] path {`
+ `${ env.scheme == 'dark' ? 'stroke: white ; fill: white' : 'stroke: #9f9f9f ; fill: #9f9f9f' }}`
+ ( env.scheme == 'dark' ? // invert dark mode hover paths
`.${this.class} [class*="modal-close-btn"]:hover path { stroke: black ; fill: black }` : '' )
+ `.${this.class} [class*="modal-close-btn"]:hover { background-color: #f2f2f2 }` // hover underlay
+ `.${this.class} [class*="modal-close-btn"] svg { margin: 11.5px }` // center SVG for hover underlay
`.${this.class} [class*=modal-close-btn]:hover path { stroke: black ; fill: black }` : '' )
+ `.${this.class} [class*=modal-close-btn]:hover { background-color: #f2f2f2 }` // hover underlay
+ `.${this.class} [class*=modal-close-btn] svg { margin: 11.5px }` // center SVG for hover underlay
+ `.${this.class} a { color: #${ env.scheme == 'dark' ? '00cfff' : '1e9ebb' } !important }`
+ `.${this.class} h2 { font-weight: bold }`
+ `.${this.class} button {`
Expand Down Expand Up @@ -769,7 +769,7 @@
}

function fillStarryBG(targetNode) { // requires https://assets.aiwebextensions.com/styles/rising-stars/css/<black|white>.min.css
if (targetNode.querySelector('[id*="stars"]')) return
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
+ 'height: 100% ; width: 100% ; border-radius: 15px ; overflow: clip ;' // bound innards exactly by targetNode
Expand Down Expand Up @@ -948,7 +948,7 @@
// Disable distracting SIDEBAR CLICK-ZOOM effect
if (!document.documentElement.hasAttribute('sidebar-click-zoom-observed')) {
new MutationObserver(mutations => mutations.forEach(({ target }) => {
if (target.closest('[class*="sidebar"]') // include sidebar divs
if (target.closest('[class*=sidebar]') // include sidebar divs
&& !target.id.endsWith('-knob-span') // exclude our toggles.sidebar
&& target.style.transform != 'none' // click-zoom occurred
) target.style.transform = 'none'
Expand Down
Loading

0 comments on commit 98da65d

Please sign in to comment.