Greasy Fork

Greasy Fork is available in English.

国开学习网教师登陆天数辅助

国家开放大学,国开学习网教师登陆天数和进入课程辅助工具,请设置浏览器允许弹窗网站(thome.ouchn.cn)

当前为 2021-06-02 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         国开学习网教师登陆天数辅助
// @namespace    http://greasyfork.icu/zh-CN/users/707063-genexy
// @version      202106022347
// @description  国家开放大学,国开学习网教师登陆天数和进入课程辅助工具,请设置浏览器允许弹窗网站(thome.ouchn.cn)
// @author       流浪的蛊惑
// @match        *://*.ouchn.cn/*
// @grant        none
// ==/UserScript==
var href = location.href;
function addXMLRequestCallback(callback){//监听请求
    var oldSend, i;
    if( XMLHttpRequest.callbacks ) {
        XMLHttpRequest.callbacks.push( callback );
    } else {
        XMLHttpRequest.callbacks = [callback];
        oldSend = XMLHttpRequest.prototype.send;
        XMLHttpRequest.prototype.send = function(){//监听发送
            for( i = 0; i < XMLHttpRequest.callbacks.length; i++ ) {
                XMLHttpRequest.callbacks[i]( this );
            }
            oldSend.apply(this, arguments);
        }
        XMLHttpRequest.prototype.wrappedSetRequestHeader=XMLHttpRequest.prototype.setRequestHeader;
        XMLHttpRequest.prototype.setRequestHeader = function(header, value) {//监听自定义主机头
            this.wrappedSetRequestHeader(header, value);
            if(!this.headers) {
                this.headers = {};
            }
            if(!this.headers[header]) {
                this.headers[header] = [];
            }
            this.headers[header].push(value);
        }
    }
}
(function() {
    'use strict';
    addXMLRequestCallback( function( xhr ) {
        xhr.addEventListener("load", function(){
            if (xhr.readyState==4 && xhr.status==200) {
                if (xhr.responseURL.includes("thome.ouchn.cn")){
                    let dat=JSON.parse(xhr.responseText);
                    console.log(dat);
                }
            }
        });
    });
    var nextjs=0,dlxs=true;
    setInterval(function(){
        let dlxx=localStorage.getItem("登陆帐号");
        if(dlxx!=null){
            if(href.includes("passport.ouchn.cn/Account/Login")){
                let zhjd=parseInt(localStorage.getItem("帐号进度"));
                localStorage.setItem("帐号进度",zhjd+1);
                let zhs=dlxx.split("\n");
                if(zhjd<=zhs.length){
                    document.getElementById("username").value=zhs[zhjd].split(",")[0];
                    document.getElementById("password").value=zhs[zhjd].split(",")[1];
                    document.getElementById("loginbth").click();
                }else{
                    dlxs=true;
                    localStorage.clear();
                }
            }
        }else if(dlxs){
            dlxs=false;
            let dlk=document.getElementsByClassName("login-bg");
            if(dlk.length>0){
                let dlstr="<center><span style=\"color:blue;background-color:#fff;font-size:20pt;\">教师账号{用户名,密码}一行一个</span><br />";
                dlstr+="<textarea id=\"dlxx\" cols=\"100\" rows=\"10\"></textarea><p><input type=\"button\" value=\"开始执行\" ";
                dlstr+="onclick=\"var dlxx=document.getElementById('dlxx').value;localStorage.setItem('登陆帐号',dlxx);localStorage.setItem('帐号进度','0');";
                dlstr+="\"></p></center>";
                dlk[0].innerHTML=dlstr;
            }
        }
        if(href.includes("://thome.ouchn.cn")){
            let kcjd=localStorage.getItem("课程进度");
            if(kcjd!=null){
                let kclj=document.getElementById("coursedesignList").getElementsByTagName("a");
                if((nextjs++)>10){
                    nextjs=0;
                    if(kcjd<=kclj.length){
                        localStorage.setItem("课程进度",parseInt(kcjd)+1);
                        kclj[kcjd].click();
                    }else{
                        localStorage.clear();
                        location.href="/Home/Logout";
                    }
                }
            }else{
                localStorage.setItem("课程进度","0");
            }
        }
        if(href.includes("course/view.php")){
            if((nextjs++)>8){
                window.close();
            }
        }
    },1000);
})();