Greasy Fork

Greasy Fork is available in English.

蓝天教育基础教育教师培训

蓝天 教育 基础教师培训 公需课

当前为 2023-06-24 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         蓝天教育基础教育教师培训
// @namespace    http://tampermonkey.net/
// @version      1.4
// @description  蓝天 教育 基础教师培训 公需课
// @author       空山新愚
// @match        https://v3.lt-edu.net/*
// @match        https://jstsgc.gdedu.gov.cn/*
// @match        https://preview.dccloud.com.cn/*
// @grant        none
// @license      MPL
// ==/UserScript==

window.onload = setTimeout(refresh,5000 * 60);
function refresh(){
    let hre = location.href;
    if (hre.includes("https://v3.lt-edu.net/student.html#/index/classStudy")) {
        location.reload(true);
    }
}

function click_item(){
    var enter = 'body > div.el-message-box__wrapper > div > div.el-message-box__btns > button.el-button.el-button--default.el-button--small.el-button--primary';
    if(document.querySelector(enter)){
        document.querySelector(enter).click();
    }
    setTimeout(click_item,300); //300 毫秒
}

function watch(){
    try {
        document.querySelector("video").play();
        document.querySelector("video").volume = 0;
        document.querySelector("video").playbackRate = 1;
    } catch (error) {setTimeout(watch, 300);}
    setTimeout(watch, 300);
}

function sleep(delay) {
    for(var t = Date.now(); Date.now() - t <= delay;);
}

var listLen = 0;

function getListCount(){
    let t = 0;
    if(document.getElementsByClassName('mb18 mt18 pr video')[document.getElementsByClassName('mb18 mt18 pr video').length - 1].childNodes[1].firstChild.children[0])
    {
        try{
            t = document.getElementsByClassName('mb18 mt18 pr video')[document.getElementsByClassName('mb18 mt18 pr video').length - 1].childNodes[1].firstChild.children[0].childElementCount;
        }catch(error){setTimeout(listLen = getListCount(), 3000);}
    }
    return t;
}

var flag_choose_item = false;
function choose(){
    try{
        listLen = getListCount();
        for(var i = 0; i < listLen; i++){
            var chooseNum;
            if((chooseNum = document.getElementsByClassName('mb18 mt18 pr video')[document.getElementsByClassName('mb18 mt18 pr video').length - 1].childNodes[1].firstChild.children[0].children[i].firstChild)){
                var videoStatu = chooseNum.children[2].className;
                if(videoStatu != 'video-status success'){
                    if(chooseNum.children[1].className != 'el-icon-video-play el-icon el-icon-video-pause'){
                        if(!flag_choose_item){
                            chooseNum.children[1].click();
                            click_item();
                            flag_choose_item = true;
                        }
                    }else{
                        flag_choose_item = false;
                    }
                    break;
                }
            }
        }
    }catch (error) {}
    setTimeout(choose_study, 1000);
}

function clickProject(){
    let hre = location.href;
    if(hre.includes("https://v3.lt-edu.net/student.html#/index/home")){
        if(document.getElementsByClassName('training-projectsButton')[0]){
            document.getElementsByClassName('training-projectsButton')[0].click();
        }
        else{
            setTimeout(clickProject, 1000);
        }
    }
}

var len;
function getLenCount(){
    let t = 0;
    try{
        t = document.getElementsByClassName('el-tree menuList_warp')[0].childElementCount - 1;
    }catch(error){setTimeout(listLen = getLenCount(), 3000);}
    return t;
}

function close_project(){
    let hre = location.href;
    if (hre.includes("https://v3.lt-edu.net/student.html#/project/index")){
        // window.open("about:blank","_self").close()
    }else{
        setTimeout(close_project, 300);
    }
}

function click_study(i){
    if(document.getElementsByClassName('project-courseButton')[i]){
        document.getElementsByClassName('project-courseButton')[i].click();
    }
}

var flag_choose = false;
function choose_study(){
    let hre = location.href;
    if (hre.includes("https://v3.lt-edu.net/student.html#/project/index")) {
        try{
            var project_main = document.getElementsByClassName('project-course')[0];
            var studyLen = project_main.childElementCount
            for(var i = 0; i < studyLen; i++){
                let studyProject = project_main.children[i].children[1].firstChild.children[1]
                let studyStatus = studyProject.textContent
                if(studyStatus != '已学习'){
                    if(!flag_choose){
                        click_study(i);
                        close_project();
                        flag_choose = true;
                    }
                    break;
                }
            }
        }catch(error){setTimeout(choose_study, 1000);}
    }
}


function readPaper(){
    let hre = location.href;
    if(document.getElementsByClassName('file-box-content')){
        let bookLen = document.getElementsByClassName('file-box-content').length;
        for(var i = 0; i < bookLen; i++){
            let bookNode = document.getElementsByClassName('file-box-content')[i];
            if(bookNode.children[1].textContent != '( 已完成 )'){
                bookNode.lastChild.click();
            }
        }
    }
}

function lop(){
    let hre = location.href;
    if (hre.includes("https://v3.lt-edu.net/student.html#/index/classStudy")) {
        try{
            len = getLenCount();
            for (let i = 0; i < len; i++){
                var treeProject = document.getElementsByClassName('nav_menu')[i];
                let isStudy = treeProject.firstChild.title
                if(isStudy == '已学习' && i == len - 1){
                    window.open('https://v3.lt-edu.net/student.html#/project/index', '_self');
                }
                if(isStudy == '已学习'){
                    continue;
                }
                let nowStudy = treeProject.children[1].className
                if(nowStudy == 'beyondConcealment ellipsis active'){
                    readPaper();
                    break;
                }else{
                    treeProject.click();
                    break;
                }
            }
            choose();
        }catch(error){}
    }
    setTimeout(lop, 2000);
}


window.onload =
    function do_see() {
    //视频播放页
    let hre = location.href;
    if(hre.includes("https://v3.lt-edu.net/student.html#/index/home")){
        clickProject();
    }else if (hre.includes("https://v3.lt-edu.net/student.html#/index/classStudy")) {
        lop();
        watch();
    }else if (hre.includes("https://v3.lt-edu.net/student.html#/project/index")) {
        choose_study();
    }
    setTimeout(do_see, 1000);
};