22
33window . modals = {
44 stack : [ ] , // of types of undismissed modals
5- get class ( ) { return `${ this . dependencies . app . cssPrefix } -modal` } ,
5+ get class ( ) { return `${ this . imports . app . cssPrefix } -modal` } ,
66
7- dependencies : {
8- import ( dependencies ) { // { app, env }
9- for ( const depName in dependencies ) this [ depName ] = dependencies [ depName ] }
7+ imports : {
8+ import ( deps ) { // { app, env }
9+ for ( const depName in deps ) this [ depName ] = deps [ depName ] }
1010 } ,
1111
1212 alert ( title = '' , msg = '' , btns = '' , checkbox = '' , width = '' ) { // generic one from chatgpt.alert()
@@ -39,37 +39,37 @@ window.modals = {
3939 + 'font-family: -apple-system, system-ui, BlinkMacSystemFont, Segoe UI, Roboto,'
4040 + 'Oxygen-Sans, Ubuntu, Cantarell, Helvetica Neue, sans-serif ;'
4141 + 'padding: 20px 25px 24px 25px !important ; font-size: 20px ;'
42- + `color: ${ this . dependencies . env . ui . scheme == 'dark' ? 'white' : 'black' } !important ;`
42+ + `color: ${ this . imports . env . ui . scheme == 'dark' ? 'white' : 'black' } !important ;`
4343 + `background-image: linear-gradient(180deg, ${
44- this . dependencies . env . ui . scheme == 'dark' ? '#99a8a6 -200px, black 200px'
44+ this . imports . env . ui . scheme == 'dark' ? '#99a8a6 -200px, black 200px'
4545 : '#b6ebff -296px, white 171px' } ) }`
4646 + `.${ this . class } [class*=modal-close-btn] {`
4747 + 'position: absolute !important ; float: right ; top: 14px !important ; right: 16px !important ;'
4848 + 'cursor: pointer ; width: 33px ; height: 33px ; border-radius: 20px }'
4949 + `.${ this . class } [class*=modal-close-btn] svg { height: 10px }`
5050 + `.${ this . class } [class*=modal-close-btn] path {`
51- + `${ this . dependencies . env . ui . scheme == 'dark' ? 'stroke: white ; fill: white'
51+ + `${ this . imports . env . ui . scheme == 'dark' ? 'stroke: white ; fill: white'
5252 : 'stroke: #9f9f9f ; fill: #9f9f9f' } }`
53- + ( this . dependencies . env . ui . scheme == 'dark' ? // invert dark mode hover paths
53+ + ( this . imports . env . ui . scheme == 'dark' ? // invert dark mode hover paths
5454 `.${ this . class } [class*=modal-close-btn]:hover path { stroke: black ; fill: black }` : '' )
5555 + `.${ this . class } [class*=modal-close-btn]:hover { background-color: #f2f2f2 }` // hover underlay
5656 + `.${ this . class } [class*=modal-close-btn] svg { margin: 11.5px }` // center SVG for hover underlay
5757 + `.${ this . class } a {`
58- + `color: #${ this . dependencies . env . ui . scheme == 'dark' ? '00cfff' : '1e9ebb' } !important }`
58+ + `color: #${ this . imports . env . ui . scheme == 'dark' ? '00cfff' : '1e9ebb' } !important }`
5959 + `.${ this . class } h2 { font-weight: bold }`
6060 + `.${ this . class } button {`
6161 + 'font-size: 14px ; text-transform: uppercase ;' // shrink/uppercase labels
6262 + 'border-radius: 0 !important ;' // square borders
6363 + 'transition: transform 0.1s ease-in-out, box-shadow 0.1s ease-in-out ;' // smoothen hover fx
6464 + 'cursor: pointer !important ;' // add finger cursor
65- + `border: 1px solid ${ this . dependencies . env . ui . scheme == 'dark' ? 'white' : 'black' } !important ;`
65+ + `border: 1px solid ${ this . imports . env . ui . scheme == 'dark' ? 'white' : 'black' } !important ;`
6666 + 'padding: 8px !important ; min-width: 102px }' // resize
6767 + `.${ this . class } button:hover {` // add zoom, re-scheme
6868 + 'transform: scale(1.055) ; color: black !important ;'
69- + `background-color: #${ this . dependencies . env . ui . scheme == 'dark' ? '00cfff' : '9cdaff' } !important }`
70- + ( ! this . dependencies . env . browser . isMobile ?
69+ + `background-color: #${ this . imports . env . ui . scheme == 'dark' ? '00cfff' : '9cdaff' } !important }`
70+ + ( ! this . imports . env . browser . isMobile ?
7171 `.${ this . class } .modal-buttons { margin-left: -13px !important }` : '' )
72- + `.about-em { color: ${ this . dependencies . env . ui . scheme == 'dark' ? 'white' : 'green' } !important }`
72+ + `.about-em { color: ${ this . imports . env . ui . scheme == 'dark' ? 'white' : 'green' } !important }`
7373 )
7474 } ,
7575
@@ -94,13 +94,13 @@ window.modals = {
9494
9595 // Show modal
9696 const aboutModal = this . alert (
97- `${ this . dependencies . app . symbol } ${ chrome . runtime . getManifest ( ) . name } ` , // title
98- `🏷️ Version: <span class="about-em">${ this . dependencies . app . version } </span>\n` // msg
97+ `${ this . imports . app . symbol } ${ chrome . runtime . getManifest ( ) . name } ` , // title
98+ `🏷️ Version: <span class="about-em">${ this . imports . app . version } </span>\n` // msg
9999 + '⚡ Powered by: '
100- + `<a href="${ this . dependencies . app . urls . chatgptJS } " target="_blank" rel="noopener">chatgpt.js</a>\n`
100+ + `<a href="${ this . imports . app . urls . chatgptJS } " target="_blank" rel="noopener">chatgpt.js</a>\n`
101101 + '📜 Open source code: '
102- + `<a href="${ this . dependencies . app . urls . gitHub } " target="_blank" rel="nopener">`
103- + this . dependencies . app . urls . gitHub + '</a>' ,
102+ + `<a href="${ this . imports . app . urls . gitHub } " target="_blank" rel="nopener">`
103+ + this . imports . app . urls . gitHub + '</a>' ,
104104 [ function getSupport ( ) { } , function rateUs ( ) { } , function moreAiExtensions ( ) { } ] , // button labels
105105 '' , 656 // modal width
106106 )
@@ -110,7 +110,7 @@ window.modals = {
110110 'text-align: center ; font-size: 51px ; line-height: 46px ; padding: 15px 0' )
111111 aboutModal . querySelector ( 'p' ) . style . cssText = (
112112 'text-align: center ; overflow-wrap: anywhere ;'
113- + `margin: ${ this . dependencies . env . browser . isPortrait ? '6px 0 -16px' : '3px 0 0' } ` )
113+ + `margin: ${ this . imports . env . browser . isPortrait ? '6px 0 -16px' : '3px 0 0' } ` )
114114
115115 // Hack buttons
116116 aboutModal . querySelector ( '.modal-buttons' ) . style . justifyContent = 'center'
@@ -121,9 +121,9 @@ window.modals = {
121121 const btnClone = btn . cloneNode ( true )
122122 btn . parentNode . replaceChild ( btnClone , btn ) ; btn = btnClone
123123 btn . onclick = ( ) => this . safeWinOpen (
124- btn . textContent == 'Get Support' ? `${ modals . dependencies . app . urls . gitHub } /issues`
125- : btn . textContent == 'Rate Us' ? `${ modals . dependencies . app . urls . gitHub } /discussions`
126- : modals . dependencies . app . urls . relatedExtensions
124+ btn . textContent == 'Get Support' ? `${ modals . imports . app . urls . gitHub } /issues`
125+ : btn . textContent == 'Rate Us' ? `${ modals . imports . app . urls . gitHub } /discussions`
126+ : modals . imports . app . urls . relatedExtensions
127127 )
128128
129129 // Prepend emoji
0 commit comments