智慧🤫HuangZhi🤫理性刷课

try to take over “智慧黄职” !( ⚠ 反对不理性的刷课行为,理不理性,你品😄,你细品😄)

目前為 2020-04-22 提交的版本,檢視 最新版本

// ==UserScript==
// @name         智慧🤫HuangZhi🤫理性刷课
// @version      0.1
// @namespace    http://tampermonkey.net/
// @description  try to take over “智慧黄职” !( ⚠ 反对不理性的刷课行为,理不理性,你品😄,你细品😄)
// @author       bellamy.nhy
// @match        http://61.136.241.22/suite/onlineLearningAdmin/onlineLearningAdminView.do?feature=onlineLearing&action=learingBKSecondContent&courseKey=*
// @match        http://61.136.241.22/suite/solver/classView.do?feature=courseSite&action=showCourseContent&structureKey=*
// @grant        none
// @icon         http://61.136.241.22/suite/template/space/common/logohere.png
// ==/UserScript==

(function() {
    'use strict';

    var keyArr = [];// save all keys of source in the current page  into this array
    var timer;
    var count = 0;
    var interval;
    var offset = 477;
    var srcInterval = 600000 + offset;
    var sendInterval = 60000;   //sendNum = srcInterval / sendInterval - 1

    j$(function(){
        let  doIt = confirm("这个页面可以用哟 😊😀\n\n ⚠ 反对不理性的刷课行为,你确定是在理性刷课吗?\n\n  还是... (哼,不听你的😕)");
        if(doIt)
            run();
        else
            alert("为你个点赞👍,要继续努力哟!!!🤞");
    });
    function run(){
        var tags = j$(".tabCont");
        for(let t of tags){
            console.log(t.id);
            let key = t.id.split("_")[1];
            keyArr.push(key);
            console.log(keyArr);
        }
        alert("本页面总共需要的挂机时间为: " + ((srcInterval - offset) * keyArr.length)/60000 + " 分钟;\n\n 请等待结束提示!");
        setTimeout(clearTimer, 0);
        interval = window.setInterval(clearTimer, srcInterval);//Video Execution cycle
    }
    function sendAction(k){
        saveLearnDuration();
        saveResourceDuration(k);
        console.log("key: "+ k +" has been sent ");
    }
    function _sendAction(k){ //closure
        return function(){
            sendAction(k);
        }
    }

    function clearTimer(){
        console.log("everytime: timer:" + timer + " delTimer: " + delTimer);
        //window.clearInterval(delTimer); //clear native Timer(delTimer)
        clearInterval(timer); //clear the previous timer generated by Script
        if(count < keyArr.length){
            console.log("count:" + count + " key:" + keyArr[count] + "开始了");
            timer = window.setInterval(_sendAction(keyArr[count]),sendInterval); // reset timer ; timer Execution cycle
        }else{
            clearInterval(interval);//stop timer sending requests
            clearInterval(timer); //clear the previous timer generated by Script
            console.log("Over: timer:" + timer + " delTimer: " + delTimer);
            alert("共处理了" + keyArr.length + "个可被执行的资源, 现已停止,即将刷新页面!😊");
            window.location.reload();
        }
        count++;
    }


})();