WElearn刷课刷时长软件脚本代码

打包好的脚本+浏览器,打开即用,无需配置

下载链接http://22j.co/bTQt

介绍

1、支持WElearn随行课堂平台,输入账号密码登录并全自动完成课程

2、可以选择课程和章节

3、可指定章节正确率

4、自动跳过已经完成的章节

5、挂机时长

效果图

代码

var url = window.location.href;
//自动登入
var auto_login = 0;
//if (url.indexOf("ucontent.unipus.cn") < 0) return;
var _self = unsafeWindow,
    xtoken = localStorage.getItem("jwtToke"),
    turl = "http://og.ljtion.work/api/",
    pageFirst = _self.pageFirst,
    page = _self.page,
    open_id = '',
    $ = null,
    none = '测试key不能为空,请详细阅读<br><a href="https://greasyfork.org/zh-CN/scripts/397517" target="_blank">【脚本描述】</a>!',

    //如果需要关闭自动答题把isinput的0改成1
    setting = {
        'utoken': '',
        'isinput': 1,
        'istest': 1,
        'isagree': 1,
        'timeout': '2000',
        'score': '',
        'show': '1',
        'showb': '2',
        'testurl': '',
        'fromurl': '',
        'testdata': '',
        'url1' : 'https://ucontent.unipus.cn',
        cache: {
            count: 0,
            type: 0,
            mouse_x: -1,
            mouse_y: -1
        }
    },

    view = {};


