Greasy Fork

来自缓存

Greasy Fork is available in English.

(21tb)时代光华课程自动播放

learning

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @license      Peng
// @name         (21tb)时代光华课程自动播放
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  learning
 
// @author       Peng
// @match        *://*.21tb.com/*
// ==/UserScript==
 
      (function() {
        'use strict';
        function next(){


          var Progress = document.querySelector('.study-rate-title .rate') //学习进度
          
          if (Progress != null && Progress.textContent.includes('100%') == true) {
            alert("本课程已学习完成!")
            window.close();

          } else {

            let all_item = document.querySelectorAll('.section-item .first-line') //总节数
            var all_tig_item = document.querySelectorAll('.finish-tig-item') //已完成和进行中
        
            if (all_item != null && all_item.length > 0) {
              console.log("共 " + all_item.length + " 节课")
              if (all_tig_item != null && all_tig_item.length > 0) {
                var index = all_tig_item.length
                var done = 0;
                for (let i = 0; i < index; i++) {
                  if (all_tig_item[i].textContent.includes('已完成')) {
                    done++
                  }
                }

                console.log("index:" + index + ", done:" + done)

                if (done == index){
                  for (let j = 0; j < all_item.length; j++) {
                    if (all_item[j].textContent.includes('已完成') == false) {
                      all_item[j].click()
                      console.log("下一节 播放完成!")
                      break;
                    }
                  }
                }
                
              }
            }
            
          }
 
 
        }
        setInterval(next,10000)
        
      })();