Js snake case to camel case

This commit is contained in:
Timothy Warren 2017-02-15 16:58:08 -05:00
parent dfdc06d048
commit 086b5a9f2d

View File

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