@@ -69,9 +69,11 @@ ipc.on('getOptions', (event, options) => {
69
69
$ ( '#history .history-container > ul' ) . append ( element )
70
70
}
71
71
72
- if ( options . showIcon === true ) $ ( '#showIcon' ) . prop ( 'checked' , true )
73
- if ( options . deleteOnUpload === true ) $ ( '#deleteOnUpload' ) . prop ( 'checked' , true )
74
- if ( options . startAtLogin === true ) $ ( '#startAtLogin' ) . prop ( 'checked' , true )
72
+ if ( options . showIcon === true ) { $ ( '#showIcon' ) . prop ( 'checked' , true ) }
73
+
74
+ if ( options . deleteOnUpload === true ) { $ ( '#deleteOnUpload' ) . prop ( 'checked' , true ) }
75
+
76
+ if ( options . startAtLogin === true ) { $ ( '#startAtLogin' ) . prop ( 'checked' , true ) }
75
77
76
78
if ( options . shortcuts ) {
77
79
for ( const shortcut of Object . keys ( options . shortcuts ) ) {
@@ -91,11 +93,8 @@ ipc.on('getOptions', (event, options) => {
91
93
92
94
if ( options . customService ) {
93
95
$ ( '#servicePrompt input[name="uploadPath"]' ) . val ( options . customService . uploadPath )
94
- $ ( 'select[name="uploadService"]' ) . val ( 'custom' )
95
- }
96
-
97
- if ( options . customService ) {
98
96
$ ( '#servicePrompt input[name="resultPath"]' ) . val ( options . customService . resultPath )
97
+ $ ( 'select[name="uploadService"]' ) . val ( 'custom' )
99
98
}
100
99
} )
101
100
@@ -140,6 +139,7 @@ $('a[href="#cancel"]').click(() => {
140
139
141
140
$ ( 'input[type="checkbox"]' ) . change ( function ( ) {
142
141
let option = $ ( this ) . attr ( 'id' )
142
+
143
143
optionsObj [ option ] = this . checked
144
144
} )
145
145
@@ -149,14 +149,20 @@ $('select[name="uploadService"]').change(function () {
149
149
return (
150
150
showPrompt ( '#servicePrompt' )
151
151
)
152
+ } else {
153
+ delete optionsObj . customService
152
154
}
155
+
153
156
if ( ! optionsObj . services ) optionsObj . services = { }
157
+
154
158
optionsObj . services . uploadService = service
155
159
} )
156
160
157
161
$ ( 'select[name="shortenerService"]' ) . change ( function ( ) {
158
162
let service = $ ( this ) . find ( 'option:selected' ) . val ( )
163
+
159
164
if ( ! optionsObj . services ) optionsObj . services = { }
165
+
160
166
optionsObj . services . shortenerService = service
161
167
} )
162
168
@@ -198,13 +204,15 @@ function parseTime (str) {
198
204
199
205
function saveAndClose ( ) {
200
206
ipc . send ( 'saveOptions' , optionsObj )
207
+
201
208
remote . getCurrentWindow ( ) . close ( )
202
209
}
203
210
204
211
function parseCombo ( combo ) {
205
212
if ( combo . includes ( 'meta' ) ) {
206
213
combo = combo . replace ( 'meta' , 'command' )
207
214
}
215
+
208
216
return combo
209
217
}
210
218
0 commit comments