Version 5.1 - All the GraphQL #32

Closed
timw4mail wants to merge 1160 commits from develop into master
3 changed files with 21 additions and 6 deletions
Showing only changes of commit 5fc70bb4fe - Show all commits

View File

@ -31,7 +31,7 @@ return [
'base/sort_tables.js',
],
'table_edit' => [
'sort_tables.js',
'base/sort_tables.js',
'anime_edit.js',
'manga_edit.js',
],

View File

@ -6,7 +6,7 @@
'use strict';
// Action to increment episode count
_.on('body.anime.list', 'click', '.plus_one', function(e) {
_.on('body.anime.list', 'click', '.plus_one', function() {
let parent_sel = _.closestParent(this, 'article');
let watched_count = parseInt(_.$('.completed_number', parent_sel)[0].textContent, 10);
let total_count = parseInt(_.$('.total_number', parent_sel)[0].textContent, 10);
@ -36,8 +36,8 @@
data: data,
dataType: 'json',
type: 'POST',
success: (res) => {
if (data.status == 'completed') {
success: () => {
if (data.data.status == 'completed') {
_.hide(parent_sel);
}

View File

@ -5,7 +5,7 @@
'use strict';
_.on('.manga.list', 'click', '.edit_buttons button', function(e) {
_.on('.manga.list', 'click', '.edit_buttons button', function() {
let this_sel = this;
let parent_sel = _.closestParent(this, 'article');
let manga_id = parent_sel.id.replace("manga-", "");
@ -26,6 +26,17 @@
}
};
// If the episode count is 0, and incremented,
// change status to currently reading
if (isNaN(completed) || completed === 0) {
data.data.status = 'current';
}
// If you increment at the last chapter, mark as completed
if (( ! isNaN(completed)) && (completed + 1) == total) {
data.data.status = 'completed';
}
// Update the total count
data['data']['progress'] = ++completed;
@ -34,7 +45,11 @@
dataType: 'json',
type: 'POST',
mimeType: 'application/json',
success: (res) => {
success: () => {
if (data.data.status == 'completed') {
_.hide(parent_sel);
}
_.$(`.${type}s_read`, parent_sel)[0].textContent = completed;
_.showMessage('success', `Sucessfully updated ${manga_name}`);
_.scrollToTop();