From edc22ebaa5acac927c7a0a28f103abf5fbf15d70 Mon Sep 17 00:00:00 2001 From: iotcat Date: Sun, 12 Jan 2020 12:47:58 +0000 Subject: [PATCH] next_video --- index.html | 58 +++++++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/index.html b/index.html index 4668c43..d608ce7 100644 --- a/index.html +++ b/index.html @@ -51,10 +51,12 @@ cookie.set('last_watch', page.params.url); } + var dp = {}; + $.post("https://acg.watch/api/getQuality.php?url="+page.params.url, function(res){ options.video.quality = JSON.parse(res); - const dp = new DPlayer(options); + dp = new DPlayer(options); /* recover history playing */ if(options.video.quality[0].url && options.video.quality[0].url != 'https://api.yimian.xyz/video?path=404.mp4'){ if(cookie.get($.md5(options.video.quality[0].url)) != null){ @@ -74,36 +76,38 @@ $.post("https://acg.watch/api/getNext.php?url="+options.video.quality[0].url, function(res){ res = JSON.parse(res); dp.notice("正在自动跳转至下一集", 4000); - setTimeout(function(){ - cookie.set('last_watch', res.url); - history.pushState({},page.title,"https://acg.watch/player?url="+res.url); - page.params.url = res.url; - $.post("https://acg.watch/api/getQuality.php?url="+res.url, function(res2){ - console.log(JSON.parse(res2)); - dp.switchVideo( - { - url: res.url, - quality: JSON.parse(res2), - defaultQuality: 0 - }, - { - id: $.md5(res.url+'').substr(0, 16), - api: 'https://danmaku.yimian.xyz/', - maximum: 1000, - addition: [], - user: 'iotcat', - bottom: '15%', - unlimited: true, - } - ); - - //setTimeout(function(){dp.switchQuality(0);}, 1000); - }); - }, 2000); + setTimeout(next_video, 2000); }); }); }); + var next_video = function(){ + cookie.set('last_watch', res.url); + history.pushState({},page.title,"https://acg.watch/player?url="+res.url); + page.params.url = res.url; + $.post("https://acg.watch/api/getQuality.php?url="+res.url, function(res2){ + console.log(JSON.parse(res2)); + dp.switchVideo( + { + url: res.url, + quality: JSON.parse(res2), + defaultQuality: 0 + }, + { + id: $.md5(res.url+'').substr(0, 16), + api: 'https://danmaku.yimian.xyz/', + maximum: 1000, + addition: [], + user: 'iotcat', + bottom: '15%', + unlimited: true, + } + ); + + //setTimeout(function(){dp.switchQuality(0);}, 1000); + }); + } +