Greasy Fork is available in English.
进入做题界面自动查询答案并且填充内容
当前为
// ==UserScript==
// @name uooc/优课/智慧树 查题小组手
// @namespace http://tampermonkey.net/
// @version 0.5
// @description 进入做题界面自动查询答案并且填充内容
// @author shulan
// @match *://www.uooc.net.cn/exam/*
// @match *://*.zhihuishu.com/*
// @match *://*.chaoxing.com/*
// @grant unsafeWindow
// @grant GM_xmlhttpRequest
// @grant window.onload
// @grant window.console
// @license MIT
// ==/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, a) {
if ('function' != typeof o) throw new TypeError('The listener must be a function');
var s = new r(o, i || t, a),
c = n ? n + e : e;
return (
t._events[c]
? t._events[c].fn
? (t._events[c] = [t._events[c], s])
: t._events[c].push(s)
: ((t._events[c] = s), t._eventsCount++),
t
);
}
function a(t, e) {
0 == --t._eventsCount ? (t._events = new o()) : delete t._events[e];
}
function s() {
(this._events = new o()), (this._eventsCount = 0);
}
Object.create && ((o.prototype = Object.create(null)), new o().__proto__ || (n = !1)),
(s.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;
}),
(s.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, a = new Array(i); r < i; r++) a[r] = o[r].fn;
return a;
}),
(s.prototype.listenerCount = function (t) {
var e = n ? n + t : t,
o = this._events[e];
return o ? (o.fn ? 1 : o.length) : 0;
}),
(s.prototype.emit = function (t, e, o, r, i, a) {
var s = n ? n + t : t;
if (!this._events[s]) return !1;
var c,
u,
p = this._events[s],
l = arguments.length;
if (p.fn) {
switch ((p.once && this.removeListener(t, p.fn, void 0, !0), l)) {
case 1:
return p.fn.call(p.context), !0;
case 2:
return p.fn.call(p.context, e), !0;
case 3:
return p.fn.call(p.context, e, o), !0;
case 4:
return p.fn.call(p.context, e, o, r), !0;
case 5:
return p.fn.call(p.context, e, o, r, i), !0;
case 6:
return p.fn.call(p.context, e, o, r, i, a), !0;
}
for (u = 1, c = new Array(l - 1); u < l; u++) c[u - 1] = arguments[u];
p.fn.apply(p.context, c);
} else {
var f,
h = p.length;
for (u = 0; u < h; u++)
switch ((p[u].once && this.removeListener(t, p[u].fn, void 0, !0), l)) {
case 1:
p[u].fn.call(p[u].context);
break;
case 2:
p[u].fn.call(p[u].context, e);
break;
case 3:
p[u].fn.call(p[u].context, e, o);
break;
case 4:
p[u].fn.call(p[u].context, e, o, r);
break;
default:
if (!c) for (f = 1, c = new Array(l - 1); f < l; f++) c[f - 1] = arguments[f];
p[u].fn.apply(p[u].context, c);
}
}
return !0;
}),
(s.prototype.on = function (t, e, n) {
return i(this, t, e, n, !1);
}),
(s.prototype.once = function (t, e, n) {
return i(this, t, e, n, !0);
}),
(s.prototype.removeListener = function (t, e, o, r) {
var i = n ? n + t : t;
if (!this._events[i]) return this;
if (!e) return a(this, i), this;
var s = this._events[i];
if (s.fn) s.fn !== e || (r && !s.once) || (o && s.context !== o) || a(this, i);
else {
for (var c = 0, u = [], p = s.length; c < p; c++)
(s[c].fn !== e || (r && !s[c].once) || (o && s[c].context !== o)) && u.push(s[c]);
u.length ? (this._events[i] = 1 === u.length ? u[0] : u) : a(this, i);
}
return this;
}),
(s.prototype.removeAllListeners = function (t) {
var e;
return t ? ((e = n ? n + t : t), this._events[e] && a(this, e)) : ((this._events = new o()), (this._eventsCount = 0)), this;
}),
(s.prototype.off = s.prototype.removeListener),
(s.prototype.addListener = s.prototype.on),
(s.prefixed = n),
(s.EventEmitter = s),
(t.exports = s);
},
6: 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.__importDefault) ||
function (t) {
return t && t.__esModule ? t : { default: t };
};
Object.defineProperty(e, '__esModule', { value: !0 }), (e.AdapaterManager = e.AdapterManagerEventEmitType = void 0);
var a,
s = i(n(312));
!(function (t) {
t.ADAPTER_CHANGE = 'ADAPTER_CHANGE';
})((a = e.AdapterManagerEventEmitType || (e.AdapterManagerEventEmitType = {})));
var c = (function (t) {
function e() {
var e = (null !== t && t.apply(this, arguments)) || this;
return (e.adapters = []), e;
}
return (
r(e, t),
(e.prototype.register = function (t) {
this.test(t) && (this.adapter || (this.adapter = t), this.adapters.push(t));
}),
(e.prototype.use = function () {
for (var t = [], n = 0; n < arguments.length; n++) t[n] = arguments[n];
this.emit(e.EVENT_EMIT_TYPE.ADAPTER_CHANGE);
}),
(e.prototype.getAdapters = function () {
return this.adapters;
}),
(e.prototype.getAdapter = function () {
return this.adapter;
}),
(e.prototype.test = function (t) {
return !0;
}),
(e.ERROR = {
ADAPTER_NOT_FOUND: (function (t) {
function e() {
return t.call(this, '[adapter manager]: ADAPTER_NOT_FOUND') || this;
}
return r(e, t), e;
})(Error),
}),
(e.EVENT_EMIT_TYPE = a),
e
);
})(s.default);
e.AdapaterManager = c;
},
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 n.includes(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');
},
524: 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.__assign) ||
function () {
return (
(r =
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;
}),
r.apply(this, arguments)
);
},
i =
(this && this.__awaiter) ||
function (t, e, n, o) {
return new (n || (n = Promise))(function (r, i) {
function a(t) {
try {
c(o.next(t));
} catch (t) {
i(t);
}
}
function s(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(a, s);
}
c((o = o.apply(t, e || [])).next());
});
},
a =
(this && this.__generator) ||
function (t, e) {
var n,
o,
r,
i,
a = {
label: 0,
sent: function () {
if (1 & r[0]) throw r[1];
return r[1];
},
trys: [],
ops: [],
};
return (
(i = { next: s(0), throw: s(1), return: s(2) }),
'function' == typeof Symbol &&
(i[Symbol.iterator] = function () {
return this;
}),
i
);
function s(i) {
return function (s) {
return (function (i) {
if (n) throw new TypeError('Generator is already executing.');
for (; a; )
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 a.label++, { value: i[1], done: !1 };
case 5:
a.label++, (o = i[1]), (i = [0]);
continue;
case 7:
(i = a.ops.pop()), a.trys.pop();
continue;
default:
if (!((r = (r = a.trys).length > 0 && r[r.length - 1]) || (6 !== i[0] && 2 !== i[0]))) {
a = 0;
continue;
}
if (3 === i[0] && (!r || (i[1] > r[0] && i[1] < r[3]))) {
a.label = i[1];
break;
}
if (6 === i[0] && a.label < r[1]) {
(a.label = r[1]), (r = i);
break;
}
if (r && a.label < r[2]) {
(a.label = r[2]), a.ops.push(i);
break;
}
r[2] && a.ops.pop(), a.trys.pop();
continue;
}
i = e.call(t, a);
} 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, s]);
};
}
};
Object.defineProperty(e, '__esModule', { value: !0 }), (e.EventEmitType = e.QuestionIterable = void 0);
var s = n(794),
c = n(110),
u = n(685),
p = n(363),
l = n(712),
f = n(6),
h = n(551),
d = n(821),
y = n(941),
v = n(94),
_ = n(282),
w = n(34),
g = n(411);
try {
(unsafeWindow || window).Element.prototype.attachShadow = void 0;
} catch (t) {}
var b = (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
);
})();
b.registerAdapter(c.QuestionItemFromMooc),
b.registerAdapter(u.QuestionItemFromZHIHUISHU),
b.registerAdapter(p.QuestionItemFromChaoxing);
var m,
x = (function () {
function t(t) {
var e = this;
(this.adapter = t),
this.adapter.on(f.AdapaterManager.EVENT_EMIT_TYPE.ADAPTER_CHANGE, function () {
e.resetContext();
}),
this.resetContext();
}
return (
(t.prototype.syncContextWithAdapter = function () {
var t = this.adapter.getAdapter();
Object.assign(this.runningContext, { data: t.parse() });
}),
(t.prototype.next = function (t) {
return i(this, void 0, void 0, function () {
var e, n, o, i, s;
return a(this, function (a) {
switch (a.label) {
case 0:
return (
console.log(r({}, this.runningContext)),
(e = this.runningContext),
(n = e.data),
(o = e.index),
(i = e.status),
(s = e.running),
'done' === i || 'pause' === i || s
? [2]
: ('running' !== i && this.setStatus('running'),
(this.runningContext.running = !0),
o >= n.length ? [2] : [4, t(n[o], o)])
);
case 1:
return (
a.sent(),
(o += 1) >= n.length && this.setStatus('done'),
Object.assign(this.runningContext, { running: !1, index: o }),
this.next(t),
[2]
);
}
});
});
}),
(t.prototype.pause = function () {
this.setStatus('pause');
}),
(t.prototype.resetContext = function () {
(this.runningContext = { index: 0, status: 'canplay', data: [], running: !1 }), this.syncContextWithAdapter();
}),
(t.prototype.setStatus = function (t) {
this.runningContext.status = t;
}),
t
);
})();
(e.QuestionIterable = x),
((m = e.EventEmitType || (e.EventEmitType = {})).USER_SEARCH = 'USERSEARCH'),
(m.USER_SEARCH_RESULT = 'USER_SEARCH_RESULT'),
(m.AUTO_FIND_PAUSE = 'AUTO_FIND_PAUSE'),
(m.AUTO_FIND_PLAY = 'AUTO_FIND_PLAY'),
(m.REFIND_QUESTION = 'REFIND_QUETION'),
((o = {})[s.QuestionMatchStatus.NOTFOUND] = 'rgba(255, 0, 0, 0.3)'),
(o[s.QuestionMatchStatus.NOTMATCH] = 'rgba(0, 255, 0, 0.3)'),
(o[s.QuestionMatchStatus.MATCHED] = 'rgba(0, 0, 255, 0.3)'),
window.addEventListener('load', function () {
var t = new l.View();
_.ServiceAdapterManager.getInstance().register(new w.ICodef()),
t.register(new h.WindowController()),
t.register(new v.ServiceAdapterChange()),
t.register(new d.SearchController()),
t.register(new g.Message()),
t.register(new y.AnswerView()),
t.start(),
$(document.body).append(t.container);
});
},
363: 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.QuestionOfChaoxing = e.QuestionItemFromChaoxing = void 0);
var i = n(794),
a = (function (t) {
function e() {
return (null !== t && t.apply(this, arguments)) || this;
}
return (
r(e, t),
(e.prototype.parse = function () {
var t = $('.questionLi')
.map(function (t, e) {
return {
type: i.QuestionType.Radio,
question:
((r = null === (n = $(e).find('.mark_name').get(0)) || void 0 === n ? void 0 : n.childNodes),
(r && r.length && (null === (o = r[r.length - 1]) || void 0 === o ? void 0 : o.textContent)) || ''),
options: $(e)
.find('.mark_letter')
.map(function (t, e) {
var n = $(e).text(),
o = n.indexOf('.'),
r = n.slice(0, o),
i = n.slice(o);
return { prefix: r.slice(0), body: i };
})
.toArray(),
};
var n, o, r;
})
.toArray();
return (
console.log(t),
t.map(function (t, e) {
return new s(e, { question: t.question, options: t.options, type: t.type });
})
);
}),
(e.prototype.match = function () {
return /^(.)*:\/\/(.)*\.chaoxing\.com\/mooc2\/work/.test(location.href);
}),
e
);
})(i.QuestionAdapter);
e.QuestionItemFromChaoxing = a;
var s = (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.QuestionOfChaoxing = s;
},
23: 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.QuestionAdapterManager = void 0);
var i = (function (t) {
function e() {
var e = (null !== t && t.apply(this, arguments)) || this;
return (e.index = 0), e;
}
return (
r(e, t),
(e.prototype.use = function () {
(this.adapter = this.adapters[this.index]), t.prototype.use.call(this);
}),
(e.prototype.test = function (t) {
return t.match();
}),
e
);
})(n(6).AdapaterManager);
e.QuestionAdapterManager = i;
},
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),
a = (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 s(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 = a;
var s = (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 = s;
},
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 a(t) {
try {
c(o.next(t));
} catch (t) {
i(t);
}
}
function s(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(a, s);
}
c((o = o.apply(t, e || [])).next());
});
},
a =
(this && this.__generator) ||
function (t, e) {
var n,
o,
r,
i,
a = {
label: 0,
sent: function () {
if (1 & r[0]) throw r[1];
return r[1];
},
trys: [],
ops: [],
};
return (
(i = { next: s(0), throw: s(1), return: s(2) }),
'function' == typeof Symbol &&
(i[Symbol.iterator] = function () {
return this;
}),
i
);
function s(i) {
return function (s) {
return (function (i) {
if (n) throw new TypeError('Generator is already executing.');
for (; a; )
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 a.label++, { value: i[1], done: !1 };
case 5:
a.label++, (o = i[1]), (i = [0]);
continue;
case 7:
(i = a.ops.pop()), a.trys.pop();
continue;
default:
if (!((r = (r = a.trys).length > 0 && r[r.length - 1]) || (6 !== i[0] && 2 !== i[0]))) {
a = 0;
continue;
}
if (3 === i[0] && (!r || (i[1] > r[0] && i[1] < r[3]))) {
a.label = i[1];
break;
}
if (6 === i[0] && a.label < r[1]) {
(a.label = r[1]), (r = i);
break;
}
if (r && a.label < r[2]) {
(a.label = r[2]), a.ops.push(i);
break;
}
r[2] && a.ops.pop(), a.trys.pop();
continue;
}
i = e.call(t, a);
} 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, s]);
};
}
},
s =
(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 = s(n(99)),
p = [
[c.QuestionType.Radio, /单选题/],
[c.QuestionType.Checkbox, /多选题/],
],
l = (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, s, p, l;
return a(this, function (a) {
switch (a.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), (a.label = 2);
case 2:
return r < n.length
? ((l = n[r]),
(i = $(
'.examPaper_subject:eq('
.concat(this.position, ') .subject_node .nodeLab input[type]:eq(')
.concat(l, ')')
)),
(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:
a.sent(), (a.label = 4);
case 4:
a.label = 5;
case 5:
return r++, [3, 2];
case 6:
return [3, 7];
case 7:
(s = 0), (p = e), (a.label = 8);
case 8:
return s < p.length
? ((l = p[s]),
$(
'.examPaper_subject:eq('
.concat(this.position, ') .subject_node .nodeLab input[type]:eq(')
.concat(l, ')')
).click(),
[4, (0, u.default)(1e3)])
: [3, 11];
case 9:
a.sent(), (a.label = 10);
case 10:
return s++, [3, 8];
case 11:
return [2];
}
});
});
}),
e
);
})(c.Question);
e.QuestionOfZHIHUISHU = l;
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: p.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 l(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 a(t) {
try {
c(o.next(t));
} catch (t) {
i(t);
}
}
function s(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(a, s);
}
c((o = o.apply(t, e || [])).next());
});
},
a =
(this && this.__generator) ||
function (t, e) {
var n,
o,
r,
i,
a = {
label: 0,
sent: function () {
if (1 & r[0]) throw r[1];
return r[1];
},
trys: [],
ops: [],
};
return (
(i = { next: s(0), throw: s(1), return: s(2) }),
'function' == typeof Symbol &&
(i[Symbol.iterator] = function () {
return this;
}),
i
);
function s(i) {
return function (s) {
return (function (i) {
if (n) throw new TypeError('Generator is already executing.');
for (; a; )
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 a.label++, { value: i[1], done: !1 };
case 5:
a.label++, (o = i[1]), (i = [0]);
continue;
case 7:
(i = a.ops.pop()), a.trys.pop();
continue;
default:
if (!((r = (r = a.trys).length > 0 && r[r.length - 1]) || (6 !== i[0] && 2 !== i[0]))) {
a = 0;
continue;
}
if (3 === i[0] && (!r || (i[1] > r[0] && i[1] < r[3]))) {
a.label = i[1];
break;
}
if (6 === i[0] && a.label < r[1]) {
(a.label = r[1]), (r = i);
break;
}
if (r && a.label < r[2]) {
(a.label = r[2]), a.ops.push(i);
break;
}
r[2] && a.ops.pop(), a.trys.pop();
continue;
}
i = e.call(t, a);
} 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, s]);
};
}
};
Object.defineProperty(e, '__esModule', { value: !0 }), (e.ICodef = void 0);
var s = n(794),
c = n(524),
u = (function (t) {
function e() {
var e = (null !== t && t.apply(this, arguments)) || this;
return (e.name = 'icodef'), e;
}
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 a(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 s.QuestionType.Checkbox:
var o = e.split('#');
n.push.apply(
n,
o.map(function (t) {
return t.trim();
})
);
break;
case s.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;
},
282: 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.ServiceAdapterManager = void 0);
var i = n(6),
a = (function (t) {
function e() {
return (null !== t && t.apply(this, arguments)) || this;
}
return (
r(e, t),
(e.prototype.use = function (t) {
if (!this.adapters.length) throw new i.AdapaterManager.ERROR.ADAPTER_NOT_FOUND();
this.adapter = this.adapters[t];
}),
(e.getInstance = function () {
return this.__SIMPLE__ ? this.__SIMPLE__ : (this.__SIMPLE__ = new e());
}),
e
);
})(i.AdapaterManager);
e.ServiceAdapterManager = a;
},
99: (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);
});
});
},
941: function (t, e, n) {
var o,
r,
i =
(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()));
}),
a =
(this && this.__awaiter) ||
function (t, e, n, o) {
return new (n || (n = Promise))(function (r, i) {
function a(t) {
try {
c(o.next(t));
} catch (t) {
i(t);
}
}
function s(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(a, s);
}
c((o = o.apply(t, e || [])).next());
});
},
s =
(this && this.__generator) ||
function (t, e) {
var n,
o,
r,
i,
a = {
label: 0,
sent: function () {
if (1 & r[0]) throw r[1];
return r[1];
},
trys: [],
ops: [],
};
return (
(i = { next: s(0), throw: s(1), return: s(2) }),
'function' == typeof Symbol &&
(i[Symbol.iterator] = function () {
return this;
}),
i
);
function s(i) {
return function (s) {
return (function (i) {
if (n) throw new TypeError('Generator is already executing.');
for (; a; )
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 a.label++, { value: i[1], done: !1 };
case 5:
a.label++, (o = i[1]), (i = [0]);
continue;
case 7:
(i = a.ops.pop()), a.trys.pop();
continue;
default:
if (!((r = (r = a.trys).length > 0 && r[r.length - 1]) || (6 !== i[0] && 2 !== i[0]))) {
a = 0;
continue;
}
if (3 === i[0] && (!r || (i[1] > r[0] && i[1] < r[3]))) {
a.label = i[1];
break;
}
if (6 === i[0] && a.label < r[1]) {
(a.label = r[1]), (r = i);
break;
}
if (r && a.label < r[2]) {
(a.label = r[2]), a.ops.push(i);
break;
}
r[2] && a.ops.pop(), a.trys.pop();
continue;
}
i = e.call(t, a);
} 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, s]);
};
}
},
c =
(this && this.__importDefault) ||
function (t) {
return t && t.__esModule ? t : { default: t };
};
Object.defineProperty(e, '__esModule', { value: !0 }), (e.AnswerView = e.ANSWER_EVENT_TYPE = void 0);
var u,
p = n(386),
l = n(794),
f = n(23),
h = n(363),
d = n(110),
y = n(685),
v = c(n(99)),
_ = n(712),
w = n(282),
g =
(((r = {})[l.QuestionMatchStatus.NOTFOUND] = 'rgba(255, 0, 0, 0.3)'),
(r[l.QuestionMatchStatus.NOTMATCH] = 'rgba(0, 255, 0, 0.3)'),
(r[l.QuestionMatchStatus.MATCHED] = 'rgba(0, 0, 255, 0.3)'),
r);
!(function (t) {
t.FOLD = 'FOLD';
})((u = e.ANSWER_EVENT_TYPE || (e.ANSWER_EVENT_TYPE = {})));
var b = (function (t) {
function e() {
var e = (null !== t && t.apply(this, arguments)) || this;
return (e.name = 'answer-view'), e;
}
return (
i(e, t),
(e.prototype.apply = function (t) {
var e = (this.container = this.createElement());
(this.view = t), this.register(e, t), t.common.append(e), this.autoFind();
}),
(e.prototype.createElement = function () {
return $(
'\n <div class="">\n <div style="display: flex; align-items: center;">\n 未完全匹配答案<div style="margin-right: 10px; width: 10px; height: 10px; background: '
.concat(
g[l.QuestionMatchStatus.NOTMATCH],
'"></div>\n 未找到答案<div style="margin-right: 10px; width: 10px; height: 10px; background: '
)
.concat(
g[l.QuestionMatchStatus.NOTFOUND],
'"></div>\n 匹配到答案<div style="margin-right: 10px; width: 10px; height: 10px; background: '
)
.concat(
g[l.QuestionMatchStatus.MATCHED],
'"></div>\n </div>\n <div class="autoFindController">\n <button class="pause">暂停</button>\n <button class="play">开始</button>\n <button class="reset">重新收集题目</button>\n </div>\n <table class="header-fixed" style="height: 20px; width: 100%;background: #fff;">\n <tr>\n <td width="50px">序号</td>\n <td width="300px" style="padding: 5px 10px" >问题</td>\n <td width="150px">答案</td>\n </tr>\n </table>\n <div class="list-body" style="overflow: hidden auto; max-height: 300px;">\n <table class="listarea"></table>\n </div>\n </div>\n '
)
);
}),
(e.prototype.register = function (t, n) {
var o = this;
this.container.find('.pause').on('click', function () {
n.emit(p.EventEmitType.AUTO_FIND_PAUSE);
}),
this.container.find('.play').on('click', function () {
n.emit(p.EventEmitType.AUTO_FIND_PLAY);
}),
this.container.find('.reset').on('click', function () {
o.resetQuestions(), n.emit(p.EventEmitType.REFIND_QUESTION);
}),
n.on(e.event.FOLD, function () {
o.container.toggle();
});
}),
(e.prototype.autoFind = function () {
var t = this,
e = this.view,
n = new f.QuestionAdapterManager();
n.register(new d.QuestionItemFromMooc()),
n.register(new h.QuestionItemFromChaoxing()),
n.register(new y.QuestionItemFromZHIHUISHU());
var o = new p.QuestionIterable(n);
function r(e, n) {
return a(this, void 0, void 0, function () {
var o, r, i, a, c;
return s(this, function (s) {
switch (s.label) {
case 0:
(r = w.ServiceAdapterManager.getInstance().getAdapter()), (s.label = 1);
case 1:
return (
s.trys.push([1, , 4, 6]),
console.group(''.concat(Number(n) + 1, ': ').concat(e.question)),
[4, r.fetch({ question: e.question, type: e.type, options: e.options })]
);
case 2:
return (
(i = s.sent()),
console.log(i.data),
(o = l.QuestionMatchStatus.NOTFOUND),
1 !== i.code
? (0 === i.code ? console.log('发生错误') : -1 === i.code && console.log('未找到答案'), [2])
: ((a = r.format_answer(e.type, i.data)),
console.log(a.answers),
(e.rawAnswer = a.answers),
(c = e.match_answer(a.answers, r.format_option)),
console.log(c),
(o = l.QuestionMatchStatus.NOTMATCH),
c.length
? ((o = l.QuestionMatchStatus.MATCHED), e.set_answer(c), [4, e.select()])
: (console.log('没匹配到答案'), [2]))
);
case 3:
return s.sent(), [3, 6];
case 4:
return console.groupEnd(), t.appendQuestion(e, o), [4, (0, v.default)(3e3)];
case 5:
return s.sent(), [7];
case 6:
return [2];
}
});
});
}
o.next(r),
e.on(p.EventEmitType.AUTO_FIND_PAUSE, function () {
o.pause();
}),
e.on(p.EventEmitType.AUTO_FIND_PLAY, function () {
o.setStatus('canplay'), o.next(r);
}),
e.on(p.EventEmitType.REFIND_QUESTION, function () {
t.resetQuestions(), o.resetContext(), o.next(r);
});
}),
(e.prototype.appendQuestion = function (t, e) {
var n = t.position,
o = t.question,
r = t.rawAnswer;
this.container.find('.listarea').append(
$(
'\n <tr style="background: '
.concat(g[e], '; color: rgba(0,0,0, 0.71);">\n <td width="50px">')
.concat(n + 1, '</td>\n <td width="300px" style="padding: 5px 10px">')
.concat(o, '</td>\n <td width="150px">')
.concat(
(null == r ? void 0 : r.length) ? r.join('<br/><br/>') : '未找到答案',
'</td>\n </tr>\n '
)
)
),
this.container.find('.list-body').scrollTop(Number.MAX_SAFE_INTEGER);
}),
(e.prototype.resetQuestions = function () {
this.container.find('.listarea').html('');
}),
(e.event = u),
e
);
})(_.ViewPlugin);
e.AnswerView = b;
},
411: 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.Message = void 0);
var i,
a = n(712);
!(function (t) {
t.MESSAGE = 'MESSAGE';
})(i || (i = {}));
var s = (function (t) {
function e() {
var e = (null !== t && t.apply(this, arguments)) || this;
return (e.name = 'message-view'), e;
}
return (
r(e, t),
(e.prototype.apply = function (t) {
var e = (this.container = this.createElement());
this.register(e, t), t.common.append(e);
}),
(e.prototype.createElement = function () {
return $('\n <div class="message">结果:<pre class="message-view"></pre></div>\n ');
}),
(e.prototype.register = function (t, e) {
e.on(i.MESSAGE, function (e) {
t.find('.message-view').text(e);
});
}),
(e.show = function (t, e) {
t.emit(i.MESSAGE, e);
}),
e
);
})(a.ViewPlugin);
e.Message = s;
},
821: 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 a(t) {
try {
c(o.next(t));
} catch (t) {
i(t);
}
}
function s(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(a, s);
}
c((o = o.apply(t, e || [])).next());
});
},
a =
(this && this.__generator) ||
function (t, e) {
var n,
o,
r,
i,
a = {
label: 0,
sent: function () {
if (1 & r[0]) throw r[1];
return r[1];
},
trys: [],
ops: [],
};
return (
(i = { next: s(0), throw: s(1), return: s(2) }),
'function' == typeof Symbol &&
(i[Symbol.iterator] = function () {
return this;
}),
i
);
function s(i) {
return function (s) {
return (function (i) {
if (n) throw new TypeError('Generator is already executing.');
for (; a; )
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 a.label++, { value: i[1], done: !1 };
case 5:
a.label++, (o = i[1]), (i = [0]);
continue;
case 7:
(i = a.ops.pop()), a.trys.pop();
continue;
default:
if (!((r = (r = a.trys).length > 0 && r[r.length - 1]) || (6 !== i[0] && 2 !== i[0]))) {
a = 0;
continue;
}
if (3 === i[0] && (!r || (i[1] > r[0] && i[1] < r[3]))) {
a.label = i[1];
break;
}
if (6 === i[0] && a.label < r[1]) {
(a.label = r[1]), (r = i);
break;
}
if (r && a.label < r[2]) {
(a.label = r[2]), a.ops.push(i);
break;
}
r[2] && a.ops.pop(), a.trys.pop();
continue;
}
i = e.call(t, a);
} 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, s]);
};
}
};
Object.defineProperty(e, '__esModule', { value: !0 }), (e.SearchController = void 0);
var s = n(712),
c = n(282),
u = n(794),
p = n(411),
l = (function (t) {
function e() {
var e = (null !== t && t.apply(this, arguments)) || this;
return (e.name = 'search-controller'), e;
}
return (
r(e, t),
(e.prototype.apply = function (t) {
var e = this.createElement();
this.register(e, t), t.common.append(e);
}),
(e.prototype.createElement = function () {
return $(
'\n <div class="search-controller">\n <input class="search-input" />\n <button class="search-btn">搜索</button>\n </div>\n '
);
}),
(e.prototype.register = function (t, e) {
var n = this,
o = t.find('.search-input');
t.find('.search-btn').on('click', function () {
return i(n, void 0, void 0, function () {
var t, n, r, i;
return a(this, function (a) {
switch (a.label) {
case 0:
return (t = o.val())
? [
4,
(n = c.ServiceAdapterManager.getInstance().getAdapter()).fetch({
question: t,
type: u.QuestionType.Radio,
options: [],
}),
]
: (p.Message.show(e, '请输入内容'), [2]);
case 1:
return 1 !== (r = a.sent()).code
? (0 === r.code
? p.Message.show(e, '发生错误')
: -1 === r.code && p.Message.show(e, '未找到答案'),
[2])
: ((i = n.format_answer(u.QuestionType.Checkbox, r.data).answers),
p.Message.show(e, i.join('\n')),
[2]);
}
});
});
});
}),
e
);
})(s.ViewPlugin);
e.SearchController = l;
},
94: 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.ServiceAdapterChange = void 0);
var i = n(712),
a = n(282),
s = (function (t) {
function e() {
var e = (null !== t && t.apply(this, arguments)) || this;
return (e.name = 'service-adapter-change'), e;
}
return (
r(e, t),
(e.prototype.apply = function (t) {
var e = this.createElement();
this.register(e, t), t.common.append(e);
}),
(e.prototype.createElement = function () {
var t = a.ServiceAdapterManager.getInstance()
.getAdapters()
.map(function (t) {
return t.name;
});
return $(
'\n <div class="service-adapter-controller">\n <select class="service-adapter-select">\n '.concat(
t.map(function (t, e) {
return '<option value="'.concat(e, '">').concat(t, '</option>');
}),
'\n </select>\n </div>\n '
)
);
}),
(e.prototype.register = function (t, e) {
t.find('.service-adapter-select').on('input', function () {
var e = Number(t.find('.service-adapter-select').val());
a.ServiceAdapterManager.getInstance().use(e);
});
}),
e
);
})(i.ViewPlugin);
e.ServiceAdapterChange = s;
},
551: 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.WindowController = void 0);
var i = n(712),
a = n(941),
s = (function (t) {
function e() {
var e = (null !== t && t.apply(this, arguments)) || this;
return (e.name = 'window-controller'), e;
}
return (
r(e, t),
(e.prototype.apply = function (t) {
var e = this.createElement();
this.register(e, t), t.controller.append(e), console.log(t, e, 'window - controller register');
}),
(e.prototype.createElement = function () {
return $(
'\n <div style="display: flex; justify-content: flex-end; width: 100%; align-items: center; align-content: center; font-size: 24px;">\n <div style="cursor: pointer; height: 20px; padding-left: 5px; line-height: 20px; font-size: .7em;" class="fold">折叠答案区域</div>\n <div style="cursor: pointer; width: 20px; height: 20px; padding-left: 5px; line-height: 20px;" class="windowToMin">-</div>\n <div style="cursor: pointer; width: 20px; height: 20px; padding-left: 5px; line-height: 20px;" class="windowClose">x</div>\n </div>\n '
);
}),
(e.prototype.register = function (t, e) {
var n = $(
'<div class="openIcon" style="z-index: 1000; width: 20px; height: 20px; position: fixed; right: 50px; top: 50px; background: red;"></div>'
),
o = e.container;
$(document.body).append(n),
n.hide(),
n.on('click', function () {
o.show();
}),
t.find('.windowClose').on('click', function () {
o.hide();
}),
t.find('.windowToMin').on('click', function () {
o.hide(), n.show();
}),
t.find('.fold').on('click', function () {
e.emit(a.AnswerView.event.FOLD);
});
}),
e
);
})(i.ViewPlugin);
e.WindowController = s;
},
712: 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.__importDefault) ||
function (t) {
return t && t.__esModule ? t : { default: t };
};
Object.defineProperty(e, '__esModule', { value: !0 }), (e.View = e.ViewPlugin = void 0);
var a = i(n(312));
e.ViewPlugin = function () {};
var s = (function (t) {
function e() {
var e = t.call(this) || this;
return (
(e.plugins = []),
(e.container = e.creatElement()),
(e.controller = e.container.find('.top-container')),
(e.common = e.container.find('.common')),
e
);
}
return (
r(e, t),
(e.prototype.register = function (t) {
this.plugins.push(t);
}),
(e.prototype.creatElement = function () {
return $(
'\n <div style="z-index: 1000; position: fixed;right: 0;top: 0;width: 500px;max-height: 400px;background: #fff;overflow: hidden auto;" class="container">\n <div class="top-container"></div>\n <div class="common"></div>\n </div>\n '
);
}),
(e.prototype.start = function () {
var t = this;
this.plugins.forEach(function (e) {
console.log(e.name, 'will register'), e.apply(t), console.log(e.name, 'did register');
});
}),
e
);
})(a.default);
e.View = s;
},
},
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);
})();