国开大学-保险学院-自动学习脚本

收录 60

国开大学-保险学院-自动学习脚本

// ==UserScript==
// @name         国开大学-保险学院-自动学习脚本
// @namespace    http://tampermonkey.net/
// @version      0.24
// @description  try to take over the world!
// @author       曦月

// @match        https://www.oucbx.com/OUCWEB/LEAP/Web/html/mystudy.html*

// @match        https://sp.yxybb.com/OUCStudy/LEAP/STUDYWeb/WEB/html/courseDetails.html*
// @match        https://sp.yxybb.com/OUCStudy/LEAP/STUDYWeb/WEB/html/cwVideoPlay.html*
// @match        https://sp.yxybb.com/OUCStudy/LEAP/STUDYWeb/WEB/html/cwPDF.html*
// @match        https://sp.yx/ybb.com/OUCStudy/LEAP/STUDYWeb/WEB/html/pdf/web/viewer.html*
// @match        https://sp.yxybb.com/OUCStudy/LEAP/STUDYWeb/WEB/html/cwExercise.html*
// @match        https://sp.yxybb.com/OUCStudy/LEAP/STUDYWeb/WEB/html/cwExerciseResult.html*
// @match        https://sp.yxybb.com/OUCStudy/LEAP/STUDYWeb/WEB/html/cwExercisePaser.html*
// @match        https://sp.yxybb.com/OUCStudy/LEAP/STUDYWeb/WEB/html/cwQa.html*
// @match        https://sp.yxybb.com/OUCStudy/LEAP/STUDYWeb/WEB/html/cwExam.html*

// @require      https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js
// @require      https://cdn.bootcdn.net/ajax/libs/js-cookie/2.2.1/js.cookie.js

// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    console.log("自动刷课脚本已启动");
    // get_msg()

    var sets = setInterval(function () {
        if (typeof Cookies != 'undefined' && typeof $ != 'undefined') {
               console.log("依赖项加载成功");
            clearInterval(sets)
            var links = window.location.href
            if (links.includes("mystudy.html")) {
            }else if (links.includes("courseDetails.html")) {
                //课程详情
                 akk()
            }else if(links.includes("cwVideoPlay.html")) {
                //课程学习
                ssp()
            }else if(links.includes("cwPDF.html") || links.includes("viewer.html")) {
                //pdf阅读
                pdf()
            }else if(links.includes("cwExercise.html") || 
                     links.includes("cwExerciseResult.html") || 
                     links.includes("cwExercisePaser.html") || 
                     links.includes("cwQa.html") ||
                     links.includes("cwExam.html")) {
                     next_page()
            }
        }else{
        console.log("加载依赖中");
      }
    },500)


    //我的课程页面
    // function get_lsss() {
    //   console.log("课程选择列表");
    //   var cok = Cookies.get('kc')
    //   if (cok === undefined) {
    //     cok = 0
    //   }
    //   var ddddddd = setInterval(function () {
    //     console.log("等待中");
    //     var kc_num = $(".l-lesson li").length
    //       for (var i = 1; i < kc_num+1; i++) {
    //         console.log(i , cok*1);
    //         if (i > cok*1) {
    //             $(".l-lesson li:eq("+i+") div")[0].click();
    //             Cookies.set('kc_num',i)
    //             i = kc_num
    //             clearInterval(ddddddd)
    //         }
    //       }
    //   },1000)
    // }

    //课程介绍
    function akk() {
      console.log("课程介绍");
      var cok = Cookies.get('kc_num')
      var but = $("[class='button primary']").eq(0).text()
      if (but != "重新学习") {
        $("[class='button primary']").eq(0)[0].click()
        // window.close()
      }else{
        console.log("此课程已学习完成");
        Cookies.set('kc',cok)
        $("#mystudy")[0].click();
      }
    }
    //pdf文案
    function pdf() {
        console.log("pad页面");
        setInterval(function () {
            console.log("滚动中");
            $("[class='w h']").contents().find("#viewerContainer").scrollTop(99999999999)
            if ($(".tsuccess").text() !== "") {
                console.log("已学习");
                next_page()
            }
        },1000)
    }
    //视频
    function ssp() {
        var myVid=document.getElementById("myPlayer_html5_api");
        myVid.volume=0;
        $(".vjs-big-play-button").click()
        setInterval(function () {
            console.log("监听中");
            if ($(".video-js").hasClass("vjs-paused")) {
                $(".vjs-big-play-button").click()
            }
            if ($(".tsuccess").text() !== "") {
                console.log("已学习");
                next_page()
            }
        },1000)
        myVid.addEventListener('pause', function () { //暂停开始执行的函数
                console.log("播放a");
            myVid.play()
        });
    }

    //答题 -- 废弃
    // function ddtss() {
    //     var da = Cookies.get('dn')
    //     if (da === undefined) {
    //         console.log("一阶段,随机填写答案");
    //         kksa()
    //         var i = 0
    //         function kksa() {
    //             setTimeout(function () {
    //                 $(".exam .item:eq(0) input").click()
    //                 $("[class='button primary outline w']:eq(1)")[0].click();
    //                 if (i < $(".exam-card .grid-item").length) {
    //                     i++
    //                     kksa()
    //                 }else{
    //                     Cookies.set('dn',1)
    //                     commitExercise()
    //                 }
    //             },600)
    //         }
    //     }else if (da === "1") {
    //         console.log("二阶段,查看正确答案");
    //         Cookies.set('dn',2)
    //         for (var i = 0; i < $("[class='button primary outline w']").length; i++) {
    //             if ($("[class='button primary outline w']").eq(i).text() == "查看解析") {
    //                 $("[class='button primary outline w']").eq(i)[0].click();
    //             }
    //         }
    //     }else if (da === "2") {
    //         console.log("三阶段,写入cookie");
    //         var i = 0;
    //         var temp_arr = []
    //         kksas()
    //         function kksas() {
    //             setTimeout(function () {
    //                 temp_arr.push($(".jiexi .content p:last-child").text().substring(5))
    //                 $("[class='button primary outline w']").eq(1)[0].click();
    //                 if (i < $(".exam-card .grid-item").length) {
    //                     i++
    //                     kksas()
    //                 }else{
    //                     Cookies.set('dnlb',temp_arr)
    //                     Cookies.set('dn',3)
    //                     console.log(Cookies.get('dnlb'));
    //                     $("[class='row w current'] [class='col v-m oneline']").click()
    //                 }
    //             },600)
    //         }
    //     }else if(da === "3"){
    //         console.log("回填");
    //         Cookies.set('dn',4)
    //         $("[class='button primary outline w']").eq(0)[0].click()
    //     }else if(da === "4"){
    //         var dnlb = JSON.parse(Cookies.get('dnlb'))
    //         console.log(dnlb);
    //         var i = 0
    //         ksdd()
    //         function ksdd() {
    //             setTimeout(function () {
    //                 for (var k = 0; k < dnlb[i].length; k++) {
    //                     console.log(i);
    //                     console.log(k);
    //                     console.log(dnlb[i].substr(k,1).charCodeAt()-65);
    //                     $(".exam .item:eq("+(dnlb[i].substr(k,1).charCodeAt()-65)+") input").click()
    //                     // $(".exam .item:eq("+dnlb[i].substr(k,1).charCodeAt()-65+") input").click()
    //                 }
    //                 $("[class='button primary outline w']:eq(1)")[0].click();
    //                 if (i < dnlb.length) {
    //                     i++
    //                     ksdd()
    //                 }else{
    //                     Cookies.set('dn',undefined)
    //                     Cookies.set('dnlb',undefined)
    //                     commitExercise()
    //                 }
    //             },600)
    //         }
            
    //     }
    // }


    function next_page() {
        for (var i = 0; i < $(".tree-content div").length; i++) {
            if ($(".tree-content div:eq("+i+") [class='status fail']").length !== 0 && ($(".tree-content div:eq("+i+") [class='col v-m icon'] img").attr("src") === "../img/video.png" || $(".tree-content div:eq("+i+") [class='col v-m icon'] img").attr("src") === "../img/PDF.png")) {
                $(".tree-content div:eq("+i+") a")[0].click();
                break
            }
        }
    }
})();
none
打赏采用二维码方式。

添加新评论