Skip to content

Commit 169837c

Browse files
committed
Abstracted scheme var in modals.stylize() ↞ [auto-sync from https://github.com/adamlui/ai-web-extensions/tree/main/googlegpt]
1 parent 172db1b commit 169837c

1 file changed

Lines changed: 23 additions & 25 deletions

File tree

chatgpt/googlegpt/googlegpt.user.js

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
// @description:zu Yengeza izimpendulo ze-AI ku-Google Search (inikwa amandla yi-Google Gemma + GPT-4o!)
150150
// @author KudoAI
151151
// @namespace https://kudoai.com
152-
// @version 2025.10.16
152+
// @version 2025.10.16.1
153153
// @license MIT
154154
// @icon data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%22170.667%22%20height=%22170.667%22%3E%3Cstyle%3E:root%7B--fill:%23000%7D@media%20(prefers-color-scheme:dark)%7B:root%7B--fill:%23fff%7D%7D%3C/style%3E%3Cpath%20fill=%22var(--fill)%22%20d=%22M82.346%20159.79c-18.113-1.815-31.78-9.013-45.921-24.184C23.197%20121.416%2017.333%20106.18%2017.333%2086c0-21.982%205.984-36.245%2021.87-52.131C55.33%2017.74%2069.27%2011.867%2091.416%2011.867c17.574%200%2029.679%203.924%2044.309%2014.363l8.57%206.116-8.705%208.705-8.704%208.704-4.288-3.608c-13.91-11.704-35.932-14.167-53.085-5.939-3.4%201.631-9.833%206.601-14.297%2011.045C44.669%2061.753%2040.95%2070.811%2040.95%2086c0%2014.342%203.594%2023.555%2013.26%2033.995%2019.088%2020.618%2048.46%2022.539%2070.457%204.608l5.333-4.348%2011.333%203.844c6.234%202.114%2011.54%203.857%2011.791%203.873.252.015-2.037%203.008-5.087%206.65-6.343%207.577-20.148%2017.217-30.493%2021.295-8.764%203.454-23.358%205.06-35.198%203.873zM92%2086.333V74.667h60.648l-11.41%2011.41-11.411%2011.41-18.914.257L92%2098z%22/%3E%3C/svg%3E
155155
// @icon64 data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%22170.667%22%20height=%22170.667%22%3E%3Cstyle%3E:root%7B--fill:%23000%7D@media%20(prefers-color-scheme:dark)%7B:root%7B--fill:%23fff%7D%7D%3C/style%3E%3Cpath%20fill=%22var(--fill)%22%20d=%22M82.346%20159.79c-18.113-1.815-31.78-9.013-45.921-24.184C23.197%20121.416%2017.333%20106.18%2017.333%2086c0-21.982%205.984-36.245%2021.87-52.131C55.33%2017.74%2069.27%2011.867%2091.416%2011.867c17.574%200%2029.679%203.924%2044.309%2014.363l8.57%206.116-8.705%208.705-8.704%208.704-4.288-3.608c-13.91-11.704-35.932-14.167-53.085-5.939-3.4%201.631-9.833%206.601-14.297%2011.045C44.669%2061.753%2040.95%2070.811%2040.95%2086c0%2014.342%203.594%2023.555%2013.26%2033.995%2019.088%2020.618%2048.46%2022.539%2070.457%204.608l5.333-4.348%2011.333%203.844c6.234%202.114%2011.54%203.857%2011.791%203.873.252.015-2.037%203.008-5.087%206.65-6.343%207.577-20.148%2017.217-30.493%2021.295-8.764%203.454-23.358%205.06-35.198%203.873zM92%2086.333V74.667h60.648l-11.41%2011.41-11.411%2011.41-18.914.257L92%2098z%22/%3E%3C/svg%3E
@@ -2243,7 +2243,6 @@
22432243
document.removeEventListener(eventType, modals.handlers.drag[eventType]))
22442244
modals.draggingModal = null
22452245
}
2246-
22472246
}
22482247
},
22492248

@@ -2675,6 +2674,7 @@
26752674
},
26762675

