Skip to content
This repository was archived by the owner on May 11, 2025. It is now read-only.

Commit ab51ae5

Browse files
committed
finish extraction logic, refactored a few buttons, remove junk (#4)
1 parent 642635c commit ab51ae5

File tree

4 files changed

+29
-23
lines changed

4 files changed

+29
-23
lines changed

app.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ function createWindow() {
4444
})
4545
}
4646

47+
// settings.deleteAll();
48+
4749
// This method will be called when Electron has finished
4850
// initialization and is ready to create browser windows.
4951
// Some APIs can only be used after this event occurs.

index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<body>
1414
<div id="main_titlebar">
1515
<div class="main_title">
16-
<p>Garry's Mod Addon Tool <span style="font-size: 0.7em; font-weight: 300; -webkit-app-region: no-drag;">by <a href="https://leeous.github.io" target="_blank" style="text-decoration: underline; color: inherit;">Leeous</a></span></p>
16+
<p>Garry's Mod Addon Tool <span style='font-size: 0.7em; font-weight: 300; -webkit-app-region: no-drag;'>by <a href='https://leeous.github.io' target='_blank' style='text-decoration: underline; color: inherit;'>Leeous</a></span></p>
1717
</div>
1818
<div class="main_buttons">
1919
<p id="minApp"></p>
@@ -28,7 +28,7 @@ <h4 style="font-weight: 300; margin: 10px">Steam <b>must</b> be open!</h4>
2828
</div>
2929
<p id="status_of_dir"></p>
3030
<div id="dir_prompt_next">
31-
<button disabled>Next</button>
31+
<button class="transition_button" data-divtoshow="#addon_management, #addon_management_prompt" data-divtohide="#directory_selection" data-resize="500, 200" disabled>Next</button>
3232
</div>
3333
</div>
3434
<div id="addon_management">
@@ -37,7 +37,7 @@ <h3>What would you like to do?</h3>
3737
<div id="addon_mgt_btn_grid">
3838
<button id="create_addon_button" class="button_normal medium-text transition_button" data-divtoshow="#create_new_addon, #addonDirPrompt" data-divtohide="#addon_management_prompt" data-resize="500, 250" style="margin: 10px;">Create a new addon</button>
3939
<button id="update_existing_addon_button" class="button_normal medium-text transition_button rowtwo" data-divtoshow="#update_existing_addon" data-divtohide="#addon_management_prompt" data-resize="500, 250" style="margin: 10px;">Loading... </button>
40-
<button class="button_normal medium-text transition_button rowtwo" data-divtoshow="#extract_addon" data-divtohide="#addon_management_prompt" data-resize="500, 250" style="margin: 10px;">Extract Addon</button>
40+
<button class="button_normal medium-text transition_button rowtwo" data-divtoshow="#extract_addon, #addon_extraction, #extract_addon_select" data-divtohide="#addon_management_prompt" data-resize="500, 250" style="margin: 10px;">Extract Addon</button>
4141
</div>
4242
</div>
4343
<div id="update_existing_addon" class="path_div">
@@ -70,7 +70,7 @@ <h3>Addon creation</h3>
7070
</div>
7171
</div>
7272
<div id="addonjsonPrompt">
73-
<p>Do you already have a addon.json?</p>
73+
<p>Do you already have an <i>addon.json</i> file?</p>
7474
<div>
7575
<button class="button_normal transition_button removeBackOption" data-divtoshow="#jsonCreator" data-divtohide="#addonjsonPrompt" data-resize="500, 350">No</button>
7676
<button class="button_normal transition_button removeBackOption" data-divtoshow="#gmaPrep" data-divtohide="#addonjsonPrompt" data-resize="500, 200">Yes</button>
@@ -205,7 +205,7 @@ <h3>Addon Extraction</h3>
205205
<div id="extraction_done">
206206
<h3>Extracted!</h3>
207207
<p><a id="extractedGMALocation" style="color: white;" href="#">View</a></p>
208-
<button class="button_normal transition_button" data-divtohide="#extract_addon" data-divtoshow="#addon_management_prompt" data-resize="500, 200" style="width: 100px;">Done</button>
208+
<button class="button_normal transition_button resetAddonExtraction" data-divtohide="#extract_addon" data-divtoshow="#addon_management_prompt" data-resize="500, 200" style="width: 100px;">Done</button>
209209
</div>
210210
</div>
211211
</div>

