链工宝自动切换视频

又不是不能用

// ==UserScript==
// @name         链工宝自动切换视频
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  又不是不能用
// @author       BrontByte
// @match        http://start.lgb360.com/video.html
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    const MAX_TIMES = 10;
    let times = 0;
    let timer=setInterval(() => {
        console.log($("body > div.video > div.video-box > div.box-in > div.list > div > div.item.active #sPlayRate").text())
        if($("body > div.video > div.video-box > div.box-in > div.list > div > div.item.active #sPlayRate").text() === "100"){
            if(times < MAX_TIMES){
                let $next = $("body > div.video > div.video-box > div.box-in > div.list > div > div.item.active")
                do{
                    $next = $next.next();
                }while($next.children(".body").children("ul").children("li:last-child").children("#sPlayRate").text() === "100")
                times ++;
                $next.children("div").trigger("click")
                console.log("看完"+times+"个视频,下一个");
            }else{
                console.log("看完"+times+"个视频,到达每日限额,停止");
                clearInterval(timer)
            }
        }
    },5000)
    })();