LAW

LC AUTO WATCH

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         LAW
// @namespace    http://tampermonkey.net/
// @version      2.80
// @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 setCookie(cname,cvalue,exdays)
{
  var d = new Date();
  d.setTime(d.getTime()+(exdays*24*60*60*1000));
  var expires = "expires="+d.toGMTString();
  document.cookie = cname + "=" + cvalue + "; " + expires +";path=/";
}
function getCookie(cname)
{
  var name = cname + "=";
  var ca = document.cookie.split(';');
  for(var i=0; i<ca.length; i++)
  {
    var c = ca[i].trim();
    if (c.indexOf(name)==0) return c.substring(name.length,c.length);
  }
  return "";
}
(function() {
    'use strict';
    let i=1;
    while(1){
        let contentitem=document.getElementById('contentitem'+i);
        if(contentitem!==null){
            let url=$('#contentitem'+i).attr('onclick').match(/learningKnowledge\(\"(.*).html"/)[1]+".html",flag=false;
            console.log(url);
            let skipstr=getCookie('skip'),skip=[];
            if(skipstr!==''){
                skip=JSON.parse(skipstr);
            }
            for(let s of skip){
                if(s===url){
                    flag=true;
                    break;
                }
            }
            if(flag){
                i++;
                continue;
            }
            window.location.href=window.location.href;
            setCookie('tmp',url,1);
            window.location.href=url;
        }else{
            break;
        }
        i++;
    }

    const tbodyTrainInfo=document.getElementById('tbodyTrainInfo');
    if(tbodyTrainInfo!==null){
        let trs = tbodyTrainInfo.children,i;
        console.log(trs);
        for(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==="100%"||str==="查看"){
                    continue;
                }
                if(str==="开始考试"){
                    let skipstr=getCookie('skip'),tmp=getCookie('tmp'),skip=[];
                    if(tmp!==''){
                        if(skipstr!==''){
                            skip=JSON.parse(skipstr);
                        }
                        skip.push(tmp);
                        setCookie('skip',JSON.stringify(skip),1);
                    }
                    window.history.back(-1);
                    break;
                }
                window.location.href=window.location.href;
                let url=trs[i].getAttribute('onclick');
                console.log(url);
                window.location.href=url.match(/return StudyRowClick\(\'(.*).html?/)[1]+".html";
                break;
                //window.history.pushState(null,"",url.match(/return StudyRowClick\(\'(.*).html?/)[1]+".html");
            }
        }
        if(i>0&&i==trs.length){
            window.history.back(-1);
        }
    }

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