专技天下全自动脚本 自动播放下一集


近期选课太多了,一个个看太麻烦,如果你还在因为要老老实实一分一秒的看视频而没有体会到足够多的欢乐时光,那么你可以花几分钟看一下这篇文章教程,了解一下自动刷课软件给你带来的快乐。支持自动播放、全自动挂机、自动跳转到下一课等功能

欢迎 点赞,关注,评论 以及各种交流~


专技天下刷课软件刷课脚本正式教程:

内置刷课插件,实现自动刷课

第一步:查看说明重点

第二步:解压插件

第三步:打开浏览器,浏览器已经自带刷课脚本考试脚本,无需手动配置。

第四步:点击开始答题后可在网页上看到当前章节测试的答案了。

链接:https://www.lanzoui.com/b01hro8ib

效果如图:

 


如下是对主要代码的解释:

_self = unsafeWindow,
url = location.pathname,
top = _self;
 
if (frameElement) document.domain = location.host.replace(/.+?\./, '');
 
try {
    while (top != _self.top) top = top.parent.document ? top.parent : _self.top;
} catch (err) {
    // console.log(err);
    top = _self;
}
 
var $ = _self.jQuery || top.jQuery,
parent = _self == top ? self : _self.parent,
Ext = _self.Ext || parent.Ext || {},
UE = _self.UE,
Hooks = Hooks || window.Hooks;
 
setting.normal = ''; // ':visible'
// setting.time += Math.ceil(setting.time * Math.random()) - setting.time / 2;
// setting.wait += Math.ceil(setting.wait * Math.random()) - setting.time / 2;
 
setting.job = [
    ':not(*)'
    ,'iframe[src*="/video/index.html"]'
    ,'iframe[src*="/work/index.html"]'
    ,'iframe[src*="/audio/index.html"]'
    ,'iframe[src*="/innerbook/index.html"]'
    ,'iframe[src*="/ppt/index.html"]'
    ,'iframe[src*="/pdf/index.html"]'
];
setting.tip = top != _self && jobSort($ || Ext.query);
 
if (url == '/ananas/modules/video/index.html') {
    if (setting.video) {
        if (setting.review) _self.greenligth = Ext.emptyFn;
        checkPlayer();
    } else {
        getIframe().remove();
    }
} else if (url == '/work/doHomeWorkNew' || url == '/api/work' || url == '/work/addStudentWorkNewWeb') {
    if (!UE) {
        var len = ($ || Ext.query || Array)('font:contains(未登录)', document).length;
        setTimeout(len == 1 ? top.location.reload : parent.greenligth, setting.time);
    } else if (setting.work) {
        setTimeout(relieveLimit, 0);
        beforeFind();
    } else {
        getIframe().remove();
    }
} else if (url == '/ananas/modules/audio/index.html') {
    if (setting.audio) {
        if (setting.review) _self.greenligth = Ext.emptyFn;
        hookAudio(_self.videojs, _self.videojs.xhr);
    } else {
        getIframe().remove();
    }
} else if (url == '/ananas/modules/innerbook/index.html') {
    setting.book ? setTimeout(bookRead, setting.time) : getIframe().remove();
} else if (url.match(/^\/ananas\/modules\/(ppt|pdf)\/index\.html$/)) {
    setting.docs ? setTimeout(docsRead, setting.time) : getIframe().remove();
} else if (url == '/knowledge/cards') {
    $ && checkToNext();
} else if (url.match(/^\/(course|zt)\/\d+\.html$/)) {
    setTimeout(function() {
        setting.read && _self.sendLogs && $('.course_section:eq(0) .chapterText').click();
    }, setting.time);
} else if (url == '/ztnodedetailcontroller/visitnodedetail') {
    setting.read && _self.sendLogs && autoRead();
} else if (url == '/mycourse/studentcourse') {
    var gv = location.search.match(/d=\d+&/g);
    setting.total && $('<a>', {
        href: '/moocAnalysis/chapterStatisticByUser?classI' + gv[1] + 'courseI' + gv[0] + 'userId=' + _self.getCookie('_uid') + '&ut=s',
        target: '_blank',
        title: '点击查看章节统计',
        style: 'margin: 0 25px;',
        html: '本课程共' + $('.icon').length + '节,剩余' + $('em:not(.openlock)').length + '节未完成'
    }).appendTo('.zt_logo').detach(setting.safe ? '*' : 'html').parent().width('auto');
    setting.course && setTimeout(goCourse, setting.time);
} else if (url.match(/^\/visit\/(courses|interaction)$/)) {
    setting.face && DisplayURL();
} else if (location.host.match(/^passport2/)) {
    setting.login && getSchoolId();
} else if (url == '/work/selectWorkQuestionYiPiYue') {
    submitAnswer(getIframe().parent(), $.extend(true, [], parent._data));
}
 
