u校园刷题刷课刷时长教程【亲测可用】

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

下载链接:https://afeixz.lanzous.com/b01hihtxg

一、软件介绍

主要由浏览器+插件的形式实现辅助看课答题

完全模拟人工操作,适用于U校园平台

打开登录即可使用,不用在另外做配置

u校园刷题刷课刷时长教程【亲测可用】_第1张图片

二、主要功能

登录后自动寻找为完成的任务点自动完成

自动答题,自动切换下一任务点,可设置指定时长

三、教程开始

一、首先我们需要准备一台电脑,下载一个火狐浏览器

二、打开火狐浏览器,在百度上搜索tamper monkey,进入途中搜索的网站

网站:http://www.tampermonkey.net/

在这里插入图片描述

三、点击图中圈着的下载按钮

在这里插入图片描述

 

四、如图,添加到火狐浏览器当中

在这里插入图片描述

 

五、如果右上角出现这个图标就表示安装成功了,如果不会安装请下载上面的成品

在这里插入图片描述

六、将下面的代码复制到tampermonkey中,添加完成后就可以登录开始了

_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 && $('', {
        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 = $(
        '
' + '' + '
正在搜索答案...
' + '' + '' + '' + '' + '
' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
题号题目(点击可复制)答案(点击可复制)
答案提示框 已折叠
' + '
' + '
' ).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 ? ['共有 ' + setting.lose + ' 道题目待完善(已深色标注)', 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($('

').append(obj.data).not('script')); $( '' + '' + $TiMu.find('.Zy_TItle:eq(0) i').text().trim() + '' + '' + question + '' + '' + (/^http/.test(obj.data) ? '' : '') + obj.data + '' + '' ).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);

 

你可能感兴趣的:(个人分享)