一、插件介绍:

      法宣在线刷积分、法宣在线刷题、法宣在线刷考试、法宣在线刷5000分

二、主要功能:

   1、自动刷积分

   2、自动刷题

   3、刷考试

   软件下载:https://wukongstudio.lanzoui.com/b01ic420d

   软件运行界面截图:

三、主要原理:

       主要是通过浏览器安装用户脚本管理器Tampermonkey,油猴脚本是一个浏览器扩展、油猴支持很多主流的浏览器,Chrome、Firefox等,实现了脚本的一次编写,到处运行了,编写脚本需要准备的知识有:HTML+Javascript+jQuery,再添加法宣在线脚本来实现自动刷积分、答题等。

四、部分代码:

function() {
    'use strict';

    // Your code here...

    let interval = null;

    function main(url) {
        if (/studycontent$/.test(url)) {
            const container = document.querySelector(".viewContainer");
            const leaves = document.querySelectorAll(".leaf-detail");
            console.log(leaves);
            for (let i = 0; i < leaves.length; i++) {
                const leaf = leaves.item(i);
                const is_shipin = leaf.querySelector(".icon--shipin");
                if (is_shipin) {
                    //                     console.log(leaf);
                    const time = leaf.querySelector(".progress-time .progress-wrap .item");
                    if(time.textContent.trim() !== "已完成") {
                        time.scrollIntoView();
                        container.scrollBy(0, -200);
                        console.log(time);
                        setTimeout(() => {
                            time.click();
                        }, 500);
                        break;
                    }
                }
            }
        }
        if (/video\/[0-9]+$/.test(url)) {
            interval = setInterval(() => {
                const video = document.querySelector("video");
                if (video.currentTime / video.duration === 1) {
                    console.log("视频已经结束");
                    history.back();
//                     document.querySelector(".f14.back.fl").click();
                    clearInterval(interval);
                } else {
                    console.log("继续监测视频是否结束");
                }
            },1000);
        }
    }

    function speed(){
        const video = document.querySelector("video");
        video.playbackRate = 4.0;
//         var speed = document.querySelector(".xt_video_player_common_list");
//         var speedChild = speed.firstChild;
//         speedChild.click();
//         console.log("Robot-开启4.0倍速");
    }

    console.log("法宣在线");
    const user_wrapper = document.querySelector(".user-wrapper");
    const btn = document.createElement("div");
    btn.classList.add("downloadbtn");
    const btn_icon = document.createElement("div");
    btn_icon.classList.add("el-badge", "item");
    const btn_icon_i = document.createElement("i");
    btn_icon_i.classList.add("icon--bofang1", "iconfont");
    btn_icon.appendChild(btn_icon_i);
    btn.appendChild(btn_icon);
    user_wrapper.prepend(btn);
    btn.addEventListener("click", () => {
        main(window.location.href);
    });
    //     main(window.location.href)
    //     console.log(window.onurlchange);
    if (window.onurlchange === null) {
        window.addEventListener("urlchange", (info) => {
            console.log(info);
            setTimeout(() => {
                main(info.url);
            }, 2000);
        });
    }

})();