Super star learning link fully automatic background course brushing browser - stable version

Superstar learning brush course browser - stable version

Online classes on each platform have corresponding tests. However, these tests are not so friendly to those students who adhere to the principle of happy learning first. In order to make these students enjoy the fun of high scores, we have found some small helpers to make online learning happier.

Supplement 2020-6-29: update the superstar test script to adapt to multi video courses. It solves the problem that multiple videos under the previous chapter cannot be played

Mending 2020-7-12: some netizens left a message saying that the double play can't be used. I didn't pay much attention before. Then I tried it myself. There is a problem. I'll try to see if it can be repaired in recent days. There are more things near the end of the term. I hope you can understand. Let's make do with it first
Supplement 2020-8-1: shared the code of skipping the discussion version
Supplement 2020-8-4: I don't know why the previous one written in jquery syntax will report an error after a period of time. It is simply changed to use the native javascript syntax

Official tutorial:

Built in course brushing plug-in, add the following code to realize automatic course brushing

Link: https://www.lanzoux.com/b01hkgoze

The effect is shown in the figure:

Step 1: view the description (key points)

Step 2: unzip the plug-in

Step 3: open the browser. The browser has its own course brushing script and examination script. There is no need to configure it manually.

Step 4: after clicking start answer, you can see the answer of the current chapter test on the web page.

 

The script code is as follows:

// ==UserScript==
// @name online class assistant
// @version      3.0.0
// @description automatic search for test answers, support automatic answer, automatic switching of questions, hiding answer search prompt box, etc., remove various functional restrictions and open user-defined parameters
// @author       wyn665817
// @match        *://*.chaoxing.com/exam/test/reVersionTestStartNew*
// @match        *://*.edu.cn/exam/test/reVersionTestStartNew*
// @connect      forestpolice.org
// @run-at       document-end
// @grant        unsafeWindow
// @grant        GM_xmlhttpRequest
// @grant        GM_setClipboard
// @supportURL   https://greasyfork.org/zh-CN/scripts/373131/feedback
// @license      MIT
// ==/UserScript==

// After the settings are modified, you need to refresh or reopen the online course page to take effect
var setting = {
    // 5E3 == 5000, scientific notation, indicating milliseconds
    time: 5E3 // The default response speed is 5 seconds, which is not recommended to be less than 3 seconds
    ,token: '' // Donor users can use the customization function to match the answers more accurately. Fill in the ID code obtained after donation here

    // 1 means on and 0 means off
    ,none: 0 // If the answer is not found or there is no matching answer, the default operation will be performed, and it will be closed by default
    ,jump: 0 // Automatically switch after answering questions, and close by default
    ,copy: 0 // Automatically copy the answer to the clipboard, or manually click the button or answer to copy. It is closed by default

    // Non automated operation
    ,hide: 0 // Without loading the answer search prompt box, the keyboard ↑ and ↓ can be temporarily removed and loaded. It is closed by default
    ,scale: 0 // The height of the rich text editor is automatically stretched. It is used for text questions. The answer box is automatically resized according to the content. It is closed by default
},
_self = unsafeWindow,
$ = _self.jQuery,
UE = _self.UE;

String.prototype.toCDB = function() {
    return this.replace(/\s/g, '').replace(/[\uff01-\uff5e]/g, function(str) {
        return String.fromCharCode(str.charCodeAt(0) - 65248);
    }).replace(/[""]/g, '"').replace(/['']/g, "'").replace(/. /g, '.');
};