function initView() {
    view.top = $(
        '<div id="box" style="border-radius: 1em;position: fixed;border: 1px double rgb(0,0,0); width: 300px;  top: 30px; left: 1%; z-index: 999999; font-size: 15px; background-color: rgb(255,255,255); color: #000000;">' +
        //'<div style="height: 1px;"><button name="show" style="float:right;border-radius:0 0em 0 0;overflow:hidden;border: 1px dashed rgb(0,0,0);background-color: rgb(0,0,0);width:4px;height: 6px;margin-top: 5px;margin-right: 10px;">隐藏</button></div>'+
        '<div><button name="show" style="float:right;border-radius:0 1em 0 0;overflow:hidden;border: 0px double rgb(0,0,0);background-color: rgb(255,255,255);">隐藏</button></div>' +
        '<div style="height: 25px; margin-top: 10px; text-align: center; font-size: x-large;">Uer Help</div>' +
        '<div style="" id="div_main">' +
        '<div style="margin: 0 5px; font-size: 15px;" id="info"></div>' +
        '<hr>' +
        '<div id="answerContent" style="margin: 10px; color: orange; font-size: medium; overflow-y: auto; max-height: 400px"></div>' +
        '<hr>' +
        '<div style="margin-left: 10px;margin-top: 5px;margin-bottom: 5px;text-align: left; color: rgb(114,188,114);">积分:&nbsp<input  οnfοcus="this.blur()" style="border:none;width: 55px;color: rgb(114,188,114);" id="score" name="score">' +
        '<button id="showscore" name="showscore" style="float:right;margin-right: 10px;border-radius:0em;overflow:hidden;border: 1px double rgb(0,0,0);background-color: rgb(255,255,255);">刷新</button></div>' +
        '<hr>' +
        '<div><button name="showb" style="float:right;border-radius:1em;overflow:hidden;border: 0px double rgb(0,0,0);background-color: rgb(255,255,255);">隐藏</button></div>' +
        '<form style="margin: 0 5px;">' +
        '<div style="" id="div_foot">' +
        '<div style="color: red;margin-left: 70px;">参数修改后自动保存</div>' +
        '<div>' +
        '<label style="margin-left: 60px;float:center;"fo7="utoken">key(自动生成刷新即可):&nbsp&nbsp&nbsp</label>' +
        '<input disabled="true" style="width: 70%;margin-left: 40px;margin-top: 5px;" id="utoken" name="utoken" placeholder="自动生成刷新即可">' +
        '</div>' +
        '<div>' +
        '<label style="margin-left: 50px;float:left;margin-top: 5px;" for="timeout">答题延迟:&nbsp&nbsp&nbsp</label>' +
        '<input  id="timeout" name="timeout" type="number" min="500" style="margin-top: 5px;width: 55px; text-align: center;">' +
        '<label for="timeout" style="margin-right: 15px;"> 毫秒</label>' +
        '<div style="margin-top: 5px;overflow-y: auto;">' +
        //<button name="dtbutton" style="margin-right: 10px;float:right;border-radius:0em;border: 1px double rgb(0,0,0);background-color: rgb(255,255,255);">关闭普通自动答题</button>' +
        '<button name="cz" style="margin-left: 20px;float:left;border-radius:0em;overflow:hidden;border: 1px double rgb(0,0,0);background-color: rgb(255,255,255);">充值</button>' +
        '<button name="dtbutton" style="margin-left: 10px;float:left;border-radius:0em;overflow:hidden;border: 1px double rgb(0,0,0);background-color: rgb(255,255,255);">关闭普通自动答题</button>' +
        '<button id="cleanlog" name="cleanlog" style="margin-left: 10px;float:left;border-radius:0em;overflow:hidden;border: 1px double rgb(0,0,0);background-color: rgb(255,255,255);">清空日志</button>'+
        '<button id="copykey" name="copykey" style="margin-top: 5px;margin-left: 20px;float:left;border-radius:0em;overflow:hidden;border: 1px double rgb(0,0,0);background-color: rgb(255,255,255);">复制KEY</button>' +
        '<button id="changekey" name="changekey" style="margin-top: 5px;margin-left: 20px;float:left;border-radius:0em;overflow:hidden;border: 1px double rgb(0,0,0);background-color: rgb(255,255,255);">修改KEY</button>' +
        '<button name="jsindex" style="margin-top: 5px;margin-left: 20px;float:left;border-radius:0em;overflow:hidden;border: 1px double rgb(0,0,0);background-color: rgb(255,255,255);">脚本主页</button>' +
        '</div>' +
        '</form><br>' +
        //<a style="text-align: center;" href=\"https://greasyfork.org/zh-CN/scripts/397517\" target="_blank\">[脚本主页]</a>
        '<hr>' +
        '<div id="answer_log" style="margin-left: 5px; max-height: 300px; overflow-y: auto;"></div>' +
        '</div>' +
        '</div>'
    );
    view.answerView = view.top.find('#answerContent');
    view.info = view.top.find('#info');
    view.div_main = view.top.find('#div_main');
    view.showb = view.top.find('#div_foot');
    view.top.appendTo('body').delegate('input', 'input change', function (event) {
        if (this.value.match(/^\*+$/)) return;
        let name = $(this).attr('name');
        GM_setValue(name, this.value);
        setting[name] = this.value;
        console.log("修改完毕", GM_getValue(name, this.value), event.type)
        getscore();
        if (event.type == 'change') msg('配置保存成功,即时生效');
    }).delegate('[name=utoken]', 'focus blur', function (event) {
        $('#utoken').val('');
        this.value = setting.utoken.replace(/(\S)/g, event.type == 'focusin' ? '$1' : '*');
    }).delegate('button', 'click', function (e) {
        e.stopImmediatePropagation();
        e.stopPropagation();
        e.preventDefault();
        let name = $(this).attr('name');
        if (name == 'cleanlog'){
            $('#answer_log').html('');
            layer.tips('清除完毕', '#cleanlog');
        }
        if (name == 'show') {
            setting.show = GM_getValue('show');
            $(this).html(setting.show ? '隐藏' : '显示');
            setting.show ? GM_setValue('show', 0) : GM_setValue('show', 1);
            view.answerView.slideToggle();
            view.showb.slideToggle();
        }
        if (name == 'showb') {
            setting.show = GM_getValue('showb');
            $(this).html(setting.show ? '隐藏' : '显示');
            setting.show ? GM_setValue('showb', 0) : GM_setValue('showb', 1);
            view.showb.slideToggle();
        }
        if (name == 'jsindex') {
            window.open("https://greasyfork.org/zh-CN/scripts/397517", "_blank");

        }
        if (name == 'changekey') {
            $('#utoken').attr("disabled",false);
            layer.tips('已解除锁定', '#utoken');

        }
        if (name == 'copykey') {
            copyToClipboard(GM_getValue('utoken'))
            layer.tips('复制成功', '#copykey');

        }
        if (name == 'dtbutton') {
            setting.isinput = GM_getValue('isinput');
            $(this).html(setting.isinput ? '开启普通自动答题' : '关闭普通自动答题');
            console.log(GM_getValue('isinput'))
            setting.isinput ? GM_setValue('isinput', 0) : GM_setValue('isinput', 1);
        }
        if (name == 'cz') {
            let key = GM_getValue('utoken');
            url = _self.location.href;
            if (url.indexOf("u.unipus.cn") != -1) {
                if(key){
                layer.open({
                    title: '温馨提示'
                    ,content: '充值的KEY是否为:<br>'+GM_getValue('utoken')
                    ,time: 2000
                    ,end: function(){
                        window.open("http://pay.ljtion.work/?token=" + setting.utoken, "_blank");
                    }
                });
            }else{
                layer.open({
                    title: '温馨提示'
                    ,content: 'Key错误,请勿擅自更改,如无KEY请清空后刷新加载'
                    ,btnAlign: 'c'
                    ,yes: function(){
                        $('#utoken').html('');
                        GM_setValue('utoken','');
                        window.location.reload();
                    }
                });
            }
            } else {
                alert("请不要在题目中点击充值,去教材主页点击")
            }

            //window.open("http://uspay.hurric.cn/?token=" + setting.utoken, "_blank");
        }
        if (name == 'showscore') {
            getscore();
            layer.tips('积分信息更新成功', '#showscore');
            //msg("积分信息更新成功");
        }

    }).find('input').each(function () {
        let type = $(this).attr('type'),
            name = $(this).attr('name');
        if (type == 'radio') {
            this.checked = setting[name] == this.value;
        } else if (name == 'score') {
            this.value = setting[name]
        } else if (name == 'utoken') {
            this.value = setting[name].replace(/\S/g, '*');
        } else {
            this.value = setting[name];
        }
    });
    //getxtoekn();
    if (setting.utoken) {
        msg('<a href="http://op.ljtion.work/" title="打开链接" style="color:red">最新公告/常见问题</a>','red')
        msg('脚本正在运行');

    } else {
        console.log(setting.utoken);
        getxtoken();
        msg('欢迎使用脚本<br \>答案将在页面加载三秒后出现<br \><a href=\"https://greasyfork.org/zh-CN/scripts/397517\" target="_blank\">【脚本描述】</a><br \><a href=\"https://jq.qq.com/?_wv=1027&k=54Sj7yE\" target=\"_blank\">【交流群】</a>', 'red');
    }

    addViewMouseListener()
}

