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

Commit e16c6dd

Browse files
committed
fix checkboxes not working correctly
1 parent ab51ae5 commit e16c6dd

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

app.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function createWindow() {
3333
mainWindow.loadFile('index.html')
3434

3535
// Open the DevTools.
36-
mainWindow.webContents.openDevTools()
36+
// mainWindow.webContents.openDevTools()
3737

3838
// Emitted when the window is closed.
3939
mainWindow.on('closed', function() {
@@ -44,8 +44,6 @@ function createWindow() {
4444
})
4545
}
4646

47-
// settings.deleteAll();
48-
4947
// This method will be called when Electron has finished
5048
// initialization and is ready to create browser windows.
5149
// Some APIs can only be used after this event occurs.
@@ -162,5 +160,4 @@ ipcMain.on("extractAddon", (e, path) => {
162160
console.log(e, path);
163161
const gmad = spawn(settings.get('gmodDirectory') + '\\bin\\gmad.exe', ['extract', '-file', path]);
164162
mainWindow.webContents.send("finishExtraction");
165-
// shell.openItem('folderpath')
166163
});

src/js/script.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,24 @@ $(document).ready(() => {
287287
})
288288
});
289289

290+
$('.typeCheckbox').on('click', (event) => {
291+
var target = $(event.target);
292+
if (jsonCheckboxCount < 2 && target.is(":checked")) {
293+
jsonCheckboxCount++;
294+
} else if (jsonCheckboxCount != 0 && !target.is(":checked")) {
295+
jsonCheckboxCount--;
296+
} else if (jsonCheckboxCount == 2 && target.is(":checked")) {
297+
event.preventDefault();
298+
}
299+
300+
if (jsonCheckboxCount == 2) {
301+
var checkboxes = $('.typeCheckbox');
302+
if (!checkboxes.is(":checked")) {
303+
$(checkboxes).prop('disabled', true);
304+
}
305+
}
306+
})
307+
290308
// Dyamically change boolean based on whether or not string is empty
291309
$("#jsonTitle > input[name='addonTitle']").on("keyup", () => {
292310
if ($("#jsonTitle > input[name='addonTitle']").val() != "") {

0 commit comments

Comments
 (0)