Skip to content

Commit

Permalink
Use array directly for submitting forms, no join/split
Browse files Browse the repository at this point in the history
  • Loading branch information
miigotu authored Aug 24, 2023
1 parent f30a691 commit 01fbf65
Showing 1 changed file with 28 additions and 18 deletions.
46 changes: 28 additions & 18 deletions sickchill/gui/slick/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -2794,9 +2794,12 @@ const SICKCHILL = {
return false;
}

const url = scRoot + '/home/setStatus';
const parameters = 'show=' + $('#showID').attr('value') + '&eps=' + epArray.join('|') + '&status=' + $('#statusSelect').val();
$.post(url, parameters, () => {
const parameters = {
show: $('#showID').attr('value'),
eps: epArray,
status: $('#statusSelect').val()
}
$.post(scRoot + '/home/setStatus', parameters, () => {
location.reload(true);
});
});
Expand Down Expand Up @@ -3360,15 +3363,7 @@ const SICKCHILL = {
if (editArray.length === 0) {
return;
}

const submitForm = $(
'<form method=\'post\' action=\'' + scRoot + '/manage/massEdit\'>'
+ '<input type=\'hidden\' name=\'edit_shows\' value=\'' + editArray.join('|') + '\'/>'
+ '</form>',
);
submitForm.appendTo('body');

submitForm.submit();
$.post(scRoot + '/manage/massEdit', {edit_shows: editArray});
});

$('.submitMassUpdate').on('click', () => {
Expand Down Expand Up @@ -3436,8 +3431,15 @@ const SICKCHILL = {
return false;
}

const url = scRoot + '/manage/massUpdate';
const parameters = 'toUpdate=' + updateArray.join('|') + '&toRefresh=' + refreshArray.join('|') + '&toRename=' + renameArray.join('|') + '&toSubtitle=' + subtitleArray.join('|') + '&toDelete=' + deleteArray.join('|') + '&toRemove=' + removeArray.join('|') + '&toMetadata=' + metadataArray.join('|');
const parameters = {
toUpdate: updateArray,
toRefresh: refreshArray,
toRename: renameArray,
toSubtitle: subtitleArray,
toDelete: deleteArray,
toRemove: removeArray,
toMetadata: metadataArray
};
$.post(url, parameters, () => {
location.reload(true);
});
Expand All @@ -3449,9 +3451,16 @@ const SICKCHILL = {
return false;
}

const url = scRoot + '/manage/massUpdate';
const parameters = 'toUpdate=' + updateArray.join('|') + '&toRefresh=' + refreshArray.join('|') + '&toRename=' + renameArray.join('|') + '&toSubtitle=' + subtitleArray.join('|') + '&toDelete=' + deleteArray.join('|') + '&toRemove=' + removeArray.join('|') + '&toMetadata=' + metadataArray.join('|');
$.post(url, parameters, () => {
const parameters = {
toUpdate: updateArray,
toRefresh: refreshArray,
toRename: renameArray,
toSubtitle: subtitleArray,
toDelete: deleteArray,
toRemove: removeArray,
toMetadata: metadataArray
};
$.post(scRoot + '/manage/massUpdate', parameters, () => {
location.reload(true);
});
});
Expand Down Expand Up @@ -3515,7 +3524,7 @@ const SICKCHILL = {
return false;
}

$.post(scRoot + '/manage/failedDownloads', 'toRemove=' + removeArray.join('|'), () => {
$.post(scRoot + '/manage/failedDownloads', {toRemove: removeArray}, () => {
location.reload(true);
});
});
Expand Down Expand Up @@ -4281,6 +4290,7 @@ const SICKCHILL = {
const shows = [];

$.each(data.results, (index, object) => {
// TODO: Results should be returned as json, and use attribute names rather than ondexes and joining.
const whichSeries = object.join('|').replaceAll('"', '');

const show = {
Expand Down

0 comments on commit 01fbf65

Please sign in to comment.