2
2
3
3
window . modals = {
4
4
stack : [ ] , // of types of undismissed modals
5
- get class ( ) { return `${ this . dependencies . app . cssPrefix } -modal` } ,
5
+ get class ( ) { return `${ this . imports . app . cssPrefix } -modal` } ,
6
6
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 ] }
10
10
} ,
11
11
12
12
alert ( title = '' , msg = '' , btns = '' , checkbox = '' , width = '' ) { // generic one from chatgpt.alert()
@@ -39,37 +39,37 @@ window.modals = {
39
39
+ 'font-family: -apple-system, system-ui, BlinkMacSystemFont, Segoe UI, Roboto,'
40
40
+ 'Oxygen-Sans, Ubuntu, Cantarell, Helvetica Neue, sans-serif ;'
41
41
+ '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 ;`
43
43
+ `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'
45
45
: '#b6ebff -296px, white 171px' } ) }`
46
46
+ `.${ this . class } [class*=modal-close-btn] {`
47
47
+ 'position: absolute !important ; float: right ; top: 14px !important ; right: 16px !important ;'
48
48
+ 'cursor: pointer ; width: 33px ; height: 33px ; border-radius: 20px }'
49
49
+ `.${ this . class } [class*=modal-close-btn] svg { height: 10px }`
50
50
+ `.${ 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'
52
52
: '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
54
54
`.${ this . class } [class*=modal-close-btn]:hover path { stroke: black ; fill: black }` : '' )
55
55
+ `.${ this . class } [class*=modal-close-btn]:hover { background-color: #f2f2f2 }` // hover underlay
56
56
+ `.${ this . class } [class*=modal-close-btn] svg { margin: 11.5px }` // center SVG for hover underlay
57
57
+ `.${ 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 }`
59
59
+ `.${ this . class } h2 { font-weight: bold }`
60
60
+ `.${ this . class } button {`
61
61
+ 'font-size: 14px ; text-transform: uppercase ;' // shrink/uppercase labels
62
62
+ 'border-radius: 0 !important ;' // square borders
63
63
+ 'transition: transform 0.1s ease-in-out, box-shadow 0.1s ease-in-out ;' // smoothen hover fx
64
64
+ '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 ;`
66
66
+ 'padding: 8px !important ; min-width: 102px }' // resize
67
67
+ `.${ this . class } button:hover {` // add zoom, re-scheme
68
68
+ '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 ?
71
71
`.${ 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 }`
73
73
)
74
74
} ,
75
75
@@ -94,13 +94,13 @@ window.modals = {
94
94
95
95
// Show modal
96
96
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
99
99
+ '⚡ 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`
101
101
+ '📜 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>' ,
104
104
[ function getSupport ( ) { } , function rateUs ( ) { } , function moreAiExtensions ( ) { } ] , // button labels
105
105
'' , 656 // modal width
106
106
)
@@ -110,7 +110,7 @@ window.modals = {
110
110
'text-align: center ; font-size: 51px ; line-height: 46px ; padding: 15px 0' )
111
111
aboutModal . querySelector ( 'p' ) . style . cssText = (
112
112
'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' } ` )
114
114
115
115
// Hack buttons
116
116
aboutModal . querySelector ( '.modal-buttons' ) . style . justifyContent = 'center'
@@ -121,9 +121,9 @@ window.modals = {
121
121
const btnClone = btn . cloneNode ( true )
122
122
btn . parentNode . replaceChild ( btnClone , btn ) ; btn = btnClone
123
123
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
127
127
)
128
128
129
129
// Prepend emoji
0 commit comments