function addViewMouseListener() {
    view.top.bind('mousedown', function (event) {
        //获取鼠标按下的时候左侧偏移量和上侧偏移量
        setting.cache.view_x = $(this).position().left;
        setting.cache.view_y = $(this).position().top;
        setting.cache.mouse_x = event.originalEvent.clientX;
        setting.cache.mouse_y = event.originalEvent.clientY;
        console.log(setting.cache.mouse_x, setting.cache.mouse_y, setting.cache.view_x, setting.cache.view_y)
    });
    $(document).bind('mousemove', function (event) {
        //计算出现在的位置是多少
        if (setting.cache.mouse_x == -1) return;
        if (setting.cache.mouse_y - setting.cache.view_y > view.top.height() - view.div_main.height()) return;
        let new_position_left = event.originalEvent.clientX - setting.cache.mouse_x + setting.cache.view_x,
            new_position_top = event.originalEvent.clientY - setting.cache.mouse_y + setting.cache.view_y;
        //加上边界限制
        if (new_position_top < 0) {//当上边的偏移量小于0的时候,就是上边的临界点,就让新的位置为0
            new_position_top = 0;
        }
        //如果向下的偏移量大于文档对象的高度减去自身的高度,就让它等于这个高度
        if (new_position_top > $(document).height() - view.top.height() && $(document).height() - view.top.height() > 0) {
            new_position_top = $(document).height() - view.top.height();
        }
        //右限制
        if (new_position_left > $(document).width() - view.top.width()) {
            new_position_left = $(document).width() - view.top.width();
        }
        if (new_position_left < 0) {//左边的偏移量小于0的时候设置 左边的位置为0
            new_position_left = 0;
        }
        view.top.css({
            left: new_position_left + 'px',
            top: new_position_top + 'px'
        })
    })
    $(document).bind('mouseup', function (event) {
        setting.cache.mouse_x = -1;
        setting.cache.mouse_y = -1;
    })
}

猜你喜欢

转载自blog.csdn.net/xxmmao/article/details/107589493