26772676
stylize() {
2677+
const { scheme: appScheme } = env.ui.app
26782678
if (!this.styles?.isConnected) document.head.append(this.styles ||= dom.create.style())
26792679
this.styles.textContent = (
26802680

@@ -2701,14 +2701,14 @@
27012701
.chatgpt-modal button { /* this.alert() buttons */
27022702
min-width: 113px ; padding: ${ env.browser.isMobile ? '5px' : '4px 15px' } !important ;
27032703
cursor: pointer ; border-radius: 0 !important ; height: 39px ;
2704-
border: 1px solid ${ env.ui.app.scheme == 'dark' ? 'white' : 'black' }!important }
2704+
border: 1px solid ${ appScheme == 'dark' ? 'white' : 'black' }!important }
27052705
.primary-modal-btn { background: black !important ; color: white !important }
27062706
.chatgpt-modal button:hover {
2707-
${ env.ui.app.scheme == 'light' ? // reduce intensity of light scheme hover glow
2707+
${ appScheme == 'light' ? // reduce intensity of light scheme hover glow
27082708
'--btn-shadow: 2px 1px 43px #00cfff70 ;' : '' }
27092709
color: inherit !important ; background-color: inherit !important /* remove color hacks */
27102710
}
2711-
${ env.ui.app.scheme == 'dark' ? // darkmode chatgpt.alert() styles
2711+
${ appScheme == 'dark' ? // darkmode chatgpt.alert() styles
27122712
`.chatgpt-modal > div, .chatgpt-modal button:not(.primary-modal-btn) {
27132713
color: white !important }
27142714
.primary-modal-btn { background: #00cfff !important ; color: black !important }
@@ -2719,9 +2719,9 @@
27192719
position: absolute !important ; float: right ; top: 14px !important ; right: 16px !important ;
27202720
cursor: pointer ; width: 33px ; height: 33px ; border-radius: 20px
27212721
}
2722-
[class*=modal-close-btn] path {${ env.ui.app.scheme == 'dark' ? 'stroke: white ; fill: white'
2723-
: 'stroke: #9f9f9f ; fill: #9f9f9f' }}
2724-
${ env.ui.app.scheme == 'dark' ? // invert dark mode hover paths
2722+
[class*=modal-close-btn] path {${ appScheme == 'dark' ? 'stroke: white ; fill: white'
2723+
: 'stroke: #9f9f9f ; fill: #9f9f9f' }}
2724+
${ appScheme == 'dark' ? // invert dark mode hover paths
27252725
'[class*=modal-close-btn]:hover path { stroke: black ; fill: black }' : '' }
27262726
[class*=modal-close-btn]:hover { background-color: #f2f2f2 } /* hover underlay */
27272727
[class*=modal-close-btn] svg { margin: 11.5px } /* center SVG for hover underlay */
@@ -2731,8 +2731,7 @@
27312731
: 'justify-self: start' }} /* left-align on desktop */
27322732
[class*=-modal] p { justify-self: start ; font-size: 20px }
27332733
[class*=-modal] button {
2734-
color: ${ env.ui.app.scheme == 'dark' ? 'white' : 'black' };
2735-
font-size: 12px !important ; background: none }
2734+
color: ${ appScheme == 'dark' ? 'white' : 'black' }; font-size: 12px !important ; background: none }
27362735
[class*=-modal-bg] {
27372736
pointer-events: auto ; /* override any disabling from site modals */
27382737
position: fixed ; top: 0 ; left: 0 ; width: 100% ; height: 100% ; /* expand to full view-port */
@@ -2746,10 +2745,9 @@
27462745
position: absolute ; /* to be click-draggable */
27472746
opacity: 0 ; /* to fade-in */
27482747
background-image: linear-gradient(180deg, ${
2749-
env.ui.app.scheme == 'dark' ? '#99a8a6 -200px, black 200px'
2750-
: '#b6ebff -296px, white 171px' }) ;
2751-
border: 1px solid ${ env.ui.app.scheme == 'dark' ? 'white' : '#b5b5b5' } !important ;
2752-
color: ${ env.ui.app.scheme == 'dark' ? 'white' : 'black' };
2748+
appScheme == 'dark' ? '#99a8a6 -200px, black 200px' : '#b6ebff -296px, white 171px' }) ;
2749+
border: 1px solid ${ appScheme == 'dark' ? 'white' : '#b5b5b5' } !important ;
2750+
color: ${ appScheme == 'dark' ? 'white' : 'black' };
27532751
transform: translateX(-3px) translateY(7px) ; /* offset to move-in from */
27542752
transition: var(--fg-transition) ; /* fade-in + move-in */
27552753
-webkit-transition: var(--fg-transition) ; -moz-transition: var(--fg-transition) ;
@@ -2767,7 +2765,7 @@
27672765
+ `#${app.slug}-settings {
27682766
min-width: ${ env.browser.isPortrait ? 288 : 698 }px ; max-width: 75vw ; word-wrap: break-word ;
27692767
margin: 12px 23px ; border-radius: 15px ;
2770-
${ env.ui.app.scheme == 'dark' ? 'stroke: white ; fill: white' : 'stroke: black ; fill: black' };
2768+
${ appScheme == 'dark' ? 'stroke: white ; fill: white' : 'stroke: black ; fill: black' };
27712769
--shadow: 0 30px 60px rgba(0,0,0,0.12) ;
27722770
box-shadow: var(--shadow) ; -webkit-box-shadow: var(--shadow) ; -moz-box-shadow: var(--shadow) }
27732771
#${app.slug}-settings-title {
@@ -2780,13 +2778,13 @@
27802778
list-style: none ; padding: 0 ; margin-bottom: 2px ; /* hide bullets, close bottom gap */
27812779
width: ${ env.browser.isPortrait ? 100 : 50 }% } /* set width based on column cnt */
27822780
${ env.browser.isPhone ? '' : `#${app.slug}-settings ul:first-of-type { /* color desktop middle sep */
2783-
border-right: 1px dotted ${ env.ui.app.scheme == 'dark' ? 'white' : 'black' }}`}
2781+
border-right: 1px dotted ${ appScheme == 'dark' ? 'white' : 'black' }}`}
27842782
#${app.slug}-settings li {
2785-
color: ${ env.ui.app.scheme == 'dark' ? 'rgb(255,255,255,0.65)' : 'rgba(0,0,0,0.45)' };
2786-
fill: ${ env.ui.app.scheme == 'dark' ? 'rgb(255,255,255,0.65)' : 'rgba(0,0,0,0.45)' };
2787-
stroke: ${ env.ui.app.scheme == 'dark' ? 'rgb(255,255,255,0.65)' : 'rgba(0,0,0,0.45)' };
2783+
color: ${ appScheme == 'dark' ? 'rgb(255,255,255,0.65)' : 'rgba(0,0,0,0.45)' };
2784+
fill: ${ appScheme == 'dark' ? 'rgb(255,255,255,0.65)' : 'rgba(0,0,0,0.45)' };
2785+
stroke: ${ appScheme == 'dark' ? 'rgb(255,255,255,0.65)' : 'rgba(0,0,0,0.45)' };
27882786
height: 24px ; padding: 6px 10px ; font-size: 13.5px ;
2789-
border-bottom: 1px dotted ${ env.ui.app.scheme == 'dark' ? 'white' : 'black' }; /* add separators */
2787+
border-bottom: 1px dotted ${ appScheme == 'dark' ? 'white' : 'black' }; /* add separators */
27902788
border-radius: 3px ; /* slightly round highlight strip */
27912789
${ config.fgAnimationsDisabled || env.browser.isMobile ? '' :
27922790
`transition: var(--settings-li-transition) ;
@@ -2795,9 +2793,9 @@
27952793
-o-transition: var(--settings-li-transition) ;
27962794
-ms-transition: var(--settings-li-transition)` }}
27972795
#${app.slug}-settings li.active {
2798-
color: ${ env.ui.app.scheme == 'dark' ? 'rgb(255,255,255)' : 'rgba(0,0,0)' };
2799-
fill: ${ env.ui.app.scheme == 'dark' ? 'rgb(255,255,255)' : 'rgba(0,0,0)' };
2800-
stroke: ${ env.ui.app.scheme == 'dark' ? 'rgb(255,255,255)' : 'rgba(0,0,0)' }}
2796+
color: ${ appScheme == 'dark' ? 'rgb(255,255,255)' : 'rgba(0,0,0)' };
2797+
fill: ${ appScheme == 'dark' ? 'rgb(255,255,255)' : 'rgba(0,0,0)' };
2798+
stroke: ${ appScheme == 'dark' ? 'rgb(255,255,255)' : 'rgba(0,0,0)' }}
28012799
#${app.slug}-settings li label { padding-right: 20px } /* right-pad labels so toggles don't hug */
28022800
#${app.slug}-settings li:last-of-type { border-bottom: none } /* remove last bottom-border */
28032801
#${app.slug}-settings li, #${app.slug}-settings li label { cursor: pointer } /* add finger on hover */
@@ -2823,7 +2821,7 @@
28232821
${ config.fgAnimationsDisabled ? '' // spin cycle arrows icon when scheme is Auto
28242822
: `#scheme-settings-entry svg[class*=arrowsCyclic],
28252823
.chatgpt-notif svg[class*=arrowsCyclic] { animation: rotate 5s linear infinite }` }
2826-
#about-settings-entry span { color: ${ env.ui.app.scheme == 'dark' ? '#28ee28' : 'green' }}
2824+
#about-settings-entry span { color: ${ appScheme == 'dark' ? '#28ee28' : 'green' }}
28272825
#about-settings-entry > span { /* outer About status span */
28282826
width: ${ env.browser.isPortrait ? '15vw' : '95px' }; height: 20px ; overflow: hidden ;
28292827
${ env.browser.isPortrait ? 'position: relative ; bottom: 3px ;' : '' } /* v-align */
@@ -2836,7 +2834,7 @@
28362834
text-wrap: nowrap ; ${
28372835
config.fgAnimationsDisabled ? '' : 'animation: ticker linear 75s infinite' }}
28382836
@keyframes ticker { 0% { transform: translateX(100%) } 100% { transform: translateX(-2000%) }}
2839-
.about-em { color: ${ env.ui.app.scheme == 'dark' ? 'white' : 'green' } !important }`
2837+
.about-em { color: ${ appScheme == 'dark' ? 'white' : 'green' } !important }`
28402838
)
28412839
},
28422840

0 commit comments

Comments
 (0)