Update search to bring in My anime list id for future integration

This commit is contained in:
Timothy Warren 2017-01-13 16:51:31 -05:00
parent abfa97d99c
commit 29d8207c63
2 changed files with 8 additions and 7 deletions

View File

@ -6,15 +6,16 @@
'use strict';
// Action to increment episode count
_.on('body.anime.list', 'click', '.plus_one', function() {
let parent_sel = _.closestParent(this, 'article');
_.on('body.anime.list', 'click', '.plus_one', e => {
let parent_sel = _.closestParent(e.target, 'article');
let watched_count = parseInt(_.$('.completed_number', parent_sel)[0].textContent, 10);
let total_count = parseInt(_.$('.total_number', parent_sel)[0].textContent, 10);
let title = _.$('.name a', parent_sel)[0].textContent;
// Setup the update data
let data = {
id: parent_sel.id,
id: parent_sel.dataset.kitsuId,
mal_id: parent_sel.dataset.malId,
data: {
progress: watched_count + 1
}
@ -41,7 +42,7 @@
_.hide(parent_sel);
}
_.showMessage('success', `Sucessfully updated ${title}`);
_.showMessage('success', `Successfully updated ${title}`);
_.$('.completed_number', parent_sel)[0].textContent = ++watched_count;
_.scrollToTop();
},

View File

@ -5,9 +5,9 @@
'use strict';
_.on('.manga.list', 'click', '.edit_buttons button', function() {
let this_sel = this;
let parent_sel = _.closestParent(this, 'article');
_.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);