// setting.time += Math.ceil(setting.time * Math.random()) - setting.time / 2;
setting.TiMu = [
    filterImg('.Cy_TItle .clearfix').replace(/\s*(\d+\.\d+(min) $/, ''),
    $('[name^=type]:not([id])').val() || '-1',
    $('.cur a').text().trim() || 'nothing',
    $('li .clearfix').map(function() {
        return filterImg(this);
    })
];

setting.div = $(
    '<div style="border: 2px dashed rgb(0, 85, 68); width: 330px; position: fixed; top: 0; right: 0; z-index: 99999; background-color: rgba(70, 196, 38, 0.6); overflow-x: auto;">' +
        '<span style="font-size: medium;"></span>' +
        '<div style="font-size: medium;">Searching for answers...</div>' +
        '<button style="margin-right: 10px;">Pause answer</button>' +
        '<button style="margin-right: 10px;' + (setting.jump ? '' : ' display: none;') + '">Click to stop this switch</button>' +
        '<button style="margin-right: 10px;">Re query</button>' +
        '<button style="margin-right: 10px; display: none;">Copy answer</button>' +
        '<button>Answer details</button>' +
        '<div style="max-height: 200px; overflow-y: auto;">' +
            '<table border="1" style="font-size: 12px;">' +
                '<thead>' +
                    '<tr>' +
                        '<th colspan="2">' + ($('#randomOptions'). val() == 'false' ? '' : '< Font color = "red" > the options in this exam are out of order. The script will choose the correct option < / font >) + '< / th >'+
                    '</tr>' +
                    '<tr>' +
                        '<th style="width: 60%; min-width: 130px;">Title (click to copy)</th>' +
                        '<th style="min-width: 130px;">Answer (click to copy)</th>' +
                    '</tr>' +
                '</thead>' +
                '<tfoot style="' + (setting.jump ? ' display: none;' : '') + '">' +
                    '<tr>' +
                        '<th colspan="2">This automatic switching has been turned off</th>' +
                    '</tr>' +
                '</tfoot>' +
                '<tbody>' +
                    '<tr>' +
                        '<td colspan="2" style="display: none;"></td>' +
                    '</tr>' +
                '</tbody>' +
            '</table>' +
        '</div>' +
    '</div>'
).appendTo('body').on('click', 'button, td', function() {
    var num = setting.$btn.index(this);
    if (num == -1) {
        GM_setClipboard($(this).text());
    } else if (num === 0) {
        if (setting.loop) {
            clearInterval(setting.loop);
            delete setting.loop;
            num = ['Search paused', 'Continue to answer the question'];
        } else {
            setting.loop = setInterval(findTiMu, setting.time);
            num = ['Searching for answers...', 'Pause answer'];
        }
        setting.$div.html(function() {
            return $(this).data('html') || num[0];
        }).removeData('html');
        $(this).html(num[1]);
    } else if (num == 1) {
        setting.jump = 0;
        setting.$div.html(function() {
            return arguments[1].replace('About to switch to the next question', 'Automatic switching is not turned on');
        });
        setting.div.find('tfoot').add(this).toggle();
    } else if (num == 2) {
        location.reload();
    } else if (num == 3) {
        GM_setClipboard(setting.div.find('td:last').text());
    } else if (num == 4) {
        ($('.leftCard .saveYl')[0] || $()).click();
    }
}).detach(setting.hide ? '*' : 'html');
setting.$btn = setting.div.children('button');
setting.$div = setting.div.children('div:eq(0)');

$(document).keydown(function(event) {
    if (event.keyCode == 38) {
        setting.div.detach();
    } else if (event.keyCode == 40) {
        setting.div.appendTo('body');
    }
});

if (setting.scale) _self.UEDITOR_CONFIG.scaleEnabled = false;
$.each(UE.instants, function() {
    var key = this.key;
    this.ready(function() {
        this.destroy();
        UE.getEditor(key);
    });
});
setting.loop = setInterval(findTiMu, setting.time);

function findTiMu() {
    GM_xmlhttpRequest({
        method: 'POST',
        url: 'http://mooc.forestpolice.org/cxk/' + (setting.token || 0) + '/' + encodeURIComponent(setting.TiMu[0]),
        headers: {
            'Content-type': 'application/x-www-form-urlencoded'
        },
        data: 'question=' + encodeURIComponent(setting.TiMu[0]) + '&type=' + setting.TiMu[1],
        timeout: setting.time,
        onload: function(xhr) {
            if (!setting.loop) {
            } else if (xhr.status == 200) {
                var obj = $.parseJSON(xhr.responseText) || {};
                if (obj.code) {
                    var data = String(obj.data).replace(/&/g, '&amp;').replace(/<(?!img)/g, '&lt;'),
                    que = setting.TiMu[0].match('<img') ? setting.TiMu[0] : setting.TiMu[0].replace(/&/g, '&amp;').replace(/</g, '&lt');
                    obj.data = /^http/.test(data) ? '<img src="' + obj.data + '">' : obj.data;
                    setting.div.find('tbody').append(
                        '<tr>' +
                            '<td title="Click to copy">' + que + '</td>' +
                            '<td title="Click to copy">' + (/^http/.test(data) ? obj.data : '') + data + '</td>' +
                        '</tr>'
                    );
                    setting.copy && GM_setClipboard(obj.data);
                    setting.$btn.eq(3).show();
                    fillAnswer(obj);
                } else {
                    setting.$div.html(obj.data || 'Server busy, retrying...');
                }
                setting.div.children('span').html(obj.msg || '');
            } else if (xhr.status == 403) {
                var html = xhr.responseText.indexOf('{') ? 'Requests are too frequent. It is recommended to try again later' : $.parseJSON(xhr.responseText).data;
                setting.$div.data('html', html).siblings('button:eq(0)').click();
            } else {
                setting.$div.text('Server exception, retrying...');
            }
        },
        ontimeout: function() {
            setting.loop && setting.$div.text('Server timed out, retrying...');
        }
    });
}

function fillAnswer(obj, tip) {
    var $input = $(':radio, :checkbox', '.Cy_ulBottom'),
    str = String(obj.data).toCDB() || new Date().toString(),
    data = str.split(/#|\x01|\|/),
    opt = obj.opt || str,
    btn = $('.saveYl:contains(Next question)').offset();
    // $input.filter(':radio:checked').prop('checked', false);
    obj.code > 0 && $input.each(function(index) {
        if (this.value == 'true') {
            data.join().match(/(^|,)(correct|yes|yes|√|T|ri)(,|$)/) && this.click();
        } else if (this.value == 'false') {
            data.join().match(/(^|,)(error|no|wrong|×|F|wr)(,|$)/) && this.click();
        } else {
            index = setting.TiMu[3][index].toCDB() || new Date().toString();
            index = $.inArray(index, data) + 1 || (setting.TiMu[1] == '1' && str.indexOf(index) + 1);
            Boolean(index) == this.checked || this.click();
        }
    }).each(function() {
        if (!/^A?B?C?D?E?F?G?$/.test(opt)) return false;
        Boolean(opt.match(this.value)) == this.checked || this.click();
    });
    if (setting.TiMu[1].match(/^[013]$/)) {
        tip = $input.is(':checked') || setting.none && (($input[Math.floor(Math.random() * $input.length)] || $()).click(), ' ');
    } else if (setting.TiMu[1].match(/^(2|[4-9]|1[08])$/)) {
        data = String(obj.data).split(/#|\x01|\|/);
        tip = $('.Cy_ulTk textarea').each(function(index) {
            index = (obj.code > 0 && data[index]) || '';
            UE.getEditor(this.name).setContent(index.trim());
        }).length;
        tip = (obj.code > 0 && data.length == tip) || setting.none && ' ';
        setting.len = str.length * setting.time / 10;
    }
    if (tip == ' ') {
        tip = 'Default action performed';
    } else if (tip) {
        tip = 'Automatic answer completed';
    } else if (tip === undefined) {
        tip = 'This question type does not support automatic answer';
    } else {
        tip = 'No valid answer found';
    }
    if (btn) {
        tip += setting.jump ? ',About to switch to the next question' : ',Automatic switching is not turned on';
        setInterval(function() {
            if (!setting.jump) return;
            var mouse = document.createEvent('MouseEvents'),
            arr = [btn.left + Math.ceil(Math.random() * 80), btn.top + Math.ceil(Math.random() * 26)];
            mouse.initMouseEvent('click', true, true, document.defaultView, 0, 0, 0, arr[0], arr[1], false, false, false, false, 0, null);
            _self.event = $.extend(true, {}, mouse);
            delete _self.event.isTrusted;
            _self.getTheNextQuestion(1);
        }, setting.len || Math.ceil(setting.time * Math.random()) * 2);
    } else {
        setting.$btn.eq(1).hide();
        tip = 'The answer has been completed. Please check the answer details by yourself';
    }
    setting.$div.data('html', tip).siblings('button:eq(0)').hide().click();
}

function filterImg(dom) {
    return $(dom).clone().find('img[src]').replaceWith(function() {
        return $('<p></p>').text('<img src="' + $(this).attr('src') + '">');
    }).end().find('iframe[src]').replaceWith(function() {
        return $('<p></p>').text('<iframe src="' + $(this).attr('src') + '"></irame>');
    }).end().text().trim();

 

Note: This version is only for internal study and research. Please do not use it commercially. If you encounter a BUG, you can leave a message and give feedback. You will reply in time! Reprint please indicate the source, thank you!

Posted by laserlight on Fri, 20 May 2022 11:52:45 +0300