随风

刷课辅助-WELearn随行课堂外研社-英语网课答案显示-刷课软件脚本,代刷代做视听说英语
关于我们提供各种网课代刷,代做,包考,等等如果想了解我们还支持那些网课,可以联系我们悬浮窗显示we learn随行...
扫描右侧二维码阅读全文
04
2020/05

刷课辅助-WELearn随行课堂外研社-英语网课答案显示-刷课软件脚本,代刷代做视听说英语

关于我们

提供各种网课代刷,代做,包考,等等

有需要的联系微信tm1802或者QQ:1757413710

支持微信支付宝,也支持走淘宝,担保交易,售后无忧,满意确认收货

如果想了解我们还支持那些网课,可以联系我们

图

悬浮窗显示we learn随行课堂选择题、填空题答案,口语参考文本,支持单元测试,不支持班级测试

使用说明

需要"总是允许此域名"
左键按住“参考文本”方可拖动答案
部分参数可自定义
不打算提供自动答题功能,欢迎有能力的同学自行开发
需要使用Chrome浏览器吗?
需要使用Tampermonkey吗?
需要允许跨域

已知问题

[ ] 部分答案重复显示,不影响作答
[ ] 不支持班级测试

示例图片
图
图

更新

v0.1
目前只支持填空题和问答题(见截图)
v0.2
支持选择题(二选一,多选)
支持单元测试
显示口语参考
优化性能
v0.2.1
增加了问题反馈渠道
v0.2.2
修复了某些课程,答案和课程不匹配的问题
v0.3
支持连线题
适配外教社数字课程系列
适配全新版大学英语《视听说教程》
适配全新版大学进阶英语:综合教程
适配全新版大学进阶英语:视听说教程
适配新世纪大学英语(第二版)综合教程
适配新世纪大学英语(第二版)视听说教程(3rd Edition)
适配新目标大学英语视听说教程1
适配新目标大学英语《综合教程》
适配新标准高职实用综合教程(第2版)
适配新标准高职公共英语系列教材:实用综合教程(精编版)
v0.4
支持判断题
适配,适配,适配
支持新世纪大学英语系列教材(第二版)综合教程的纠错选择题
美化字体
优化代码逻辑
修复了有时无法获取URL的问题
v0.4.1
修复了全新版大学进阶英语:综合教程部分题目的识别问题
当悬浮窗可移动时(鼠标位于“参考答案”上时),鼠标指针会改变
悬浮窗毛玻璃效果,支持自定义背景色(修改containerColor变量)
v0.4.2
修复了新标准高职实用综合教程(第2版)部分题目的识别问题
v0.4.3
支持下拉选择题
v0.4.4
修改了一下描述
v0.4.5
答案前加入序号
v0.4.6
修复了新标准高职公共英语系列教材:实用综合教程(精编版)下第七、八单元的单元测试不显示答案的问题
v0.4.7
适配高职的单词测试

脚本代码

