From 5856656d1efc244bd3e8b6564ae3981e4d040752 Mon Sep 17 00:00:00 2001 From: young-zy Date: Sat, 9 Jun 2018 21:11:08 +0800 Subject: [PATCH] prevent only viewing the last video && remove the redirect to test --- soraka.user.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/soraka.user.js b/soraka.user.js index 76cd264..d10492b 100644 --- a/soraka.user.js +++ b/soraka.user.js @@ -265,6 +265,7 @@ class Soraka { number: $number.text().replace(/\s+/g, ' ').trim().split(' ')[0], title: $link.attr('title'), href: $link.attr('href'), + state: $number.text().replace(/\s+/g, ' ').trim().split(' ')[1], }; } }).toArray(); @@ -277,9 +278,12 @@ class Soraka { jumpToLastChapter() { return this.getChapters().then(chapters => { - const lastActiveChapter = chapters.pop(); + chapters.reverse(); + var lastActiveChapter = chapters.pop(); + while(lastActiveChapter.state === undefined ){ + lastActiveChapter = chapters.pop(); + } this.config.chapter = lastActiveChapter; - const last = API_HOST + lastActiveChapter.href; const current = window.location.href; @@ -433,9 +437,7 @@ class Soraka { .then(isLast => { if (isLast) { this.getConfig().then(_ => { - this.watchVideo().then(_ => { - this.jumpToChapterTest(); - }); + this.watchVideo().then(_ => {setTimeout("location.reload()",2000);}); }); } });