From 79c0c6cf900675f05c939766b29bf1e801c16bbd Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Fri, 13 Jan 2017 16:51:31 -0500 Subject: [PATCH] Update search to bring in My anime list id for future integration --- public/js/anime_edit.js | 9 +++++---- public/js/manga_edit.js | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/public/js/anime_edit.js b/public/js/anime_edit.js index c4e53e15..37bb5a68 100644 --- a/public/js/anime_edit.js +++ b/public/js/anime_edit.js @@ -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(); }, diff --git a/public/js/manga_edit.js b/public/js/manga_edit.js index afe712ce..33b93ca6 100644 --- a/public/js/manga_edit.js +++ b/public/js/manga_edit.js @@ -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);