ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

最新版清华社英语自动刷题刷时长脚本分享

2021-05-13 02:32:51  阅读:1172  来源: 互联网

标签:最新版 config await else 刷题 && changeEvent true 时长


一、脚本介绍:

      最新版清华社英语在线刷题脚本是一款电脑上的运行的脚本,例如快速刷交互英语视听说等课程,实现课程进度100%以及挂时长。

二、脚本功能:

1、每个单元完成进度为100%

2、每个单元成绩为95-100分

3、每个单元会有学习时长 

脚本运行效果图如下:

 

 

已集成好脚本的浏览器下载:https://wukongstudio.lanzoui.com/b01i5qpof

三、脚本主要实现原理 :

      主要是通过浏览器安装油猴脚本来实现。油猴脚本适用于Chrome和Firefox等浏览器。油猴脚本将在您的用户脚本管理方面提供更多的便利。它提供了例如便捷脚本安装、自动更新检查、标签中的脚本运行状况速览、内置的编辑器等众多功能。

 

四、脚本的主要代码:

 

 function input_in(e, txt) {
        if (e.type == 'textarea') {
            e.value= txt;
        } else {
            e.innerText= txt;
        }

        let changeEvent = null;
        changeEvent = document.createEvent ("HTMLEvents");
        changeEvent.initEvent ("input", true, true);
        e.dispatchEvent (changeEvent);

        changeEvent = document.createEvent ("HTMLEvents");
        changeEvent.initEvent ("keyup", true, true);
        e.dispatchEvent (changeEvent);

        changeEvent = document.createEvent ("HTMLEvents");
        changeEvent.initEvent ("change", true, true);
        e.dispatchEvent (changeEvent);
    }

    function mouseEvent(div, type, pos) {
        var mousedown = document.createEvent("MouseEvents");

        let x = 0;
        let y = 0;
        if(pos == undefined) {
            let rect = div.getBoundingClientRect();
            x = (rect.x*2 + rect.width)/2;
            y = (rect.y*2 + rect.height)/2;
        } else {
            x = pos.x;
            y = pos.y;
        }

        mousedown.initMouseEvent(type,true,true,unsafeWindow,0,  
        x, y, x, y,false,false,false,false,0,null);
        div.dispatchEvent(mousedown);
    }

    async function dragTo(from, to) {
        let dragBlock = $(".lib-drag-block");
        dragBlock.scrollTop(to.offsetTop - dragBlock[0].offsetTop);
        $(document).scrollTop(dragBlock[0].offsetTop);
        await sleep(100);
        mouseEvent(from, 'mousedown');
        await sleep(100);
        mouseEvent(to, 'mousemove');
        await sleep(10);
        mouseEvent(to, 'mousemove');
        mouseEvent(to, 'mousemove');
        mouseEvent(to, 'mouseup');
        await sleep(100);
    }

    async function doTopic() {
        let setTixing = async (t)=> {
            console.log('[+] 题型:', t);
            $('#yun_status').text('当前题型:'+t);
        }; 

        if($('.wy-course-bottom .wy-course-btn-right .wy-btn').text().indexOf('Submit')==-1 && $('#J_prismPlayer').length==0) {
            // $('.page-next')[1].click();
            // await sleep(pageNextDelay);
            $('#yun_status').text('当前题目已完成');
            return false;
        }

        if($('img[title="录音"]').length!=0 && config.autodo.includes('auto_luyin')) {
            await setTixing('录音');
            await doReadRepeat();
        } else if($('.lib-textarea-container, .img-blank-answer').length!=0 && config.autodo.includes('auto_lytk')) {
            await setTixing('听力/图片填空');
            await doListenImgAnswer();
        } else if($('.lib-fill-blank-do-input-left').length!=0 && config.autodo.includes('auto_tiankong')) {
            await setTixing('填空');
            await doTianKone();
        } else if($('.lib-single-item-img').length!=0 && config.autodo.includes('auto_danxuan')) {
            await setTixing('单选');
            await doSingleChoose();
        } else if($('.lib-role-select-item').length!=0 && config.autodo.includes('auto_roleplay')) {
            await setTixing('角色扮演');
            await doRolePlay();
        } else if($('.ant-select-dropdown-menu-item').length!=0 && config.autodo.includes('auto_dropchoose')) {
            await setTixing('下拉选择');
            await doDropChoose();
        } else if($('.lib-drag-box').length!=0 && config.autodo.includes('auto_drag')) {
            await setTixing('托块');
            await doDrag();
        } else if($('#J_prismPlayer').length!=0 && config.autodo.includes('auto_video')) {
            await setTixing('视频');
            await doVideo();
            await sleep(config.delay); // 增加时长
            return true;
        } else {
            await unSupposedOrSkip();
            return false;
        }

        await sleep(config.delay); // 增加时长
        click_btn(); // Submit
        return true;
    }

 

标签:最新版,config,await,else,刷题,&&,changeEvent,true,时长
来源: https://www.cnblogs.com/wukong2020/p/14762881.html

专注分享技术,共同学习,共同进步。侵权联系[admin#icode9.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有