src/css/style.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ header {
101101
display: inline-block;
102102
margin: 0;
103103
padding: 5px 5px;
104+
transition: ease all 0.5s;
104105
}
105106

106107
#dir_select_prompt {

src/js/script.js

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ addonToCreateData = {
3030
"ignore": []
3131
};
3232
currentAppVersion = "v1.3";
33+
let defaultMenuTitle = ""
34+
3335

3436
// Dialog properties
3537
let dirDialogOptions = {
@@ -173,6 +175,7 @@ $(document).ready(() => {
173175
})
174176
});
175177

178+
// Prompts user for an icon for their addon
176179
$("#addon_icon").click(() => {
177180
dialog.showOpenDialog(win, imgDialogOptions).then(result => {
178181
addonIcon = result.filePaths[0];
@@ -201,15 +204,9 @@ $(document).ready(() => {
201204
});
202205
});
203206

204-
$("#dir_prompt_next button").click(() => {
205-
$("#directory_selection").fadeOut(() => {
206-
$("#addon_management").fadeIn();
207-
$("#addon_management_prompt").fadeIn();
208-
win.setBounds({
209-
height: 200,
210-
})
211-
});
212-
})
207+
$(".resetAddonCreation").click(() => {
208+
resetAddonCreation();
209+
});
213210

214211
$("#update_existing_addon_button").click(() => {
215212
if (okToProcessAddonList) {
@@ -221,18 +218,11 @@ $(document).ready(() => {
221218
}
222219
});
223220

224-
$("#create_new_addon_button").click(() => {
225-
$("#addon_management_prompt").fadeOut(() => {
226-
win.setBounds({height: 250})
227-
$("#create_new_addon, #addonDirPrompt").fadeIn()
228-
})
229-
});
230-
231221
$(".back_button").click((event) => {
232222
var target = event.target;
233223
var divToGoBack = $(target).data("forwards");
234224
var divToShow = $(target).data("backwards");
235-
resetAddonCreation()
225+
resetAddonCreation();
236226
if ($(target).data("resize") != null) {
237227
var resizeInfo = JSON.parse("[" + $(target).data("resize") + "]");
238228
}
@@ -320,6 +310,10 @@ $(document).ready(() => {
320310
}
321311
});
322312

313+
$(".resetAddonExtraction, #extraction_back").click(() => {
314+
resetAddonExtraction()
315+
});
316+
323317
// =============
324318
// AJAX Requests
325319
// =============
@@ -393,8 +387,8 @@ $(document).ready(() => {
393387
}
394388
}
395389
}
396-
// console.log(data.response);
397390
okToProcessAddonList = true;
391+
// Change button text and allow user to view/update thier addons
398392
$("#update_existing_addon_button").text("Update existing addon");
399393
});
400394
}
@@ -446,6 +440,7 @@ $(document).ready(() => {
446440
}
447441
}
448442

443+
// Resets any data we've gotten from the user for the new addon
449444
function resetAddonCreation() {
450445
jsonCheckboxCount = 0;
451446

@@ -489,6 +484,14 @@ $(document).ready(() => {
489484
$("#addonjsonPrompt, #addonIconPrompt, #jsonCreator, #gmaPrep, #createGMA, #new_addon, #uploading, #uploadToWorkshopPrompt").css("display", "none");
490485
}
491486

487+
function resetAddonExtraction() {
488+
$("#extracting_addon, #extraction_done").css("display", "none");
489+
490+
$("#currentGMAFile").text("");
491+
$("#addon_extract_next button").css({backgroundColor: "#0f0f0f", cursor: "not-allowed"});
492+
$("#addon_extract_next button").prop("disabled", true);
493+
}
494+
492495
// Ensure all options that are required are checked
493496
function validateJsonForm() {
494497
if (jsonChecks[0] && jsonChecks[1]) {

0 commit comments

Comments
 (0)