Greasy Fork

来自缓存

Greasy Fork is available in English.

超星学习通破解视频暂停播放

学习通, 超星,破解视频倍速自动暂停

当前为 2022-03-31 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         超星学习通破解视频暂停播放
// @namespace    none
// @version      1.0
// @description  学习通, 超星,破解视频倍速自动暂停
// @author       umrcheng
// @match        https://mooc1.chaoxing.com/mycourse/*
// @icon         https://public-1256790247.cos.ap-nanjing.myqcloud.com/zuzhi.svg
// @grant        none
// @license      MIT
// ==/UserScript==

(function () {
      // user           umrcheng
      // email          [email protected]
      // bilibili       https://space.bilibili.com/94884732?spm_id_from=333.1007.0.0

      'use strict';

      var num = 0; // 计数
      var time; // 定时器
      var speed = 10000; // 1000 = 1s 每多少毫秒检测一次视频是否已阻止暂停


      console.log('===========================等待页面加载完成=============================');

      time = setInterval(() => {
            // 开始
            run();
            console.log('已阻止学习通暂停视频' + num + '次');
      }, speed)


      function run(){

            var iframe = document.getElementsByTagName('iframe')['0'].contentWindow.document.getElementsByTagName('iframe');

            // 保存视频对象
            window.videos = [];
            window.vid_arr = [];

            // 遍历视频对象
            traverse(iframe);

            // 阻止
            for(var i = 0; i < window.videos.length; i ++){
                  prevent_suspended(window.videos[i]);
            }

            return true;
      };

      // 遍历视频对象
      function traverse(iframe){
            var video; //视频对象

            for(var i = 0; i < iframe.length; i ++){
                  try{
                        video = iframe[i].contentWindow.document.getElementsByTagName('video').video_html5_api;
                        if(Object.prototype.toString.call(video) != '[object HTMLVideoElement]'){
                              video = iframe[i].contentWindow.document.getElementsByTagName('video');
                        }
                        if(window.videos.length < iframe.length){
                              if(Object.prototype.toString.call(video) != '[object HTMLCollection]' && Object.prototype.toString.call(video) == '[object HTMLVideoElement]'){
                                    window.videos.push(video);
                              }
                        }
                  }catch (e){
                        console.log("警告, 发生特殊情况, 但此不影响运行", e, "有需要请联系作者");
                        continue;
                  }
            }
            return true
      }

      // 阻止暂停视频
      function prevent_suspended(v){
            v.pause = () => {
                  num ++;
            }
            v.volume = 0;

            return true;
      }
})();