Greasy Fork

Greasy Fork is available in English.

automate_video_play_for_雨课堂

风刮的唉!

当前为 2022-09-29 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         automate_video_play_for_雨课堂
// @namespace    http://tampermonkey.net/
// @version      0.1
// @license      MIT
// @description  风刮的唉!
// @author       camerayuhang from FZU
// @match        https://changjiang.yuketang.cn/v2/web/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=yuketang.cn
// @grant        none
// @require      https://cdn.bootcdn.net/ajax/libs/jquery/3.6.1/jquery.js
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    setTimeout(() => {
      console.log("click to DropDown to show more Dom");
      let span = $("span.blue.ml20");
      span.click();
    }, 3000);
    setTimeout(() => {
      let currentURL = window.location.href;
      let sectionVideoNodes = $("#pane--1 .activity-info.el-tooltip use[*|href='#icon-shipin']").parent().parent().parent().parent();
      //let sectionVideoNodes = $("#pane--1 .activity-info.el-tooltip h2:contains('Video')").parent().parent().parent();
      console.log("get all nodes containing the video");
      for (let i = 0; i < sectionVideoNodes.length; i++) {
        const ele = sectionVideoNodes[i];
        let flagText = $(ele).children(".statistics-box").children(".aside").children().eq(1);
        if (flagText.text() !== "已完成") {
            console.log(ele);
            flagText.click();
            break;
        }
        setTimeout(function() {
          let title = $("div.title-fl span")[0].innerText;  // title
          setTimeout(function() {
            let pause_btn = $("xt-bigbutton.pause_show");  // pause button
            if (pause_btn.length == 1) {  //  determine whether the button is shown
              console.log("The video is paused---click to play");
              pause_btn.click();
            }
          }, 3000);

          // interval for lisening the video process
          let jsq = "my_interval"
          jsq = setInterval(function() {
            let w = $("span.text:eq(1)")[0];  // element for process
            console.log(title + '---' + w.innerText);
            if (w.innerText == "完成度:100%") {
              clearInterval(jsq);
              console.log("close the interval")
              window.location.replace(currentURL)
            }
          }, 3000);
        }, 3000);
      }
    }, 5000);
})();