// ==UserScript== // @name TsingHuaELT网课助手 // @namespace https://www.github.com/SSmJaE/ // @description 显示清华社英语在线题目答案;支持班级测试;开放自定义设置 // @version 0.0.3 // @author SSmJaE // @license GPL-3.0 // @compatible Chrome // @run-at document-end // @match https://www.tsinghuaelt.com/course-student/* // @match https://www.tsinghuaelt.com/course-study-student/* // @connect localhost // @connect 47.97.90.127 // @grant GM_setValue // @grant GM_getValue // @grant GM_setClipboard // @grant GM_xmlhttpRequest // @grant unsafeWindow // @require https://cdn.jsdelivr.net/npm/vue/dist/vue.js // @require https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js // ==/UserScript== /******/ (function(modules) { // webpackBootstrap /******/ // install a JSONP callback for chunk loading /******/ function webpackJsonpCallback(data) { /******/ var chunkIds = data[0]; /******/ var moreModules = data[1]; /******/ /******/ /******/ // add "moreModules" to the modules object, /******/ // then flag all "chunkIds" as loaded and fire callback /******/ var moduleId, chunkId, i = 0, resolves = []; /******/ for(;i < chunkIds.length; i++) { /******/ chunkId = chunkIds[i]; /******/ if(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) { /******/ resolves.push(installedChunks[chunkId][0]); /******/ } /******/ installedChunks[chunkId] = 0; /******/ } /******/ for(moduleId in moreModules) { /******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { /******/ modules[moduleId] = moreModules[moduleId]; /******/ } /******/ } /******/ if(parentJsonpFunction) parentJsonpFunction(data); /******/ /******/ while(resolves.length) { /******/ resolves.shift()(); /******/ } /******/ /******/ }; /******/ /******/ /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // object to store loaded and loading chunks /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched /******/ // Promise = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ 0: 0 /******/ }; /******/ /******/ /******/ /******/ // script path function /******/ function jsonpScriptSrc(chunkId) { /******/ return __webpack_require__.p + "" + chunkId + ".TsingHuaELT.0.0.3.user.js" /******/ } /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ // The chunk loading function for additional chunks /******/ // Since all referenced chunks are already included /******/ // in this file, this function is empty here. /******/ __webpack_require__.e = function requireEnsure() { /******/ return Promise.resolve(); /******/ }; /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // on error function for async loading /******/ __webpack_require__.oe = function(err) { console.error(err); throw err; }; /******/ /******/ var jsonpArray = window["webpackJsonp"] = window["webpackJsonp"] || []; /******/ var oldJsonpFunction = jsonpArray.push.bind(jsonpArray); /******/ jsonpArray.push = webpackJsonpCallback; /******/ jsonpArray = jsonpArray.slice(); /******/ for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]); /******/ var parentJsonpFunction = oldJsonpFunction; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 57); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(40); /***/ }), /* 1 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _asyncToGenerator; }); function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } /***/ }), /* 2 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, "d", function() { return /* binding */ injectToContent; }); __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ addMessage; }); __webpack_require__.d(__webpack_exports__, "e", function() { return /* binding */ makeDraggable; }); __webpack_require__.d(__webpack_exports__, "f", function() { return /* binding */ requestErrorHandler; }); __webpack_require__.d(__webpack_exports__, "g", function() { return /* binding */ setValue; }); __webpack_require__.d(__webpack_exports__, "c", function() { return /* binding */ getValue; }); __webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ copyToClipboard; }); // UNUSED EXPORTS: sleep, clearHtmlTagAndSplit // EXTERNAL MODULE: ./node_modules/@babel/runtime/regenerator/index.js var regenerator = __webpack_require__(0); var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js var esm_typeof = __webpack_require__(4); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 3 modules var slicedToArray = __webpack_require__(20); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js var asyncToGenerator = __webpack_require__(1); // EXTERNAL MODULE: ./src/global.ts var global = __webpack_require__(3); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js var defineProperty = __webpack_require__(12); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js var classCallCheck = __webpack_require__(6); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js var createClass = __webpack_require__(7); // CONCATENATED MODULE: ./src/utils/bridge.ts function sleep(ms) { return new Promise(function (resolve) { return setTimeout(resolve, ms); }); } /**inject和content公用的消息组件*/ var bridge_Communication = /*#__PURE__*/function () { function Communication(serviceType, serviceSource, serviceTarget) { Object(classCallCheck["a" /* default */])(this, Communication); this.sessions = new Set(); this.responses = {}; this.serviceType = serviceType; this.serviceSource = serviceSource; this.serviceTarget = serviceTarget; this.listen(); } Object(createClass["a" /* default */])(Communication, [{ key: "emit", value: function emit(event, payload) {} }, { key: "listen", value: function listen() { var _this = this; window.addEventListener("message", /*#__PURE__*/function () { var _ref = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee(event) { var data, response, payload, key, value, defaultValue, returnValue; return regenerator_default.a.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: // console.error(event); data = event.data; if (!(data.extension === "unipus-helper")) { _context.next = 33; break; } if (!(data.serviceTarget === _this.serviceSource && data.serviceSource === _this.serviceTarget)) { _context.next = 33; break; } if (!(data.type === "request")) { _context.next = 32; break; } if (!(data.serviceSource === "inject" && data.serviceTarget === "content")) { _context.next = 30; break; } payload = JSON.parse(data.payload); _context.t0 = payload.type; _context.next = _context.t0 === "fetch" ? 9 : _context.t0 === "setValue" ? 13 : _context.t0 === "getValue" ? 19 : 26; break; case 9: _context.next = 11; return new Promise(function (resolve) { return chrome.runtime.sendMessage(data.payload, function (response) { console.error(554321); console.error(response); resolve(response); }); }); case 11: response = _context.sent; return _context.abrupt("break", 28); case 13: key = payload.key; value = payload.value; _context.next = 17; return new Promise(function (resolve) { chrome.storage.sync.set(Object(defineProperty["a" /* default */])({}, key, value), function () { console.log("".concat(key, " is set to ") + value); resolve(undefined); }); }); case 17: response = {}; return _context.abrupt("break", 28); case 19: key = payload.key; defaultValue = payload.defaultValue; _context.next = 23; return new Promise(function (resolve) { chrome.storage.sync.get(key, function (result) { console.error("".concat(key, " currently is ") + result[key]); var temp; try { temp = JSON.parse(result[key]); } catch (e) { temp = result[key]; } resolve(temp); }); }); case 23: returnValue = _context.sent; response = returnValue ? returnValue : defaultValue; return _context.abrupt("break", 28); case 26: response = "no event handler for " + payload.type; return _context.abrupt("break", 28); case 28: _context.next = 31; break; case 30: response = {}; case 31: window.postMessage({ extension: "unipus-helper", sessionId: data.sessionId, serviceType: _this.serviceType, serviceSource: _this.serviceSource, serviceTarget: _this.serviceTarget, type: "response", status: "200", payload: response }, "*"); case 32: if (data.type === "response") { console.error("".concat(_this.serviceType, " ").concat(_this.serviceSource, " receive server ").concat(_this.serviceTarget, "'s response")); _this.responses[data.sessionId] = data.payload; _this.sessions["delete"](data.sessionId); } case 33: case "end": return _context.stop(); } } }, _callee); })); return function (_x) { return _ref.apply(this, arguments); }; }()); } /**模拟网络请求 */ }, { key: "request", value: function request(message) { var _this2 = this; return new Promise( /*#__PURE__*/function () { var _ref2 = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee2(resolve, reject) { var sessionId, response; return regenerator_default.a.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: if (!(_this2.serviceSource === "content" && _this2.serviceTarget === "background")) { _context2.next = 4; break; } chrome.runtime.sendMessage(message, function (response) { resolve(response); }); _context2.next = 13; break; case 4: sessionId = String(Math.random()); window.postMessage({ extension: "unipus-helper", sessionId: sessionId, serviceType: _this2.serviceType, serviceSource: _this2.serviceSource, serviceTarget: _this2.serviceTarget, type: "request", payload: JSON.stringify(message) }, "*"); _this2.sessions.add(sessionId); case 7: if (false) {} if (!_this2.sessions.has(sessionId)) { response = _this2.responses[sessionId]; delete _this2.responses[sessionId]; resolve(response); } _context2.next = 11; return sleep(50); case 11: _context2.next = 7; break; case 13: case "end": return _context2.stop(); } } }, _callee2); })); return function (_x2, _x3) { return _ref2.apply(this, arguments); }; }()); } }]); return Communication; }(); /* harmony default export */ var bridge = (bridge_Communication); // CONCATENATED MODULE: ./src/utils/common.ts function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } var injectToContent = false ? undefined : {}; function common_sleep(ms) { return new Promise(function (resolve) { return setTimeout(resolve, ms); }); } function addMessage(_x) { return _addMessage.apply(this, arguments); } /**实现拖动,带边界检测*/ function _addMessage() { _addMessage = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee2(message) { var type, scrollDown, add, _add, _iterator, _step, line, _args2 = arguments; return regenerator_default.a.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: _add = function _add3() { _add = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee(finalInfo, finalType) { var single, _args = arguments; return regenerator_default.a.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: single = _args.length > 2 && _args[2] !== undefined ? _args[2] : true; if (!(finalType !== "hr")) { _context.next = 4; break; } if (!(finalInfo === "")) { _context.next = 4; break; } return _context.abrupt("return"); case 4: global["c" /* Global */].messages.push({ info: finalInfo, type: finalType }); if (!(global["c" /* Global */].USER_SETTINGS.autoSlide && single === true)) { _context.next = 9; break; } _context.next = 8; return common_sleep(10); case 8: //等待message渲染完成,不然不会拉到最底 scrollDown(); case 9: case "end": return _context.stop(); } } }, _callee); })); return _add.apply(this, arguments); }; add = function _add2(_x7, _x8) { return _add.apply(this, arguments); }; scrollDown = function _scrollDown() { document.querySelector("#container-messages").scrollBy(0, 1000); }; type = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : "normal"; if (!Array.isArray(message)) { _context2.next = 30; break; } _iterator = _createForOfIteratorHelper(message); _context2.prev = 6; _iterator.s(); case 8: if ((_step = _iterator.n()).done) { _context2.next = 19; break; } line = _step.value; if (!(Object(esm_typeof["a" /* default */])(line) === "object")) { _context2.next = 15; break; } _context2.next = 13; return add(line.info, line.type, false); case 13: _context2.next = 17; break; case 15: _context2.next = 17; return add(String(line), "normal", false); case 17: _context2.next = 8; break; case 19: _context2.next = 24; break; case 21: _context2.prev = 21; _context2.t0 = _context2["catch"](6); _iterator.e(_context2.t0); case 24: _context2.prev = 24; _iterator.f(); return _context2.finish(24); case 27: scrollDown(); _context2.next = 32; break; case 30: _context2.next = 32; return add(String(message), type); case 32: case "end": return _context2.stop(); } } }, _callee2, null, [[6, 21, 24, 27]]); })); return _addMessage.apply(this, arguments); } function makeDraggable(handle, container) { function getProperty(ele, prop) { return parseInt(window.getComputedStyle(ele)[prop]); } var draggable = false, pastX, pastY, containerWidth, containerHeight, containerLeft = getProperty(container, "left"), containerTop = getProperty(container, "top"), windowWidth = window.innerWidth, windowHeight = window.innerHeight; handle.addEventListener("mousedown", function (e) { handle.style.cursor = "grabbing"; draggable = true; pastX = e.clientX; pastY = e.clientY; containerWidth = getProperty(container, "width"); containerHeight = getProperty(container, "height"); }, false); document.addEventListener("mousemove", function (e) { if (draggable === true) { var currentX = e.clientX, currentY = e.clientY, diffX = currentX - pastX, diffY = currentY - pastY; var targetX = containerLeft + diffX; var targetY = containerTop + diffY; if (targetX <= 0) targetX = 0; if (targetY <= 0) targetY = 0; if (targetX >= windowWidth - containerWidth) targetX = windowWidth - containerWidth; if (targetY >= windowHeight - containerHeight) targetY = windowHeight - containerHeight; container.style.left = targetX + "px"; container.style.top = targetY + "px"; } }); handle.addEventListener("mouseup", function () { handle.style.cursor = "grab"; draggable = false; containerLeft = getProperty(container, "left"); containerTop = getProperty(container, "top"); }, false); //防止意外未退出拖动状态 document.body.addEventListener("keydown", function (e) { if (e.key === "Escape") { // console.log(e); handle.style.cursor = "grab"; draggable = false; containerLeft = getProperty(container, "left"); containerTop = getProperty(container, "top"); } }, false); } /** 通过装饰器,实现请求失败时,输出定制化的提示信息 * * 如果不对request进行装饰器包裹,异常直接输出至console * * 如果使用了装饰器,但是未提供message,输出默认值 */ function requestErrorHandler() { var message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "请求异常,稍后再试"; return function (target, propertyKey, descriptor) { var originalMethod = descriptor.value; descriptor.value = function () { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var result = originalMethod.apply(this, args); result["catch"](function (error) { addMessage("".concat(message), "error"); // addMessage(`${error}`, "error"); }); return result; }; return descriptor; }; } /**调用GM_setValue或者chrome.storage * * 如果调用的是GM_setValue,会对value进行JSON.stringify */ function setValue(_x2, _x3) { return _setValue.apply(this, arguments); } /**调用GM_getValue或者chrome.storage * * 如果调用的是GM_getValue,返回JSON.parse后的结果 */ function _setValue() { _setValue = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee3(key, value) { return regenerator_default.a.wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: typeof GM_setValue === "function" || function GM_setValue() {}; if (true) { _context3.next = 6; break; } _context3.next = 4; return injectToContent.request({ type: "setValue", key: key, value: value }); case 4: _context3.next = 7; break; case 6: GM_setValue(key, JSON.stringify(value)); case 7: case "end": return _context3.stop(); } } }, _callee3); })); return _setValue.apply(this, arguments); } function getValue(_x4, _x5) { return _getValue.apply(this, arguments); } /**针对带数字索引的答案 */ function _getValue() { _getValue = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee4(key, defaultValue) { var returnValue, temp; return regenerator_default.a.wrap(function _callee4$(_context4) { while (1) { switch (_context4.prev = _context4.next) { case 0: typeof GM_getValue === "function" || function GM_getValue() {}; if (true) { _context4.next = 8; break; } _context4.next = 4; return injectToContent.request({ type: "getValue", key: key, defaultValue: defaultValue }); case 4: returnValue = _context4.sent; console.error(returnValue); _context4.next = 10; break; case 8: temp = GM_getValue(key, defaultValue); try { returnValue = JSON.parse(temp); } catch (error) { returnValue = temp; } case 10: return _context4.abrupt("return", returnValue); case 11: case "end": return _context4.stop(); } } }, _callee4); })); return _getValue.apply(this, arguments); } function copyToClipboard(_x6) { return _copyToClipboard.apply(this, arguments); } /**格式化单元测试接口返回的html格式答案 */ function _copyToClipboard() { _copyToClipboard = Object(asyncToGenerator["a" /* default */])( /*#__PURE__*/regenerator_default.a.mark(function _callee5(text) { return regenerator_default.a.wrap(function _callee5$(_context5) { while (1) { switch (_context5.prev = _context5.next) { case 0: _context5.next = 2; return navigator.clipboard.writeText(text.replace(/^.*、/, "")); case 2: case "end": return _context5.stop(); } } }, _callee5); })); return _copyToClipboard.apply(this, arguments); } function clearHtmlTagAndSplit(text) { return text.split(/<(?:br|hr) *\/?>/).map(function (answer) { var buffer = answer.replace(/<.*?>/g, "").replace(/ /g, ""); var temp = buffer.split(/:/); if (temp.length === 2) { var _temp = Object(slicedToArray["a" /* default */])(temp, 2), index = _temp[0], answerText = _temp[1]; var realIndex = index.padStart(2, "0"); buffer = "".concat(realIndex, "\u3001").concat(answerText); } return buffer; }); } /***/ }), /* 3 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return Global; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BASE_URL; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return DEBUG_MODE; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return VERSION; }); /* unused harmony export QUERY_INTERVAL */ /* harmony import */ var _package_json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(36); var _package_json__WEBPACK_IMPORTED_MODULE_0___namespace = /*#__PURE__*/__webpack_require__.t(36, 1); var Global = { messages: [], USER_SETTINGS: {}, collapse: true, showExamQueryButton: false }; // *--------------------以下为常量 var BASE_URL; var DEBUG_MODE; if (false) {} else { BASE_URL = "http://47.97.90.127/api/tsinghua"; DEBUG_MODE = false; } var VERSION = _package_json__WEBPACK_IMPORTED_MODULE_0__[/* version */ "a"]; var QUERY_INTERVAL = 3000; //单位ms /***/ }), /* 4 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; }); function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ // css base code, injected by the css-loader // eslint-disable-next-line func-names module.exports = function (useSourceMap) { var list = []; // return the list of modules as css string list.toString = function toString() { return this.map(function (item) { var content = cssWithMappingToString(item, useSourceMap); if (item[2]) { return "@media ".concat(item[2], " {").concat(content, "}"); } return content; }).join(''); }; // import a list of modules into the list // eslint-disable-next-line func-names list.i = function (modules, mediaQuery, dedupe) { if (typeof modules === 'string') { // eslint-disable-next-line no-param-reassign modules = [[null, modules, '']]; } var alreadyImportedModules = {}; if (dedupe) { for (var i = 0; i < this.length; i++) { // eslint-disable-next-line prefer-destructuring var id = this[i][0]; if (id != null) { alreadyImportedModules[id] = true; } } } for (var _i = 0; _i < modules.length; _i++) { var item = [].concat(modules[_i]); if (dedupe && alreadyImportedModules[item[0]]) { // eslint-disable-next-line no-continue continue; } if (mediaQuery) { if (!item[2]) { item[2] = mediaQuery; } else { item[2] = "".concat(mediaQuery, " and ").concat(item[2]); } } list.push(item); } }; return list; }; function cssWithMappingToString(item, useSourceMap) { var content = item[1] || ''; // eslint-disable-next-line prefer-destructuring var cssMapping = item[3]; if (!cssMapping) { return content; } if (useSourceMap && typeof btoa === 'function') { var sourceMapping = toComment(cssMapping); var sourceURLs = cssMapping.sources.map(function (source) { return "/*# sourceURL=".concat(cssMapping.sourceRoot || '').concat(source, " */"); }); return [content].concat(sourceURLs).concat([sourceMapping]).join('\n'); } return [content].join('\n'); } // Adapted from convert-source-map (MIT) function toComment(sourceMap) { // eslint-disable-next-line no-undef var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))); var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64); return "/*# ".concat(data, " */"); } /***/ }), /* 6 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; }); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /***/ }), /* 7 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; }); function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } /***/ }), /* 8 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _getPrototypeOf; }); function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /***/ }), /* 9 */ /***/ (function(module, exports) { module.exports = Vue; /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var isOldIE = function isOldIE() { var memo; return function memorize() { if (typeof memo === 'undefined') { // Test for IE <= 9 as proposed by Browserhacks // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805 // Tests for existence of standard globals is to allow style-loader // to operate correctly into non-standard environments // @see https://github.com/webpack-contrib/style-loader/issues/177 memo = Boolean(window && document && document.all && !window.atob); } return memo; }; }(); var getTarget = function getTarget() { var memo = {}; return function memorize(target) { if (typeof memo[target] === 'undefined') { var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) { try { // This will throw an exception if access to iframe is blocked // due to cross-origin restrictions styleTarget = styleTarget.contentDocument.head; } catch (e) { // istanbul ignore next styleTarget = null; } } memo[target] = styleTarget; } return memo[target]; }; }(); var stylesInDom = []; function getIndexByIdentifier(identifier) { var result = -1; for (var i = 0; i < stylesInDom.length; i++) { if (stylesInDom[i].identifier === identifier) { result = i; break; } } return result; } function modulesToDom(list, options) { var idCountMap = {}; var identifiers = []; for (var i = 0; i < list.length; i++) { var item = list[i]; var id = options.base ? item[0] + options.base : item[0]; var count = idCountMap[id] || 0; var identifier = "".concat(id, " ").concat(count); idCountMap[id] = count + 1; var index = getIndexByIdentifier(identifier); var obj = { css: item[1], media: item[2], sourceMap: item[3] }; if (index !== -1) { stylesInDom[index].references++; stylesInDom[index].updater(obj); } else { stylesInDom.push({ identifier: identifier, updater: addStyle(obj, options), references: 1 }); } identifiers.push(identifier); } return identifiers; } function insertStyleElement(options) { var style = document.createElement('style'); var attributes = options.attributes || {}; if (typeof attributes.nonce === 'undefined') { var nonce = true ? __webpack_require__.nc : undefined; if (nonce) { attributes.nonce = nonce; } } Object.keys(attributes).forEach(function (key) { style.setAttribute(key, attributes[key]); }); if (typeof options.insert === 'function') { options.insert(style); } else { var target = getTarget(options.insert || 'head'); if (!target) { throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid."); } target.appendChild(style); } return style; } function removeStyleElement(style) { // istanbul ignore if if (style.parentNode === null) { return false; } style.parentNode.removeChild(style); } /* istanbul ignore next */ var replaceText = function replaceText() { var textStore = []; return function replace(index, replacement) { textStore[index] = replacement; return textStore.filter(Boolean).join('\n'); }; }(); function applyToSingletonTag(style, index, remove, obj) { var css = remove ? '' : obj.media ? "@media ".concat(obj.media, " {").concat(obj.css, "}") : obj.css; // For old IE /* istanbul ignore if */ if (style.styleSheet) { style.styleSheet.cssText = replaceText(index, css); } else { var cssNode = document.createTextNode(css); var childNodes = style.childNodes; if (childNodes[index]) { style.removeChild(childNodes[index]); } if (childNodes.length) { style.insertBefore(cssNode, childNodes[index]); } else { style.appendChild(cssNode); } } } function applyToTag(style, options, obj) { var css = obj.css; var media = obj.media; var sourceMap = obj.sourceMap; if (media) { style.setAttribute('media', media); } else { style.removeAttribute('media'); } if (sourceMap && typeof btoa !== 'undefined') { css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */"); } // For old IE /* istanbul ignore if */ if (style.styleSheet) { style.styleSheet.cssText = css; } else { while (style.firstChild) { style.removeChild(style.firstChild); } style.appendChild(document.createTextNode(css)); } } var singleton = null; var singletonCounter = 0; function addStyle(obj, options) { var style; var update; var remove; if (options.singleton) { var styleIndex = singletonCounter++; style = singleton || (singleton = insertStyleElement(options)); update = applyToSingletonTag.bind(null, style, styleIndex, false); remove = applyToSingletonTag.bind(null, style, styleIndex, true); } else { style = insertStyleElement(options); update = applyToTag.bind(null, style, options); remove = function remove() { removeStyleElement(style); }; } update(obj); return function updateStyle(newObj) { if (newObj) { if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) { return; } update(obj = newObj); } else { remove(); } }; } module.exports = function (list, options) { options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of