function getIframe(tip, win, job) {
    if (!$) return Ext.get(frameElement || []).parent().child('.ans-job-icon') || Ext.get([]);
    do {
        win = win ? win.parent : _self;
        job = $(win.frameElement).prevAll('.ans-job-icon');
    } while (!job.length && win.parent.frameElement);
    return tip ? win : job;
}
 
function jobSort($) {
    var fn = $.fn ? [getIframe(1), 'length'] : [self, 'dom'],
    sel = setting.job.join(', :not(.ans-job-finished) > .ans-job-icon' + setting.normal + ' ~ ');
    if ($(sel, fn[0].parent.document)[0] == fn[0].frameElement) return true;
    if (!getIframe()[fn[1]] || getIframe().parent().is('.ans-job-finished')) return null;
    setInterval(function() {
        $(sel, fn[0].parent.document)[0] == fn[0].frameElement && location.reload();
    }, setting.time);
}
 
function checkPlayer() {
    var data = Ext.decode(_self.config('data')),
    danmaku = data && data.danmaku ? data.danmaku : 0;
    if (setting.player == 'flash') {
        _self.showHTML5Player = _self.showMoocPlayer;
        danmaku = 1;
    } else if (setting.player == 'html5') {
        _self.showMoocPlayer = _self.showHTML5Player;
        danmaku = 0;
    }
    if (!danmaku && _self.supportH5Video() && !navigator.userAgent.match(/metasr/i)) {
        if (setting.phone) Ext.isIos = Ext.isAndroid = false;
        hookVideo(_self.videojs, _self.videojs.xhr);
    } else if (_self.flashChecker().hasFlash) {
        hookJQuery();
    } else {
        alert("此浏览器不支持flash,请修改脚本player参数为'html5',或者更换浏览器");
    }
}
 
function hookVideo(Hooks, xhr) {
    _self.videojs = function() {
        _self.videojs = Hooks;
        var config = arguments[1],
        line = Ext.Array.filter(Ext.Array.map(config.playlines, function(value, index) {
            return value.label == setting.line && index;
        }), function(value) {
            return Ext.isNumber(value);
        })[0] || 0,
        http = Ext.Array.filter(config.sources, function(value) {
            return value.label == setting.http;
        })[0];
        config.playlines.unshift(config.playlines[line]);
        config.playlines.splice(line + 1, 1);
        config.plugins.videoJsResolutionSwitcher.default = http ? http.res : 360;
        config.plugins.studyControl.enableSwitchWindow = 1;
        config.plugins.timelineObjects.url = '/richvideo/initdatawithviewer?';
        if (setting.drag) {
            config.plugins.seekBarControl.enableFastForward = 1;
            config.playbackRates = [1, 1.25, 1.5, 2];
        }
        // config.preload = setting.tip ? 'auto' : 'none';
        var player = Hooks.apply(this, arguments);
        player.children_[0].muted = setting.muted;
        player.on('loadstart', function() {
            setting.tip && this.play().catch(Ext.emptyFn);
        });
        player.on('ended', function() {
            Ext.fly(frameElement).parent().addCls('ans-job-finished');
        });
        _self.videojs.xhr = setting.login ? function(options, callback) {
            return xhr.call(this, options, function(error, response) {
                response.statusCode || top.location.reload();
                return callback.apply(this, arguments);
            });
        } : xhr;
        return player;
    };
}
 
