@@ -5,11 +5,10 @@ async function init() {
5
5
$titleSub = document . getElementById ( 'titleSub' )
6
6
7
7
const settingsDefault = {
8
- subtitle : 'DISCIPLINE EQUALS FREEDOM' ,
9
8
titleMain : 'GET AFTER IT' ,
10
9
titleSub : 'STANDBY TO GET SOME' ,
11
- colorBackground : '#101318 ' ,
12
- colorText : '#222830 ' ,
10
+ colorBackground : 'rgba(16, 19, 24, 1) ' ,
11
+ colorText : 'rgba(34, 40, 48, 1) ' ,
13
12
}
14
13
15
14
let settings = { ...settingsDefault }
@@ -26,7 +25,7 @@ async function init() {
26
25
function saveOptions ( ) {
27
26
return new Promise ( ( resolve , reject ) => {
28
27
for ( const key of Object . keys ( settings ) ) {
29
- console . log ( `settings[key]:` , settings [ key ] )
28
+ console . log ( `settings[${ key } ]:` , settings [ key ] )
30
29
settings [ key ] = settings [ key ] . trim ( )
31
30
if ( typeof settings [ key ] !== 'string' || ! settings [ key ] || settings [ key ] === '' ) {
32
31
settings [ key ] = 'UNDEFINED'
@@ -51,7 +50,6 @@ async function init() {
51
50
e . preventDefault ( )
52
51
e . stopPropagation ( )
53
52
console . log ( `Editing:` , key )
54
- console . log ( `e:` , e . target )
55
53
e . target . contentEditable = true
56
54
e . target . focus ( )
57
55
document . execCommand ( 'selectAll' , false , null )
@@ -62,7 +60,6 @@ async function init() {
62
60
return async ( e ) => {
63
61
e . preventDefault ( )
64
62
console . log ( `Blured:` , key )
65
- console . log ( `e:` , e )
66
63
let text = e . target . innerText . trim ( )
67
64
if ( typeof text !== 'string' || text === '' || ! text ) {
68
65
text = settingsDefault [ key ]
@@ -112,12 +109,9 @@ async function init() {
112
109
parent : pickerParentColorText ,
113
110
color : settings . colorText ,
114
111
} )
115
-
116
112
function pickerOnChange ( key ) {
117
- return async ( color ) => {
113
+ return ( color ) => {
118
114
setColorForKey ( key , color . rgbaString )
119
- settings [ key ] = color . rgbaString
120
- await saveOptions ( )
121
115
}
122
116
}
123
117
function pickerOnDone ( key ) {
@@ -129,10 +123,11 @@ async function init() {
129
123
130
124
pickerColorBackground . onChange = pickerOnChange ( 'colorBackground' )
131
125
pickerColorBackground . onDone = pickerOnDone ( 'colorBackground' )
126
+ pickerColorBackground . onClose = pickerOnDone ( 'colorBackground' )
127
+
132
128
pickerColorText . onChange = pickerOnChange ( 'colorText' )
133
129
pickerColorText . onDone = pickerOnDone ( 'colorText' )
134
-
135
- // onDone is similar to onChange, but only called when you click 'Ok'.
130
+ pickerColorText . onClose = pickerOnDone ( 'colorText' )
136
131
}
137
132
138
133
$main . addEventListener ( 'dblclick' , openOptions )
0 commit comments