Js snake case to camel case
This commit is contained in:
parent
ee2760b2b5
commit
488a01f8a5
@ -6,13 +6,13 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
_.on('.manga.list', 'click', '.edit_buttons button', e => {
|
_.on('.manga.list', 'click', '.edit_buttons button', e => {
|
||||||
let this_sel = e.target;
|
let thisSel = e.target;
|
||||||
let parent_sel = _.closestParent(e.target, 'article');
|
let parentSel = _.closestParent(e.target, 'article');
|
||||||
let manga_id = parent_sel.id.replace("manga-", "");
|
let mangaId = parentSel.id.replace("manga-", "");
|
||||||
let type = this_sel.classList.contains("plus_one_chapter") ? 'chapter' : 'volume';
|
let type = thisSel.classList.contains("plus_one_chapter") ? 'chapter' : 'volume';
|
||||||
let completed = parseInt(_.$(`.${type}s_read`, parent_sel)[0].textContent, 10);
|
let completed = parseInt(_.$(`.${type}s_read`, parentSel)[0].textContent, 10);
|
||||||
let total = parseInt(_.$(`.${type}_count`, parent_sel)[0].textContent, 10);
|
let total = parseInt(_.$(`.${type}_count`, parentSel)[0].textContent, 10);
|
||||||
let manga_name = _.$('.name', parent_sel)[0].textContent;
|
let mangaName = _.$('.name', parentSel)[0].textContent;
|
||||||
|
|
||||||
if (isNaN(completed)) {
|
if (isNaN(completed)) {
|
||||||
completed = 0;
|
completed = 0;
|
||||||
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
// Setup the update data
|
// Setup the update data
|
||||||
let data = {
|
let data = {
|
||||||
id: manga_id,
|
id: mangaId,
|
||||||
data: {
|
data: {
|
||||||
progress: completed
|
progress: completed
|
||||||
}
|
}
|
||||||
@ -47,16 +47,16 @@
|
|||||||
mimeType: 'application/json',
|
mimeType: 'application/json',
|
||||||
success: () => {
|
success: () => {
|
||||||
if (data.data.status == 'completed') {
|
if (data.data.status == 'completed') {
|
||||||
_.hide(parent_sel);
|
_.hide(parentSel);
|
||||||
}
|
}
|
||||||
|
|
||||||
_.$(`.${type}s_read`, parent_sel)[0].textContent = completed;
|
_.$(`.${type}s_read`, parentSel)[0].textContent = completed;
|
||||||
_.showMessage('success', `Sucessfully updated ${manga_name}`);
|
_.showMessage('success', `Sucessfully updated ${mangaName}`);
|
||||||
_.scrollToTop();
|
_.scrollToTop();
|
||||||
},
|
},
|
||||||
error: (xhr, errorType, error) => {
|
error: (xhr, errorType, error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
_.showMessage('error', `Failed to updated ${manga_name}`);
|
_.showMessage('error', `Failed to updated ${mangaName}`);
|
||||||
_.scrollToTop();
|
_.scrollToTop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user