// ==UserScript==
// @name uooc/优课/智慧树 查题小组手
// @namespace http://tampermonkey.net/
// @version 0.3
// @description 进入做题界面自动查询答案并且填充内容
// @author shulan
// @match *://www.uooc.net.cn/exam/*
// @match *://*.zhihuishu.com/*
// @grant unsafeWindow
// @grant GM_xmlhttpRequest
// @grant window.onload
// @grant window.console
// @license MIT
// @downloadURL none
// ==/UserScript==
(() => {
'use strict';
var t = {
312: t => {
var e = Object.prototype.hasOwnProperty,
n = '~';
function o() {}
function r(t, e, n) {
(this.fn = t), (this.context = e), (this.once = n || !1);
}
function i(t, e, o, i, s) {
if ('function' != typeof o) throw new TypeError('The listener must be a function');
var a = new r(o, i || t, s),
c = n ? n + e : e;
return (
t._events[c]
? t._events[c].fn
? (t._events[c] = [t._events[c], a])
: t._events[c].push(a)
: ((t._events[c] = a), t._eventsCount++),
t
);
}
function s(t, e) {
0 == --t._eventsCount ? (t._events = new o()) : delete t._events[e];
}
function a() {
(this._events = new o()), (this._eventsCount = 0);
}
Object.create && ((o.prototype = Object.create(null)), new o().__proto__ || (n = !1)),
(a.prototype.eventNames = function () {
var t,
o,
r = [];
if (0 === this._eventsCount) return r;
for (o in (t = this._events)) e.call(t, o) && r.push(n ? o.slice(1) : o);
return Object.getOwnPropertySymbols ? r.concat(Object.getOwnPropertySymbols(t)) : r;
}),
(a.prototype.listeners = function (t) {
var e = n ? n + t : t,
o = this._events[e];
if (!o) return [];
if (o.fn) return [o.fn];
for (var r = 0, i = o.length, s = new Array(i); r < i; r++) s[r] = o[r].fn;
return s;
}),
(a.prototype.listenerCount = function (t) {
var e = n ? n + t : t,
o = this._events[e];
return o ? (o.fn ? 1 : o.length) : 0;
}),
(a.prototype.emit = function (t, e, o, r, i, s) {
var a = n ? n + t : t;
if (!this._events[a]) return !1;
var c,
u,
l = this._events[a],
p = arguments.length;
if (l.fn) {
switch ((l.once && this.removeListener(t, l.fn, void 0, !0), p)) {
case 1:
return l.fn.call(l.context), !0;
case 2:
return l.fn.call(l.context, e), !0;
case 3:
return l.fn.call(l.context, e, o), !0;
case 4:
return l.fn.call(l.context, e, o, r), !0;
case 5:
return l.fn.call(l.context, e, o, r, i), !0;
case 6:
return l.fn.call(l.context, e, o, r, i, s), !0;
}
for (u = 1, c = new Array(p - 1); u < p; u++) c[u - 1] = arguments[u];
l.fn.apply(l.context, c);
} else {
var f,
h = l.length;
for (u = 0; u < h; u++)
switch ((l[u].once && this.removeListener(t, l[u].fn, void 0, !0), p)) {
case 1:
l[u].fn.call(l[u].context);
break;
case 2:
l[u].fn.call(l[u].context, e);
break;
case 3:
l[u].fn.call(l[u].context, e, o);
break;
case 4:
l[u].fn.call(l[u].context, e, o, r);
break;
default:
if (!c) for (f = 1, c = new Array(p - 1); f < p; f++) c[f - 1] = arguments[f];
l[u].fn.apply(l[u].context, c);
}
}
return !0;
}),
(a.prototype.on = function (t, e, n) {
return i(this, t, e, n, !1);
}),
(a.prototype.once = function (t, e, n) {
return i(this, t, e, n, !0);
}),
(a.prototype.removeListener = function (t, e, o, r) {
var i = n ? n + t : t;
if (!this._events[i]) return this;
if (!e) return s(this, i), this;
var a = this._events[i];
if (a.fn) a.fn !== e || (r && !a.once) || (o && a.context !== o) || s(this, i);
else {
for (var c = 0, u = [], l = a.length; c < l; c++)
(a[c].fn !== e || (r && !a[c].once) || (o && a[c].context !== o)) && u.push(a[c]);
u.length ? (this._events[i] = 1 === u.length ? u[0] : u) : s(this, i);
}
return this;
}),
(a.prototype.removeAllListeners = function (t) {
var e;
return t ? ((e = n ? n + t : t), this._events[e] && s(this, e)) : ((this._events = new o()), (this._eventsCount = 0)), this;
}),
(a.prototype.off = a.prototype.removeListener),
(a.prototype.addListener = a.prototype.on),
(a.prefixed = n),
(a.EventEmitter = a),
(t.exports = a);
},
794: (t, e) => {
Object.defineProperty(e, '__esModule', { value: !0 }),
(e.QuestionMatchStatus = e.QuestionType = e.QuestionAdapter = e.Question = void 0);
var n = (function () {
function t(t, e, n) {
void 0 === t && (t = ''),
void 0 === e && (e = []),
void 0 === n && (n = o.Radio),
(this.question = t),
(this.options = e),
(this.type = n);
}
return (
(t.prototype.set_answer = function (t) {
this.answer = t;
}),
(t.prototype.match_answer = function (t, e) {
var n = this;
return this.options
.map(function (t, o) {
return [e(n.type, t.body), o];
})
.filter(function (e) {
var n = e[0];
return t.some(function (t) {
return new RegExp(n).test(t) || n === t;
});
})
.map(function (t) {
return t[0], t[1];
});
}),
t
);
})();
e.Question = n;
var o, r;
(e.QuestionAdapter = function () {}),
(function (t) {
(t[(t.Radio = 0)] = 'Radio'),
(t[(t.Checkbox = 1)] = 'Checkbox'),
(t[(t.Judge = 3)] = 'Judge'),
(t[(t.InBlank = 2)] = 'InBlank');
})((o = e.QuestionType || (e.QuestionType = {}))),
((r = e.QuestionMatchStatus || (e.QuestionMatchStatus = {}))[(r.NOTFOUND = 0)] = 'NOTFOUND'),
(r[(r.NOTMATCH = 1)] = 'NOTMATCH'),
(r[(r.MATCHED = 2)] = 'MATCHED');
},
941: function (t, e) {
var n =
(this && this.__assign) ||
function () {
return (
(n =
Object.assign ||
function (t) {
for (var e, n = 1, o = arguments.length; n < o; n++)
for (var r in (e = arguments[n])) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]);
return t;
}),
n.apply(this, arguments)
);
};
Object.defineProperty(e, '__esModule', { value: !0 }), (e.Service = void 0);
var o = (function () {
function t() {}
return (
(t.fetch = function (t) {
return new Promise(function (e, o) {
GM_xmlhttpRequest(
n(n({}, t), {
onload: function (t) {
e(t);
},
onerror: function (t) {
o(t);
},
})
);
});
}),
t
);
})();
e.Service = o;
},
386: function (t, e, n) {
var o,
r =
(this && this.__extends) ||
((o = function (t, e) {
return (
(o =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (t, e) {
t.__proto__ = e;
}) ||
function (t, e) {
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && (t[n] = e[n]);
}),
o(t, e)
);
}),
function (t, e) {
if ('function' != typeof e && null !== e)
throw new TypeError('Class extends value ' + String(e) + ' is not a constructor or null');
function n() {
this.constructor = t;
}
o(t, e), (t.prototype = null === e ? Object.create(e) : ((n.prototype = e.prototype), new n()));
}),
i =
(this && this.__assign) ||
function () {
return (
(i =
Object.assign ||
function (t) {
for (var e, n = 1, o = arguments.length; n < o; n++)
for (var r in (e = arguments[n])) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]);
return t;
}),
i.apply(this, arguments)
);
},
s =
(this && this.__awaiter) ||
function (t, e, n, o) {
return new (n || (n = Promise))(function (r, i) {
function s(t) {
try {
c(o.next(t));
} catch (t) {
i(t);
}
}
function a(t) {
try {
c(o.throw(t));
} catch (t) {
i(t);
}
}
function c(t) {
var e;
t.done
? r(t.value)
: ((e = t.value),
e instanceof n
? e
: new n(function (t) {
t(e);
})).then(s, a);
}
c((o = o.apply(t, e || [])).next());
});
},
a =
(this && this.__generator) ||
function (t, e) {
var n,
o,
r,
i,
s = {
label: 0,
sent: function () {
if (1 & r[0]) throw r[1];
return r[1];
},
trys: [],
ops: [],
};
return (
(i = { next: a(0), throw: a(1), return: a(2) }),
'function' == typeof Symbol &&
(i[Symbol.iterator] = function () {
return this;
}),
i
);
function a(i) {
return function (a) {
return (function (i) {
if (n) throw new TypeError('Generator is already executing.');
for (; s; )
try {
if (
((n = 1),
o &&
(r = 2 & i[0] ? o.return : i[0] ? o.throw || ((r = o.return) && r.call(o), 0) : o.next) &&
!(r = r.call(o, i[1])).done)
)
return r;
switch (((o = 0), r && (i = [2 & i[0], r.value]), i[0])) {
case 0:
case 1:
r = i;
break;
case 4:
return s.label++, { value: i[1], done: !1 };
case 5:
s.label++, (o = i[1]), (i = [0]);
continue;
case 7:
(i = s.ops.pop()), s.trys.pop();
continue;
default:
if (!((r = (r = s.trys).length > 0 && r[r.length - 1]) || (6 !== i[0] && 2 !== i[0]))) {
s = 0;
continue;
}
if (3 === i[0] && (!r || (i[1] > r[0] && i[1] < r[3]))) {
s.label = i[1];
break;
}
if (6 === i[0] && s.label < r[1]) {
(s.label = r[1]), (r = i);
break;
}
if (r && s.label < r[2]) {
(s.label = r[2]), s.ops.push(i);
break;
}
r[2] && s.ops.pop(), s.trys.pop();
continue;
}
i = e.call(t, s);
} catch (t) {
(i = [6, t]), (o = 0);
} finally {
n = r = 0;
}
if (5 & i[0]) throw i[1];
return { value: i[0] ? i[1] : void 0, done: !0 };
})([i, a]);
};
}
},
c =
(this && this.__importDefault) ||
function (t) {
return t && t.__esModule ? t : { default: t };
};
Object.defineProperty(e, '__esModule', { value: !0 });
var u = n(794),
l = n(110),
p = c(n(283)),
f = n(685),
h = n(34),
d = c(n(312));
try {
(unsafeWindow || window).Element.prototype.attachShadow = void 0;
} catch (t) {}
var y,
v = (function () {
function t(t) {
this.quetions = t;
}
return (
(t.from = function (e) {
return new t(e.parse());
}),
(t.registerAdapter = function (t) {
var e = new t();
e.match() && this.questionAdapter.push(e);
}),
(t.questionAdapter = []),
t
);
})();
v.registerAdapter(l.QuestionItemFromMooc),
v.registerAdapter(f.QuestionItemFromZHIHUISHU),
(function (t) {
(t.USER_SEARCH = 'USERSEARCH'), (t.USER_SEARCH_RESULT = 'USER_SEARCH_RESULT');
})(y || (y = {}));
var w = (function (t) {
function e() {
var e = t.call(this) || this;
return (
(e.container = $(
'
'
)),
(e.controller = e.container.find('.controller')),
(e.listarea = e.container.find('.list table.listarea')),
(e.message = e.container.find('.message')),
(e.search = e.container.find('.search')),
(e.timer = null),
e.init(),
e
);
}
return (
r(e, t),
(e.prototype.init = function () {
this.windowController(), this.saerchView();
}),
(e.prototype.appendItem = function (t, e) {
var n,
o,
r =
(((n = {})[u.QuestionMatchStatus.NOTFOUND] = 'rgba(255, 0, 0, 0.3)'),
(n[u.QuestionMatchStatus.NOTMATCH] = 'rgba(0, 255, 0, 0.3)'),
(n[u.QuestionMatchStatus.MATCHED] = 'rgba(0, 0, 255, 0.3)'),
n),
i = $(
'\n ')
.concat(t.position + 1, ' | \n ')
.concat(t.question, ' | \n ')
.concat(
(null === (o = t.rawAnswer) || void 0 === o ? void 0 : o.length)
? t.rawAnswer.join('
')
: '未找到答案',
' | \n
'
)
);
this.listarea.append(i), this.container.find('.list .list-body').scrollTop(Number.MAX_SAFE_INTEGER);
}),
(e.prototype.windowController = function () {
var t = this,
e = $(
''
);
this.controller.append(e);
var n = $(
''
);
$(document.body).append(n),
n.hide(),
n.on('click', function () {
t.container.show(), n.hide();
}),
e.find('.windowClose').on('click', function () {
t.container.hide();
}),
e.find('.windowToMin').on('click', function () {
t.container.hide(), n.show();
});
}),
(e.prototype.saerchView = function () {
var t = this,
e = this.search.find('.search-input'),
n = this.search.find('.search-btn'),
o = this.search.find('.search-result');
n.on('click', function () {
var n = e.val();
if (!n) return t.show('请输入内容');
t.emit(y.USER_SEARCH, n);
}),
this.on(y.USER_SEARCH_RESULT, function (t) {
var e = t.status,
n = t.data;
0 === e ? o.text((null == n ? void 0 : n.join('\n')) || '') : o.text('未找到答案');
});
}),
(e.prototype.show = function (t) {
var e = this;
return (
clearTimeout(this.timer),
this.message.text(t),
{
close: function () {
e.message.text('');
},
}
);
}),
e
);
})(d.default);
window.addEventListener('load', function () {
!(function () {
s(this, void 0, void 0, function () {
var t,
e,
n,
o,
r,
c,
l,
f,
d,
_,
b,
x,
m,
g = this;
return a(this, function (O) {
switch (O.label) {
case 0:
return (
(t = new w()),
$(document.body).append(t.container),
(e = function (e) {
var n = t.show(JSON.stringify(e, null, 4));
return i(i({}, n), {
delay: function (t) {
return setTimeout(function () {
return n.close();
}, t);
},
});
})('准备开始...').delay(2e3),
[4, (0, p.default)(2e3)]
);
case 1:
for (c in (O.sent(),
(n = v.from(v.questionAdapter[0])),
(o = new h.ICodef()),
t.on(y.USER_SEARCH, function (n) {
return s(g, void 0, void 0, function () {
var r, i;
return a(this, function (s) {
switch (s.label) {
case 0:
return s.trys.push([0, 2, , 3]), e('正在查找中'), [4, o.fetch({ question: n, type: 0 })];
case 1:
return 1 !== (r = s.sent()).code
? (0 === r.code ? e('发生错误') : -1 === r.code && e('未找到答案'),
t.emit(y.USER_SEARCH_RESULT, { status: 1 }),
[2])
: (t.emit(y.USER_SEARCH_RESULT, {
status: 0,
data: o.format_answer(u.QuestionType.Checkbox, r.data).answers,
}),
e('查找完毕').delay(5e3),
[3, 3]);
case 2:
return (
(i = s.sent()),
console.log(i),
t.emit(y.USER_SEARCH_RESULT, { status: 1 }),
e('发生错误: '.concat((null == i ? void 0 : i.message) || i)).delay(5e3),
[3, 3]
);
case 3:
return [2];
}
});
});
}),
(r = []),
n.quetions))
r.push(c);
(l = 0), (O.label = 2);
case 2:
if (!(l < r.length)) return [3, 9];
(f = r[l]), (d = n.quetions[f]), (_ = void 0), (O.label = 3);
case 3:
return (
O.trys.push([3, , 6, 8]),
console.group(''.concat(Number(f) + 1, ': ').concat(d.question)),
[4, o.fetch(d)]
);
case 4:
return (
(b = O.sent()),
console.log(b.data),
(_ = u.QuestionMatchStatus.NOTFOUND),
1 !== b.code
? (0 === b.code ? e('发生错误').delay(2e3) : -1 === b.code && e('未找到答案').delay(2e3), [3, 8])
: ((x = o.format_answer(d.type, b.data)),
console.log(x.answers),
(d.rawAnswer = x.answers),
(m = d.match_answer(x.answers, o.format_option)),
console.log(m),
(_ = u.QuestionMatchStatus.NOTMATCH),
m.length
? ((_ = u.QuestionMatchStatus.MATCHED), d.set_answer(m), [4, d.select()])
: (e('没匹配到答案'), [3, 8]))
);
case 5:
return O.sent(), [3, 8];
case 6:
return console.groupEnd(), t.appendItem(d, _), [4, (0, p.default)(3e3)];
case 7:
return O.sent(), [7];
case 8:
return l++, [3, 2];
case 9:
return [2];
}
});
});
})();
});
},
110: function (t, e, n) {
var o,
r =
(this && this.__extends) ||
((o = function (t, e) {
return (
(o =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (t, e) {
t.__proto__ = e;
}) ||
function (t, e) {
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && (t[n] = e[n]);
}),
o(t, e)
);
}),
function (t, e) {
if ('function' != typeof e && null !== e)
throw new TypeError('Class extends value ' + String(e) + ' is not a constructor or null');
function n() {
this.constructor = t;
}
o(t, e), (t.prototype = null === e ? Object.create(e) : ((n.prototype = e.prototype), new n()));
});
Object.defineProperty(e, '__esModule', { value: !0 }), (e.QuestionOfMooc = e.QuestionItemFromMooc = void 0);
var i = n(794),
s = (function (t) {
function e() {
return (null !== t && t.apply(this, arguments)) || this;
}
return (
r(e, t),
(e.prototype.parse = function () {
return $('.queBox')
.map(function (t, e) {
return {
type: i.QuestionType.Radio,
question: $(e).find('.ti-q-c').text(),
options: $(e)
.find('.ti-alist .ti-a')
.map(function (t, e) {
var n = $(e),
o = n.find('.ti-a-i').text().trim(),
r = n.find('.ti-a-c').text().trim();
return { prefix: o.slice(0, o.indexOf('.')), body: r };
})
.toArray(),
};
})
.toArray()
.map(function (t, e) {
return new a(e, { question: t.question, options: t.options, type: t.type });
});
}),
(e.prototype.match = function () {
return /^(.)*:\/\/(.)*\.uooc\.net\.cn\/exam/.test(location.href);
}),
e
);
})(i.QuestionAdapter);
e.QuestionItemFromMooc = s;
var a = (function (t) {
function e(e, n) {
var o = t.call(this, n.question, n.options, n.type) || this;
return (o.position = e), o;
}
return (
r(e, t),
(e.prototype.select = function () {
var t,
e = this;
'number' == typeof this.position &&
(null === (t = this.answer) ||
void 0 === t ||
t.map(function (t) {
$('.queBox .ti-alist:eq('.concat(e.position, ') .ti-a .ti-a-i [type=radio]:eq(').concat(t, ')')).click();
}));
}),
e
);
})(i.Question);
e.QuestionOfMooc = a;
},
685: function (t, e, n) {
var o,
r =
(this && this.__extends) ||
((o = function (t, e) {
return (
(o =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (t, e) {
t.__proto__ = e;
}) ||
function (t, e) {
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && (t[n] = e[n]);
}),
o(t, e)
);
}),
function (t, e) {
if ('function' != typeof e && null !== e)
throw new TypeError('Class extends value ' + String(e) + ' is not a constructor or null');
function n() {
this.constructor = t;
}
o(t, e), (t.prototype = null === e ? Object.create(e) : ((n.prototype = e.prototype), new n()));
}),
i =
(this && this.__awaiter) ||
function (t, e, n, o) {
return new (n || (n = Promise))(function (r, i) {
function s(t) {
try {
c(o.next(t));
} catch (t) {
i(t);
}
}
function a(t) {
try {
c(o.throw(t));
} catch (t) {
i(t);
}
}
function c(t) {
var e;
t.done
? r(t.value)
: ((e = t.value),
e instanceof n
? e
: new n(function (t) {
t(e);
})).then(s, a);
}
c((o = o.apply(t, e || [])).next());
});
},
s =
(this && this.__generator) ||
function (t, e) {
var n,
o,
r,
i,
s = {
label: 0,
sent: function () {
if (1 & r[0]) throw r[1];
return r[1];
},
trys: [],
ops: [],
};
return (
(i = { next: a(0), throw: a(1), return: a(2) }),
'function' == typeof Symbol &&
(i[Symbol.iterator] = function () {
return this;
}),
i
);
function a(i) {
return function (a) {
return (function (i) {
if (n) throw new TypeError('Generator is already executing.');
for (; s; )
try {
if (
((n = 1),
o &&
(r = 2 & i[0] ? o.return : i[0] ? o.throw || ((r = o.return) && r.call(o), 0) : o.next) &&
!(r = r.call(o, i[1])).done)
)
return r;
switch (((o = 0), r && (i = [2 & i[0], r.value]), i[0])) {
case 0:
case 1:
r = i;
break;
case 4:
return s.label++, { value: i[1], done: !1 };
case 5:
s.label++, (o = i[1]), (i = [0]);
continue;
case 7:
(i = s.ops.pop()), s.trys.pop();
continue;
default:
if (!((r = (r = s.trys).length > 0 && r[r.length - 1]) || (6 !== i[0] && 2 !== i[0]))) {
s = 0;
continue;
}
if (3 === i[0] && (!r || (i[1] > r[0] && i[1] < r[3]))) {
s.label = i[1];
break;
}
if (6 === i[0] && s.label < r[1]) {
(s.label = r[1]), (r = i);
break;
}
if (r && s.label < r[2]) {
(s.label = r[2]), s.ops.push(i);
break;
}
r[2] && s.ops.pop(), s.trys.pop();
continue;
}
i = e.call(t, s);
} catch (t) {
(i = [6, t]), (o = 0);
} finally {
n = r = 0;
}
if (5 & i[0]) throw i[1];
return { value: i[0] ? i[1] : void 0, done: !0 };
})([i, a]);
};
}
},
a =
(this && this.__importDefault) ||
function (t) {
return t && t.__esModule ? t : { default: t };
};
Object.defineProperty(e, '__esModule', { value: !0 }), (e.QuestionItemFromZHIHUISHU = e.QuestionOfZHIHUISHU = void 0);
var c = n(794),
u = a(n(283)),
l = [
[c.QuestionType.Radio, /单选题/],
[c.QuestionType.Checkbox, /多选题/],
],
p = (function (t) {
function e(e, n) {
var o = t.call(this, n.question, n.options, n.type) || this;
return (o.position = e), o;
}
return (
r(e, t),
(e.prototype.select = function () {
var t;
return i(this, void 0, void 0, function () {
var e, n, o, r, i, a, l, p;
return s(this, function (s) {
switch (s.label) {
case 0:
if ('number' != typeof this.position) return [2];
switch (((e = this.answer || []), this.type)) {
case c.QuestionType.Checkbox:
return [3, 1];
case c.QuestionType.Radio:
return [3, 7];
}
return [3, 7];
case 1:
for (o in ((n = []), this.options)) n.push(o);
(r = 0), (s.label = 2);
case 2:
return r < n.length
? ((p = n[r]),
(i = $(
'.examPaper_subject:eq('
.concat(this.position, ') .subject_node .nodeLab input[type]:eq(')
.concat(p, ')')
)),
(null === (t = i.get(0)) || void 0 === t ? void 0 : t.checked)
? (i.click(), [4, (0, u.default)(1e3)])
: [3, 4])
: [3, 6];
case 3:
s.sent(), (s.label = 4);
case 4:
s.label = 5;
case 5:
return r++, [3, 2];
case 6:
return [3, 7];
case 7:
(a = 0), (l = e), (s.label = 8);
case 8:
return a < l.length
? ((p = l[a]),
$(
'.examPaper_subject:eq('
.concat(this.position, ') .subject_node .nodeLab input[type]:eq(')
.concat(p, ')')
).click(),
[4, (0, u.default)(1e3)])
: [3, 11];
case 9:
s.sent(), (s.label = 10);
case 10:
return a++, [3, 8];
case 11:
return [2];
}
});
});
}),
e
);
})(c.Question);
e.QuestionOfZHIHUISHU = p;
var f = (function (t) {
function e() {
return (null !== t && t.apply(this, arguments)) || this;
}
return (
r(e, t),
(e.prototype.parse = function () {
return $('.examPaper_subject')
.map(function (t, e) {
var n = $(e).find('.subject_type').text();
return {
type: l.reduce(function (t, e) {
return e[1].test(n) ? e[0] : t;
}, c.QuestionType.Radio),
question: $(e).find('.subject_stem .subject_describe').text(),
options: $(e)
.find('.subject_node .nodeLab')
.map(function (t, e) {
var n = $(e),
o = n.find('.ABCase').text().trim(),
r = n.find('.node_detail').text().trim();
return { prefix: o.slice(0, o.indexOf('.')), body: r };
})
.toArray(),
};
})
.toArray()
.map(function (t, e) {
return new p(e, { question: t.question, options: t.options, type: t.type });
});
}),
(e.prototype.match = function () {
return /^(.)*:\/\/onlineexamh5new\.zhihuishu\.com\/stuExamWeb\.html.*/.test(location.href);
}),
e
);
})(c.QuestionAdapter);
e.QuestionItemFromZHIHUISHU = f;
},
34: function (t, e, n) {
var o,
r =
(this && this.__extends) ||
((o = function (t, e) {
return (
(o =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array &&
function (t, e) {
t.__proto__ = e;
}) ||
function (t, e) {
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && (t[n] = e[n]);
}),
o(t, e)
);
}),
function (t, e) {
if ('function' != typeof e && null !== e)
throw new TypeError('Class extends value ' + String(e) + ' is not a constructor or null');
function n() {
this.constructor = t;
}
o(t, e), (t.prototype = null === e ? Object.create(e) : ((n.prototype = e.prototype), new n()));
}),
i =
(this && this.__awaiter) ||
function (t, e, n, o) {
return new (n || (n = Promise))(function (r, i) {
function s(t) {
try {
c(o.next(t));
} catch (t) {
i(t);
}
}
function a(t) {
try {
c(o.throw(t));
} catch (t) {
i(t);
}
}
function c(t) {
var e;
t.done
? r(t.value)
: ((e = t.value),
e instanceof n
? e
: new n(function (t) {
t(e);
})).then(s, a);
}
c((o = o.apply(t, e || [])).next());
});
},
s =
(this && this.__generator) ||
function (t, e) {
var n,
o,
r,
i,
s = {
label: 0,
sent: function () {
if (1 & r[0]) throw r[1];
return r[1];
},
trys: [],
ops: [],
};
return (
(i = { next: a(0), throw: a(1), return: a(2) }),
'function' == typeof Symbol &&
(i[Symbol.iterator] = function () {
return this;
}),
i
);
function a(i) {
return function (a) {
return (function (i) {
if (n) throw new TypeError('Generator is already executing.');
for (; s; )
try {
if (
((n = 1),
o &&
(r = 2 & i[0] ? o.return : i[0] ? o.throw || ((r = o.return) && r.call(o), 0) : o.next) &&
!(r = r.call(o, i[1])).done)
)
return r;
switch (((o = 0), r && (i = [2 & i[0], r.value]), i[0])) {
case 0:
case 1:
r = i;
break;
case 4:
return s.label++, { value: i[1], done: !1 };
case 5:
s.label++, (o = i[1]), (i = [0]);
continue;
case 7:
(i = s.ops.pop()), s.trys.pop();
continue;
default:
if (!((r = (r = s.trys).length > 0 && r[r.length - 1]) || (6 !== i[0] && 2 !== i[0]))) {
s = 0;
continue;
}
if (3 === i[0] && (!r || (i[1] > r[0] && i[1] < r[3]))) {
s.label = i[1];
break;
}
if (6 === i[0] && s.label < r[1]) {
(s.label = r[1]), (r = i);
break;
}
if (r && s.label < r[2]) {
(s.label = r[2]), s.ops.push(i);
break;
}
r[2] && s.ops.pop(), s.trys.pop();
continue;
}
i = e.call(t, s);
} catch (t) {
(i = [6, t]), (o = 0);
} finally {
n = r = 0;
}
if (5 & i[0]) throw i[1];
return { value: i[0] ? i[1] : void 0, done: !0 };
})([i, a]);
};
}
};
Object.defineProperty(e, '__esModule', { value: !0 }), (e.ICodef = void 0);
var a = n(794),
c = n(941),
u = (function (t) {
function e() {
return (null !== t && t.apply(this, arguments)) || this;
}
return (
r(e, t),
(e.prototype.fetch = function (t) {
var e = this;
return new Promise(function (n) {
return i(e, void 0, void 0, function () {
var e, o;
return s(this, function (r) {
switch (r.label) {
case 0:
return [
4,
c.Service.fetch({
method: 'POST',
url: 'http://cx.icodef.com/wyn-nb',
headers: { 'Content-Type': 'application/x-www-form-urlencoded', Authorization: '' },
data: 'question='.concat(encodeURIComponent(t.question), '&type=').concat(t.type),
}),
];
case 1:
return (e = r.sent()), (o = JSON.parse(e.responseText)), n(o), [2];
}
});
});
});
}),
(e.prototype.format_answer = function (t, e) {
var n = [];
switch (t) {
case a.QuestionType.Checkbox:
var o = e.split('#');
n.push.apply(
n,
o.map(function (t) {
return t.trim();
})
);
break;
case a.QuestionType.Radio:
n.push(e.trim());
}
return { answers: n };
}),
(e.prototype.format_option = function (t, e) {
return e
.trim()
.replace(/,/g, ',')
.replace(/。/g, '.')
.replace(/(/g, '(')
.replace(/)/g, ')')
.replace(/(“|”)/g, '"');
}),
e
);
})(c.Service);
e.ICodef = u;
},
283: (t, e) => {
Object.defineProperty(e, '__esModule', { value: !0 }),
(e.default = function (t) {
return new Promise(function (e) {
return setTimeout(function () {
return e(void 0);
}, t);
});
});
},
},
e = {};
!(function n(o) {
var r = e[o];
if (void 0 !== r) return r.exports;
var i = (e[o] = { exports: {} });
return t[o].call(i.exports, i, i.exports, n), i.exports;
})(386);
})();