(function () {
'use strict';

var container, title, bufferUrl;
const containerColor = 'rgba(255,255,255,0.95)'; //悬浮窗背景色
const checkInterval = 3000; //答案查询间隔,单位毫秒
const PARSER = new DOMParser();
const MANIFEST = [
    'new%20century%20college%20english%20secedition%20integration%201',
    'new%20century%20college%20english%20secedition%20integration%202',
    'new%20century%20college%20english%20secedition%20integration%203',
    'new%20century%20college%20english%20secedition%20integration%204',
    'an%20integrated%20skills%20course%20(2nd%20edition)%201%20for%20vocational%20college%20english',
    'an%20integrated%20skills%20course%20(2nd%20edition)%202%20for%20vocational%20college%20english',
    'an%20integrated%20skills%20course%20(2nd%20edition)%203%20for%20vocational%20college%20english',
    'an%20integrated%20skills%20course%20(2nd%20edition)%204%20for%20vocational%20college%20english',
    'an%20integrated%20skills%20course%201',
    'an%20integrated%20skills%20course%202',
];
const ORIGIN = [
    'new%20target%20college%20english%20integrated%20course%201',
    'new%20target%20college%20english%20integrated%20course%202',
    'new%20target%20college%20english%20integrated%20course%203',
    'new%20target%20college%20english%20integrated%20course%204',
    'new%20progressive%20college%20english%20integrated%20course%201',
    'new%20progressive%20college%20english%20integrated%20course%202',
    'new%20progressive%20college%20english%20integrated%20course%203',
    'new%20progressive%20college%20english%20integrated%20course%204',
]
const answerTypes = [
    'et-tof', //判断题
    'et-blank', //问答题+填空题
    'et-select', //下拉选择题
    'et-choice', //选择题(二选一,多选)
    'et-matching', //连线题
    'et-reference', //口语参考
    'correctresponse value', //identifier类型
    'wordDeclaration', //高职单词测试
];

function createContainer() {
    container = document.createElement('div');
    container.id = 'container';
    container.setAttribute('style', "top: 100px; left: 100px; margin: 0 auto; z-index: 99; border-radius: 8px;" +
        " box-shadow: 0 11px 15px -7px rgba(0,0,0,.2), 0 24px 38px 3px rgba(0,0,0,.14), 0 9px 46px 8px rgba(0,0,0,.12);" +
        " position: absolute; background:" + containerColor + "; min-width: 150px;max-width:400px; max-height: 500px; min-height: 100px;overflow:auto;")
    container.style.visibility = 'hidden';
    if (!top.document.querySelector('#container')) {
        top.document.body.appendChild(container);
    }

    title = document.createElement('div');
    title.textContent = '参考答案';
    title.setAttribute("style", "background: rgba(0,0,0,0); height: 25px; margin-top: 10px; text-align: center; font-size: x-large;cursor:move;");
    container.appendChild(title);
}

function dragBox(drag, wrap) {
    function getCss(ele, prop) {
        return parseInt(window.getComputedStyle(ele)[prop]);
    }

    var initX, initY,
        dragable = false,
        wrapLeft = getCss(wrap, "left"),
        wrapRight = getCss(wrap, "top");

    drag.addEventListener("mousedown", function (e) {
        dragable = true;
        initX = e.clientX;
        initY = e.clientY;
    }, false);

    document.addEventListener("mousemove", function (e) {
        if (dragable === true) {
            var nowX = e.clientX,
                nowY = e.clientY,
                disX = nowX - initX,
                disY = nowY - initY;
            wrap.style.left = wrapLeft + disX + "px";
            wrap.style.top = wrapRight + disY + "px";
        }
    });

    drag.addEventListener("mouseup", function (e) {
        dragable = false;
        wrapLeft = getCss(wrap, "left");
        wrapRight = getCss(wrap, "top");
    }, false);

};

function emptyContainer() {
    container.innerHTML = '';
    container.appendChild(title);
    isShow();
}

function isShow() {
    container.childNodes.length > 1 ? container.style.visibility = 'visible' : container.style.visibility = 'hidden';
}

function getCurrentUrl() {
    let currentUrl;
    try {
        currentUrl = document.querySelector('div.courseware_main_1').firstElementChild.src;
    } catch (error) {
        currentUrl = top.frames[0].location.href;
    }
    return currentUrl;
}

function isChange() {
    let currentUrl = getCurrentUrl();
    if (currentUrl != bufferUrl) {
        emptyContainer();
        determineCourseType(currentUrl);
    }
    bufferUrl = currentUrl;
}

function determineCourseType(answerUrl) {
    let courseInfo = /com\/(.*?)\//.exec(answerUrl)[1];
    let identifier;
    try {
        identifier = /#(.*)\?/.exec(answerUrl)[1];
    } catch (error) {}

    if (MANIFEST.includes(courseInfo)) { //需要查询名单的
        let manifestUrl = 'https://centercourseware.sflep.com/' + courseInfo + '/resource/manifest.xml';
        queryManifest(manifestUrl, identifier, courseInfo);
    } else if (ORIGIN.includes(courseInfo)) { //直接在当前页面查找的
        setTimeout(() => {
            let answers = top.frames[0].document.querySelectorAll('[data-solution]');
            addToContainer('', answers);
            isShow();
        }, 2000);
    } else { //默认(视听说)
        answerUrl = 'https://centercourseware.sflep.com/' + courseInfo + '/data' + identifier + 
 '.html';
        sendAjaxRequest(answerUrl);
    }
}

function queryManifest(manifestUrl, identifier, courseInfo) {
    GM_xmlhttpRequest({
        method: "GET",
        url: manifestUrl,
        onload: response => {
            let html = response.response;
            let htmlDOM = PARSER.parseFromString(html, 'text/html');
            let selector = 'resource[identifier="' + identifier + '"] file';
            let resource = htmlDOM.querySelector(selector).getAttribute('href').replace('.html', 
 '.xml').replace('.htm', '');
            let answerUrl = 'https://centercourseware.sflep.com/' + courseInfo + '/' + resource;
            sendAjaxRequest(answerUrl);
        }
    });
}

function sendAjaxRequest(answerUrl) {
    GM_xmlhttpRequest({
        method: "GET",
        url: answerUrl,
        onload: response => {
            let html = response.response;
            let htmlDOM = PARSER.parseFromString(html, 'text/html');
            // console.log(htmlDOM);
            parseAjaxResponse(htmlDOM);
        }
    });
   }

  function parseAjaxResponse(htmlDOM) {
    emptyContainer();
    answerTypes.map(answerType => htmlDOM.querySelectorAll(answerType)).forEach(answers => 
  addToContainer(htmlDOM, answers));
    isShow();
}

function addToContainer(htmlDOM, answers) {
    if (answers.length > 0) {
        for (let i = 0; i < answers.length; i++) {
            let content = document.createElement('div');
            // let br = document.createElement('br')
            let tag = answers[i].tagName;
            switch (tag) {
                case 'ET-BLANK':
                    content.textContent = answers[i].textContent;
                    break;
                case 'ET-TOF':
                case 'ET-SELECT':
                case 'ET-CHOICE':
                case 'ET-MATCHING':
                    content.textContent = answers[i].getAttribute('key');
                    break;
                case 'ET-REFERENCE':
                case 'WORDDECLARATION':
                    content.innerHTML = answers[i].innerHTML;
                    break;
                case 'VALUE':
                    (() => {
                        let identifier = answers[i].textContent;
                        if (identifier.length == 36) { //选择题
                            if (answers[i].textContent.length == 36) {
                                let selector = '[identifier="' + identifier + '"]';
                                try {
                                    content.textContent = htmlDOM.querySelector(selector).textContent;
                                } catch (error) {
                                    content.textContent = answers[i].textContent; //高职第七八单元填空
                                }
                            } else { //高职,非精编,综合,单元测试
                                content.textContent = answers[i].textContent;
                            }

                        } else if (identifier.length > 200) { //纠错题
                            let selectors = identifier.split(',');
                            for (let i = 0; i < selectors.length; i++) {
                                let selector = '[identifier="' + selectors[i] + '"]';
                                content.innerHTML += htmlDOM.querySelector(selector).textContent + " 
    <br>";
                            }
                        } else { //填空题
                            content.textContent = answers[i].textContent;
                        }
                    })();
                    break;
                default:
                    (() => {
                        if (answers[i].hasAttribute('data-solution')) {
                            let answer = answers[i].getAttribute('data-solution');
                            if (!answer.length) {
                                try {
                                    content.textContent = answers[i].firstElementChild.textContent;
                                } catch (error) {
                                    content.textContent = answers[i].textContent;
                                }
                            } else {
                                content.textContent = answer;
                            }
                        }
                    })();
                    break;
            }
            if (content.textContent.length) {
                content.textContent = String(i + 1) + '、' + content.textContent
            }
            content.setAttribute('style', "margin: 10px 10px; color: orange; font-size: medium;" +
                "font-family:Georgia, 'Times New Roman', Times, serif; ");
            container.appendChild(content);

        }
    }
 }

createContainer();
dragBox(title, container);
isChange();
 setInterval(isChange, checkInterval);
})();

小白使用

安装刷课浏览器:https://guyue.lanzous.com/ic67ood
安装完了重新访问该页面,安装下面脚本
访问脚本:https://greasyfork.org/zh-CN/scripts/398601-welearn英语网课答案显示

选择安装脚本即可

Last modification:May 4th, 2020 at 12:07 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment