Greasy Fork is available in English.

永春县公务员局公共课继续教育平台

test

您查看的为 2019-07-22 00:47:15 UTC 提交的版本。查看 最新版本

// ==UserScript==
// @name         永春县公务员局公共课继续教育平台
// @namespace    www.tuziang.com/combat/1841.html
// @version      0.1
// @description  test
// @author       Tuziang
// @match        *://*.xy.59iedu.com/*
// @match        *://*.yc.fjlearning.com/*
// @grant        GM_setValue
// @grant        GM_getValue
// ==/UserScript==

(function () {
    'use strict';
    // Your code here...
    //展开表格
    var lists = []
    if (window.location.href.indexOf("http://xy.59iedu.com/Course/MyCourse/Index") != -1) {
        var chapters = document.getElementsByTagName("img")
        for (var i = 0; i < chapters.length; i++) {
            if (chapters[i].src.indexOf("xkarrowone.gif") != -1) {
                chapters[i].click()
            }
        }
        //在课程学习页面,获取所有链接
        window.setTimeout(function () {
            var links = document.getElementById("tabsLearning").getElementsByTagName("a")
            for (let i = 0; i < links.length; i++) {
                lists.push(links[i].getAttribute("href"))
                //alert(lists)
            }
            console.log(lists)
            //console.log(lists.join('-'))

            GM_setValue("string", lists.join('-'))
        }, 3000);

    }

    window.setTimeout(function () {
        var s = GM_getValue("string")
        //console.log(s)
        //console.log(typeof(s))

        lists = s.split('-')
        console.log(lists)
        setInterval(function () {

            //判断是否需要 跳转到下一节
            var current_course
            var current_medId
            if (learnMediaTime >= mediaTime) {
                current_course = lists.shift()
                current_medId = current_course.split("&medId=")[1]
                while (current_course.indexOf("medId") == -1 || current_medId <= window.location.href.split("&medId=")[1]) {
                    current_course = lists.shift()
                    current_medId = current_course.split("&medId=")[1]
                }
                location.href = "http://xy.59iedu.com" + current_course;

            }
        }, 2000)
    }, 4000);
})();