function hookJQuery() {
    Hooks.set(_self, 'jQuery', function(target, propertyName, ignored, jQuery) {
        Hooks.method(jQuery.fn, 'cxplayer', function(target, methodName, method, thisArg, args) {
            var that = this,
            // events = Ext.clone(config.events),
            config = args[0];
            config.events.onStart = function() {
                for (var i = 0; i < 16; i++) setting.muted && that.addVolNum(false);
                // events.onStart();
            };
            config.events.onEnd = function() {
                Ext.fly(frameElement).parent().addCls('ans-job-finished');
                // events.onEnd();
            };
            config.datas.isDefaultPlay = setting.tip || false;
            config.enableSwitchWindow = 1;
            config.datas.currVideoInfo.resourceUrl = '/richvideo/initdatawithviewer?';
            config.datas.currVideoInfo.dftLineIndex = Ext.Array.filter(Ext.Array.map(decodeURIComponent(config.datas.currVideoInfo.getVideoUrl).match(/{.+?}/g) || [], function(value, index) {
                return value.match(setting.line + setting.http) && index;
            }), function(value) {
                return Ext.isNumber(value);
            })[0] || 0;
            if (setting.drag) config.datas.currVideoInfo.getVideoUrl = config.datas.currVideoInfo.getVideoUrl.replace(/&drag=false&/, '&drag=true&');
            return Hooks.Reply.method(arguments);
        });
        return Hooks.Reply.set(arguments);
    });
}
 
function hookAudio(Hooks, xhr) {
    _self.videojs = function() {
        _self.videojs = Hooks;
        var config = arguments[1];
        config.plugins.studyControl.enableSwitchWindow = 1;
        if (setting.drag) config.plugins.seekBarControl.enableFastForward = 1;
        var player = Hooks.apply(this, arguments);
        player.children_[0].muted = setting.muted;
        player.on('loadeddata', function() {
            setting.tip && this.play().catch(Ext.emptyFn);
        });
        player.on('ended', function() {
            Ext.fly(frameElement).parent().addCls('ans-job-finished');
        });
        _self.videojs.xhr = setting.login ? function(options, callback) {
            return xhr.call(this, options, function(error, response) {
                response.statusCode || top.location.reload();
                return callback.apply(this, arguments);
            });
        } : xhr;
        return player;
    };
}
 
function bookRead() {
    if (_self.setting) return setting.tip && top.onchangepage(_self.getFrameAttr('end'));
    setting.tip && Ext.fly(frameElement).parent().addCls('ans-job-finished');
}
 
function docsRead() {
    if (_self.setting) return setting.tip && _self.finishJob();
    setting.tip && Ext.fly(frameElement).parent().addCls('ans-job-finished');
}
 
function relieveLimit() {
    if (setting.scale) _self.UEDITOR_CONFIG.scaleEnabled = false;
    $('script').prev('textarea').each(function(index, value) {
        UE.getEditor(this.name).ready(function() {
            this.destroy();
            UE.getEditor(value.name).addListener('beforepaste', _self.myEditor_paste);
        });
    });
    if (!setting.paste && _self.allowPaste == '1') return;
    $('input[onpaste]').removeAttr('onpaste');
    _self.myEditor_paste = $.noop;
    // _self.pasteText = function() {return true};
}
 
function beforeFind() {
    if ($.type(parent._data) == 'array') return getIframe().remove();
    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;">正在搜索答案...</div>' +
            '<button style="margin-right: 10px;">暂停答题</button>' +
            '<button style="margin-right: 10px;">' + (setting.auto ? '取消本次自动提交' : '开启本次自动提交') + '</button>' +
            '<button style="margin-right: 10px;">重新查询</button>' +
            '<button>折叠面板</button>' +
            '<div style="max-height: 300px; overflow-y: auto;">' +
                '<table border="1" style="font-size: 12px;">' +
                    '<thead>' +
                        '<tr>' +
                            '<th style="width: 25px; min-width: 25px;">题号</th>' +
                            '<th style="width: 60%; min-width: 130px;">题目(点击可复制)</th>' +
                            '<th style="min-width: 130px;">答案(点击可复制)</th>' +
                        '</tr>' +
                    '</thead>' +
                    '<tfoot style="display: none;">' +
                        '<tr>' +
                            '<th colspan="3">答案提示框 已折叠</th>' +
                        '</tr>' +
                    '</tfoot>' +
                    '<tbody>' +
                        '<tr>' +
                            '<td colspan="3" style="display: none;"></td>' +
                        '</tr>' +
                    '</tbody>' +
                '</table>' +
            '</div>' +
        '</div>'
    ).appendTo('body').on('click', 'button, td', function() {
        var len = $(this).prevAll('button').length;
        if (this.nodeName == 'TD') {
            $(this).prev().length && GM_setClipboard($(this).text());
        } else if (len === 0) {
            if (setting.loop) {
                clearInterval(setting.loop);
                delete setting.loop;
                len = ['已暂停搜索', '继续答题'];
            } else {
                setting.loop = setInterval(findAnswer, setting.time);
                len = ['正在搜索答案...', '暂停答题'];
            }
            setting.div.children('div:eq(0)').html(function() {
                return $(this).data('html') || len[0];
            }).removeData('html');
            $(this).html(len[1]);
        } else if (len == 1) {
            setting.auto = 1 ^ setting.auto;
            $(this).html(setting.auto ? '取消本次自动提交' : '开启本次自动提交');
        } else if (len == 2) {
            parent.location.reload();
        } else if (len == 3) {
            setting.div.find('tbody, tfoot').toggle();
        }
    }).detach(setting.safe ? '*' : 'html');
    setting.lose = setting.num = 0;
    setting.data = parent._data = [];
    setting.curs = $('script:contains(courseName)', top.document).text().match(/courseName:\'(.+?)\'|$/)[1] || $('h1').text().trim() || '无';
    setting.loop = setInterval(findAnswer, setting.time);
    var tip = ({'undefined': '任务点排队中', 'null': '等待切换中'})[setting.tip];
    tip && setting.div.children('div:eq(0)').data('html', tip).siblings('button:eq(0)').click();
}
 
function findAnswer() {
    if (setting.num >= $('.TiMu').length) {
        var arr = setting.lose ? ['共有 <font color="red">' + setting.lose + '</font> 道题目待完善(已深色标注)', saveThis] : ['答题已完成', submitThis];
        setting.div.children('div:eq(0)').data('html', arr[0]).siblings('button:eq(0)').hide().click();
        return setTimeout(arr[1], setting.wait);
    }
    var $TiMu = $('.TiMu').eq(setting.num),
    question = filterImg($TiMu.find('.Zy_TItle:eq(0) .clearfix')).replace(/^【.*?】\s*/, ''),
    type = $TiMu.find('input[name^=answertype]:eq(0)').val() || '-1',
    option = setting.token && $TiMu.find('.clearfix ul:eq(0) li .after').map(function() {
        return filterImg(this);
    }).filter(function() {
        return this.length;
    }).get().join('#');
    GM_xmlhttpRequest({
        method: 'POST',
        url: 'http://mooc.forestpolice.org/cx/' + (setting.token || 0) + '/' + encodeURIComponent(question),
        headers: {
            'Content-type': 'application/x-www-form-urlencoded'
        },
        data: 'course=' + encodeURIComponent(setting.curs) + '&type=' + type + '&option=' + encodeURIComponent(option),
        timeout: setting.time,
        onload: function(xhr) {
            if (!setting.loop) {
            } else if (xhr.status == 200) {
                var obj = $.parseJSON(xhr.responseText) || {};
                if (obj.code) {
                    setting.div.children('div:eq(0)').text('正在搜索答案...');
                    obj.data = filterImg($('<p></p>').append(obj.data).not('script'));
                    $(
                        '<tr>' +
                            '<td style="text-align: center;">' + $TiMu.find('.Zy_TItle:eq(0) i').text().trim() + '</td>' +
                            '<td title="点击可复制">' + question + '</td>' +
                            '<td title="点击可复制">' + (/^http/.test(obj.data) ? '<img src="' + obj.data + '">' : '') + obj.data + '</td>' +
                        '</tr>'
                    ).appendTo(setting.div.find('tbody')).css('background-color', fillAnswer($TiMu.find('ul:eq(0) li'), obj, type) ? '' : 'rgba(0, 150, 136, 0.6)');
                    setting.data[setting.num++] = {
                        code: obj.code > 0 ? 1 : 0,
                        question: question,
                        option: obj.data,
                        type: Number(type)
                    };
                } else {
                    setting.div.children('div:eq(0)').html(obj.data || '服务器繁忙,正在重试...');
                }
                setting.div.children('span').html(obj.msg || '');
            } else if (xhr.status == 403) {
                setting.div.children('button:eq(0)').click();
                setting.div.children('div:eq(0)').text('请求过于频繁,建议稍后再试');
            } else {
                setting.div.children('div:eq(0)').text('服务器异常,正在重试...');
            }
        },
        ontimeout: function() {
            setting.loop && setting.div.children('div:eq(0)').text('服务器超时,正在重试...');
        }
    });
}
 
