Ayuanman 发表于 2023-3-5 21:15:54

求学习强国软件

求学习强国软件

潘钜森 发表于 2023-3-5 21:41:20

**[https://www.123pan.com/s/4Mh9-kYn4h.html](https://www.123pan.com/s/4Mh9-kYn4h.html)**

blue23 发表于 2023-3-6 10:11:23

geoi6sam1 发表于 2023-3-5 21:41
**(https://www.123pan.com/s/4Mh9-kYn4h.html)**

大哥,电脑版用不了 了

御青衣 发表于 2023-3-6 22:06:09

// ==UserScript==
// @name         涓嶅涔犱綍浠ュ己鍥?beta
// @namespace    http://tampermonkey.net/
// @version      20220214
// @description闂鍙嶉浣嶇疆锛?https://github.com/TechXueXi/techxuexi-js/issues 銆傝鏂囩珷,鐪嬭棰戯紝鍋氫範棰樸€?// @author       techxuexi 锛岃嵎鍖呰泲銆?// @match      https://www.xuexi.cn
// @match      https://www.xuexi.cn/*
// @match      https://pc.xuexi.cn/points/login.html*
// @match      https://pc.xuexi.cn/points/exam-practice.html
// @match      https://pc.xuexi.cn/points/exam-weekly-detail.html?id=*
// @match      https://pc.xuexi.cn/points/exam-weekly-list.html
// @match      https://pc.xuexi.cn/points/exam-paper-detail.html?id=*
// @match      https://pc.xuexi.cn/points/exam-paper-list.html
// @require      https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.5.1.min.js
// @require      https://cdn.jsdelivr.net/npm/blueimp-md5@2.9.0
// @grant      GM_addStyle
// @grant      GM_setValue
// @grant      GM_getValue
// @grant      GM_deleteValue
// @grant      GM_openInTab
// ==/UserScript==
var study_css = ".egg_study_btn{outline:0;border:0;position:fixed;top:5px;left:5px;padding:12px 20px;border-radius:10px;cursor:pointer;background-color:#fff;color:#d90609;font-size:18px;font-weight:bold;text-align:center;box-shadow:0 0 9px #666777}.egg_manual_btn{transition:0.5s;outline:none;border:none;padding:12px 20px;border-radius:10px;cursor:pointer;background-color:#e3484b;color:rgb(255,255,255);font-size:18px;font-weight:bold;text-align:center;}.egg_auto_btn{transition:0.5s;outline:none;border:none;padding:12px 20px;border-radius:10px;cursor:pointer;background-color:#666777;color:rgb(255,255,255);font-size:18px;font-weight:bold;text-align:center;}.egg_setting_box{position:fixed;top:70px;left:5px;padding:12px 20px;border-radius:10px;background-color:#fff;box-shadow:0 0 9px #666777}.egg_setting_item{margin-top:5px;height:30px;width:140px;font-size:16px;display:flex;justify-items:center;justify-content:space-between}input.egg_setting_switch{cursor:pointer;margin:0;outline:0;appearance:none;-webkit-appearance:none;-moz-appearance:none;position:relative;width:40px;height:22px;background:#ccc;border-radius:50px;transition:border-color .3s,background-color .3s}input.egg_setting_switch::after{content:'';display:inline-block;width:1rem;height:1rem;border-radius:50%;background:#fff;box-shadow:0,0,2px,#999;transition:.4s;top:3px;position:absolute;left:3px}input.egg_setting_switch:checked{background:#fd5052}input.egg_setting_switch:checked::after{content:'';position:absolute;left:55%;top:3px}";
GM_addStyle(study_css);
//https://www.xuexi.cn/lgdata/3uoe1tg20en0.json
//鏌ヨ浠婃棩瀹屾垚鎯呭喌
const SearchSocreUrl = "https://pc-proxy-api.xuexi.cn/api/score/days/listScoreProgress?sence=score&deviceType=2";
//閲嶈鏂伴椈鍒楄〃锛堜富锛?const NewsUrl1 = "https://www.xuexi.cn/lgdata/1jscb6pu1n2.json";
//瀛︿範鏃惰瘎鏂伴椈鍒楄〃
const NewsUrl2 = "https://www.xuexi.cn/lgdata/1ap1igfgdn2.json";
//鏂伴椈瑙嗛鍒楄〃
const VideosUrl1 = "https://www.xuexi.cn/lgdata/3o3ufqgl8rsn.json";
//鏂伴椈瑙嗛鍒楄〃
const VideosUrl2 = "https://www.xuexi.cn/lgdata/1742g60067k.json";
//姣忔棩绛旈椤甸潰
const ExamPracticeUrl = "https://pc.xuexi.cn/points/exam-practice.html";
//姣忓懆绛旈鍒楄〃API
const ExamWeeklyListUrl = "https://pc-proxy-api.xuexi.cn/api/exam/service/practice/pc/weekly/more?pageNo={pageNo}&pageSize=50";
//涓撻」绛旈鍒楄〃API
const ExamPaperListUrl = "https://pc-proxy-api.xuexi.cn/api/exam/service/paper/pc/list?pageSize=50&pageNo={pageNo}";
//棰樼洰API锛堝彧鏈夋瘡鍛ㄧ瓟棰樺拰涓撻」缁冧範锛?//const ExamQueryUrl = "https://pc-proxy-api.xuexi.cn/api/exam/service/detail/queryV3?type={type}&id={id}&forced=true";//type=1涓撻」缁冧範锛宼ype=2姣忓懆绛旈
//姣忓懆绛旈椤甸潰
const ExamWeeklyUrl = "https://pc.xuexi.cn/points/exam-weekly-detail.html?id={id}";
//涓撻」娴嬭瘯椤甸潰
const ExamPaperUrl = "https://pc.xuexi.cn/points/exam-paper-detail.html?id={id}";
//鏂囨湰鏈嶅姟鍣ㄤ繚瀛楢PI
const AnswerSaveUrl = "https://a6.qikekeji.com/txt/data/save/";
//鏂囨湰鏈嶅姟鍣ㄨ幏鍙朅PI
const AnswerDetailUrl = "https://a6.qikekeji.com/txt/data/detail/";
//鑾峰彇褰撳墠鏃ユ湡
var currDate = new Date().toISOString().split('T');
var newsNum = 6;
var news = [];
var videoNum = 6;
var videos = [];
//閰嶇疆
var settings = {};
var settingsDefault = {
    News: true, //0
    Video: true,//1
    ExamPractice: true, //6 姣忔棩绛旈
    ExamWeekly: true,//2 姣忓懆绛旈
    ExamPaper: true,//5 涓撻」缁冧範
    ShowMenu: false, //7 闅愯棌鑿滃崟
    AutoStart: false, //鏄惁鍔犺浇鑴氭湰鍚庤嚜鍔ㄦ挱鏀?}
var pause = false;//鏄惁鏆傚仠绛旈
//姣忓懆绛旈褰撳墠椤电爜
var examWeeklyPageNo = 1;
//姣忓懆绛旈鎬婚〉鐮?var examWeeklyTotalPageCount = null;
//姣忓懆绛旈寮€鍚€嗗簭绛旈: false: 椤哄簭绛旈; true: 閫嗗簭绛旈
var examWeeklyReverse = false;
//涓撻」绛旈褰撳墠椤电爜
var examPaperPageNo = 1;
//涓撻」绛旈鎬婚〉鐮?var examPaperTotalPageCount = null;
//涓撻」绛旈寮€鍚€嗗簭绛旈: false: 椤哄簭绛旈; true: 閫嗗簭绛旈
var examPaperReverse = false;
//姣忓懆绛旈锛屼笓椤圭瓟棰?璇锋眰rate 闄愬埗 姣?3000ms 涓€娆?const ratelimitms = 3000;

//榛樿鎯呭喌涓? chrome 鍙厑璁?window.close 鍏抽棴 window.open 鎵撳紑鐨勭獥鍙?鎵€浠ユ垜浠氨瑕佺敤window.open鍛戒护,鍦ㄥ師鍦扮綉椤垫墦寮€鑷韩绐楀彛鍐嶅叧涓?灏卞彲浠ユ垚鍔熷叧闂簡
function closeWin() {
    try {
      window.opener = window;
      var win = window.open("", "_self");
      win.close();
      top.close();
    } catch (e) {
    }

}

async function sleep( timeMS ) {
    return new Promise( res => setTimeout( res, time ) );
}

/**妯℃嫙榧犳爣绉诲姩鏀规柟娉曟潵鑷猦ttps://blog.csdn.net/Wuzihui___/article/details/79952068
* @param id
* @param clientX鐩稿绐楀彛妯潗鏍? * @param clientY鐩稿绐楀彛绾靛潗鏍? * @param distance 婊戝姩璺濈
*/
function dragandDrop(btn_hk, clientX, clientY, distance) {
    var elem = btn_hk,
      k = 0,
      interval;
    iME(elem,"mousedown",0, 0, clientX, clientY);
    let waitTime = Math.floor(Math.random() * (0.005 * 1000 - 0.09 * 1000) + 0.09 * 1000)
    interval = setInterval(function() {
      k++;
      iter(k);
      if (k === distance) {
            clearInterval(interval);
            iME(elem, "mouseup", clientX + k, clientY, 220 + k, 400);
      }
    }, waitTime);
    function iter(y) {
      iME(elem, "mousemove", clientX + y, clientY, clientX + y, clientY);
    }
    function iME(obj, event, screenXArg, screenYArg, clientXArg, clientYArg) {
      var mousemove = document.createEvent("MouseEvent");
      mousemove.initMouseEvent(event, true, true, unsafeWindow, 0, screenXArg, screenYArg, clientXArg, clientYArg, 0, 0, 0, 0, 0, null);
      obj.dispatchEvent(mousemove);
    }
}

/**
* 闅忔満绛夊緟鏈€灏忓埌鏈€澶т箣闂村嚑绉? 闇€瑕乤wait
* @param {number} minSecond 鏈€鐭椂闀? * @param {number} MaxSecond 鏈€闀挎椂闀? * @returns Promise
*/
function waitRandomBetween(minSecond = 2, MaxSecond = 5) {
    if (MaxSecond <= minSecond) {
      MaxSecond = minSecond + 3
    }

    let waitTime = Math.floor(Math.random() * (MaxSecond * 1000 - minSecond * 1000) + minSecond * 1000)
    return new Promise((resolve, reject) => {
      setTimeout(() => {
            console.log(`闅忔満绛夊緟${waitTime / 1000}绉抈)
            resolve()
      }, waitTime)
    })
}

$(document).ready(function () {
    let url = window.location.href;
    if (url == "https://www.xuexi.cn" || url == "https://www.xuexi.cn/" || url == "https://www.xuexi.cn/index.html") {
      let ready = setInterval(function () {
            if (document.getElementsByClassName("text-wrap")) {
                clearInterval(ready);//鍋滄瀹氭椂鍣?                //鍒濆鍖栬缃?                initSetting();
                //鍒涘缓"寮€濮嬪涔?鎸夐挳
                createStartButton();
            }
      }, 800);
    } else if (url.indexOf("login.html") !== -1) {
      console.log("妫€娴嬪埌鐧诲綍椤?)
      setTimeout(() => {
            window.scrollTo(0, 1000);
      }, 500);
    }
    else if (typeof GM_getValue("readingUrl") != 'object' && url == GM_getValue("readingUrl")) {
      try {
            let settingTemp = JSON.parse(GM_getValue('studySetting'));
            if (!settingTemp) {
                createTip();//鍒涘缓瀛︿範鎻愮ず
            }
            reading(0);
      } catch (e) {
            createTip();//鍒涘缓瀛︿範鎻愮ず
            reading(0);
      }
    } else if (typeof GM_getValue("watchingUrl") != 'object' && url == GM_getValue("watchingUrl")) {
      try {
            let settingTemp = JSON.parse(GM_getValue('studySetting'));
            if (!settingTemp) {
                createTip();//鍒涘缓瀛︿範鎻愮ず
            }
      } catch (e) {
            createTip();//鍒涘缓瀛︿範鎻愮ず
      }
      let randNum = 0;
      var checkVideoPlayingInterval = setInterval(function () {
            let temp = getVideoTag();
            if (temp.video) {
                if (!temp.video.muted) {
                  temp.video.muted = true;
                }
                if (temp.video.paused) {
                  temp.video.paused = false;
                  console.log("姝e湪灏濊瘯鎾斁瑙嗛")
                  if (randNum == 0) {//灏濊瘯浣跨敤js鐨勬柟寮忔挱鏀?                        try {
                            temp.video.play();//灏濊瘯浣跨敤js鐨勬柟寮忔挱鏀?                        } catch (e) { }
                        randNum++;
                  } else {
                        try {
                            temp.pauseButton.click();//灏濊瘯鐐瑰嚮鎾斁鎸夐挳鎾斁
                        } catch (e) { }
                        randNum--;
                  }
                } else {
                  console.log("鎴愬姛鎾斁")
                  clearInterval(checkVideoPlayingInterval);
                  reading(1);
                }
            } else {
                console.log("绛夊緟鍔犺浇")
            }
      }, 800);
    } else if (url.indexOf("exam") != -1 && url.indexOf("list") == -1) {
      //绛旈椤甸潰
      let ready = setInterval(function () {
            if (document.getElementsByClassName("title")) {
                clearInterval(ready);//鍋滄瀹氭椂鍣?                //鍒涘缓鈥滄墜鍔ㄧ瓟棰樷€濇寜閽?                createManualButton();
                //鍘婚櫎绛旈楠岃瘉
                //cancelVerify();
                //寮€濮嬬瓟棰?                doingExam();
            }
      }, 500);
    } else {
    }
});


//鑾峰彇video鏍囩
function getVideoTag() {
    let iframe = document.getElementsByTagName("iframe");
    let video = null;
    let pauseButton = null;
    var u = navigator.userAgent;

    // 瑙嗛鎾斁鎸夐挳鏇存柊
    video = document.getElementsByTagName("video");
    pauseButton = document.getElementsByClassName("prism-big-play-btn");

    return {
      "video": video,
      "pauseButton": pauseButton
    }

    // if (u.indexOf('Mac') > -1) {//Mac
    //   if (iframe != null && iframe.innerHTML) {
    //         //濡傛灉鏈塱frame,璇存槑澶栭潰鐨剉ideo鏍囩鏄亣鐨?    //         video = iframe.contentWindow.document.getElementsByTagName("video");
    //         pauseButton = iframe.contentWindow.document.getElementsByClassName("prism-play-btn");
    //   } else {
    //         //鍚﹀垯杩欎釜video鏍囩鏄湡鐨?    //         video = document.getElementsByTagName("video");
    //         pauseButton = document.getElementsByClassName("prism-play-btn");
    //   }
    //   return {
    //         "video": video,
    //         "pauseButton": pauseButton
    //   }
    // }
    // else {
    //   if (iframe) {
    //         //濡傛灉鏈塱frame,璇存槑澶栭潰鐨剉ideo鏍囩鏄亣鐨?    //         video = iframe.contentWindow.document.getElementsByTagName("video");
    //         pauseButton = iframe.contentWindow.document.getElementsByClassName("prism-play-btn");
    //   } else {
    //         //鍚﹀垯杩欎釜video鏍囩鏄湡鐨?    //         video = document.getElementsByTagName("video");
    //         pauseButton = document.getElementsByClassName("prism-play-btn");
    //   }
    //   return {
    //         "video": video,
    //         "pauseButton": pauseButton
    //   }
    // }
}

//璇绘柊闂绘垨鑰呯湅瑙嗛
//type:0涓烘柊闂伙紝1涓鸿棰?async function reading(type) {
    //鐪嬫枃绔犳垨鑰呰棰?    var time = 1;
    if (type == 0) {
      time = parseInt(Math.random() * (100 - 80 + 1) + 80, 10);//80-100绉掑悗鍏抽棴椤甸潰锛岀湅鏂囩珷
    } else {
      time = parseInt(Math.random() * (250 - 230 + 1) + 230, 10);//230-250绉掑悗鍏抽棴椤甸潰锛岀湅瑙嗛
    }
    let firstTime = time - 2;
    let secendTime = 12;
    let scrollLength = document.body.scrollHeight / 2;
    var readingInterval = setInterval(function () {
      time--;
      $("#studyTip").text(time + " 绉掑悗鍏抽棴椤甸潰");
      if (time <= firstTime) {
            try {
                $("html,body").animate({ scrollTop: 394 }, 1000);
            } catch (e) {
                window.scrollTo(0, 394);
            }
            firstTime = -1;
      }
      if (time <= secendTime) {
            try {
                $("html,body").animate({ scrollTop: scrollLength / 3 }, 1000);
            } catch (e) {
                window.scrollTo(0, scrollLength / 3);
            }
            secendTime = -1;
      }
      if (time <= 0) {
            if (type == 0) {
                GM_setValue('readingUrl', null);
            } else {
                GM_setValue('watchingUrl', null);
            }
            clearInterval(readingInterval);
            closeWin();
      }
    }, 1000);
    //鍏抽棴鏂囩珷鎴栬棰戦〉闈?}
//鍒涘缓瀛︿範鎻愮ず
function createTip() {
    let tipInfo = document.createElement("div");
    //娣诲姞鏍峰紡
    tipInfo.setAttribute("id", "studyTip");
    tipInfo.innerText = "姝e湪鍒濆鍖?...";
    tipInfo.style.position = "fixed";
    tipInfo.style.bottom = "15px";
    tipInfo.style.left = "5px";
    tipInfo.style.padding = "12px 14px";
    tipInfo.style.border = "none";
    tipInfo.style.borderRadius = "10px";
    tipInfo.style.backgroundColor = "#222222";
    tipInfo.style.color = "#ffffff";
    tipInfo.style.fontSize = "14px";
    tipInfo.style.fontWeight = "bold";
    //鎻掑叆鑺傜偣
    let body = document.getElementsByTagName("body");
    body.append(tipInfo)
}
//绛夊緟绐楀彛鍏抽棴
function waitingClose(newPage) {
    return new Promise(resolve => {
      let doing = setInterval(function () {
            if (newPage.closed) {
                clearInterval(doing);//鍋滄瀹氭椂鍣?                resolve('done');
            }
      }, 1000);
    });
}
//闃呰鏂囩珷
async function readNews() {
    await getNews();
    for (let i = 0; i < news.length; i++) {
      GM_setValue('readingUrl', news.url);
      console.log("姝e湪鐪嬬" + (i + 1) + "涓柊闂?);
      let newPage = GM_openInTab(news.url, { active: true, insert: true, setParent: true });
      await waitingClose(newPage);
      await waitRandomBetween(1, 3);
    }
}
//鑾峰彇鏂伴椈鍒楄〃
function getNews() {
    return new Promise(resolve => {
      news = new Array();
      let n = 6;
      if (newsNum < 6) {//濡傛灉闇€瑕佸涔犵殑鏂伴椈鏁伴噺涓嶅埌6锛屼篃灏辨槸宸茬粡瀛﹁繃浜嗭紝浣嗘槸绉垎涓嶅锛岃ˉ鐨?            n = newsNum;
      }
      console.log("杩橀渶瑕佺湅" + n + "涓柊闂?)
      //鏂伴椈鏁伴噺鏄惁瓒冲
      let enough = true;
      //鑾峰彇閲嶈鏂伴椈
      $.ajax({
            type: "GET",
            url: NewsUrl1,
            dataType: "json",
            success: function (data) {
                let j = 0;
                if (n == 6) {//濡傛灉浠婂ぉ杩樻病瀛﹁繃锛屽垯浼樺厛鎵句粖澶╃殑鏂伴椈
                  for (let i = 0; i < n; i++) {
                        //濡傛灉鏈夊綋澶╂棩鏈熺殑,鍒欏姞鍏?                        if (data.auditTime.indexOf(currDate) != -1) {
                            news.push(data);
                            j++;
                        } else {//鍚﹀垯璺冲嚭寰幆
                            break;
                        }
                  }
                }
                for (j; j < n; j++) {
                  let temp = parseInt(Math.random() * (data.length + 1), 10);
                  news.push(data);
                }
                resolve('done');
            },
            error: function () {
                news = null;
                resolve('done');
            }
      });
    });
}
//鑾峰彇瑙嗛鍒楄〃
function getVideos() {
    return new Promise(resolve => {
      videos = new Array();
      let n = 6;
      if (videoNum < 6) {//濡傛灉闇€瑕佸涔犵殑瑙嗛鏁伴噺涓嶅埌6锛屼篃灏辨槸宸茬粡瀛﹁繃浜嗭紝浣嗘槸绉垎涓嶅锛岃ˉ鐨?            n = videoNum;
      }
      console.log("杩橀渶瑕佺湅" + n + "涓棰?)
      $.ajax({
            type: "GET",
            url: VideosUrl1,
            dataType: "json",
            success: function (data) {
                let j = 0;
                if (n == 6) {
                  for (let i = 0; i < n; i++) {
                        //濡傛灉鏈夊綋澶╂棩鏈熺殑,鍒欏姞鍏?                        if (data.auditTime.indexOf(currDate) != -1) {
                            videos.push(data);
                            j++;
                        } else {//鍚﹀垯璺冲嚭寰幆
                            break;
                        }
                  }
                }
                for (j; j < n; j++) {
                  let temp = parseInt(Math.random() * (data.length + 1), 10);
                  videos.push(data);
                }
                resolve('done');
            },
            error: function () {
                videos = [];
                resolve('done');
            }
      });
    });
}
//鐪嬪涔犺棰?async function watchVideo() {
    await getVideos();
    for (let i = 0; i < videos.length; i++) {
      GM_setValue('watchingUrl', videos.url);
      console.log("姝e湪瑙傜湅绗? + (i + 1) + "涓棰?);
      let newPage = GM_openInTab(videos.url, { active: true, insert: true, setParent: true })
      await waitingClose(newPage);
      await waitRandomBetween(1, 3);
    }
}
//鍋氭瘡鏃ョ瓟棰?function doExamPractice() {
    return new Promise(resolve => {
      console.log("姝e湪瀹屾垚姣忔棩绛旈")
      let newPage = GM_openInTab(ExamPracticeUrl, { active: true, insert: true, setParent: true });
      let doing = setInterval(function () {
            if (newPage.closed) {
                clearInterval(doing);//鍋滄瀹氭椂鍣?                resolve('done');
            }
      }, 1000);
    });
}

//fix code = 429
async function waitingDependStartTime(startTime) {
    let remainms = Date.now() - startTime;
    if (remainms < ratelimitms) {
      let second = (ratelimitms - remainms) / 1000
      await waitRandomBetween(second + 1, second + 3)
    }
}
//鍒濆鍖栦笓椤圭瓟棰樻€婚〉鏁板睘鎬?async function InitExamPaperAttr() {
    let startTime = Date.now();
    var data = await getExamPaperByPageNo(1); // 榛樿浠庣涓€椤佃幏鍙栧叏閮ㄩ〉灞炴€?    if (data) {
      // 鍒濆鍖栨€婚〉鐮?      examPaperTotalPageCount = data.totalPageCount;
      // 鑻ヤ笓椤圭瓟棰橀€嗗簭, 鍒欎粠鏈€鍚庝竴椤靛紑濮?      if (examPaperReverse) {
            examPaperPageNo = examPaperTotalPageCount;
      }
    }
    await waitingDependStartTime(startTime);
}

//鑾峰彇鎸囧畾椤垫暟鐨勪笓椤圭瓟棰樺垪琛?function getExamPaperByPageNo(examPaperPageNoParam) {
    return new Promise(function (resolve) {
      $.ajax({
            type: "GET",
            url: ExamPaperListUrl.replace("{pageNo}", examPaperPageNoParam),
            xhrFields: {
                withCredentials: true //濡傛灉娌℃湁杩欎釜璇锋眰澶辫触
            },
            dataType: "json",
            success: function (data) {
                data = decodeURIComponent(escape(window.atob(data.data_str.replace(/-/g, "+").replace(/_/g, "/"))));
                //JSON鏍煎紡鍖?                data = JSON.parse(data);
                resolve(data);
            },
            error: function () {
                resolve(new Array());
            }
      });
    })
}

//鏌ヨ涓撻」绛旈鍒楄〃鐪嬬湅杩樻湁娌℃湁娌″仛杩囩殑锛屾湁鍒欒繑鍥瀒d
async function findExamPaper() {
    var continueFind = true;
    var examPaperId = null;
    console.log("鍒濆鍖栦笓椤圭瓟棰樺睘鎬?);
    await InitExamPaperAttr();
    console.log("姝e湪瀵绘壘鏈畬鎴愮殑涓撻」绛旈");
    while (continueFind) {
      let startTime = Date.now();

      await getExamPaperByPageNo(examPaperPageNo).then(async (data) => {
            if (data) {
                let examPapers = data.list;//鑾峰彇涓撻」绛旈鐨勫垪琛?                if (examPaperReverse) {
                  // 鑻ュ紑鍚€嗗簭绛旈, 鍒欏弽杞笓椤圭瓟棰樺垪琛?                  console.log("涓撻」绛旈,寮€鍚€嗗簭妯″紡,浠庢渶鏃╃殑棰樼洰寮€濮嬬瓟棰?);
                  examPapers.reverse();
                }
                for (let j = 0; j < examPapers.length; j++) {
                  //閬嶅巻鏌ヨ鏈夋病鏈夋病鍋氳繃鐨?                  if (examPapers.status != 2) {//status锛?1涓?寮€濮嬬瓟棰? , 2涓?閲嶆柊绛旈"
                        //濡傛灉涓嶆槸"閲嶆柊绛旈"锛屽垯鍙互鍋?                        examPaperId = examPapers.id;
                        continueFind = false;
                        break;
                  }
                }
                if (!continueFind) {
                } else {
                  //澧炲姞椤电爜 (鑻ュ紑鍚€嗗簭缈婚〉, 鍒欏噺灏戦〉鐮?
                  examPaperPageNo += examPaperReverse ? -1 : 1;
                  if (examPaperTotalPageCount == null
                        || examPaperPageNo > examPaperTotalPageCount
                        || examPaperPageNo < 1) {
                        //宸茬粡鎵惧畬鎵€鏈夐〉鐮侊紝杩樻槸娌℃壘鍒帮紝涓嶅啀缁х画鏌ユ壘
                        continueFind = false;
                  }
                }
            } else {
                continueFind = false;
            }
            //fix code = 429
            await waitingDependStartTime(startTime);
      })
    }
    return examPaperId;
}

//鍋氫笓椤圭瓟棰?function doExamPaper() {
    return new Promise(function (resolve) {
      //鏌ユ壘鏈夋病鏈夋病鍋氳繃鐨勪笓椤圭瓟棰橈紝鏈夊垯杩斿洖ID
      findExamPaper().then(examPaperId => {
            if (examPaperId != null) {
                console.log("姝e湪鍋氫笓椤圭瓟棰?)
                let newPage = GM_openInTab(ExamPaperUrl.replace("{id}", examPaperId), { active: true, insert: true, setParent: true });
                let doing = setInterval(function () {
                  if (newPage.closed) {
                        clearInterval(doing);//鍋滄瀹氭椂鍣?                        resolve('done');
                  }
                }, 1000);
            } else {
                console.log("娌℃湁鎵惧埌鏈畬鎴愮殑涓撻」绛旈锛岃烦杩?)
                resolve('noTest');
            }
      });
    })
}

//鍒濆鍖栨瘡鍛ㄧ瓟棰樻€婚〉鏁板睘鎬?async function InitExamWeeklyAttr() {
    let startTime = Date.now();
    var data = await getExamWeeklyByPageNo(1); // 榛樿浠庣涓€椤佃幏鍙栧叏閮ㄩ〉灞炴€?    if (data) {
      // 鍒濆鍖栨€婚〉鐮?      examWeeklyTotalPageCount = data.totalPageCount;
      // 鑻ユ瘡鍛ㄧ瓟棰橀€嗗簭, 鍒欎粠鏈€鍚庝竴椤靛紑濮?      if (examWeeklyReverse) {
            examWeeklyPageNo = examWeeklyTotalPageCount;
      }
    }
    await waitingDependStartTime(startTime);
}

//鑾峰彇鎸囧畾椤垫暟鐨勬瘡鍛ㄧ瓟棰樺垪琛?function getExamWeeklyByPageNo(examWeeklyPageNoParam) {
    return new Promise(function (resolve) {
      $.ajax({
            type: "GET",
            url: ExamWeeklyListUrl.replace("{pageNo}", examWeeklyPageNoParam),
            xhrFields: {
                withCredentials: true //濡傛灉娌℃湁杩欎釜璇锋眰澶辫触
            },
            dataType: "json",
            success: function (data) {
                data = decodeURIComponent(escape(window.atob(data.data_str.replace(/-/g, "+").replace(/_/g, "/"))));
                //JSON鏍煎紡鍖?                data = JSON.parse(data);
                resolve(data);
            },
            error: function () {
                resolve(new Array());
            }
      });
    })
}

//鏌ヨ姣忓懆绛旈鍒楄〃鐪嬬湅杩樻湁娌℃湁娌″仛杩囩殑锛屾湁鍒欒繑鍥瀒d
async function findExamWeekly() {
    var continueFind = true;
    var examWeeklyId = null;
    console.log("鍒濆鍖栨瘡鍛ㄧ瓟棰?);
    await InitExamWeeklyAttr();
    console.log("姝e湪瀵绘壘鏈畬鎴愮殑姣忓懆绛旈");
    while (continueFind) {
      let startTime = Date.now();
      await getExamWeeklyByPageNo(examWeeklyPageNo).then(async (data) => {
            if (data) {
                if (examWeeklyReverse) {
                  // 鑻ュ紑鍚€嗗簭绛旈, 鍒欏弽杞垪琛?                  console.log("姣忓懆绛旈,寮€鍚€嗗簭妯″紡,浠庢渶鏃╃殑棰樼洰寮€濮嬬瓟棰?);
                  data.list.reverse();
                }
                for (let i = 0; i < data.list.length; i++) {
                  let examWeeks = data.list.practices;//鑾峰彇姣忓懆鐨勬祴璇曞垪琛?                  if (examWeeklyReverse) {
                        // 鑻ュ紑鍚€嗗簭, 鍒欏弽杞瘡鍛ㄧ殑娴嬭瘯鍒楄〃
                        examWeeks.reverse();
                  }
                  for (let j = 0; j < examWeeks.length; j++) {
                        //閬嶅巻鏌ヨ鏈夋病鏈夋病鍋氳繃鐨?                        if (examWeeks.status != 2) {//status锛?1涓?寮€濮嬬瓟棰? , 2涓?閲嶆柊绛旈"
                            //濡傛灉涓嶆槸"閲嶆柊绛旈"锛屽垯鍙互鍋?                            examWeeklyId = examWeeks.id;
                            continueFind = false;
                            break;
                        }
                  }
                  if (!continueFind) {
                        //濡傛灉宸茬粡鎵惧埌浜嗭紝鍒欓€€鍑哄惊鐜?                        break;
                  }
                }
                if (!continueFind) {
                } else {
                  //澧炲姞椤电爜
                  examWeeklyPageNo += examWeeklyReverse ? -1 : 1;
                  if (examWeeklyTotalPageCount == null
                        || examWeeklyPageNo > examWeeklyTotalPageCount
                        || examWeeklyPageNo < 1) {
                        //宸茬粡鎵惧畬鎵€鏈夐〉鐮侊紝杩樻槸娌℃壘鍒帮紝涓嶅啀缁х画鏌ユ壘
                        continueFind = false;
                  }
                }
            } else {
                continueFind = false;
            }

            //fix code = 429
            await waitingDependStartTime(startTime);
      })
    }
    return examWeeklyId;
}
//鍋氭瘡鍛ㄧ瓟棰?function doExamWeekly() {
    return new Promise(function (resolve) {
      //鏌ユ壘鏈夋病鏈夋病鍋氳繃鐨勬瘡鍛ㄦ祴璇曪紝鏈夊垯杩斿洖ID
      //examWeeklyId = 147;//娴嬭瘯棰樼洰
      findExamWeekly().then(examWeeklyId => {
            if (examWeeklyId != null) {
                console.log("姝e湪鍋氭瘡鍛ㄧ瓟棰?)
                let newPage = GM_openInTab(ExamWeeklyUrl.replace("{id}", examWeeklyId), { active: true, insert: true, setParent: true });
                let doing = setInterval(function () {
                  if (newPage.closed) {
                        clearInterval(doing);//鍋滄瀹氭椂鍣?                        resolve('done');
                  }
                }, 1000);
            } else {
                console.log("娌℃湁鎵惧埌鏈畬鎴愮殑姣忓懆绛旈锛岃烦杩?)
                resolve('noTest');
            }
      });
    })
}
//鑾峰彇绛旈鎸夐挳
function getNextButton() {
    return new Promise(function (resolve) {
      let nextInterVal = setInterval(() => {
            let nextAll = document.querySelectorAll(".ant-btn");
            let next = nextAll;
            if (nextAll.length == 2) {
                next = nextAll;
            }
            if (next.textContent) {
                clearInterval(nextInterVal);//鍋滄瀹氭椂鍣?                resolve(next);
            }
      }, 800);
    })
}
//鏆傚仠閿?function doingPause() {
    return new Promise(function (resolve) {
      let doing = setInterval(function () {
            if (!pause) {
                clearInterval(doing);//鍋滄瀹氭椂鍣?                resolve('done');
            }
            console.log("绛夊緟")
      }, 500);
    })
}
//绛旈杩囩▼(鏁村悎)
async function doingExam() {
    let nextButton = null;
    let qNum = 0;//棰樺彿,绗竴棰樹粠0寮€濮嬬畻
    let shouldSaveAnswer = false;
    while (true) {
      //鍏堢瓑绛夊啀寮€濮嬪仛棰?      await waitRandomBetween(2, 5);
      await doingPause();
      nextButton = await getNextButton();
      if (document.getElementsByClassName('nc_iconfont btn_slide') != null) {
            dragandDrop(document.getElementsByClassName('nc_iconfont btn_slide'), 0, 0, 300);
      }
      if (nextButton.textContent == "鍐嶇粌涓€娆? || nextButton.textContent == "鍐嶆潵涓€缁? || nextButton.textContent == "鏌ョ湅瑙f瀽") {
            break;
      }
      try {
            document.querySelector(".tips").click();
      } catch (e) {
            console.log(e);
      }
      //鎵€鏈夋彁绀?      var allTips = document.querySelectorAll("font");
      await waitRandomBetween(2, 3);
      //閫夐」鎸夐挳
      var allbuttons = document.querySelectorAll(".q-answer");
      //鑾峰彇鎵€鏈夊~绌?      var blanks = document.querySelectorAll("input");
      try {
            //鑾峰彇闂绫诲瀷
            var questionType = document.querySelector(".q-header").textContent;
            questionType = questionType.substr(0, 3)
      } catch (e) {
      }
      var results = [];
      switch (questionType) {
            case "濉┖棰?: {
                //绗嚑涓~绌?                var inputBubblesEvent = new Event('input', { bubbles: true });
                if (blanks.length > 1) {//濡傛灉鏈夊涓~绌?                  if (allTips.length == 0) {//濡傛灉娌℃湁鎻愮ず锛屽厛鑾峰彇鐪嬬湅鏈夋病鏈夌瓟妗?                        try {//灏濊瘯鐐瑰嚮瑙嗛鎾斁鎸夐挳,鎾笉鎾兘娌″叧绯?                            document.getElementsByClassName("outter").click();
                        } catch (e) { }
                        //鐢熸垚绉橀挜
                        let key = getKey();
                        //灏濊瘯鑾峰彇绛旀
                        let answerData = await getAnswer(key);
                        if (answerData.status == 0 || answerData == "error") {//娌℃湁绛旀
                            for (let i = 0; i < blanks.length; i++) {//娌$瓟妗堬紝闅忎究濉偣涓滆タ
                              blanks.setAttribute("value", i);
                              //蹇呴』瑕侀樆姝簨浠讹紝涓嶇劧鏃犳晥
                              blanks.dispatchEvent(inputBubblesEvent);
                            }
                            shouldSaveAnswer = true;//绛斿畬淇濆瓨绛旀
                        } else {//鑾峰彇鍒颁簡绛旀
                            //鏍煎紡鍖?                            answerData = JSON.parse(answerData.data.txt_content);
                            answerData = answerData.content;
                            //鍥犱负鏈夊涓┖锛屾墍浠ユ湁澶氫釜绛旀锛屽厛鍒囧壊
                            answerData = answerData.split(";");
                            for (let i = 0; i < answerData.length; i++) {//灏嗙瓟妗堝~鍏?                              blanks.setAttribute("value", answerData);
                              blanks.dispatchEvent(inputBubblesEvent);
                            }
                        }
                  } else if (allTips.length == blanks.length) {
                        //濡傛灉濉┖鏁伴噺鍜屾彁绀烘暟閲忎竴鑷?                        for (let i = 0; i < allTips.length; i++) {
                            //灏嗙瓟妗堝~鍐欏埌瀵瑰簲鐨勭┖涓?                            let answer = allTips.textContent;
                            if (answer && answer.length > 0) {
                              blanks.setAttribute("value", answer);
                              blanks.dispatchEvent(inputBubblesEvent);
                            } else {
                              //鍙戠敓浜嗛敊璇紝鍙ソ闅忎究濉竴涓?                              blanks.setAttribute("value", i);
                              blanks.dispatchEvent(inputBubblesEvent);
                            }
                        }
                  } else if (allTips.length > blanks.length) {
                        //鑻ユ彁绀烘暟閲忔瘮濉┖鐨勬暟閲忓
                        //鐩存帴灏嗘墍鏈夌瓟妗堟暣鍚堝~杩涘幓
                        let answer = "";
                        for (let i = 0; i < allTips.length; allTips++) {
                            answer += allTips.textContent();
                        }
                        for (let j = 0; j < blanks.length; j++) {
                            blanks.setAttribute("value", answer);
                            blanks.dispatchEvent(inputBubblesEvent);
                        }
                  } else {
                        //涓€鑸笉浼氳窇鍒拌繖锛屽鏋滃埌杩欎簡杈撳嚭涓€涓嬶紝琛ㄧず鎯婅
                        console.log("灞呯劧璺戝埌浜嗚繖閲?)
                  }
                } else if (blanks.length == 1) {//鍙湁涓€涓┖锛岀洿鎺ユ妸鎵€鏈塼ips鍚堝苟銆?                  let answer = "";
                  if (allTips.length != 0) {//濡傛灉鏈夋彁绀?                        for (let i = 0; i < allTips.length; i++) {
                            answer += allTips.textContent;
                        }
                  } else {
                        try {//灏濊瘯鐐瑰嚮瑙嗛鎾斁鎸夐挳,涓嶈繃鎾笉鎾兘娌″叧绯?                            document.querySelector('video').play();
                        } catch (e) { }
                        let key = getKey();
                        let answerData = await getAnswer(key);
                        if (answerData.status == 0 || answerData == "error") {
                            //娌℃湁鑾峰彇鍒扮瓟妗?                            answer = "涓嶇煡閬?;
                            //娌℃湁鍏朵粬浜哄仛杩囪繖閬撹棰戦锛屾墍浠ラ渶瑕佺瓟瀹屼繚瀛樼瓟妗堬紝杩欐牱鍏朵粬浜洪亣鍒板氨鑳藉仛瀵?                            shouldSaveAnswer = true;
                        } else {
                            //鏈夌瓟妗?                            answerData = JSON.parse(answerData.data.txt_content);
                            answer = answerData.content;
                        }
                  }
                  blanks.setAttribute("value", answer);
                  blanks.dispatchEvent(inputBubblesEvent);
                  break;
                }
                else {
                  //鎬曟湁娌$┖鐧界殑鎯呭喌銆?                }
                break;
            }
            case "澶氶€夐": {
                results = [];
                let hasButton = false;
                for (let i = 0; i < allTips.length; i++) {
                  let tip = allTips;
                  let answer = tip.textContent;
                  if (answer && answer.length > 0) {
                        for (let j = 0; j < allbuttons.length; j++) {
                            //鑾峰彇鎸夐挳
                            let selectButton = allbuttons;
                            //鑾峰彇鎸夐挳鐨勪笂鐨勭瓟妗?                            let buttonAnswer = selectButton.textContent;
                            if (buttonAnswer == answer || buttonAnswer.indexOf(answer) != -1 || answer.indexOf(buttonAnswer) != -1) {
                              hasButton = true;
                              if (!$(selectButton).hasClass("chosen")) {
                                    selectButton.click();
                              }
                              break;
                            }
                        }
                  }
                }
                if (!hasButton) {
                  allbuttons.click();
                }
                break;
            }
            case "鍗曢€夐": {
                let results = [];
                let answer = "";
                for (let i = 0; i < allTips.length; i++) {
                  answer += allTips.textContent;
                }
                if (answer && answer.length > 0) {
                  let hasButton = false;
                  for (let i = 0; i < allbuttons.length; i++) {
                        let radioButton = allbuttons;
                        let buttonAnswer = radioButton.textContent;
                        //瀵规瘮绛旀
                        if (buttonAnswer == answer || buttonAnswer.indexOf(answer) != -1 || answer.indexOf(buttonAnswer) != -1) {
                            hasButton = true;
                            radioButton.click();
                            break;
                        }
                  }
                  if (!hasButton) {
                        //娌℃壘鍒版寜閽紝闅忎究閫変竴涓?                        allbuttons.click();
                  }
                } else {
                  //娌$瓟妗堬紝闅忎究閫変竴涓?                  try {
                        allbuttons.click();
                  } catch(e) {
                        console.log(e);
                  }
                }
                break;
            }
            default:
                break;
      }
      qNum++;
      nextButton = await getNextButton();
      if (nextButton.textContent != "鍐嶇粌涓€娆? && nextButton.textContent != "鍐嶆潵涓€缁? && nextButton.textContent != "鏌ョ湅瑙f瀽") {
            nextButton.click();
            if (shouldSaveAnswer) {//濡傛灉搴旇淇濆瓨绛旀
                let key = getKey();//鑾峰彇key
                let answerTemp = document.getElementsByClassName("answer").innerText;
                let reg = new RegExp(' ', "g")
                let answer = "";
                try {//浠庡瓧绗︿覆涓嬁鍑虹瓟妗?                  answer = answerTemp.split("锛?);
                  answer = answer.replace(reg, ";");
                } catch (e) {
                  answer = answerTemp;
                }
                await saveAnswer(key, answer);
                shouldSaveAnswer = false;
            }
      } else {
            //宸茬粡鍋氬畬锛岃烦鍑哄惊鐜?            break;
      }
    }
    closeWin();
}
//鑾峰彇鍏抽敭瀛?function getKey() {
    //鑾峰彇棰樼洰鐨勬枃鏈唴瀹?    let key = document.getElementsByClassName("q-body").innerText;
    //澶栭儴寮曠敤md5鍔犲瘑
    key = md5(key);
    console.log(key)
    return key;
}
//淇濆瓨绛旀
function saveAnswer(key, value) {
    return new Promise(function (resolve) {
      value = [{ "title": key, "content": value }];
      value = JSON.stringify(value);
      $.ajax({
            type: "POST",
            url: AnswerSaveUrl,
            data: {
                txt_name: key,
                txt_content: value,
                password: "",
                v_id: ""
            },
            dataType: "json",
            success: function (data) {
                resolve(data);
            },
            error: function () {
                resolve("error");
            }
      });
    })
}
//鑾峰彇绛旀
function getAnswer(key) {
    return new Promise(function (resolve) {
      $.ajax({
            type: "POST",
            url: AnswerDetailUrl,
            data: {
                txt_name: key,
                password: ""
            },
            dataType: "json",
            success: function (data) {
                resolve(data);
            },
            error: function () {
                resolve("error");
            }
      });
    })
}
//鍘婚櫎绛旈楠岃瘉
function cancelVerify() {
    try {
      let verifyBox = document.getElementById("nc_mask");
      verifyBox.id = "egg_nc_mask";
      verifyBox.innerHTML = "";
      verifyBox.remove();
    } catch (e) {
      console.log("鍘婚櫎楠岃瘉澶辫触");
    }
}
//鏌ヨ浠婃棩瀹屾垚鎯呭喌
function getToday() {
    return new Promise(function (resolve) {
      $.ajax({
            type: "GET",
            url: SearchSocreUrl,
            xhrFields: {
                withCredentials: true //濡傛灉娌℃湁杩欎釜璇锋眰澶辫触
            },
            dataType: "json",
            success: function (temp) {
                resolve(temp.data.taskProgress);
            },
            error: function () {
                resolve(new Array());
            }
      });
    })
}
//鍒濆鍖栭厤缃?function initSetting() {
    try {
      let settingTemp = JSON.parse(GM_getValue('studySetting'));
      if (settingTemp != null && Object.prototype.toString.call(settingTemp) === '') {
            // 澧炲姞鍒ゆ柇鏄惁涓烘棫鏁扮粍绫诲瀷缂撳瓨
            settings = settingTemp;
      } else {
            settings = JSON.parse(JSON.stringify(settingsDefault));
      }
    } catch (e) {
      //娌℃湁鍒欑洿鎺ュ垵濮嬪寲
      settings = JSON.parse(JSON.stringify(settingsDefault));
    }
}
//鍒涘缓鈥滄墜鍔ㄧ瓟棰樷€濇寜閽?function createManualButton() {
    let title = document.getElementsByClassName("title");
    let manualButton = document.createElement("button");
    manualButton.setAttribute("id", "manualButton");
    manualButton.innerText = "鍏抽棴鑷姩绛旈";
    manualButton.className = "egg_auto_btn";
    //娣诲姞浜嬩欢鐩戝惉
    try {// Chrome銆丗ireFox銆丱pera銆丼afari銆両E9.0鍙婂叾浠ヤ笂鐗堟湰
      manualButton.addEventListener("click", clickManualButton, false);
    } catch (e) {
      try {// IE8.0鍙婂叾浠ヤ笅鐗堟湰
            manualButton.attachEvent('onclick', clickManualButton);
      } catch (e) {// 鏃╂湡娴忚鍣?            console.log("涓嶅涔犱綍浠ュ己鍥絜rror: 鎵嬪姩绛旈鎸夐挳缁戝畾浜嬩欢澶辫触")
      }
    }
    //鎻掑叆鑺傜偣
    title.parentNode.insertBefore(manualButton, title.nextSibling);
}
//鐐瑰嚮鎵嬪姩瀛︿範鎸夐挳
function clickManualButton() {
    let manualButton = document.getElementById("manualButton");
    if (manualButton.innerText == "鍏抽棴鑷姩绛旈") {
      manualButton.innerText = "寮€鍚嚜鍔ㄧ瓟棰?;
      manualButton.className = "egg_manual_btn";
      pause = true;
    } else {
      manualButton.innerText = "鍏抽棴鑷姩绛旈";
      manualButton.className = "egg_auto_btn";
      pause = false;
    }
}
//鍒涘缓鈥滃紑濮嬪涔犫€濇寜閽拰閰嶇疆
function createStartButton() {
    let base = document.createElement("div");
    var baseInfo = "";
    baseInfo += "<form id=\"settingData\" class=\"egg_menu\" action=\"\" target=\"_blank\" onsubmit=\"return false\"><div class=\"egg_setting_box\"><div class=\"egg_setting_item\"><label>鏂伴椈<\/label><input class=\"egg_setting_switch\" type=\"checkbox\" name=\"News\" " + (settings.News ? 'checked' : '') + "\/>                                <\/div>                                <div class=\"egg_setting_item\">                                        <label>瑙嗛<\/label>                                        <input class=\"egg_setting_switch\" type=\"checkbox\" name=\"Video\" " + (settings.Video ? 'checked' : '') + "\/>                                <\/div>                                <div class=\"egg_setting_item\">                                        <label>姣忔棩绛旈<\/label>                                        <input class=\"egg_setting_switch\" type=\"checkbox\" name=\"ExamPractice\" " + (settings.ExamPractice ? 'checked' : '') + "\/>                                <\/div>        <div class=\"egg_setting_item\">                                        <label>涓撻」缁冧範<\/label>                                        <input class=\"egg_setting_switch\" type=\"checkbox\" name=\"ExamPaper\" " + (settings.ExamPaper ? 'checked' : '') + "\/><\/div><hr \/><div title='Tip:寮€濮嬪涔犲悗锛岄殣钘忕浉鍏抽〉闈㈠拰鎻愮ず锛堜笉闅愯棌绛旈涓殑鍏抽棴鑷姩绛旈鎸夐挳锛? class=\"egg_setting_item\"> <label>杩愯闅愯棌<\/label> <input class=\"egg_setting_switch\" type=\"checkbox\" name=\"ShowMenu\"" + (settings.ShowMenu ? 'checked' : '') + "/></div>" +
      "<div title='Tip:杩涘叆瀛︿範棣栭〉5绉掑悗鑷姩寮€濮嬪涔? class=\"egg_setting_item\"> <label>鑷姩寮€濮?\/label> <input class=\"egg_setting_switch\" type=\"checkbox\" name=\"AutoStart\"" + (settings.AutoStart ? 'checked' : '') + "/></div>"
      +
      "<a style=\"text-decoration: none;\" title=\"瑙嗛涓嶈嚜鍔ㄦ挱鏀撅紵鐐规鏌ョ湅瑙e喅鍔炴硶\" target=\"blank\" href=\"https://docs.qq.com/doc/DZllGcGlJUG1qT3Vx\"><div style=\"color:#5F5F5F;font-size:14px;\" class=\"egg_setting_item\"><label style=\"cursor: pointer;\">瑙嗛涓嶈嚜鍔ㄦ挱鏀?<\/label><\/div><\/a><\/div><\/form>";
    base.innerHTML = baseInfo;
    let body = document.getElementsByTagName("body");
    body.append(base)
    let startButton = document.createElement("button");
    startButton.setAttribute("id", "startButton");
    startButton.innerText = "寮€濮嬪涔?;
    startButton.className = "egg_study_btn egg_menu";
    //娣诲姞浜嬩欢鐩戝惉
    try {// Chrome銆丗ireFox銆丱pera銆丼afari銆両E9.0鍙婂叾浠ヤ笂鐗堟湰
      startButton.addEventListener("click", start, false);
    } catch (e) {
      try {// IE8.0鍙婂叾浠ヤ笅鐗堟湰
            startButton.attachEvent('onclick', start);
      } catch (e) {// 鏃╂湡娴忚鍣?            console.log("涓嶅涔犱綍浠ュ己鍥絜rror: 寮€濮嬪涔犳寜閽粦瀹氫簨浠跺け璐?)
      }
    }
    //鎻掑叆鑺傜偣
    body.append(startButton)

    if (settings.AutoStart) {
      setTimeout(() => {
            if (startButton.innerText === "寮€濮嬪涔?) {
                start()
            }
      }, 5000)
    }
}
//淇濆瓨閰嶇疆
function saveSetting() {
    let form = document.getElementById("settingData");
    let formData = new FormData(form);
    settings.News = (formData.get('News') != null);
    settings.Video = (formData.get('Video') != null);
    settings.ExamPractice = (formData.get('ExamPractice') != null);
    settings.ExamWeekly = (formData.get('ExamWeekly') != null);
    settings.ExamPaper = (formData.get('ExamPaper') != null);
    settings.ShowMenu = (formData.get('ShowMenu') != null);//杩愯鏃舵槸鍚﹁闅愯棌
    settings.AutoStart = (formData.get('AutoStart') != null);//鏄惁鑷姩鍚姩
    GM_setValue('studySetting', JSON.stringify(settings));
}
//鏄惁鏄剧ず鐩綍
function showMenu(isShow = true) {
    let items = document.getElementsByClassName("egg_menu");
    for (let i = 0; i < items.length; i++) {
      items.style.display = isShow ? "block" : "none";
    }
}
//寮€濮?async function start() {
    //淇濆瓨閰嶇疆
    console.log("鍒濆鍖?..")
    saveSetting();
    let loggedBox = document.querySelectorAll("a");
    console.log("妫€鏌ユ槸鍚︾櫥褰?..")
    if (loggedBox && loggedBox.innerText) {
      let startButton = document.getElementById("startButton");
      startButton.innerText = "姝e湪瀛︿範";
      startButton.style.cursor = "default";
      startButton.setAttribute("disabled", true);
      if (settings.ShowMenu) {
            showMenu(false);
      }
      let taskProgress = null;
      let continueToDo = true;
      let tasks =
      while (continueToDo) {
            //鏌ヨ浠婂ぉ杩樻湁浠€涔堜换鍔℃病鍋氬畬
            console.log("妫€鏌ヤ粖澶╄繕鏈変粈涔堜换鍔℃病鍋氬畬")
            taskProgress = await getToday();
            if (taskProgress != null) {
                console.log("寮€濮嬪涔?)

                // 鏄剧ず鐩墠寰楀垎
                /*
                let eggSettingItems = document.getElementsByClassName("egg_setting_item");
                console.log(eggSettingItems.children.innerHTML);
                eggSettingItems.children.innerHTML += ' ' + taskProgress.currentScore + '/' + taskProgress.dayMaxScore;
                eggSettingItems.children.innerHTML += ' ' + ( taskProgress.currentScore + taskProgress.currentScore ) + '/' + ( taskProgress.dayMaxScore + taskProgress.dayMaxScore );
                eggSettingItems.children.innerHTML += ' ' + taskProgress.currentScore + '/' + taskProgress.dayMaxScore;
                eggSettingItems.children.innerHTML += ' ' + taskProgress.currentScore + '/' + taskProgress.dayMaxScore;
                */
                //妫€鏌ユ柊闂?                if (settings.News && taskProgress.currentScore != taskProgress.dayMaxScore) {
                  tasks = false;//鍙杩樻湁瑕佸仛鐨勶紝灏卞綋鍋氭病瀹屾垚
                  newsNum = taskProgress.dayMaxScore - taskProgress.currentScore;//杩橀渶瑕佺湅澶氬皯涓柊闂?                  console.log("1.鐪嬫柊闂?);
                  await readNews();
                } else {
                  tasks = true;
                }

                //妫€鏌ヨ棰?                let temp = parseInt(taskProgress.dayMaxScore - taskProgress.currentScore);
                let temp2 = parseInt(taskProgress.dayMaxScore - taskProgress.currentScore);
                if (settings.Video && (temp != 0 || temp2 != 0)) {
                  tasks = false;//鍙杩樻湁瑕佸仛鐨勶紝灏卞綋鍋氭病瀹屾垚
                  videoNum = temp > temp2 ? temp : temp2;//杩橀渶瑕佺湅澶氬皯涓棰?                  console.log("2.鐪嬭棰?);
                  await watchVideo();
                } else {
                  tasks = true;
                }

                //妫€鏌ユ瘡鏃ョ瓟棰?                if (settings.ExamPractice && taskProgress.currentScore != taskProgress.dayMaxScore) {
                  tasks = false;//鍙杩樻湁瑕佸仛鐨勶紝灏卞綋鍋氭病瀹屾垚
                  console.log("3.鍋氭瘡鏃ョ瓟棰?);
                  await doExamPractice();
                } else {
                  tasks = true;
                }
                tasks = true
                /*
                //妫€鏌ユ瘡鍛ㄧ瓟棰?                if (settings.ExamWeekly && taskProgress.currentScore == 0) {
                  tasks = false;//鍙杩樻湁瑕佸仛鐨勶紝灏卞綋鍋氭病瀹屾垚
                  console.log("4.鍋氭瘡鍛ㄧ瓟棰?);
                  let result = await doExamWeekly();
                  if (result == "noTest") {
                        //濡傛灉鏄叏閮藉畬鎴愪簡锛屽凡缁忔病鏈夎兘鍋氱殑浜?                        tasks = true;
                  }
                } else {
                  tasks = true;
                }*/

                //妫€鏌ヤ笓椤圭粌涔?                if (settings.ExamPaper && taskProgress.currentScore == 0) {
                  tasks = false;//鍙杩樻湁瑕佸仛鐨勶紝灏卞綋鍋氭病瀹屾垚
                  console.log("5.鍋氫笓椤圭粌涔?);
                  let result = await doExamPaper();
                  if (result == "noTest") {
                        //濡傛灉鏄叏閮藉畬鎴愪簡锛屽凡缁忔病鏈夎兘鍋氱殑浜?                        tasks = true;
                  }
                } else {
                  tasks = true;
                }

                if (tasks && tasks && tasks && tasks && tasks) {
                  //濡傛灉妫€鏌ラ兘鍋氬畬浜嗭紝灏变笉鐢ㄧ户缁簡
                  continueToDo = false;
                }
            } else {
                alert("鍙戠敓鎰忓閿欒")
                continueToDo = false;
            }
            console.log("continueToDo : " + continueToDo)
      }
      console.log("宸插畬鎴?)
      startButton.innerText = "宸插畬鎴?;
      startButton.style.color = "#c7c7c7";
      if (settings.ShowMenu) {
            showMenu()
      }
    } else {
      //鎻愰啋鐧诲綍
      // alert("璇峰厛鐧诲綍");

      //淇敼涓鸿烦杞埌鐧婚檰椤?      let loggedButton = document.querySelectorAll("a");
      loggedButton.click()
      setTimeout(() => {
            closeWin()
      }, 2000);
    }
    return false;
}

山雀 发表于 2023-3-19 18:29:25

油猴脚本.
链接:https://pan.baidu.com/s/1XhGQoz4D1u0OuCDOrEXW1Q?pwd=9ycs
提取码:9ycs
--来自百度网盘超级会员V7的分享

ps:中间的模拟拖动滑块操作等哥哥们优化加入随机数最好。

2054725871 发表于 2023-3-22 14:58:12

山雀 发表于 2023-3-19 18:29
油猴脚本.
链接:https://pan.baidu.com/s/1XhGQoz4D1u0OuCDOrEXW1Q?pwd=9ycs
提取码:9ycs


大佬这脚本还能用吗

迦治 发表于 2023-3-22 20:55:29

2054725871 发表于 2023-3-22 14:58
大佬这脚本还能用吗

用不了了

山雀 发表于 2023-3-23 09:58:51

迦治 发表于 2023-3-22 20:55
用不了了

链接:https://pan.baidu.com/s/1BALXPtrGOiOifVeTBSFv2A?pwd=6a0x
提取码:6a0x

山雀 发表于 2023-3-23 09:59:25

迦治 发表于 2023-3-22 20:55
用不了了

依然奔放

hutu7758 发表于 2023-3-23 11:05:43

迦治 发表于 2023-3-22 20:55
用不了了

点下更新能用
页: [1] 2
查看完整版本: 求学习强国软件