LAW

LC AUTO WATCH

当前为 2022-09-14 提交的版本,查看 最新版本

// ==UserScript==
// @name         LAW
// @namespace    http://tampermonkey.net/
// @version      2.1
// @description  LC AUTO WATCH
// @author       You
// @match        https://edu.inspur.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=inspur.com
// @grant        none
// ==/UserScript==
let curTime = "";
function refreshSchedule(){
    const divStartArea=document.getElementById('divStartArea');
    if(divStartArea!==null){
        const spanLeavTimes=document.getElementById('spanLeavTimes').innerText;
        if(divStartArea.style.display==="none"){
            window.history.back(-1);
        }else{
            if(curTime===""||curTime===spanLeavTimes){
                myPlayer.play();
            }else{
                console.log(divStartArea.innerText);
            }
            curTime=spanLeavTimes;
        }
    }
}
(function() {
    'use strict';

    let contentitem=document.getElementById('contentitem1');
    if(contentitem!==null){
        let url=$('#contentitem1').attr('onclick');
        console.log(url.length);
        window.location.href=url.substr(19,(url.length-19-2));
    }

    const tbodyTrainInfo=document.getElementById('tbodyTrainInfo');
    if(tbodyTrainInfo!==null){
        let trs = tbodyTrainInfo.children;
        console.log(trs);
        for(let i =1;i<trs.length;i++){
            if(trs[i].nodeName==='TR'){
                //console.log(trs[i]);
                let str=trs[i].lastElementChild.lastElementChild.lastElementChild.innerText;
                if(str==="开始考试"||str==="100%"){
                    continue;
                }
                let url=trs[i].getAttribute('onclick');
                console.log(url);
                //window.location.href=url.match(/return StudyRowClick\(\'(.*).html?/)[1]+".html";
                window.history.pushState(null,"",url.match(/return StudyRowClick\(\'(.*).html?/)[1]+".html");
            }
        }
    }

    const tableContainer=document.getElementById('tableContainer');
    if(tableContainer!==null){
        window.location.href=window.location.href;
        let trs = tableContainer.firstElementChild.firstElementChild.children;
        console.log(trs);
        if(trs.length>1&&trs[1].nodeName==='TR'&&trs[1].className!=="empty"){
            //console.log(trs[1]);
            let check=trs[1].firstElementChild.firstElementChild.firstElementChild;
            if(check!==null){
                check.checked=true;
                ClickSelf(check);
                $('#hidDeleteType').val("BacthDelete");
                document.getElementById('btnDelete').click();
            }
            let url=trs[1].children[2].innerHTML;
            console.log(url);
            window.location.href=url.match(/isOpenFaceId\(&quot;&quot;,&quot;&quot;,&quot;(.*).html?/)[1]+".html";
            //window.location.replace(url.match(/isOpenFaceId\(&quot;&quot;,&quot;&quot;,&quot;(.*).html?/)[1]+".html");
        }
    }

    const normalrow=document.getElementsByClassName('normalrow clearfix');
    if(normalrow!==null){
        for(let i =0;i<normalrow.length;i++){
            if(normalrow[i].nodeName==='DIV'){
                let str=normalrow[i].getElementsByClassName('fontnumber study-schedule')[0].innerHTML;
                if(str==="&nbsp;100%"){
                    continue;
                }
                let url=normalrow[i].getElementsByClassName('text-color6')[0].getAttribute('href');
                console.log(url);
                window.location.href=url.match(/javascript:void\(StudyRowClick\(\'(.*).html?/)[1]+".html";
            }
        }
    }
    let timer=null;
    clearInterval(timer);
    timer=setInterval(() => {
        refreshSchedule();
    }, 10000);
    if(typeof phaseTrackIntervalTime!=='undefined'){
        phaseTrackIntervalTime = 60000;
    }
    // Your code here...
})();