Update search to bring in My anime list id for future integration
This commit is contained in:
parent
abfa97d99c
commit
29d8207c63
@ -6,15 +6,16 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// Action to increment episode count
|
// Action to increment episode count
|
||||||
_.on('body.anime.list', 'click', '.plus_one', function() {
|
_.on('body.anime.list', 'click', '.plus_one', e => {
|
||||||
let parent_sel = _.closestParent(this, 'article');
|
let parent_sel = _.closestParent(e.target, 'article');
|
||||||
let watched_count = parseInt(_.$('.completed_number', parent_sel)[0].textContent, 10);
|
let watched_count = parseInt(_.$('.completed_number', parent_sel)[0].textContent, 10);
|
||||||
let total_count = parseInt(_.$('.total_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;
|
let title = _.$('.name a', parent_sel)[0].textContent;
|
||||||
|
|
||||||
// Setup the update data
|
// Setup the update data
|
||||||
let data = {
|
let data = {
|
||||||
id: parent_sel.id,
|
id: parent_sel.dataset.kitsuId,
|
||||||
|
mal_id: parent_sel.dataset.malId,
|
||||||
data: {
|
data: {
|
||||||
progress: watched_count + 1
|
progress: watched_count + 1
|
||||||
}
|
}
|
||||||
@ -41,7 +42,7 @@
|
|||||||
_.hide(parent_sel);
|
_.hide(parent_sel);
|
||||||
}
|
}
|
||||||
|
|
||||||
_.showMessage('success', `Sucessfully updated ${title}`);
|
_.showMessage('success', `Successfully updated ${title}`);
|
||||||
_.$('.completed_number', parent_sel)[0].textContent = ++watched_count;
|
_.$('.completed_number', parent_sel)[0].textContent = ++watched_count;
|
||||||
_.scrollToTop();
|
_.scrollToTop();
|
||||||
},
|
},
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
_.on('.manga.list', 'click', '.edit_buttons button', function() {
|
_.on('.manga.list', 'click', '.edit_buttons button', e => {
|
||||||
let this_sel = this;
|
let this_sel = e.target;
|
||||||
let parent_sel = _.closestParent(this, 'article');
|
let parent_sel = _.closestParent(e.target, 'article');
|
||||||
let manga_id = parent_sel.id.replace("manga-", "");
|
let manga_id = parent_sel.id.replace("manga-", "");
|
||||||
let type = this_sel.classList.contains("plus_one_chapter") ? 'chapter' : 'volume';
|
let type = this_sel.classList.contains("plus_one_chapter") ? 'chapter' : 'volume';
|
||||||
let completed = parseInt(_.$(`.${type}s_read`, parent_sel)[0].textContent, 10);
|
let completed = parseInt(_.$(`.${type}s_read`, parent_sel)[0].textContent, 10);
|
||||||
|
Loading…
Reference in New Issue
Block a user