// ==UserScript== // @name 学在浙大/智云课堂 辅助脚本 // @description 学在浙大/智云课堂 辅助脚本 by memset0 // @namespace https://github.com/memset0/Learning-at-ZJU-Helper // @homepage https://github.com/memset0/Learning-at-ZJU-Helper // @supportURL https://github.com/memset0/Learning-at-ZJU-Helper/issues // @match *://livingroom.cmc.zju.edu.cn/* // @match *://onlineroom.cmc.zju.edu.cn/* // @match *://classroom.zju.edu.cn/* // @match *://interactivemeta.cmc.zju.edu.cn/* // @grant unsafeWindow // @grant GM_setValue // @grant GM_getValue // @grant GM_addValueChangeListener // @grant GM_removeValueChangeListener // @encoding utf-8 // @run-at document-start // @version 1.1.2 // @author memset0 // @license MIT // @downloadURL none // ==/UserScript== (() => { var e = { 297: (e, t, n) => { "use strict"; n.d(t, { A: () => s }); var r = n(601), o = n.n(r), i = n(314), a = n.n(i)()(o()); a.push([e.id, ".mem-btn{border:none;display:flex;margin-left:16px;cursor:pointer;height:32px;line-height:32px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;border-radius:4px;background-color:#f0f1f3;font-size:14px;color:#144aea;text-align:center;position:relative;padding:0 6px}@media screen and (max-width:1679px){.mem-btn{margin-left:11.42856px;height:22.85712px;line-height:22.85712px;font-size:9.99999px}}@media screen and (min-width:1680px) and (max-width:1919px){.mem-btn{margin-left:14px;height:28px;line-height:28px;font-size:12.25px}}", ""]); const s = a }, 513: (e, t, n) => { "use strict"; n.d(t, { A: () => s }); var r = n(601), o = n.n(r), i = n(314), a = n.n(i)()(o()); a.push([e.id, ".custom-footer,.feedback-wrapper,.hot-recommend-wrapper,.menu-content>.first-menu:nth-child(4),.menu-content>.first-menu:nth-child(5),__nothing__{display:none!important}__nothing__{opacity:0!important;pointer-events:none;cursor:default}.living-page-wrapper{padding-bottom:20.040129px}.course-filter-searchAll-custom{border-left:none!important;border-right:none!important}.collect>.collect_span,.collect>.good_span,.operate_wrap>.collect_span,.operate_wrap>.good_span{display:none!important}.side_tab_wrap .side_tab{background:#f9f9f9!important;transform:none!important;color:#a0a0a0!important}.side_tab_wrap .side_tab span{transform:none!important}.side_tab_wrap .side_tab.active span{color:#144aea!important;font-weight:700!important}.relative-info-gap,.relative-info-right{display:none}.relative-info-left{width:100%!important}", ""]); const s = a }, 314: e => { "use strict"; e.exports = function(e) { var t = []; return t.toString = function() { return this.map((function(t) { var n = "", r = void 0 !== t[5]; return t[4] && (n += "@supports (".concat(t[4], ") {")), t[2] && (n += "@media ".concat(t[2], " {")), r && (n += "@layer".concat(t[5].length > 0 ? " ".concat(t[5]) : "", " {")), n += e(t), r && (n += "}"), t[2] && (n += "}"), t[4] && (n += "}"), n })).join("") }, t.i = function(e, n, r, o, i) { "string" == typeof e && (e = [ [null, e, void 0] ]); var a = {}; if (r) for (var s = 0; s < this.length; s++) { var c = this[s][0]; null != c && (a[c] = !0) } for (var u = 0; u < e.length; u++) { var l = [].concat(e[u]); r && a[l[0]] || (void 0 !== i && (void 0 === l[5] || (l[1] = "@layer".concat(l[5].length > 0 ? " ".concat(l[5]) : "", " {").concat(l[1], "}")), l[5] = i), n && (l[2] ? (l[1] = "@media ".concat(l[2], " {").concat(l[1], "}"), l[2] = n) : l[2] = n), o && (l[4] ? (l[1] = "@supports (".concat(l[4], ") {").concat(l[1], "}"), l[4] = o) : l[4] = "".concat(o)), t.push(l)) } }, t } }, 601: e => { "use strict"; e.exports = function(e) { return e[1] } }, 756: (e, t, n) => { "use strict"; n.r(t), n.d(t, { default: () => v }); var r = n(72), o = n.n(r), i = n(825), a = n.n(i), s = n(659), c = n.n(s), u = n(56), l = n.n(u), d = n(540), p = n.n(d), f = n(113), m = n.n(f), h = n(297), g = {}; g.styleTagTransform = m(), g.setAttributes = l(), g.insert = c().bind(null, "head"), g.domAPI = a(), g.insertStyleElement = p(), o()(h.A, g); const v = h.A && h.A.locals ? h.A.locals : void 0 }, 242: (e, t, n) => { "use strict"; n.r(t), n.d(t, { default: () => v }); var r = n(72), o = n.n(r), i = n(825), a = n.n(i), s = n(659), c = n.n(s), u = n(56), l = n.n(u), d = n(540), p = n.n(d), f = n(113), m = n.n(f), h = n(513), g = {}; g.styleTagTransform = m(), g.setAttributes = l(), g.insert = c().bind(null, "head"), g.domAPI = a(), g.insertStyleElement = p(), o()(h.A, g); const v = h.A && h.A.locals ? h.A.locals : void 0 }, 72: e => { "use strict"; var t = []; function n(e) { for (var n = -1, r = 0; r < t.length; r++) if (t[r].identifier === e) { n = r; break } return n } function r(e, r) { for (var i = {}, a = [], s = 0; s < e.length; s++) { var c = e[s], u = r.base ? c[0] + r.base : c[0], l = i[u] || 0, d = "".concat(u, " ").concat(l); i[u] = l + 1; var p = n(d), f = { css: c[1], media: c[2], sourceMap: c[3], supports: c[4], layer: c[5] }; if (-1 !== p) t[p].references++, t[p].updater(f); else { var m = o(f, r); r.byIndex = s, t.splice(s, 0, { identifier: d, updater: m, references: 1 }) } a.push(d) } return a } function o(e, t) { var n = t.domAPI(t); return n.update(e), function(t) { if (t) { if (t.css === e.css && t.media === e.media && t.sourceMap === e.sourceMap && t.supports === e.supports && t.layer === e.layer) return; n.update(e = t) } else n.remove() } } e.exports = function(e, o) { var i = r(e = e || [], o = o || {}); return function(e) { e = e || []; for (var a = 0; a < i.length; a++) { var s = n(i[a]); t[s].references-- } for (var c = r(e, o), u = 0; u < i.length; u++) { var l = n(i[u]); 0 === t[l].references && (t[l].updater(), t.splice(l, 1)) } i = c } } }, 659: e => { "use strict"; var t = {}; e.exports = function(e, n) { var r = function(e) { if (void 0 === t[e]) { var n = document.querySelector(e); if (window.HTMLIFrameElement && n instanceof window.HTMLIFrameElement) try { n = n.contentDocument.head } catch (e) { n = null } t[e] = n } return t[e] }(e); if (!r) throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid."); r.appendChild(n) } }, 540: e => { "use strict"; e.exports = function(e) { var t = document.createElement("style"); return e.setAttributes(t, e.attributes), e.insert(t, e.options), t } }, 56: (e, t, n) => { "use strict"; e.exports = function(e) { var t = n.nc; t && e.setAttribute("nonce", t) } }, 825: e => { "use strict"; e.exports = function(e) { if ("undefined" == typeof document) return { update: function() {}, remove: function() {} }; var t = e.insertStyleElement(e); return { update: function(n) { ! function(e, t, n) { var r = ""; n.supports && (r += "@supports (".concat(n.supports, ") {")), n.media && (r += "@media ".concat(n.media, " {")); var o = void 0 !== n.layer; o && (r += "@layer".concat(n.layer.length > 0 ? " ".concat(n.layer) : "", " {")), r += n.css, o && (r += "}"), n.media && (r += "}"), n.supports && (r += "}"); var i = n.sourceMap; i && "undefined" != typeof btoa && (r += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i)))), " */")), t.styleTagTransform(r, e, t.options) }(t, e, n) }, remove: function() { ! function(e) { if (null === e.parentNode) return !1; e.parentNode.removeChild(e) }(t) } } } }, 113: e => { "use strict"; e.exports = function(e, t) { if (t.styleSheet) t.styleSheet.cssText = e; else { for (; t.firstChild;) t.removeChild(t.firstChild); t.appendChild(document.createTextNode(e)) } } }, 15: (e, t, n) => { "use strict"; function r(e) { return e && "__vue__" in e } n.r(t), n.d(t, { check: () => s, load: () => c, name: () => o, skip: () => i }); const o = "[builtin]视频页面前置"; function i({ env: e }) { return !e.isVideoPage } function a({ document: e }) { const t = e.querySelector(".living-page-wrapper"), n = e.querySelector("#cmcPlayer_container"), o = e.querySelector(".living-page-wrapper .operate_wrap"); return r(t) && r(n) && o ? { course: t, player: n, wrapper: o, courseVue: t.__vue__, playerVue: n.__vue__ } : null } function s({ document: e }) { return !!a({ document: e }) } function c({ logger: e, document: t, extendContext: r }) { n(756); const o = a({ document: t }); r({ elements: o }); const i = o.wrapper, s = t.createElement("div"); s.className = "mem-btn-group", i.insertBefore(s, i.firstChild), e.debug("wrapper", i), r({ addButton: function(e, n, r) { const o = t.createElement("button"); o.className = "mem-btn mem-btn-primary", o.textContent = n, o.onclick = r, o.setAttribute("data-key", e); for (const t of s.children) if (Number(t.getAttribute("data-key")) > e) return s.insertBefore(o, t), o; return s.appendChild(o), o } }) } }, 238: (e, t, n) => { "use strict"; n.r(t), n.d(t, { load: () => i, name: () => r, required: () => o }); const r = "视频链接解析", o = ["builtin-video-pages"]; function i({ logger: e, clipboard: t, elements: n, addButton: r }) { const o = r(0, "解析链接", (() => { const r = function() { try { return "live" === n.playerVue.liveType ? JSON.parse(n.playerVue.liveUrl.replace("mutli-rate: ", ""))[0].url : document.querySelector("#cmc_player_video").src } catch (e) { return null } }(); r ? (e.info("视频链接:", r), t.copy(r), o.innerText = "解析链接(已拷贝)", setTimeout((() => { o.innerText = "解析链接" }), 500)) : alert("获取视频地址失败,请待播放器完全加载后再试。") })) } }, 906: (e, t, n) => { "use strict"; n.r(t), n.d(t, { check: () => s, description: () => o, load: () => c, name: () => r, required: () => i, skip: () => a }); const r = "示例插件", o = "这是一个示例插件,他不应该被加载到脚本中。", i = []; function a() { return !1 } function s() { return !0 } function c({ logger: e }) { e.debug("示例插件已被加载。") } }, 928: (e, t, n) => { "use strict"; n.r(t), n.d(t, { load: () => o, name: () => r }); const r = "专注模式"; function o() { n(242) } }, 342: (e, t, n) => { var r = { "./builtin-video-pages/index.js": 15, "./download-video/index.js": 238, "./example-plugin/index.js": 906, "./focus-mode/index.js": 928 }; function o(e) { var t = i(e); return n(t) } function i(e) { if (!n.o(r, e)) { var t = new Error("Cannot find module '" + e + "'"); throw t.code = "MODULE_NOT_FOUND", t } return r[e] } o.keys = function() { return Object.keys(r) }, o.resolve = i, e.exports = o, o.id = 342 } }, t = {}; function n(r) { var o = t[r]; if (void 0 !== o) return o.exports; var i = t[r] = { id: r, exports: {} }; return e[r](i, i.exports, n), i.exports } n.n = e => { var t = e && e.__esModule ? () => e.default : () => e; return n.d(t, { a: t }), t }, n.d = (e, t) => { for (var r in t) n.o(t, r) && !n.o(e, r) && Object.defineProperty(e, r, { enumerable: !0, get: t[r] }) }, n.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t), n.r = e => { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e, "__esModule", { value: !0 }) }, n.nc = void 0, (() => { "use strict"; const e = "[zju-helper]", t = { log(...t) { console.log(e, ...t) }, error(...t) { console.error(e, ...t) }, debug(...t) { console.debug(e, ...t) }, info(...t) { console.info(e, ...t) } }; async function r(e) { return new Promise((t => setTimeout(t, e))) } function o(e) { const t = document.createElement("input"); t.style.position = "fixed", t.style.opacity = 0, t.value = e, document.body.appendChild(t), t.select(), document.execCommand("copy"), document.body.removeChild(t) } const i = new class { _load_plugins() { const e = n(342), t = {}; return e.keys().forEach((n => { const r = n.slice(2, -9); "example-plugin" !== r && (t[r] = e(n), t[r].slug = r) })), t } constructor() { this.plugins = this._load_plugins() } async load() { const e = { logger: t, clipboard: { copy: o }, window: unsafeWindow, document: unsafeWindow.document, env: { isVideoPage: "classroom.zju.edu.cn" === location.host && "/livingroom" === location.pathname || !("interactivemeta.cmc.zju.edu.cn" !== location.host || "/" !== location.pathname || !location.hash.startsWith("#/replay?")) }, extendContext: t => { for (const n in t) Object.keys(e).includes(n) && e[n] instanceof Object ? e[n] = { ...e[n], ...t[n] } : e[n] = t[n] } }, n = () => { for (const e in this.plugins) if (!this.plugins[e].loaded) return !1; return !0 }; t.debug("开始加载插件", this.plugins); do { for (const n in this.plugins) { const r = this.plugins[n]; if (!r.loaded) { if (r.skip instanceof Function && await r.skip(e)) { r.loaded = !0, r.skipped = !0, t.debug(`跳过加载 ${r.slug} 插件`); continue } if (r.check instanceof Function && !await r.check(e)) continue; if (r.required && r.required instanceof Array && r.required.length > 0) { let e = "ok"; for (const t of r.required) { if (this.plugins[t].skipped) { e = "skip"; break } if (!this.plugins[t].loaded) { e = "wait"; break } } if ("skip" === e) { r.loaded = !0, r.skipped = !0, t.debug(`跳过加载 ${r.slug} 插件,因为前置插件被跳过`); continue } if ("wait" === e) continue } await r.load({ ...e }), r.loaded = !0 } } await r(100) } while (!n()); t.info("插件加载完成!") } safe_load() { (async () => { try { await i.load() } catch (e) { throw t.error(e), e } })() } }; i.safe_load() })() })();