传智自动刷视频

习题会自动跳过,你需要手动点回来做,可改默认播放速度

当前为 2021-03-05 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         传智自动刷视频
// @namespace    shuidas
// @version      0.4
// @description  习题会自动跳过,你需要手动点回来做,可改默认播放速度
// @author       shuidas
// @match        *://*.ityxb.com/preview/*
// @grant        none
// ==/UserScript==

(function() {

    'use strict';
                 //↙
    var speed = 1; //←想改默认速度在这里改
                 //↖
    var num = 0; //初始视频位数 第一个序号是0
    var max = 0; //获取网页视频总数默认为0

    //$('video')[0].playbackRate=? 自己控制台手动改倍速

    setTimeout(function() {
       $('.point-item-box>div:first-child')[num].parentElement.parentElement.parentElement.setAttribute('class','chapter-item-box');//关掉第一个列表
       $('.point-item-box>div:first-child')[num].parentElement.parentElement.style.display = 'none';

       max = $('.point-item-box').length - 1;
       while($('.point-item-box>div:first-child')[num].children[1].innerHTML == "100%"){
          num++;
          if(num > max)
              return;
       }

        $('.point-item-box')[num].click();
        
        console.log('当前播放标题:'+$('.point-item-box>div:first-child')[num].children[0].children[1].title);

        $('.point-item-box>div:first-child')[num].parentElement.parentElement.parentElement.setAttribute('class','chapter-item-box expand');//展开列表
        $('.point-item-box>div:first-child')[num].parentElement.parentElement.style.display = null;

        setTimeout(function() {
            $('video')[0].muted = true;

            $('video')[0].playbackRate=speed;
            $('video+div+div')[0].children[13].innerHTML=speed+"倍速"; //显示倍速
            $('video')[0].parentNode.children[8].lastChild.innerText=speed+"倍速";
            $('video')[0].parentNode.children[8].children[4].style.color='white'; //标白

            var str=6; //标蓝
            switch (speed){
                case 1.5:
                    str=2;break;
                case 2:
                    str=1;break;
                case 2.5:
                    str=0;break;
                case 1.25:
                    str=3;break;
                case 1:
                    str=4;break;
                case 0.5:
                    str=5;break;
            }
            $('video')[0].parentNode.children[8].children[str].style.color='rgb(7, 130, 245)';

            $('video')[0].play();
            $('video')[0].muted = false;
            $('video+div+div')[0].children[16].click()},500);//播放视频
    },1000);

    setTimeout(function() {$("video")[0].addEventListener("ended", function() { //播放结束换下一个视频
     num++;
     if(num > max)
          return;
     $('.point-item-box')[num].click();

     console.log('当前播放标题:'+$('.point-item-box>div:first-child')[num].children[0].children[1].title);

     $('.point-item-box>div:first-child')[num].parentElement.parentElement.parentElement.setAttribute('class','chapter-item-box expand');//展开列表
     $('.point-item-box>div:first-child')[num].parentElement.parentElement.style.display = null;
     
     setTimeout(function() {
         $('video')[0].muted = true;

         $('video')[0].playbackRate=speed;
         $('video+div+div')[0].children[13].innerHTML=speed+"倍速";
         $('video')[0].parentNode.children[8].lastChild.innerText=speed+"倍速";

         $('video')[0].play();
         $('video')[0].muted = false;
         $('video+div+div')[0].children[16].click()},500); //播放视频
});},1000);

})();