Greasy Fork

来自缓存

Greasy Fork is available in English.

云班课一键看班课资源

try to take over the world!

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         云班课一键看班课资源
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       Avenshy
// @match        https://www.mosoteach.cn/web/index.php*
// @grant        GM_registerMenuCommand
// @grant        GM_unregisterMenuCommand
// @grant        GM_setValue
// @grant        GM_getValue
// ==/UserScript==


(function () {
    'use strict';
    function HookPlay() {
        let temp = myPlayer.play;
        myPlayer.play = function () {
            temp();
            let count = 0;
            let int = setInterval(function () {
                count++;
                if (isNaN(myPlayer.duration) == false) {
                    clearInterval(int);
                    $.ajax({
                        type: 'post',
                        dataType: 'json',
                        url: 'https://www.mosoteach.cn/web/index.php?c=res&m=save_watch_to',
                        data: {
                            clazz_course_id: clazzcourseId,
                            res_id: watchingResId,
                            watch_to: Math.ceil(myPlayer.duration),
                            duration: Math.ceil(myPlayer.duration),
                            current_watch_to: Math.ceil(myPlayer.duration)
                        },
                        success: function () {
                            location.reload();
                        }
                    }); // 直接复制修改官方代码 
                }
                if (count > 100) {
                    clearInterval(int);
                    location.reload();
                }
            }, 10);
        };
    };

    function run() {
        HookPlay();
        let menu = document.querySelectorAll("div[data-value].res-row-open-enable");
        let i = 1;
        for (let x of menu) {
            let finish = x.querySelector("span[data-is-drag]").getAttribute("data-is-drag");
            console.log(finish);
            if (finish == "N") {
                if (Array.from(x.classList).includes("preview")) { // 对视频特殊处理
                    x.click();
                    return null;

                } else { // 不是视频则直接刷
                    $.get("/web/index.php?c=res&m=online_preview&clazz_course_id=" + clazzcourseId + "&file_id=" + x.getAttribute("data-value"),
                        function (data, status) {
                            console.log(i + " > " + status);
                        }
                    );
                }
            }
            i++;
        }

        GM_setValue("FuckYBK", "0");
        alert('FINISH !!Made By Avenshy !!');
        location.reload();

    }
    function SetMenuStart() {
        GM_registerMenuCommand("开启脚本", () => {
            GM_setValue("FuckYBK", "1");
            GM_unregisterMenuCommand("开启脚本");
            SetMenuStop();
            run();
        });
    }
    function SetMenuStop() {
        GM_registerMenuCommand("停止脚本", () => {
            GM_setValue("FuckYBK", "0");
            location.reload();
        });
    }


    if (GM_getValue("FuckYBK", "") == "1") {
        SetMenuStop();
        run();
    } else {
        SetMenuStart();
    }

    // Your code here...
})();