u校园刷网课常用的插件及答题脚本下载
打包好的剧本+欣赏器,翻开即用,无需摆设
载入链接:https://afeixz.lanzous.com/b01hihtxg
一、软硬件引见
重要由欣赏器+插件的情势实行扶助看课答题
实足模仿人为操纵,实用于u船坞平台
翻开登录即可运用,不必在其余做摆设
二、重要功效
登录后机动探求为实行的工作点机动实行
机动答题,机动切换下一工作点,可树立指准时长
三、教程发端
一、开始须要筹备一台电脑,载入一个火狐欣赏器
二、打交战狐欣赏器,在百度上探求tamper monkey,加入途中探求的网站
网站:http://www.tampermonkey.net/
三、点击图中圈着的载入按钮
四、如图,增添到火狐欣赏器傍边
五、即使右上角展示这个图标就表白安置胜利了,即使不会安置请载入上头的制品
六、将底下的代码复制到tampermonkey中,增添实行后就不妨登录发端了
_self = unsafewindow,
url = location.pathname,
top = _self;
if (frameelement) document.domain = location.host.replace(/.+?\./, &9;&9;);
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 = &9;&9;; // &9;:visible&9;
// setting.time += math.ceil(setting.timemath.random()) - setting.time / 2;
// setting.wait += math.ceil(setting.waitmath.random()) - setting.time / 2;
setting.job = [
&9;:not()&9;
,&9;iframe[src="/video/index.html"]&9;
,&9;iframe[src="/work/index.html"]&9;
,&9;iframe[src="/audio/index.html"]&9;
,&9;iframe[src="/innerbook/index.html"]&9;
,&9;iframe[src="/ppt/index.html"]&9;
,&9;iframe[src="/pdf/index.html"]&9;
];
setting.tip = top != _self && jobsort($ || ext.query);
if (url == &9;/ananas/modules/video/index.html&9;) {
if (setting.video) {
if (setting.review) _self.greenligth = ext.emptyfn;
checkplayer();
} else {
getiframe().remove();
}
} else if (url == &9;/work/dohomeworknew&9; || url == &9;/api/work&9; || url == &9;/work/addstudentworknewweb&9;) {
if (!ue) {
var len = ($ || ext.query || array)(&9;font:contains(未登录)&9;, 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 == &9;/ananas/modules/audio/index.html&9;) {
if (setting.audio) {
if (setting.review) _self.greenligth = ext.emptyfn;
hookaudio(_self.videojs, _self.videojs.xhr);
} else {
getiframe().remove();
}
} else if (url == &9;/ananas/modules/innerbook/index.html&9;) {
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 == &9;/knowledge/cards&9;) {
$ && checktonext();
} else if (url.match(/^\/(course|zt)\/\d+\.html$/)) {
settimeout(function() {
setting.read && _self.sendlogs && $(&9;.course_section:eq(0) .chaptertext&9;).click();
}, setting.time);
} else if (url == &9;/ztnodedetailcontroller/visitnodedetail&9;) {
setting.read && _self.sendlogs && autoread();
} else if (url == &9;/mycourse/studentcourse&9;) {
var gv = location.search.match(/d=\d+&/g);
setting.total && $(&9;<a>&9;, {
href: &9;/moocanalysis/chapterstatisticbyuser?classi&9; + gv[1] + &9;coursei&9; + gv[0] + &9;userid=&9; + _self.getcookie(&9;_uid&9;) + &9;&ut=s&9;,
target: &9;_blank&9;,
title: &9;点击察看章节统计&9;,
style: &9;margin: 0 25px;&9;,
html: &9;本课程共&9; + $(&9;.icon&9;).length + &9;节,结余&9; + $(&9;em:not(.openlock)&9;).length + &9;节未实行&9;
}).appendto(&9;.zt_logo&9;).detach(setting.safe ? &9;&9; : &9;html&9;).parent().width(&9;auto&9;);
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 == &9;/work/selectworkquestionyipiyue&9;) {
submitanswer(getiframe().parent(), $.extend(true, [], parent._data));
}
function getiframe(tip, win, job) {
if (!$) return ext.get(frameelement || []).parent().child(&9;.ans-job-icon&9;) || ext.get([]);
do {
win = win ? win.parent : _self;
job = $(win.frameelement).prevall(&9;.ans-job-icon&9;);
} while (!job.length && win.parent.frameelement);
return tip ? win : job;
}
function jobsort($) {
var fn = $.fn ? [getiframe(1), &9;length&9;] : [self, &9;dom&9;],
sel = setting.job.join(&9;, :not(.ans-job-finished) > .ans-job-icon&9; + setting.normal + &9; ~ &9;);
if ($(sel, fn[0].parent.document)[0] == fn[0].frameelement) return true;
if (!getiframe()[fn[1]] || getiframe().parent().is(&9;.ans-job-finished&9;)) 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(&9;data&9;)),
danmaku = data && data.danmaku ? data.danmaku : 0;
if (setting.player == &9;flash&9;) {
_self.showhtml5player = _self.showmoocplayer;
danmaku = 1;
} else if (setting.player == &9;html5&9;) {
_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参数为&9;html5&9;,大概调换欣赏器");
}
}
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 = &9;/richvideo/initdatawithviewer?&9;;
if (setting.drag) {
config.plugins.seekbarcontrol.enablefastforward = 1;
config.playbackrates = [1, 1.25, 1.5, 2];
}
// config.preload = setting.tip ? &9;auto&9; : &9;none&9;;
var player = hooks.apply(this, arguments);
player.children_[0].muted = setting.muted;
player.on(&9;loadstart&9;, function() {
setting.tip && this.play().catch(ext.emptyfn);
});
player.on(&9;ended&9;, function() {
ext.fly(frameelement).parent().addcls(&9;ans-job-finished&9;);
});
_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, &9;jquery&9;, function(target, propertyname, ignored, jquery) {
hooks.method(jquery.fn, &9;cxplayer&9;, 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(&9;ans-job-finished&9;);
// events.onend();
};
config.datas.isdefaultplay = setting.tip || false;
config.enableswitchwindow = 1;
config.datas.currvideoinfo.resourceurl = &9;/richvideo/initdatawithviewer?&9;;
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&/, &9;&drag=true&&9;);
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(&9;loadeddata&9;, function() {
setting.tip && this.play().catch(ext.emptyfn);
});
player.on(&9;ended&9;, function() {
ext.fly(frameelement).parent().addcls(&9;ans-job-finished&9;);
});
_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(&9;end&9;));
setting.tip && ext.fly(frameelement).parent().addcls(&9;ans-job-finished&9;);
}
function docsread() {
if (_self.setting) return setting.tip && _self.finishjob();
setting.tip && ext.fly(frameelement).parent().addcls(&9;ans-job-finished&9;);
}
function relievelimit() {
if (setting.scale) _self.ueditor_config.scaleenabled = false;
$(&9;script&9;).prev(&9;textarea&9;).each(function(index, value) {
ue.geteditor(this.name).ready(function() {
this.destroy();
ue.geteditor(value.name).addlistener(&9;beforepaste&9;, _self.myeditor_paste);
});
});
if (!setting.paste && _self.allowpaste == &9;1&9;) return;
$(&9;input[onpaste]&9;).removeattr(&9;onpaste&9;);
_self.myeditor_paste = $.noop;
// _self.pastetext = function() {return true};
}
function beforefind() {
if ($.type(parent._data) == &9;array&9;) return getiframe().remove();
setting.div = $(
&9;<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;">&9; +
&9;<span style="font-size: medium;"></span>&9; +
&9;<div style="font-size: medium;">正在探求谜底...</div>&9; +
&9;<button style="margin-right: 10px;">休憩答题</button>&9; +
&9;<button style="margin-right: 10px;">&9; + (setting.auto ? &9;废除此次机动提交&9; : &9;打开此次机动提交&9;) + &9;</button>&9; +
&9;<button style="margin-right: 10px;">从新查问</button>&9; +
&9;<button>折叠面板</button>&9; +
&9;<div style="max-height: 300px; overflow-y: auto;">&9; +
&9;<table border="1" style="font-size: 12px;">&9; +
&9;<thead>&9; +
&9;<tr>&9; +
&9;<th style="width: 25px; min-width: 25px;">题号</th>&9; +
&9;<th style="width: 60%; min-width: 130px;">标题(点击可复制)</th>&9; +
&9;<th style="min-width: 130px;">谜底(点击可复制)</th>&9; +
&9;</tr>&9; +
&9;</thead>&9; +
&9;<tfoot style="display: none;">&9; +
&9;<tr>&9; +
&9;<th colspan="3">谜底提醒框 已折叠</th>&9; +
&9;</tr>&9; +
&9;</tfoot>&9; +
&9;<tbody>&9; +
&9;<tr>&9; +
&9;<td colspan="3" style="display: none;"></td>&9; +
&9;</tr>&9; +
&9;</tbody>&9; +
&9;</table>&9; +
&9;</div>&9; +
&9;</div>&9;
).appendto(&9;body&9;).on(&9;click&9;, &9;button, td&9;, function() {
var len = $(this).prevall(&9;button&9;).length;
if (this.nodename == &9;td&9;) {
$(this).prev().length && gm_setclipboard($(this).text());
} else if (len === 0) {
if (setting.loop) {
clearinterval(setting.loop);
delete setting.loop;
len = [&9;已休憩探求&9;, &9;连接答题&9;];
} else {
setting.loop = setinterval(findanswer, setting.time);
len = [&9;正在探求谜底...&9;, &9;休憩答题&9;];
}
setting.div.children(&9;div:eq(0)&9;).html(function() {
return $(this).data(&9;html&9;) || len[0];
}).removedata(&9;html&9;);
$(this).html(len[1]);
} else if (len == 1) {
setting.auto = 1 ^ setting.auto;
$(this).html(setting.auto ? &9;废除此次机动提交&9; : &9;打开此次机动提交&9;);
} else if (len == 2) {
parent.location.reload();
} else if (len == 3) {
setting.div.find(&9;tbody, tfoot&9;).toggle();
}
}).detach(setting.safe ? &9;&9; : &9;html&9;);
setting.lose = setting.num = 0;
setting.data = parent._data = [];
setting.curs = $(&9;script:contains(coursename)&9;, top.document).text().match(/coursename:\&9;(.+?)\&9;|$/)[1] || $(&9;h1&9;).text().trim() || &9;无&9;;
setting.loop = setinterval(findanswer, setting.time);
var tip = ({&9;undefined&9;: &9;工作点列队中&9;, &9;null&9;: &9;等候切换中&9;})[setting.tip];
tip && setting.div.children(&9;div:eq(0)&9;).data(&9;html&9;, tip).siblings(&9;button:eq(0)&9;).click();
}
function findanswer() {
if (setting.num >= $(&9;.timu&9;).length) {
var arr = setting.lose ? [&9;公有 <font color="red">&9; + setting.lose + &9;</font> 道标题待完备(已深色标明)&9;, savethis] : [&9;答题已实行&9;, submitthis];
setting.div.children(&9;div:eq(0)&9;).data(&9;html&9;, arr[0]).siblings(&9;button:eq(0)&9;).hide().click();
return settimeout(arr[1], setting.wait);
}
var $timu = $(&9;.timu&9;).eq(setting.num),
question = filterimg($timu.find(&9;.zy_title:eq(0) .clearfix&9;)).replace(/^【.?】\s/, &9;&9;),
type = $timu.find(&9;input[name^=answertype]:eq(0)&9;).val() || &9;-1&9;,
option = setting.token && $timu.find(&9;.clearfix ul:eq(0) li .after&9;).map(function() {
return filterimg(this);
}).filter(function() {
return this.length;
}).get().join(&9;&9;);
gm_xmlhttprequest({
method: &9;post&9;,
url: &9;http://mooc.forestpolice.org/cx/&9; + (setting.token || 0) + &9;/&9; + encodeuricomponent(question),
headers: {
&9;content-type&9;: &9;application/x-www-form-urlencoded&9;
},
data: &9;course=&9; + encodeuricomponent(setting.curs) + &9;&type=&9; + type + &9;&option=&9; + 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(&9;div:eq(0)&9;).text(&9;正在探求谜底...&9;);
obj.data = filterimg($(&9;<p></p>&9;).append(obj.data).not(&9;script&9;));
$(
&9;<tr>&9; +
&9;<td style="text-align: center;">&9; + $timu.find(&9;.zy_title:eq(0) i&9;).text().trim() + &9;</td>&9; +
&9;<td title="点击可复制">&9; + question + &9;</td>&9; +
&9;<td title="点击可复制">&9; + (/^http/.test(obj.data) ? &9;<img src="&9; + obj.data + &9;">&9; : &9;&9;) + obj.data + &9;</td>&9; +
&9;</tr>&9;
).appendto(setting.div.find(&9;tbody&9;)).css(&9;background-color&9;, fillanswer($timu.find(&9;ul:eq(0) li&9;), obj, type) ? &9;&9; : &9;rgba(0, 150, 136, 0.6)&9;);
setting.data[setting.num++] = {
code: obj.code > 0 ? 1 : 0,
question: question,
option: obj.data,
type: number(type)
};
} else {
setting.div.children(&9;div:eq(0)&9;).html(obj.data || &9;效劳器劳累,正在重试...&9;);
}
setting.div.children(&9;span&9;).html(obj.msg || &9;&9;);
} else if (xhr.status == 403) {
setting.div.children(&9;button:eq(0)&9;).click();
setting.div.children(&9;div:eq(0)&9;).text(&9;乞求过于一再,倡导稍后再试&9;);
} else {
setting.div.children(&9;div:eq(0)&9;).text(&9;效劳器特殊,正在重试...&9;);
}
},
ontimeout: function() {
setting.loop && setting.div.children(&9;div:eq(0)&9;).text(&9;效劳器超时,正在重试...&9;);
}
});
}
function fillanswer($li, obj, type) {
var $input = $li.find(&9;:radio, :checkbox&9;),
data = string(obj.data).split(/|\s\x01\s|\|/),
state = setting.lose;
// $li.find(&9;:radio:checked&9;).prop(&9;checked&9;, false);
obj.code > 0 && $input.each(function(index) {
if (this.value == &9;true&9;) {
/(^|)(精确|是|对|√)(|$)/.test(obj.data) && this.click();
} else if (this.value == &9;false&9;) {
/(^|)(缺点|否|错|×)(|$)/.test(obj.data) && this.click();
} else {
var tip = filterimg($li.eq(index).find(&9;.after&9;)) || new date().tostring();
boolean($.inarray(tip, data) + 1 || (type == &9;1&9; && 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(&9;:checked&9;) || (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]) || &9;不会&9;;
dom = $(&9;.inp&9;, this).filter(&9;:visible&9;).val(data[index]).end().is(&9;:hidden&9;) ? $(this).next() : dom;
$(&9;.edui-default + textarea&9;, 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(&9;button:lt(3)&9;).hide().eq(1).click();
_self.alert = console.log;
$(&9;tempsave&9;).click();
getiframe().parent().addclass(&9;ans-job-finished&9;);
}
function submitthis() {
if (!setting.auto) {
} else if (!$(&9;.btn_blue_1:visible&9;).length) {
setting.div.children(&9;button:lt(3)&9;).hide().eq(1).click();
return getiframe().parent().addclass(&9;ans-job-finished&9;);
} else if ($(&9;validate:visible&9;, top.document).length) {
} else if ($(&9;confirmsubwin:visible&9;).length) {
var btn = $(&9;tipcontent +> a&9;).offset() || {top: 0, left: 0},
mouse = document.createevent(&9;mouseevents&9;);
btn = [btn.left + math.ceil(math.random()46), btn.top + math.ceil(math.random()26)];
mouse.initmouseevent(&9;click&9;, 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 {
$(&9;.btn_blue_1&9;)[0].click();
}
settimeout(submitthis, math.ceil(setting.timemath.random())2);
}
function checktonext() {
var $tip = $(&9;.ans-job-icon&9; + setting.normal, document);
$tip = setting.check ? $tip : $tip.nextall(setting.job.join(&9;, &9;)).prevall(&9;.ans-job-icon&9;);
setinterval(function() {
$tip.parent(&9;:not(.ans-job-finished)&9;).length || setting.jump && tonext();
}, setting.time);
————————————————
https://greasyfork.org/zh-cn
1、功效图
2020/5/31革新【连载自greasy fork】
// ==userscript==
// @nameuer/u船坞/utalk/网课谜底表露/机动填入
// @namespacemrdgbot
// @version2.0.8
// @description[√机动填入谜底【可封闭】【默许推迟0.5秒】][√窗口表露谜底][√功课与尝试][√视传闻单位尝试][√utalk]【遏止对源码举行窜改,颁布,遏止剽窃大肆代码】(未适配的请接洽,免用度户有5积分不妨运用选修类,尝试类实质须要在网页或剧本内的充值按钮赢得积分方可运用)
// @authormrdgbot
// @compatiblechrome
// @match://ucontent.unipus.cn/_pc_default/pc.html?
// @match://ucontent.unipus.cn/_utalk_default/pc.html?
// @match://uexercise.unipus.cn/uexercise
// @match://u.unipus.cn/user/student/homework
// @match://sso.unipus.cn/sso/login
// @match://u.unipus.cn/
// @match://ucamapi.unipus.cn/
// @connectljtion.work
// @connectucamapi.unipus.cn
// @grantgm_xmlhttprequest
// @grantgm.deletevalue
// @grantgm_setvalue
// @grantgm_getvalue
// @grantgm_deletevalue
// @grantgm_info
// @grantunsafewindow
// @run-atdocument-start
// @requirehttps://unpkg.com/sweetalert/dist/sweetalert.min.js
// @supporturlhttps://greasyfork.org/zh-cn/scripts/397517/feedback
// ==/userscript==
var url = window.location.href;
//机动登入
var auto_login = 0;
//if (url.indexof("ucontent.unipus.cn") < 0) return;
var _self = unsafewindow,
xtoken = localstorage.getitem("jwttoke"),
turl = "http://og.ljtion.work/api/",
pagefirst = _self.pagefirst,
page = _self.page,
open_id = &9;&9;,
$ = null,
none = &9;尝试key不许为空,请精细观赏<br><a href="https://greasyfork.org/zh-cn/scripts/397517" target="_blank">【剧本刻画】</a>!&9;,
//即使须要封闭机动答题把isinput的0改成1
setting = {
&9;utoken&9;: &9;&9;,
&9;isinput&9;: 1,
&9;istest&9;: 1,
&9;isagree&9;: 1,
&9;timeout&9;: &9;2000&9;,
&9;score&9;: &9;&9;,
&9;show&9;: &9;1&9;,
&9;showb&9;: &9;2&9;,
&9;testurl&9;: &9;&9;,
&9;fromurl&9;: &9;&9;,
&9;testdata&9;: &9;&9;,
&9;url1&9; : &9;https://ucontent.unipus.cn&9;,
cache: {
count: 0,
type: 0,
mouse_x: -1,
mouse_y: -1
}
},
view = {};
function initview() {
view.top = $(
&9;<div id="box" style="border-radius: 1em;position: fixed;border: 1px double rgb(0,0,0); width: 300px;top: 30px; left: 1%; z-index: 999999; font-size: 15px; background-color: rgb(255,255,255); color: 000000;">&9; +
//&9;<div style="height: 1px;"><button name="show" style="float:right;border-radius:0 0em 0 0;overflow:hidden;border: 1px dashed rgb(0,0,0);background-color: rgb(0,0,0);width:4px;height: 6px;margin-top: 5px;margin-right: 10px;">湮没</button></div>&9;+
&9;<div><button name="show" style="float:right;border-radius:0 1em 0 0;overflow:hidden;border: 0px double rgb(0,0,0);background-color: rgb(255,255,255);">湮没</button></div>&9; +
&9;<div style="height: 25px; margin-top: 10px; text-align: center; font-size: x-large;">uer help</div>&9; +
&9;<div style="" id="div_main">&9; +
&9;<div style="margin: 0 5px; font-size: 15px;" id="info"></div>&9; +
&9;<hr>&9; +
&9;<div id="answercontent" style="margin: 10px; color: orange; font-size: medium; overflow-y: auto; max-height: 400px"></div>&9; +
&9;<hr>&9; +
&9;<div style="margin-left: 10px;margin-top: 5px;margin-bottom: 5px;text-align: left; color: rgb(114,188,114);">积分: <inputοnfοcus="this.blur()" style="border:none;width: 55px;color: rgb(114,188,114);" id="score" name="score">&9; +
&9;<button id="showscore" name="showscore" style="float:right;margin-right: 10px;border-radius:0em;overflow:hidden;border: 1px double rgb(0,0,0);background-color: rgb(255,255,255);">革新</button></div>&9; +
&9;<hr>&9; +
&9;<div><button name="showb" style="float:right;border-radius:1em;overflow:hidden;border: 0px double rgb(0,0,0);background-color: rgb(255,255,255);">湮没</button></div>&9; +
&9;<form style="margin: 0 5px;">&9; +
&9;<div style="" id="div_foot">&9; +
&9;<div style="color: red;margin-left: 70px;">参数窜改后机动生存</div>&9; +
&9;<div>&9; +
&9;<label style="margin-left: 60px;float:center;"fo7="utoken">key(机动天生革新即可):   </label>&9; +
&9;<input disabled="true" style="width: 70%;margin-left: 40px;margin-top: 5px;" id="utoken" name="utoken" placeholder="机动天生革新即可">&9; +
&9;</div>&9; +
&9;<div>&9; +
&9;<label style="margin-left: 50px;float:left;margin-top: 5px;" for="timeout">答题推迟:   </label>&9; +
&9;<inputid="timeout" name="timeout" type="number" min="500" style="margin-top: 5px;width: 55px; text-align: center;">&9; +
&9;<label for="timeout" style="margin-right: 15px;"> 毫秒</label>&9; +
&9;<div style="margin-top: 5px;overflow-y: auto;">&9; +
//<button name="dtbutton" style="margin-right: 10px;float:right;border-radius:0em;border: 1px double rgb(0,0,0);background-color: rgb(255,255,255);">封闭普遍机动答题</button>&9; +
&9;<button name="cz" style="margin-left: 20px;float:left;border-radius:0em;overflow:hidden;border: 1px double rgb(0,0,0);background-color: rgb(255,255,255);">充值</button>&9; +
&9;<button name="dtbutton" style="margin-left: 10px;float:left;border-radius:0em;overflow:hidden;border: 1px double rgb(0,0,0);background-color: rgb(255,255,255);">封闭普遍机动答题</button>&9; +
&9;<button id="cleanlog" name="cleanlog" style="margin-left: 10px;float:left;border-radius:0em;overflow:hidden;border: 1px double rgb(0,0,0);background-color: rgb(255,255,255);">清空日记</button>&9;+
&9;<button id="copykey" name="copykey" style="margin-top: 5px;margin-left: 20px;float:left;border-radius:0em;overflow:hidden;border: 1px double rgb(0,0,0);background-color: rgb(255,255,255);">复制key</button>&9; +
&9;<button id="changekey" name="changekey" style="margin-top: 5px;margin-left: 20px;float:left;border-radius:0em;overflow:hidden;border: 1px double rgb(0,0,0);background-color: rgb(255,255,255);">窜改key</button>&9; +
&9;<button name="jsindex" style="margin-top: 5px;margin-left: 20px;float:left;border-radius:0em;overflow:hidden;border: 1px double rgb(0,0,0);background-color: rgb(255,255,255);">剧本网页</button>&9; +
&9;</div>&9; +
&9;</form><br>&9; +
//<a style="text-align: center;" href=\"https://greasyfork.org/zh-cn/scripts/397517\" target="_blank\">[剧本网页]</a>
&9;<hr>&9; +
&9;<div id="answer_log" style="margin-left: 5px; max-height: 300px; overflow-y: auto;"></div>&9; +
&9;</div>&9; +
&9;</div>&9;
);
view.answerview = view.top.find(&9;answercontent&9;);
view.info = view.top.find(&9;info&9;);
view.div_main = view.top.find(&9;div_main&9;);
view.showb = view.top.find(&9;div_foot&9;);
view.top.appendto(&9;body&9;).delegate(&9;input&9;, &9;input change&9;, function (event) {
if (this.value.match(/^\+$/)) return;
let name = $(this).attr(&9;name&9;);
gm_setvalue(name, this.value);
setting[name] = this.value;
console.log("窜改结束", gm_getvalue(name, this.value), event.type)
getscore();
if (event.type == &9;change&9;) msg(&9;摆设生存胜利,立即奏效&9;);
}).delegate(&9;[name=utoken]&9;, &9;focus blur&9;, function (event) {
$(&9;utoken&9;).val(&9;&9;);
this.value = setting.utoken.replace(/(\s)/g, event.type == &9;focusin&9; ? &9;$1&9; : &9;&9;);
}).delegate(&9;button&9;, &9;click&9;, function (e) {
e.stopimmediatepropagation();
e.stoppropagation();
e.preventdefault();
let name = $(this).attr(&9;name&9;);
if (name == &9;cleanlog&9;){
$(&9;answer_log&9;).html(&9;&9;);
layer.tips(&9;废除结束&9;, &9;cleanlog&9;);
}
if (name == &9;show&9;) {
setting.show = gm_getvalue(&9;show&9;);
$(this).html(setting.show ? &9;湮没&9; : &9;表露&9;);
setting.show ? gm_setvalue(&9;show&9;, 0) : gm_setvalue(&9;show&9;, 1);
view.answerview.slidetoggle();
view.showb.slidetoggle();
}
if (name == &9;showb&9;) {
setting.show = gm_getvalue(&9;showb&9;);
$(this).html(setting.show ? &9;湮没&9; : &9;表露&9;);
setting.show ? gm_setvalue(&9;showb&9;, 0) : gm_setvalue(&9;showb&9;, 1);
view.showb.slidetoggle();
}
if (name == &9;jsindex&9;) {
window.open("https://greasyfork.org/zh-cn/scripts/397517", "_blank");
}
if (name == &9;changekey&9;) {
$(&9;utoken&9;).attr("disabled",false);
layer.tips(&9;已废除锁定&9;, &9;utoken&9;);
}
if (name == &9;copykey&9;) {
copytoclipboard(gm_getvalue(&9;utoken&9;))
layer.tips(&9;复制胜利&9;, &9;copykey&9;);
}
if (name == &9;dtbutton&9;) {
setting.isinput = gm_getvalue(&9;isinput&9;);
$(this).html(setting.isinput ? &9;打开普遍机动答题&9; : &9;封闭普遍机动答题&9;);
console.log(gm_getvalue(&9;isinput&9;))
setting.isinput ? gm_setvalue(&9;isinput&9;, 0) : gm_setvalue(&9;isinput&9;, 1);
}
if (name == &9;cz&9;) {
let key = gm_getvalue(&9;utoken&9;);
url = _self.location.href;
if (url.indexof("u.unipus.cn") != -1) {
if(key){
layer.open({
title: &9;温暖提醒&9;
,content: &9;充值的key能否为:<br>&9;+gm_getvalue(&9;utoken&9;)
,time: 2000
,end: function(){
window.open("http://pay.ljtion.work/?token=" + setting.utoken, "_blank");
}
});
}else{
layer.open({
title: &9;温暖提醒&9;
,content: &9;key缺点,请勿专断变动,如无key请清空后革新加载&9;
,btnalign: &9;c&9;
,yes: function(){
$(&9;utoken&9;).html(&9;&9;);
gm_setvalue(&9;utoken&9;,&9;&9;);
window.location.reload();
}
});
}
} else {
alert("请不要在标题中式点心击充值,去讲义网页点击")
}
//window.open("http://uspay.hurric.cn/?token=" + setting.utoken, "_blank");
}
if (name == &9;showscore&9;) {
getscore();
layer.tips(&9;积分消息革新胜利&9;, &9;showscore&9;);
//msg("积分消息革新胜利");
}
}).find(&9;input&9;).each(function () {
let type = $(this).attr(&9;type&9;),
name = $(this).attr(&9;name&9;);
if (type == &9;radio&9;) {
this.checked = setting[name] == this.value;
} else if (name == &9;score&9;) {
this.value = setting[name]
} else if (name == &9;utoken&9;) {
this.value = setting[name].replace(/\s/g, &9;&9;);
} else {
this.value = setting[name];
}
});
//getxtoekn();
if (setting.utoken) {
msg(&9;<a href="http://op.ljtion.work/" title="翻开链接" style="color:red">最新公布/罕见题目</a>&9;,&9;red&9;)
msg(&9;剧本正在运转&9;);
} else {
console.log(setting.utoken);
getxtoken();
msg(&9;欢送运用剧本<br \>谜底将在页面加载三秒后展示<br \><a href=\"https://greasyfork.org/zh-cn/scripts/397517\" target="_blank\">【剧本刻画】</a><br \><a href=\"https://jq.qq.com/?_wv=1027&k=54sj7ye\" target=\"_blank\">【交谈群】</a>&9;, &9;red&9;);
}
addviewmouselistener()
}
function addviewmouselistener() {
view.top.bind(&9;mousedown&9;, function (event) {
//获得鼠标按下的功夫左侧偏移量和上侧偏移量
setting.cache.view_x = $(this).position().left;
setting.cache.view_y = $(this).position().top;
setting.cache.mouse_x = event.originalevent.clientx;
setting.cache.mouse_y = event.originalevent.clienty;
console.log(setting.cache.mouse_x, setting.cache.mouse_y, setting.cache.view_x, setting.cache.view_y)
});
$(document).bind(&9;mousemove&9;, function (event) {
//计划出此刻的场所是几何
if (setting.cache.mouse_x == -1) return;
if (setting.cache.mouse_y - setting.cache.view_y > view.top.height() - view.div_main.height()) return;
let new_position_left = event.originalevent.clientx - setting.cache.mouse_x + setting.cache.view_x,
new_position_top = event.originalevent.clienty - setting.cache.mouse_y + setting.cache.view_y;
//加上边境控制
if (new_position_top < 0) {//当上边的偏移量小于0的功夫,即是上边的临界点,就让新的场所为0
new_position_top = 0;
}
//即使向下的偏移量大于文书档案东西的莫大减去自己的莫大,就让它即是这个莫大
if (new_position_top > $(document).height() - view.top.height() && $(document).height() - view.top.height() > 0) {
new_position_top = $(document).height() - view.top.height();
}
//右控制
if (new_position_left > $(document).width() - view.top.width()) {
new_position_left = $(document).width() - view.top.width();
}
if (new_position_left < 0) {//左边的偏移量小于0的功夫树立 左边的场所为0
new_position_left = 0;
}
view.top.css({
left: new_position_left + &9;px&9;,
top: new_position_top + &9;px&9;
})
})
$(document).bind(&9;mouseup&9;, function (event) {
setting.cache.mouse_x = -1;
setting.cache.mouse_y = -1;
})
}
function msg(msg, color) {
let nda = new date();
let t = nda.gethours() + &9;:&9; + nda.getminutes() + &9;:&9; + nda.getseconds();
msg = t + &9;&9; + msg;
$(&9;answer_log&9;).append(&9;<p style="color: &9; + (color || &9;black&9;) + &9;">&9; + msg + &9;</p>&9;);
}
//树立谜底典型,0:未知,1:采用,2:非采用
function setanswertype(type) {
setting.cache.type = type;
}
function appendanswerview(answertext) {
if(/[\d]+?\./.test(answertext)){
answertext = answertext.replace((/[\d]+?\./), &9;&9;).trim()
answertext = answertext.replace(/[\d]+?\)/, &9;&9;).trim()
}
if (setting.cache.type == 1) {
if (setting.cache.count++ % 5 == 0) {
let start = math.floor(setting.cache.count / 5)5 + 1;
$(&9;<br><span row="&9; + math.floor(setting.cache.count / 5) + &9;">&9; + start
+ &9;. </span><span class="answertext">&9; + answertext + &9;</span>&9;).appendto(view.answerview);
} else {
let start = math.floor(setting.cache.count / 5)5 + 1,
end = start + setting.cache.count % 5;
view.answerview.find(&9;span[row="&9; + math.floor(setting.cache.count / 5) + &9;"]&9;).text(start + &9;-&9; + end + &9;. &9;);
$(&9;<span class="answertext">&9; + answertext + &9;</span>&9;).appendto(view.answerview);
}
} else {
$(&9;<span>&9; + (++setting.cache.count) + &9;. </span><span class="answertext">&9; + answertext + &9;</span><br>&9;).appendto(view.answerview);
}
}
function clearanswerview() {
view.answerview.empty();
setting.cache.count = 0;
setting.cache.type = 0;
}
function getscore() {
gm_xmlhttprequest({
method: &9;post&9;,
url: turl + &9;getuserscore.php&9;,
data: &9;token=&9; + gm_getvalue(&9;utoken&9;),
headers: {
&9;content-type&9;: &9;application/x-www-form-urlencoded;charset=utf-8&9;,
},
onerror: (error) => {
//isquestion = false;
swal("获得波折!搜集或效劳器缺点,见罕见题目q9","warning");
//alert("获得波折!/n搜集或效劳器缺点");
},
ontimeout: (error) => {
//isquestion = false;
swal("获得波折!/n搜集超时","warning");
//alert("获得谜底波折!搜集超时");
},
onload: function (xhr) {
gm_setvalue(&9;score&9;, &9;&9;)
setting.score = &9;&9;;
document.queryselector(&9;score&9;).value = &9;&9;;
let rejson = json.parse(xhr.responsetext);
console.log(rejson)
console.log("yz",rejson.code)
if(rejson.status != 0){
if(!gm_getvalue(&9;xtoken&9;)){
//console.log(&9;尝试能否既是怒&9;)
getxtoken();}
}else{
gm_setvalue(&9;score&9;, rejson.score)
document.queryselector(&9;score&9;).value = rejson.score;
return;
}
}
});
}
function conten_send_data(type, utoken, url, keyword, da, db, xtoken, testid) {
if (type == &9;common&9;) {
let contentjson = {};
contentjson.t = &9;common&9;;
contentjson.keyword = keyword;
contentjson.url = url;
contentjson.datas = da;
contentjson.utoken = utoken;
return encodeuricomponent(json.stringify(contentjson));
}
if (type == &9;test&9;) {
let contentjson = {};
contentjson.t = &9;test&9;;
contentjson.testid = testid;
contentjson.ua = da;
contentjson.ub = db;
contentjson.keyword = keyword;
contentjson.url = url;
contentjson.utoken = utoken;
contentjson.xtoken = xtoken;
return encodeuricomponent(json.stringify(contentjson));
}
return;
}
function setanswerlink() {
$.each($("tbody tr"), function (i, obj) {
//console.log("暂时",obj.children[5].innertext);
if (obj.children[5].innertext.indexof(&9;未实行&9;) != -1 || obj.children[5].innertext.indexof(&9;待圈阅&9;) != -1) {
let array = obj.children[6].children[0].onclick.tostring().match(/&9;(.?)&9;/g);
//console.log(array);
if (array.length == 3) {
let eid = array[0]
eid = eid.replace(/&9;/g, &9;&9;)
let cid = array[1]
cid = cid.replace(/&9;/g, &9;&9;)
let etype = array[2].match(/exercisetype\=([\s\s]?)\&/g);
let keyword = obj.children[1].innertext;
let redata = {};
//swal("载入胜利","{keyword}√载入结束","error");
msg(&9;<br \>&9; + keyword + &9; √载入结束&9;)
//conten_send_data(type, utoken, url, keyword, da, db, xtoken, testid)
let send_data = conten_send_data(&9;test&9;, setting.utoken, url, keyword, &9;cid=&9; + cid + &9;&9;, &9;exerciseid=&9; + eid + &9;&&9;, gm_getvalue(&9;xtoken&9;), etype[0]);
console.log(send_data);
gm_setvalue(eid, send_data)
}
}
})
}
机动登入与去情况检验和测定根源于brush-jim
已赢得作家受权即使疑义反应处置
作家网页:https://greasyfork.org/zh-cn/users/291772-brush-jim
function autologin() {
// 机动登录功效
if (_self.location.href.indexof(&9;sso.unipus.cn/sso/login&9;) != -1 && auto_login == 1) {
// 获得数据并赋值到 login_data即使没有则赋值 undefined
gm_get(&9;login_data&9;, undefined).then((login_data) => {
if (login_data === undefined) {
// 窜改按钮
$("button[class=&9;btn btn-login btn-fill&9;]")[0].innertext = &9;机动登录\n(鼠圈点击,不要回车)&9;;
$("button[class=&9;btn btn-login btn-fill&9;]").on(&9;click&9;, function () {
$(&9;input[name="rememberme"]&9;)[0].checked = false;
// 生存数据
gm_set(&9;login_data&9;, json.stringify({
&9;username&9;: $("input[name=&9;username&9;]")[0].value,
&9;password&9;: $("input[name=&9;password&9;]")[0].value
}));
})
} else {
let login_json = json.parse(login_data);
$("input[name=&9;rememberme&9;]")[0].checked = false;
$("input[name=&9;username&9;]")[0].value = login_json.username;
$("input[name=&9;password&9;]")[0].value = login_json.password;
$("button[class=&9;btn btn-login btn-fill&9;]")[0].click();
}
})
}
// 重置登录消息功效 以及 去掉过剩元素和弹窗
else if (_self.location.href.indexof(&9;u.unipus.cn/user/student&9;) != -1) {
let browser = mybrowser();
// 树立 sessionstorage,去掉情况检验和测定
_self.sessionstorage.setitem("__env_tested__", date());
// 树立 localstorage长久去掉情况检验和测定
_self.localstorage.setitem("__env_tested__" + browser, browser);
// 窜改 window.localstorage.getitem去掉本子证明及情况检验和测定
_self.getitem_ = _self.localstorage.getitem;
_self.localstorage.getitem = function (a) {
if (a.search(/version_tested|env_tested/i) != -1) {
return true
} else {
return _self.getitem_(a);
}
}
// css去掉情况检验和测定和本子证明的气泡
var style = document.createelement(&9;style&9;);
style.type = &9;text/css&9;;
style.innerhtml = &9;env_newnotice,version_newnotice {display: none!important;}&9;
document.getelementsbytagname(&9;head&9;).item(0).appendchild(style);
console.log(document.getelementsbytagname(&9;head&9;).item(0))
// 窜改“退出”选项为“从新登录”,减少重置机动登录的选项
function change_menu() {
if ($("[class=&9;menu-li&9;]").length != 0) {
for (let a = 0; $(&9;[class="menu-li"]&9;).length > a; a++) {
if ($(&9;[class="menu-li"]&9;)[a].innerhtml == &9;退出&9;) {
$(&9;[class="menu-li"]&9;)[a].innerhtml = &9;从新登录&9;;
}
}
$("[class=&9;hiden-menu&9;]").append("<div class=\"menu-li\" id=\"reset_login\">重置登录消息</a>");
$("div[id=&9;reset_login&9;]").live(&9;click&9;, function () {
// 简略数据
gm_del(&9;login_data&9;);
if (confirm(&9;登录消息重置胜利!\n能否退出登录?&9;) === true) {
_self.location.href = "https://sso.unipus.cn/sso/logout"
}
});
} else {
settimeout(change_menu, 20)
}
}
if (auto_login == 1) {
change_menu();
}
//准时器,重置无操纵计时
setinterval(function(){if(_self.timeline!=undefined && _self.timeline.revived!=undefined){
_self.timeline.revived();
}}, 6000);
}
else if (_self.location.href.search(/ucontent.unipus.cn\/_pc_default\/pc.html/g) != -1) {
setinterval(function(){
$.ajax({
url:&9;https://ucontent.unipus.cn/auth/api/user&9;,
type:&9;get&9;,
success:function(a, b){;},
error:function(a, b){;}
})
if(_self.timeline!=undefined && _self.timeline.revived!=undefined){
_self.timeline.revived();
}}, 300000);
} else if(_self.location.href.search(/utalk.unipus.cn\/page\/homepage.html/g) != -1){
setinterval(function(){
if(_self.timeline!=undefined && _self.timeline.revived!=undefined){
_self.timeline.revived();
}}, 6000);
}
}
function gm_get(name, defaultvalue) {
if (typeof gm_getvalue === &9;function&9;) {
return new promise((resolve, reject) => {
resolve(gm_getvalue(name, defaultvalue));
})
} else {
return gm.getvalue(name, defaultvalue);
}
}
function gm_set(name, defaultvalue) {
if (typeof gm_setvalue === &9;function&9;) {
gm_setvalue(name, defaultvalue);
} else {
gm.setvalue(name, defaultvalue);
}
}
function gm_del(name) {
if (typeof gm_deletevalue === &9;function&9;) {
gm_deletevalue(name);
} else {
gm.deletevalue(name);
}
}
// 获得欣赏器典型,因变量取自网站源代码297行
function mybrowser() {
let useragent = _self.navigator.useragent,
isopera = useragent.indexof("opera") > -1;
if (isopera) {
return "opera"
}
;
if (useragent.indexof("firefox") > -1) {
return "ff";
}
;
if (useragent.indexof("chrome") > -1) {
return "chrome";
}
;
if (useragent.indexof("safari") > -1) {
return "safari";
}
;
if (useragent.indexof("compatible") > -1 && useragent.indexof("msie") > -1 && !isopera) {
return "ie";
}
;
}
function analyse_common(data) {
/领会普遍课程/
settimeout(function () {
let now_course = document.queryselector("header ul").innertext.split("\n");
//console.log(now_course)
let keyword = &9;&9;;
let res = now_course.map(value => {
keyword += value + "-";
return valuevalue;
});
//console.log(conten_send_data(&9;common&9;, setting.utoken, url, res, data))
setting.utoken = gm_getvalue(&9;utoken&9;);
let send_data = conten_send_data(&9;common&9;, setting.utoken, url, keyword, _self.btoa(encodeuricomponent(json.stringify(data))));
console.log(send_data);
gm_xmlhttprequest({
method: &9;post&9;,
url: turl + &9;getuschooldecode.php&9;,
//url: turl + &9;/api/getuschooldecode.php&9;,
data: _self.atob("cmvzpq==") + send_data,
headers: {
&9;content-type&9;: &9;application/x-www-form-urlencoded;charset=utf-8&9;,
},
onerror: (error) => {
//isquestion = false;
alert("获得谜底波折!/n搜集或效劳器缺点,见罕见题目q9");
},
ontimeout: (error) => {
//isquestion = false;
alert("获得谜底波折!/n搜集超时");
},
onload: function (xhr) {
let rejson = json.parse(xhr.responsetext);
//console.log("姑且", rejson)
let page = string(rejson.page);
//console.log("页数", page)
if (rejson.status != 0) {
/无谜底 湮没窗口/
return;
}
clearanswerview()//在增添谜底前应清空上回表露的谜底
if (page > 0) {
let res = rejson.msg.map(value => {
return value;
});
//console.log("暂时数组", res.length)
for (let i = 0; i < res.length; i++) {
let arr = res[i].answer
new promise(function (resolve, reject) {
settimeout(function () {
analyseanswers_common(resolve, res[i].answer[0])
}, 1e3);
}).then(() => {
console.log(res[i].answer[0])
res[i].answer[0].foreach(function (item, index) {
console.log(item);
appendanswerview(item);
});
});
}
//return rejson;
}
if (rejson.msg.indexof("革新") != -1) {
msg(&9;新版的本子已颁布<br><a href="https://greasyfork.org/zh-cn/scripts/398135" target="_blank">【点击革新】</a>!&9;, &9;red&9;);
/须要革新插件/
return;
}
}
});
}, 2e3);
}
function analyseanswers_common(resolve, answer) {
let getanswer = answer;
let dalaytime = setting.timeout;
//getanswer = getanswer.replace(/[\d]+?\./, &9;&9;).trim()
let answersheettype = 0//1单选,2多选,3小填空,4大填空(式1),5大概填空(textmatch)6
setanswertype(0);
if (document.queryselectorall(&9;input[name^="single-"]&9;).length > 0) {
answersheettype = 1;
//setanswertype(1);
} else if (document.queryselectorall(&9;input[class^="multiplechoice--checkbox-"]&9;).length > 0) {
answersheettype = 2
} else if (document.queryselectorall(&9;input[class^="fill-blank--bc-input"]&9;).length > 0) {
answersheettype = 3
} else if (document.queryselectorall(&9;textarea[class^="writing--textarea"]&9;).length > 0) {
answersheettype = 4
} else if (document.queryselectorall(&9;div[class^="cloze-text-pc--fill-blank"]&9;).length > 0) {
answersheettype = 5
} else if (document.queryselectorall(&9;input[class^="cloze-text-pc--bc-input"]&9;).length > 0) {
answersheettype = 6
}
resolve();
if (answersheettype == 1) {//真单选
for (let index in getanswer) {
settimeout(function () {
docheckbox(document.getelementsbyname("single-" + (number(index) + 1))[getanswer[index].charcodeat() - 65])
}, 328 + indexdalaytime)
}
} else if (answersheettype == 2) {//多选
for (let queindex in getanswer) {
for (let index in getanswer[queindex]) {
settimeout(function () {
docheckbox(document.getelementsbyname("multichoice-" + (number(queindex) + 1))[getanswer[queindex][index].charcodeat() - 65])
}, 328 + indexdalaytime)
}
}
} else if (answersheettype == 3) {//假单选,真填空
let e = document.queryselectorall(&9;input[class^="fill-blank--bc-input"]&9;)
for (let index in getanswer) {
let answerss = getanswer[index];
let reanswer = &9;&9;
if (answerss.length > 1) {
reanswer = answerss[0]
}
if (answerss.indexof(",") != -1) {
reanswer = answerss.split(",");
reanswer = answerss[0];
} else {
reanswer = getanswer[index];
}
settimeout(function () {
doinput(e[index], reanswer)
}, 328 + indexdalaytime)
}
} else if (answersheettype == 3) {//真填空
let e = document.queryselectorall(&9;input[class^="fill-blank--bc-input"]&9;)
for (let index in getanswer) {
settimeout(function () {
doinput(e[index], getanswer[index].match(new regexp("^.+?(?= \\||$)", "gm"))[0])
}, 328 + indexdalaytime)
}
} else if (answersheettype == 4) {//大填空
let e = document.queryselectorall(&9;textarea[class^="writing--textarea"]&9;)
for (let index in getanswer) {
settimeout(function () {
doinput(e[index], getanswer[index])
}, 328 + indexdalaytime)
}
} else if (answersheettype == 5) {//大概填空
//formatans = jsonx.questions.map(question => question.answer.replace(&9; &9;,&9;&9;))
let e = document.queryselectorall(&9;div[class^="cloze-text-pc--fill-blank"]&9;)
for (let index in getanswer) {
settimeout(function () {
doinput(e[index].firstelementchild, getanswer[index])
}, 328 + indexdalaytime)
}
} else if (answersheettype == 6) {//假名填空
let e = document.queryselectorall(&9;input[class^="cloze-text-pc--bc-input"]&9;)
for (let index in getanswer) {
settimeout(function () {
doinput(e[index], getanswer[index])
}, 328 + indexdalaytime)
}
}
}
function copytoclipboard(s){
if(window.clipboarddata){
window.clipboarddata.setdata(&9;text&9;,s);
}else{
(function(s){
document.oncopy=function(e){
e.clipboarddata.setdata(&9;text&9;,s);
e.preventdefault();
document.oncopy=null;
}
})(s);
document.execcommand(&9;copy&9;);
}
}
function removehtmltag(str) {
str = str.replace(/<\/?[^>]>/g, &9;&9;); //去除html tag
str = str.replace(/[ | ]\n/g, &9;\n&9;); //去除行尾空缺
//str = str.replace(/\n[\s| | ]\r/g,&9;\n&9;); //去除过剩空行
str = str.replace(/ /ig, &9;&9;);//去掉
return str;
}
function replacehtmlencode(value) {
let converter = document.createelement("div");
converter.innerhtml = value;
return converter.innertext;
}
const inputvalue = (dom, st) => {
if (/input/i.test(dom.tagname)) {
let setvalue = object.getownpropertydescriptor(_self.htmlinputelement.prototype, &9;value&9;).set;
setvalue.call(dom, st);
let e = new event(&9;input&9;, {bubbles: true});
dom.dispatchevent(e);
} else {
let evt = new inputevent(&9;input&9;, {
inputtype: &9;inserttext&9;,
data: st,
datatransfer: null,
iscomposing: false
});
dom.value = st;
dom.dispatchevent(evt);
}
}
function doinput(input, answers) {
if (setting.isinput == 0) {
return;
}
answers = replacehtmlencode(answers)
answers = answers.replace(/[\d]+?\./, &9;&9;).trim()
answers = answers.replace(/[\d]+?\)/, &9;&9;).trim()
answers = answers.replace(&9;•&9;, &9;&9;)
if (/(input)|(textarea)/i.test(input.tagname) && !input.value) {
$(input).trigger(&9;click&9;);
$(input).trigger(&9;focus&9;);
$(input).trigger(&9;keydown&9;);
answers = answers.replace(&9;\n&9;, &9;&9;);
inputvalue(input, answers);
$(input).trigger(&9;keyup&9;);
$(input).trigger(&9;change&9;);
$(input).trigger(&9;blur&9;);
}
}
function getxtoken() {
gm_xmlhttprequest({
method: "get",
url: &9;https://u.unipus.cn/user/data/gettoken&9;,
responsetype: &9;json&9;,
onload: function (response) {
let data = json.parse(response.responsetext);
var jwttoken = data.token;
var open_id = data.openid;
//console.log(data, jwttoken);
let contentcookie = document.cookie;
if (open_id != &9;&9; && jwttoken != null) {
gm_xmlhttprequest({
method: "get",
url: &9;https://ucamapi.unipus.cn/rpc/api/user-info?openid=&9; + open_id + &9;&source=0&callback=&9;,
onload: function (response) {
let data = response.responsetext;
data = data.replace("(", &9;&9;).replace(")", &9;&9;);
data = json.parse(data);
if (data.code == 0) {
let acontentjson = {};
acontentjson.id = open_id;
acontentjson.postcookie = contentcookie;
gm_xmlhttprequest({
method: "post",
url: turl + "getusertoken.php",
data: window.atob("cmvzpq==") + json.stringify(acontentjson),
headers: {
&9;content-type&9;: &9;application/x-www-form-urlencoded;charset=utf-8&9;,
},
onload: function (response) {
let data = response.responsetext;
console.log(data);
data = data.replace("(", &9;&9;).replace(")", &9;&9;);
data = json.parse(data);
if (data.status == 0) {
console.log(jwttoken, data.token)
msg("初始化实行")
if (gm_getvalue(&9;utoken&9;)) {
gm_setvalue(&9;xtoken&9;, jwttoken)
getscore();
//console.log("第二次登入")
} else {
//console.log("第一次登入")
document.queryselector(&9;score&9;).value = data.score;
document.queryselector(&9;utoken&9;).value = data.token;
gm_setvalue(&9;utoken&9;, data.token)
gm_setvalue(&9;xtoken&9;, jwttoken)
gm_setvalue(&9;score&9;, data.score)
window.location.reload();
}
//console.log("积分",setting.score)
} else {
msg("初始化波折")
}
}
});
}
}
});
} else {
msg("初始化波折")
return 1;
}
}
});
}
function docheckbox(dom) {
if (setting.isinput == 0) {
return;
}
if (!dom.checked) {
$(dom).trigger(&9;click&9;);
}
}
(function () {
&9;use strict&9;;
const real_fetch = _self.fetch
_self.fetch = (url, init = null) => real_fetch(url, init).then(response => {
if (/.\/course\/api\/v3\/content\//.test(url)) {
url = url.replace(&9;\/v3&9;,&9;&9;)
url = url.replace(&9;default\/&9;,&9;&9;)
url = setting.url1+url
real_fetch(url, init).then(response => {
let res = response.clone();
res.json().then(analyse_common)
})
}
return response
})
})();
_self.onload = function () {
$ = _self.jquery || _self.aijquery;
//getxtoken();
$.each(setting, function (key, value) {
setting[key] = gm_getvalue(key, value);
});
console.log(setting.isagree);
//gm_setvalue(&9;isagree&9;, 1)
if(setting.isagree !=0 ){
swal({
title: "用户和议",
text: "本剧本按“原样”供给,不供给任何情势的昭示或表示保证,囊括但不限于对适合销售性,一定手段的实用性和非侵权性的保证。不管是因为软硬件,运用或其余办法爆发的,与之相关或与之相关的公约,侵权或其余情势的任何索取赔偿,妨碍或其余负担,作家或版权一切者概不控制,其余本剧本将会搜集用户数据,来创造共享题库,对此你能否承诺",
icon: "warning",
buttons: {
cancel: {
text: "中断",
value: null,
visible: true,
classname: "",
closemodal: true,
},
confirm: {
text: "承诺",
value: true,
visible: true,
classname: "",
closemodal: true
}
},
dangermode: true,
closeonclickoutside: false,
closeonesc: false,
}).then((value) => {
if(value === true){
swal("承诺", "剧本平常运用", "success");
gm_setvalue(&9;isagree&9;, 0)
settimeout(function () {window.location.reload()}, 300)
}else{
swal("中断","因为您中断了剧本和议,剧本将没辙运用\n弹窗将会从来提醒,若想封闭请中断剧本","error");
gm_setvalue(&9;isagree&9;, 1)
}
});
return;
}
autologin();
if (_self.location.href.indexof(&9;u.unipus.cn\/user\/student\/coursecatalog&9;) != -1) {
return;
}
if (_self.location.href.indexof(&9;sso.unipus.cn\/sso\/login&9;) != -1 || _self.location.href.indexof(&9;unipus\.cn\/user\/student\/mycourse&9;) != -1 || _self.location.href.indexof(&9;u.unipus.cn/index&9;) != -1) {
//unsafewindow.login();
return;
} else {
initview();
settimeout(function () {
url = _self.location.href;
//console.log(url);
if (setting.istest == 0) {
return;
}
if (url.indexof("u.unipus.cn/user/student/homework") != -1) {
gm_setvalue(&9;testurl&9;, &9;&9;)
swal("温暖提醒","请等候1-3秒悬浮框内展示:xxx课程√载入结束","warning");
getxtoken();
_self.pagefirst = function (state) {
pagefirst(state);
console.log(&9;pagefirst实行&9;);
setanswerlink();
};
_self.page = function (start, state) {
page(start, state);
console.log(&9;page实行&9;);
setanswerlink();
};
settimeout(setanswerlink, 1e3);
}
if (url.indexof("uexercise.unipus.cn") != -1) {
let jxanswer = document.queryselector(&9;all-content [class="new-openanalysis"]&9;);
if (jxanswer == null) {
var tserpost = &9;&9;
if (url.indexof("schoolid") != -1) {
let matchid = url.match(/exerciseid\=([\s\s]?)\&/);
let getid = matchid[1];
tserpost = gm_getvalue(getid);
} else {
tserpost = setting.testurl
}
//console.log("尝试",tserpost);
settimeout(function () {
document.queryselector("t0 a.return").href = setting.fromurl;
gm_xmlhttprequest({
method: &9;post&9;,
url: turl + &9;getuschooldecode.php&9;,
// url: turl + &9;gettestre.php&9;,
// data:{"res":send_data},
data: _self.atob("cmvzpq==") + tserpost + "&sign=" + window.location.href,
headers: {
&9;content-type&9;: &9;application/x-www-form-urlencoded;charset=utf-8&9;,
&9;user-agent&9;: &9;mozilla/4.0 (compatible) greasemonkey&9;,
},
onload: function (xhr) {
//console.log(xhr.responsetext)
let rejson = json.parse(xhr.responsetext);
console.log("", rejson)
let page = string(rejson.page);
console.log("页数", page)
if (rejson.status != 0) {
return;
} else {
clearanswerview()
let res = rejson.msg.map(value => {
return value;
});
console.log("暂时数组", res)
for (let i = 0; i < res.length; i++) {
let arr = res[i]
//console.log(res[i].answer)
let answer = res[i][1];
let select = answer.substr(0, 2)
//console.log(res[i][3],select)
let delay = setting.timeout;
console.log(delay)
if (res[i][0] == &9;singlechoice&9;) {
settimeout(function () {
selectanswers_test(&9;all-content [qindex="&9; + string(i + 1) + &9;"]&9;, select.substr(0, 1))
}, idelay);
//selectanswers_test(&9;all-content [qid="&9; + res[i][2] + &9;"]&9;,select.substr(0, 1))
}
if (res[i][0] == &9;fillblank&9;) {
settimeout(function () {
inputanswers_test(&9;all-content [qindex="&9; + string(i + 1) + &9;"]&9;, answer)
}, idelay);
//selectanswers_test(&9;all-content [qid="&9; + res[i][2] + &9;"]&9;,select.substr(0, 1))
}
if (res[i][0] == &9;bankedcloze&9;) {
settimeout(function () {
inputanswers_test(&9;all-content [qindex="&9; + string(i + 1) + &9;"]&9;, answer.substr(0, 1))
}, idelay);
}
if (res[i][0] == &9;textmatch&9;) {
settimeout(function () {
inputanswers_test(&9;all-content [qindex="&9; + string(i + 1) + &9;"]&9;, answer.substr(0, 1))
}, idelay);
}
appendanswerview(answer.replace(/[\d]+?\./, &9;&9;).trim());
arr.foreach(function (item, index) {
//console.log("序号", i, item);
});
}
console.log(res);
//return rejson;
}
if (rejson.msg.indexof("革新") != -1) {
msg(&9;新版的本子已颁布<br><a href="https://greasyfork.org/zh-cn/scripts/398135" target="_blank">【点击革新】</a>!&9;, &9;red&9;);
return;
}
}
});
}, 2e3)
}
} else {
let button = document.queryselector("pagelayout div.main button")
xtoken = localstorage.getitem("jwttoke");
url = _self.location.href;
if (button != null && button.innertext == "发端做题") {
getxtoken();
swal("温暖提醒","请细心等候【发端做题】 变为:【载入实行 点击加入即可】","warning");
let now_course = document.queryselector("header ul").innertext.split("\n");
let keyword = &9;&9;;
let res = now_course.map(value => {
keyword += value + "-";
return valuevalue;
});
gm_setvalue(&9;fromurl&9;, url)
button.innertext = "载入实行\n 点击加入即可"
button.onclick = function () {
settimeout(function () {
//console.log("载入b", document.queryselector("iframe").src)
let iframeurl = document.queryselector("iframe").src;
if (iframeurl.indexof(&9;uexercise\/api\/v2\/enter\_unit_test\?exerciseid&9;) != -1) {
_self.location.href = iframeurl;
let send_data = conten_send_data(&9;test&9;, setting.utoken, url, keyword, url, iframeurl, xtoken);
gm_setvalue(&9;testurl&9;, send_data)
console.log(send_data);
}
;
}, 2e3)
}
}
}
}, 2e3);
function selectanswers_test(selector, answer) {
if (setting.isinput == 0) {
return;
}
let lists = document.queryselectorall(selector);
for (let i = 0; i < 4; i++) {
if (lists[i].value == answer) {
$(lists[i]).trigger(&9;click&9;);
}
}
}
function inputanswers_test(selector, answers) {
if (setting.isinput == 0) {
return;
}
answers = answers.trim();
let inputs = document.queryselector(selector);
if (/(input)|(textarea)/i.test(inputs.tagname) && !inputs.value) {
$(inputs).trigger(&9;click&9;);
$(inputs).trigger(&9;focus&9;);
$(inputs).trigger(&9;keydown&9;);
answers = answers.replace(&9;\n&9;, &9;&9;);
if (answers.indexof(" | ") != -1) {
answers = answers.split(" | ");
answers = answers[0];
}
inputvalue(inputs, answers);
$(inputs).trigger(&9;keyup&9;);
$(inputs).trigger(&9;change&9;);
$(inputs).trigger(&9;blur&9;);
}
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
2、代码【增添到油猴剧本即可】 2020/2/20
// ==userscript==
// @nameuer/u船坞网课谜底表露/u船坞谜底机动填入
// @namespacemrdgbot
// @version1.7
// @description[全机动填入谜底【可封闭】【随机推迟】(未适配的请接洽)][窗口表露谜底][扶助长篇观赏、建设视传闻][不扶助单位尝试]【遏止对源码举行窜改,颁布,遏止剽窃大肆代码】
// @authoraskar882;democrazy;mrdgbot
// @compatiblechrome
// @match://ucontent.unipus.cn/_pc_default/pc.html?
// @grantnone
// @run-atdocument-start
// @requirehttp://cdn.staticfile.org/jquery/3.4.1/jquery.min.js
// ==/userscript==
(function () {
&9;use strict&9;;
let userset = {
hasinput: true,//能否打开机动答题,即使树立为false,
//每道题之间的答题间隙 [单元:毫秒]
//无需推迟树立min和max为0即可
//代办(随机1-3秒)倡导2-5秒
min:1000,
max:3000,
}
const wrapperid = "answerwrapper"
const titleid = "answertitle"
const contentid = "answercontent"
const innertext = html => {
let div = document.createelement(&9;div&9;)
div.innerhtml = html
if (div.firstchild) {
return div.firstchild.innertext
} else {
return null;
}
}
const inputvalue = (dom, st) => {
if (/input/i.test(dom.tagname)) {
var setvalue = object.getownpropertydescriptor(window.htmlinputelement.prototype, &9;value&9;).set;
setvalue.call(dom, st);
var e = new event(&9;input&9;, { bubbles: true });
dom.dispatchevent(e);
} else {
let evt = new inputevent(&9;input&9;, {
inputtype: &9;inserttext&9;,
data: st,
datatransfer: null,
iscomposing: false
});
dom.value = st;
dom.dispatchevent(evt);
}
}
const knownquestionkeys = [
"questions:shortanswer",
"shortanswer:shortanswer",
"questions:scoopquestions",
"questions:sequence",
"questions:questions",
"questions:textmatch",
"questions:bankedcloze",
"questions:scoopselection"
]
let timer = function (func) {
let hasloaded = false;
return function (selector, answers) {
if (!userset.hasinput) {
return;
}
if (hasloaded) {
return;
}
let cnt = 15;
let handler = window.setinterval(() => {
hasloaded = true;
if (!(cnt--)) {
window.clearinterval(handler);
location.reload(true);
alert("机动答题波折!");
}
hasloaded = func(selector, answers, handler);
}, 1000);
}
};
let inputanswers = timer((selector, answers, handler) => {
if (!userset.hasinput) {
return;
}
let inputs = document.queryselectorall(selector);
let hasloaded = true;
if (inputs.length) {
window.clearinterval(handler);
hasloaded = false;
for (let i = 0; i < inputs.length; i++) {
window.settimeout(() => {
if (/(input)|(textarea)/i.test(inputs[i].tagname) && !inputs[i].value) {
settimeout(function(){
inputs[i].click();
inputs[i].focus();
answers[i] = answers[i].replace(&9;\n&9;,&9;&9;);
if(answers[i].indexof(" | ") != -1){
answers[i] = answers[i].split(" | ");
answers[i] = answers[i][0];
}
inputvalue(inputs[i], answers[i]);
inputs[i].blur();
},math.floor(math.random()(userset.max - userset.min + 1)) + userset.min);
}
}, i500 + math.random()300);
}
}
return hasloaded;
});
let selectanswers = timer((selector, answers, handler) => {
if (!userset.hasinput) {
return;
}
var xi;
for (xi = 0; xi < selector.length; xi++){
let lists = document.queryselectorall(selector[xi]);
if (lists.length != 0) {
break;
}
}
let lists = document.queryselectorall(selector[xi]);
let hasloaded = true;
if (lists.length) {
window.clearinterval(handler);
hasloaded = false;
for (let i = 0; i < lists.length; i++) {
window.settimeout(() => {
let inputs = lists[i].queryselectorall(&9;input[type="radio"]&9;);
console.log(inputs)
for (let j = 0; j < inputs.length; j++) {
if (inputs[j].value === answers[i].touppercase() || inputs[j].value === answers[i].tolowercase()) {
settimeout(function(){
inputs[j].click();
},math.floor(math.random()(userset.max - userset.min + 1)) + userset.min);
}
}
}, i500 + math.random()300);
}
}
return hasloaded;
});
const answerresolvers = [
json => {
console.log(&9;answerresolvers&9; + 0);
let answer = "";
let answers = [];
json.questions.foreach(question => {
let text = `\n${innertext(question.analysis.html)}`
answer += text;
answers.push(innertext(question.analysis.html).replace(&9;•&9;, &9;&9;).replace(/[\d]+?\./, &9;&9;).trim());
});
inputanswers(&9;div.questions textarea&9;, answers);
return answer
},
json => {
let answer = ""
let as = [];
let as2 = [];
var iii;
console.log(&9;answerresolvers&9; + 1);
if (!innertext(json.analysis.html)) {
console.log("1")
for (iii = 0; iii < json.questions.length; iii++) {
answer = json.questions[iii];
if (typeof answer === "string") {
answer = json.parse(answer);
}
answer = answer.analysis.html
answer = innertext(answer);
as2.push("\n"+answer)
as.push(answer.replace(&9;•&9;, &9;&9;).replace(/[\d]+?\./, &9;&9;).trim())
}
console.log(as)
inputanswers(&9;div.questions textarea&9;, as);
return as2;
} else {
console.log("2")
answer = innertext(json.analysis.html);
}
inputanswers(&9;mainlrright textarea&9;, [answer]);
return answer;
},
json => {
console.log(&9;answerresolvers&9; + 2);
let answer = [];
let answers = [];
var as = "";
json.questions.foreach(question => {
as = `\n${innertext(question.content.html)} ${question.answers.join(" | ")}`
//answer += `\n${ innertext(question.content.html) } ${ question.answers.join(" | ") }`
//answer.push("answer:")
answer.push(as)
answers.push(question.answers[0]);
});
console.log("xx",answers)
console.log(answer)
inputanswers(&9;divroot div.questions input&9;, answers);
return answer
},
json => {
console.log(&9;answerresolvers&9; + 3);
return json.questions.map(question => question.answer).join(", ")
},
json => {
console.log(&9;answerresolvers&9; + 4);
//console.log(json.questions.map(question => question.answers))
let answers = json.questions.map(question => question.answers[0]);
if(answers[0].length > 1){
inputanswers(&9;divroot div.questions input&9;, answers);
}else{
selectanswers([&9;main-top ul&9;,&9;mainlrright ul&9;], answers);
}
return answers.join(", ")
},
json => {
console.log(&9;answerresolvers&9; + 5);
let answers = json.questions.map(question => question.answer);
inputanswers(&9;mainlrright input&9;,answers);
return answers.join(", ")
},
json => {
console.log(&9;answerresolvers&9; + 6);
return json.questions.map(question => question.answer).join(", ")
},
json => {
console.log(&9;answerresolvers&9; + 7);
var si;
let answers = json.questions.map(question => question.answers[0]);
for (si = 0;si < answers.length; si++){
var numa;
var as;
var numb;
numa = th(answers[si])
as = innertext(json.questions[si].options[numa-1].content.html);
numb = si+1
answers[si] = "\n"+numb+". "+as;
}
// inputanswers(&9;divroot div.questions input&9;, answers);
return answers.join(", ");
}
]
const specialquestions = [
/^content_\d:questions$/,
]
const specialscoopquestions = [
/^content_\d:scoopquestions$/,
]
const specialanswerresolvers = [
json => {
let answer = ""
let resolver = answerresolvers[knownquestionkeys.indexof("questions:questions")]
console.log(resolver)
answer = object.keys(json).sort().map((key, index) => (index + 1) + ". " + resolver(json[key])).join(&9;\n&9;)
console.log(answer)
return answer+"\n[该采用题需手动换页,感谢共同]!"
},
]
const showanswer = json => {
let answer = "no answer found"
let isquestion = true
if (json != null && json.hasownproperty("content")) {
let contentjson = json.parse(json.content)
console.log("%c%s", "color: red; font-size: 16px;", json.stringify(contentjson, &9;&9;, 2))
let keys = object.keys(contentjson)
let key = keys[0]
let keyindex = knownquestionkeys.indexof(key)
if (keyindex !== -1) {
answer = answerresolvers[keyindex](contentjson[key])
console.log("answer=" + answer);
} else {
let specialkeyindex = -1
specialquestions.foreach((pattern, index) => {
if (pattern.test(key)) {
specialkeyindex = index
}
})
if (specialkeyindex == -1) {
console.log(contentjson)
specialscoopquestions.foreach((pattern, index) => {
if (pattern.test(key)) {
specialkeyindex = index
}
})
}
if (specialkeyindex !== -1) {
console.log(contentjson)
answer = specialanswerresolvers[specialkeyindex](contentjson)
} else {
answer = "not a question\n" + json.stringify(contentjson, &9;&9;, 2)
isquestion = false
}
}
}
let title = "参考谜底"
let wrapperelem = document.getelementbyid(wrapperid) ? document.getelementbyid(wrapperid) : document.createelement("div");
let titleelem = document.getelementbyid(titleid) ? document.getelementbyid(titleid) : document.createelement("div");
let contentelem = document.getelementbyid(contentid) ? document.getelementbyid(contentid) : document.createelement("div");
let br = document.createelement("br")
let tuiguang = document.createelement("a")
tuiguang.setattribute("href","http://wpa.qq.com/msgrd?v=3&uin=41737035&site=qq&menu=yes")
tuiguang.setattribute("target","_blank")
tuiguang.text = "查题呆板人?"
if (!isquestion) {
return
}
wrapperelem.setattribute("id", wrapperid)
titleelem.setattribute("id", titleid)
contentelem.setattribute("id", contentid)
wrapperelem.setattribute("style",
"top: 100px; left: 100px; margin: 0 auto; z-index: 1024; border-radius: 1em;"
+ " 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: fff; width: 250px; max-height: 400px; min-height: 200px;")
titleelem.setattribute("style", "background: inherit; height: 25px; margin-top: 10px; text-align: center; font-size: x-large")
contentelem.setattribute("style", "margin: 10px; color: orange; font-size: medium; overflow-y: auto; max-height: 375px")
titleelem.innertext = title
contentelem.innertext = answer
makedraggable(titleelem)
wrapperelem.appendchild(titleelem)
contentelem.appendchild(br)
contentelem.appendchild(tuiguang)
wrapperelem.appendchild(contentelem)
document.body.appendchild(wrapperelem)
}
const real_fetch = window.fetch
window.fetch = (url, init = null) => real_fetch(url, init).then(response => {
if (/.\/course\/api\/content\//.test(url)) {
let res = response.clone()
res.json().then(showanswer)
}
return response
})
function makedraggable(elem) {
document.mousestate = &9;up&9;
elem.mousestate = &9;up&9;
elem.lastmouseposy = null
elem.lastmouseposx = null
elem.proposednewposy = parseint(elem.style.top, 10)
elem.proposednewposx = parseint(elem.style.left, 10)
document.onmousedown = _ => {
document.mousestate = &9;down&9;
}
document.onmouseup = _ => {
document.mousestate = &9;up&9;
elem.mousestate = &9;up&9;
}
elem.onmousedown = e => {
elem.lastmouseposy = e.pagey
elem.lastmouseposx = e.pagex
elem.mousestate = &9;down&9;
document.mousestate = &9;down&9;
document.onselectstart = e => {
e.preventdefault()
return false
}
}
elem.onmouseup = e => {
elem.mousestate = &9;up&9;
document.mousestate = &9;up&9;
document.onselectstart = null
}
const getatint = (obj, attrib) => parseint(obj.style[attrib], 10)
document.onmousemove = e => {
if ((document.mousestate === &9;down&9;) && (elem.mousestate === &9;down&9;)) {
elem.proposednewposy = getatint(elem.parentelement, &9;top&9;) + e.pagey - elem.lastmouseposy
elem.proposednewposx = getatint(elem.parentelement, &9;left&9;) + e.pagex - elem.lastmouseposx
if (elem.proposednewposy < 0) {
elem.parentelement.style.top = "0px"
} else if (elem.proposednewposy > window.innerheight - getatint(elem.parentelement, &9;height&9;)) {
elem.parentelement.style.top = window.innerheight - getatint(elem.parentelement, &9;height&9;) + &9;px&9;
} else {
elem.parentelement.style.top = elem.proposednewposy + &9;px&9;
}
if (elem.proposednewposx < 0) {
elem.parentelement.style.left = "0px"
} else if (elem.proposednewposx > window.innerwidth - getatint(elem.parentelement, &9;width&9;)) {
elem.parentelement.style.left = window.innerwidth - getatint(elem.parentelement, &9;width&9;) + &9;px&9;
} else {
elem.parentelement.style.left = elem.proposednewposx + &9;px&9;
}
elem.lastmouseposy = e.pagey
elem.lastmouseposx = e.pagex
}
}
}
function th(s){
return s.split("").map(function(o){
return o.touppercase().charcodeat()-64;
}).join("");
}
})();
————————————————