Skip to content

Commit

Permalink
fix checkboxes not working correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Leeous committed Feb 18, 2020
1 parent ab51ae5 commit e16c6dd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
5 changes: 1 addition & 4 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function createWindow() {
mainWindow.loadFile('index.html')

// Open the DevTools.
mainWindow.webContents.openDevTools()
// mainWindow.webContents.openDevTools()

// Emitted when the window is closed.
mainWindow.on('closed', function() {
Expand All @@ -44,8 +44,6 @@ function createWindow() {
})
}

// settings.deleteAll();

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
Expand Down Expand Up @@ -162,5 +160,4 @@ ipcMain.on("extractAddon", (e, path) => {
console.log(e, path);
const gmad = spawn(settings.get('gmodDirectory') + '\\bin\\gmad.exe', ['extract', '-file', path]);
mainWindow.webContents.send("finishExtraction");
// shell.openItem('folderpath')
});
18 changes: 18 additions & 0 deletions src/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,24 @@ $(document).ready(() => {
})
});

$('.typeCheckbox').on('click', (event) => {
var target = $(event.target);
if (jsonCheckboxCount < 2 && target.is(":checked")) {
jsonCheckboxCount++;
} else if (jsonCheckboxCount != 0 && !target.is(":checked")) {
jsonCheckboxCount--;
} else if (jsonCheckboxCount == 2 && target.is(":checked")) {
event.preventDefault();
}

if (jsonCheckboxCount == 2) {
var checkboxes = $('.typeCheckbox');
if (!checkboxes.is(":checked")) {
$(checkboxes).prop('disabled', true);
}
}
})

// Dyamically change boolean based on whether or not string is empty
$("#jsonTitle > input[name='addonTitle']").on("keyup", () => {
if ($("#jsonTitle > input[name='addonTitle']").val() != "") {
Expand Down

0 comments on commit e16c6dd

Please sign in to comment.