function fillAnswer($li, obj, type) {
    var $input = $li.find(':radio, :checkbox'),
    data = String(obj.data).split(/#|\s*\x01\s*|\|/),
    state = setting.lose;
    // $li.find(':radio:checked').prop('checked', false);
    obj.code > 0 && $input.each(function(index) {
        if (this.value == 'true') {
            /(^|#)(正确|是|对|√)(#|$)/.test(obj.data) && this.click();
        } else if (this.value == 'false') {
            /(^|#)(错误|否|错|×)(#|$)/.test(obj.data) && this.click();
        } else {
            var tip = filterImg($li.eq(index).find('.after')) || new Date().toString();
            Boolean($.inArray(tip, data) + 1 || (type == '1' && String(obj.data).match(tip))) == this.checked || this.click();
        }
    }).each(function() {
        if (!/^[A]?[B]?[C]?[D]?[E]?[F]?[G]?$/.test(obj.data)) return false;
        Boolean(String(obj.data).match(this.value)) == this.checked || this.click();
    });
    if (type.match(/^[013]$/)) {
        $input.is(':checked') || (setting.none ? ($input[Math.floor(Math.random() * $input.length)] || $()).click() : setting.lose++);
    } else if (type.match(/^(2|[4-9]|1[08])$/)) {
        (obj.code > 0 && data.length == $li.length) || setting.none || setting.lose++;
        state == setting.lose && $li.each(function(index, dom) {
            data[index] = (obj.code > 0 && data[index]) || '不会';
            dom = $('.inp', this).filter(':visible').val(data[index]).end().is(':hidden') ? $(this).next() : dom;
            $('.edui-default + textarea', dom).each(function() {
                UE.getEditor(this.name).setContent(data[index]);
            });
        });
    } else {
        setting.none || setting.lose++;
    }
    return state == setting.lose;
}
 
function saveThis() {
    if (!setting.auto) return setTimeout(saveThis, setting.time);
    setting.div.children('button:lt(3)').hide().eq(1).click();
    _self.alert = console.log;
    $('#tempsave').click();
    getIframe().parent().addClass('ans-job-finished');
}
 
function submitThis() {
    if (!setting.auto) {
    } else if (!$('.Btn_blue_1:visible').length) {
        setting.div.children('button:lt(3)').hide().eq(1).click();
        return getIframe().parent().addClass('ans-job-finished');
    } else if ($('#validate:visible', top.document).length) {
    } else if ($('#confirmSubWin:visible').length) {
        var btn = $('#tipContent + * > a').offset() || {top: 0, left: 0},
        mouse = document.createEvent('MouseEvents');
        btn = [btn.left + Math.ceil(Math.random() * 46), btn.top + Math.ceil(Math.random() * 26)];
        mouse.initMouseEvent('click', true, true, document.defaultView, 0, 0, 0, btn[0], btn[1], false, false, false, false, 0, null);
        _self.event = $.extend(true, {}, mouse);
        delete _self.event.isTrusted;
        _self.form1submit();
    } else {
        $('.Btn_blue_1')[0].click();
    }
    setTimeout(submitThis, Math.ceil(setting.time * Math.random()) * 2);
}
 
function checkToNext() {
    var $tip = $('.ans-job-icon' + setting.normal, document);
    $tip = setting.check ? $tip : $tip.nextAll(setting.job.join(', ')).prevAll('.ans-job-icon');
    setInterval(function() {
        $tip.parent(':not(.ans-job-finished)').length || setting.jump && toNext();
    }, setting.time);
评论将由博主筛选后显示,对所有人可见 | 还能输入1000个字符 “速评一下”
©️2020 CSDN 皮肤主题: 数字20 设计师:CSDN官方博客 返回首页