@@ -19,6 +19,7 @@ jsonCheckboxCount = 0;
19
19
jsonChecks = [ false , false ] ;
20
20
apiError = 0 ;
21
21
addonGMADir = "" ;
22
+ existingAddonId = null ;
22
23
var addonTitle ;
23
24
var addonTags ;
24
25
var addonType ;
@@ -75,7 +76,6 @@ $(document).ready(() => {
75
76
}
76
77
}
77
78
// console.log(data.response);
78
- var addon = data . response . publishedfiledetails [ "0" ] ;
79
79
okToProcessAddonList = true ;
80
80
$ ( '#update_existing_addon_button' ) . text ( 'Update existing addon' ) ;
81
81
} ) ;
@@ -182,6 +182,7 @@ $(document).ready(() => {
182
182
$ ( '#create_new_addon_button' ) . click ( ( ) => {
183
183
$ ( '#addon_management_prompt' ) . fadeOut ( ( ) => {
184
184
win . setBounds ( { height : 250 } )
185
+
185
186
$ ( '#create_new_addon, #addonDirPrompt' ) . fadeIn ( )
186
187
} )
187
188
} )
@@ -190,6 +191,7 @@ $(document).ready(() => {
190
191
var target = event . target ;
191
192
var divToGoBack = $ ( target ) . data ( 'forwards' ) ;
192
193
var divToShow = $ ( target ) . data ( 'backwards' ) ;
194
+ resetAddonCreation ( )
193
195
if ( $ ( target ) . data ( 'resize' ) != null ) {
194
196
var resizeInfo = JSON . parse ( "[" + $ ( target ) . data ( 'resize' ) + "]" ) ;
195
197
}
@@ -209,7 +211,7 @@ $(document).ready(() => {
209
211
} )
210
212
211
213
$ ( '.removeBackOption' ) . click ( ( ) => {
212
- $ ( '#back_button_addon_creation' ) . fadeOut ( ) ;
214
+ // $('#back_button_addon_creation').fadeOut();
213
215
} )
214
216
215
217
// General function for transitioning between div tags (with a shitty name)
@@ -225,24 +227,13 @@ $(document).ready(() => {
225
227
} )
226
228
}
227
229
228
- // Check if user needs to refresh their addons
229
- // TODO: Hopefully I can remove this later on as it really isn't needed (except in the case of Steam being down)
230
- $ ( '#refresh_addons' ) . click ( ( ) => {
231
- console . log ( "Attempting to refresh addons..." ) ;
232
- $ ( '#yourAddons' ) . children ( ) . remove ( ) ;
233
- getAddonInfoFromSteam ( ) ;
234
- populateAddonList ( ) ;
235
-
236
- } ) ;
237
-
238
- // Get array of addon infomation and append their names to #yourAddons
230
+ // Get array of addon infomation and append their info to #yourAddons
239
231
function populateAddonList ( ) {
240
232
// This check is done to make sure this only gets executed once
241
233
if ( ! donePopulatingAddonList ) {
242
234
for ( let i = 0 ; i < addon_data . length ; i ++ ) {
243
- $ ( '#yourAddons' ) . append ( "<div class='addon_existing'><p>" + addon_data [ i ] . title + "</p><p class='addon_link'><a href='steam://url/CommunityFilePage/" + addon_data [ i ] . id + "'>View</a> <a href='#'>Update</a></p></div>" ) ;
235
+ $ ( '#yourAddons' ) . append ( "<div class='addon_existing'><p class='title' >" + addon_data [ i ] . title + "</p><p class='addon_link'><a href='steam://url/CommunityFilePage/" + addon_data [ i ] . id + "'>View</a> <a href='#' class='updateAddon' data-id='" + addon_data [ i ] . id + " '>Update</a></p></div>") ;
244
236
donePopulatingAddonList = true ;
245
-
246
237
}
247
238
// Make sure if nothing is returned to let the user know
248
239
// TODO: Allow for multiple error codes such as 429 (too many requests)
@@ -342,7 +333,7 @@ $(document).ready(() => {
342
333
}
343
334
}
344
335
345
- $ ( "# resetAddonCreation" ) . click ( ( ) => {
336
+ $ ( ". resetAddonCreation" ) . click ( ( ) => {
346
337
resetAddonCreation ( ) ;
347
338
} ) ;
348
339
@@ -366,40 +357,57 @@ $(document).ready(() => {
366
357
// Clear the addon name on directory selection
367
358
$ ( "#addonDir b" ) . text ( '' ) ;
368
359
369
- // Set the input to null
360
+ // Set the file inputs to null
370
361
$ ( "#addon_dir_folder" ) . val ( null ) ;
362
+ $ ( "#addon_icon" ) . val ( null ) ;
371
363
372
364
// Reset directory validation
373
365
$ ( '#addonDirCheck' ) . css ( { backgroundColor : "#0f0f0f" , cursor : "not-allowed" } ) ;
374
366
$ ( '#addonDirCheck' ) . prop ( 'disabled' , true ) ;
375
367
368
+ // Reset icon validation
369
+ $ ( '#addonIconCheck' ) . css ( { backgroundColor : "#0f0f0f" , cursor : "not-allowed" } ) ;
370
+ $ ( '#addonIconCheck' ) . prop ( 'disabled' , true ) ;
371
+
376
372
// Reset validation checks
377
373
jsonChecks = [ false , false ] ;
378
374
validateJsonForm ( ) ;
379
375
376
+ // Reset existingAddonId if user was updating instead of creating
377
+ existingAddonId = null ;
378
+
380
379
// Hide any div that may still be displayed
381
- $ ( '#addonjsonPrompt, #jsonCreator, #gmaPrep, #createGMA' ) . css ( 'display' , 'none' ) ;
380
+ $ ( '#addonjsonPrompt, #addonIconPrompt, # jsonCreator, #gmaPrep, #createGMA, #new_addon, #uploading, #uploadToWorkshopPrompt ' ) . css ( 'display' , 'none' ) ;
382
381
}
383
382
383
+ $ ( "#yourAddons" ) . on ( 'click' , '.updateAddon' , ( event ) => {
384
+ var target = event . target ;
385
+ existingAddonId = $ ( target ) . data ( 'id' ) ;
386
+ $ ( "#update_existing_addon" ) . fadeOut ( ( ) => {
387
+ $ ( "#create_new_addon .top h3" ) . text ( 'Updating addon' ) ;
388
+ $ ( "#create_new_addon, #addonDirPrompt" ) . fadeIn ( ) ;
389
+ } ) ;
390
+ } ) ;
391
+
384
392
$ ( "#createGMAFile" ) . click ( ( ) => {
385
393
$ ( '#gmaPrep' ) . fadeOut ( ( ) => {
386
- win . setBounds ( { height : 225 } )
394
+ win . setBounds ( { height : 250 } ) ;
387
395
$ ( '#createGMA' ) . fadeIn ( ) ;
388
- ipcRenderer . send ( 'createGMAFile' , currentNewAddon ) ;
396
+ ipcRenderer . send ( 'createGMAFile' , currentNewAddon ) ;
389
397
} ) ;
390
- } )
398
+ } ) ;
391
399
392
400
$ ( "#uploadCurrentGMA" ) . click ( ( ) => {
393
- ipcRenderer . send ( 'uploadToWorkshop' , addonGMADir , addonIcon ) ;
401
+ ipcRenderer . send ( 'uploadToWorkshop' , addonGMADir , addonIcon , existingAddonId ) ;
394
402
$ ( '#uploadToWorkshopPrompt' ) . fadeOut ( ( ) => {
395
- win . setBounds ( { height : 225 } )
403
+ win . setBounds ( { height : 250 } )
396
404
$ ( '#uploading' ) . fadeIn ( ) ;
397
405
} )
398
406
} )
399
407
400
408
ipcRenderer . on ( 'currentAddonID' , ( event , newAddonID ) => {
401
409
$ ( '#uploading' ) . fadeOut ( ( ) => {
402
- win . setBounds ( { height : 200 } )
410
+ win . setBounds ( { height : 225 } )
403
411
$ ( '#new_addon_link' ) . attr ( 'href' , 'steam://url/CommunityFilePage/' + newAddonID )
404
412
$ ( '#new_addon' ) . fadeIn ( )
405
413
} ) ;
0 commit comments