// ==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 *://classroom.zju.edu.cn/*
// @match *://onlineroom.cmc.zju.edu.cn/*
// @match *://livingroom.cmc.zju.edu.cn/*
// @match *://interactivemeta.cmc.zju.edu.cn/*
// @match *://courses.zju.edu.cn/*
// @grant unsafeWindow
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_addValueChangeListener
// @grant GM_removeValueChangeListener
// @grant GM_getResourceText
// @resource jszip.min.js https://jsd.cdn.zzko.cn/gh/memset0/Learning-at-ZJU-Helper@latest/lib/jszip.min.js
// @encoding utf-8
// @run-at document-start
// @version 1.2.1
// @author memset0
// @license MIT
// ==/UserScript==
(() => {
var e = {
443: (e, t, n) => {
"use strict";
n.d(t, {
A: () => s
});
var o = n(601),
r = n.n(o),
i = n(314),
a = n.n(i)()(r());
a.push([e.id, ".mem-bvp-btn{position:relative;margin-right:10px;order:-1;color:#fff;font-size:12px}.__better-video-player .app-wrap{overflow:hidden}.__better-video-player .player-wrapper{position:fixed;top:0;left:0;z-index:114514;width:100%;height:100%}.better-video-player .app-wrap{overflow:hidden!important}.better-video-player .player-wrapper{position:fixed!important;top:0!important;left:0!important;z-index:114514!important;width:100%!important;height:100%!important}", ""]);
const s = a
},
297: (e, t, n) => {
"use strict";
n.d(t, {
A: () => s
});
var o = n(601),
r = n.n(o),
i = n(314),
a = n.n(i)()(r());
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
},
254: (e, t, n) => {
"use strict";
n.d(t, {
A: () => s
});
var o = n(601),
r = n.n(o),
i = n(314),
a = n.n(i)()(r());
a.push([e.id, ".footer.gtm-category.ng-scope,__nothing__{display:none!important}", ""]);
const s = a
},
844: (e, t, n) => {
"use strict";
n.d(t, {
A: () => s
});
var o = n(601),
r = n.n(o),
i = n(314),
a = n.n(i)()(r());
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 = "",
o = void 0 !== t[5];
return t[4] && (n += "@supports (".concat(t[4], ") {")), t[2] && (n += "@media ".concat(t[2], " {")), o && (n += "@layer".concat(t[5].length > 0 ? " ".concat(t[5]) : "", " {")), n += e(t), o && (n += "}"), t[2] && (n += "}"), t[4] && (n += "}"), n
})).join("")
}, t.i = function(e, n, o, r, i) {
"string" == typeof e && (e = [
[null, e, void 0]
]);
var a = {};
if (o)
for (var s = 0; s < this.length; s++) {
var c = this[s][0];
null != c && (a[c] = !0)
}
for (var l = 0; l < e.length; l++) {
var u = [].concat(e[l]);
o && a[u[0]] || (void 0 !== i && (void 0 === u[5] || (u[1] = "@layer".concat(u[5].length > 0 ? " ".concat(u[5]) : "", " {").concat(u[1], "}")), u[5] = i), n && (u[2] ? (u[1] = "@media ".concat(u[2], " {").concat(u[1], "}"), u[2] = n) : u[2] = n), r && (u[4] ? (u[1] = "@supports (".concat(u[4], ") {").concat(u[1], "}"), u[4] = r) : u[4] = "".concat(r)), t.push(u))
}
}, t
}
},
601: e => {
"use strict";
e.exports = function(e) {
return e[1]
}
},
213: function(e, t, n) {
var o, r;
void 0 === (r = "function" == typeof(o = function() {
"use strict";
function t(e, t, n) {
var o = new XMLHttpRequest;
o.open("GET", e), o.responseType = "blob", o.onload = function() {
s(o.response, t, n)
}, o.onerror = function() {
console.error("could not download file")
}, o.send()
}
function o(e) {
var t = new XMLHttpRequest;
t.open("HEAD", e, !1);
try {
t.send()
} catch (e) {}
return 200 <= t.status && 299 >= t.status
}
function r(e) {
try {
e.dispatchEvent(new MouseEvent("click"))
} catch (n) {
var t = document.createEvent("MouseEvents");
t.initMouseEvent("click", !0, !0, window, 0, 0, 0, 80, 20, !1, !1, !1, !1, 0, null), e.dispatchEvent(t)
}
}
var i = "object" == typeof window && window.window === window ? window : "object" == typeof self && self.self === self ? self : "object" == typeof n.g && n.g.global === n.g ? n.g : void 0,
a = i.navigator && /Macintosh/.test(navigator.userAgent) && /AppleWebKit/.test(navigator.userAgent) && !/Safari/.test(navigator.userAgent),
s = i.saveAs || ("object" != typeof window || window !== i ? function() {} : "download" in HTMLAnchorElement.prototype && !a ? function(e, n, a) {
var s = i.URL || i.webkitURL,
c = document.createElement("a");
n = n || e.name || "download", c.download = n, c.rel = "noopener", "string" == typeof e ? (c.href = e, c.origin === location.origin ? r(c) : o(c.href) ? t(e, n, a) : r(c, c.target = "_blank")) : (c.href = s.createObjectURL(e), setTimeout((function() {
s.revokeObjectURL(c.href)
}), 4e4), setTimeout((function() {
r(c)
}), 0))
} : "msSaveOrOpenBlob" in navigator ? function(e, n, i) {
if (n = n || e.name || "download", "string" != typeof e) navigator.msSaveOrOpenBlob(function(e, t) {
return void 0 === t ? t = {
autoBom: !1
} : "object" != typeof t && (console.warn("Deprecated: Expected third argument to be a object"), t = {
autoBom: !t
}), t.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type) ? new Blob(["\ufeff", e], {
type: e.type
}) : e
}(e, i), n);
else if (o(e)) t(e, n, i);
else {
var a = document.createElement("a");
a.href = e, a.target = "_blank", setTimeout((function() {
r(a)
}))
}
} : function(e, n, o, r) {
if ((r = r || open("", "_blank")) && (r.document.title = r.document.body.innerText = "downloading..."), "string" == typeof e) return t(e, n, o);
var s = "application/octet-stream" === e.type,
c = /constructor/i.test(i.HTMLElement) || i.safari,
l = /CriOS\/[\d]+/.test(navigator.userAgent);
if ((l || s && c || a) && "undefined" != typeof FileReader) {
var u = new FileReader;
u.onloadend = function() {
var e = u.result;
e = l ? e : e.replace(/^data:[^;]*;/, "data:attachment/file;"), r ? r.location.href = e : location = e, r = null
}, u.readAsDataURL(e)
} else {
var d = i.URL || i.webkitURL,
p = d.createObjectURL(e);
r ? r.location = p : location.href = p, r = null, setTimeout((function() {
d.revokeObjectURL(p)
}), 4e4)
}
});
i.saveAs = s.saveAs = s, e.exports = s
}) ? o.apply(t, []) : o) || (e.exports = r)
},
734: (e, t, n) => {
"use strict";
n.r(t), n.d(t, {
default: () => y
});
var o = n(72),
r = n.n(o),
i = n(825),
a = n.n(i),
s = n(659),
c = n.n(s),
l = n(56),
u = n.n(l),
d = n(540),
p = n.n(d),
f = n(113),
m = n.n(f),
g = n(443),
h = {};
h.styleTagTransform = m(), h.setAttributes = u(), h.insert = c().bind(null, "head"), h.domAPI = a(), h.insertStyleElement = p(), r()(g.A, h);
const y = g.A && g.A.locals ? g.A.locals : void 0
},
756: (e, t, n) => {
"use strict";
n.r(t), n.d(t, {
default: () => y
});
var o = n(72),
r = n.n(o),
i = n(825),
a = n.n(i),
s = n(659),
c = n.n(s),
l = n(56),
u = n.n(l),
d = n(540),
p = n.n(d),
f = n(113),
m = n.n(f),
g = n(297),
h = {};
h.styleTagTransform = m(), h.setAttributes = u(), h.insert = c().bind(null, "head"), h.domAPI = a(), h.insertStyleElement = p(), r()(g.A, h);
const y = g.A && g.A.locals ? g.A.locals : void 0
},
831: (e, t, n) => {
"use strict";
n.r(t), n.d(t, {
default: () => y
});
var o = n(72),
r = n.n(o),
i = n(825),
a = n.n(i),
s = n(659),
c = n.n(s),
l = n(56),
u = n.n(l),
d = n(540),
p = n.n(d),
f = n(113),
m = n.n(f),
g = n(254),
h = {};
h.styleTagTransform = m(), h.setAttributes = u(), h.insert = c().bind(null, "head"), h.domAPI = a(), h.insertStyleElement = p(), r()(g.A, h);
const y = g.A && g.A.locals ? g.A.locals : void 0
},
445: (e, t, n) => {
"use strict";
n.r(t), n.d(t, {
default: () => y
});
var o = n(72),
r = n.n(o),
i = n(825),
a = n.n(i),
s = n(659),
c = n.n(s),
l = n(56),
u = n.n(l),
d = n(540),
p = n.n(d),
f = n(113),
m = n.n(f),
g = n(844),
h = {};
h.styleTagTransform = m(), h.setAttributes = u(), h.insert = c().bind(null, "head"), h.domAPI = a(), h.insertStyleElement = p(), r()(g.A, h);
const y = g.A && g.A.locals ? g.A.locals : void 0
},
72: e => {
"use strict";
var t = [];
function n(e) {
for (var n = -1, o = 0; o < t.length; o++)
if (t[o].identifier === e) {
n = o;
break
} return n
}
function o(e, o) {
for (var i = {}, a = [], s = 0; s < e.length; s++) {
var c = e[s],
l = o.base ? c[0] + o.base : c[0],
u = i[l] || 0,
d = "".concat(l, " ").concat(u);
i[l] = u + 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 = r(f, o);
o.byIndex = s, t.splice(s, 0, {
identifier: d,
updater: m,
references: 1
})
}
a.push(d)
}
return a
}
function r(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, r) {
var i = o(e = e || [], r = r || {});
return function(e) {
e = e || [];
for (var a = 0; a < i.length; a++) {
var s = n(i[a]);
t[s].references--
}
for (var c = o(e, r), l = 0; l < i.length; l++) {
var u = n(i[l]);
0 === t[u].references && (t[u].updater(), t.splice(u, 1))
}
i = c
}
}
},
659: e => {
"use strict";
var t = {};
e.exports = function(e, n) {
var o = 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 (!o) throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");
o.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 o = "";
n.supports && (o += "@supports (".concat(n.supports, ") {")), n.media && (o += "@media ".concat(n.media, " {"));
var r = void 0 !== n.layer;
r && (o += "@layer".concat(n.layer.length > 0 ? " ".concat(n.layer) : "", " {")), o += n.css, r && (o += "}"), n.media && (o += "}"), n.supports && (o += "}");
var i = n.sourceMap;
i && "undefined" != typeof btoa && (o += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i)))), " */")), t.styleTagTransform(o, 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))
}
}
},
961: (e, t, n) => {
"use strict";
n.r(t), n.d(t, {
check: () => s,
load: () => c,
name: () => r,
required: () => i
});
var o = n(99);
const r = "更好的视频播放器",
i = ["builtin-video-pages"];
function a(e) {
const t = e.querySelector(".control-bottom .control-right");
return t && t.children && 0 !== t.children.length ? t : null
}
function s({
document: e
}) {
return !!a(e)
}
async function c({
logger: e,
document: t,
elements: r,
addButton: i
}) {
n(734);
const s = a(t),
c = t.createElement("div");
c.className = "mem-bvp-btn", c.innerText = "网页全屏", c.onclick = () => async function() {
t.body.classList.toggle("better-video-player"), await (0, o.y)(100), r.playerVue.resizePlayer()
}(), s.insertBefore(c, s.firstChild), e.debug("wrapper", s, c)
}
},
15: (e, t, n) => {
"use strict";
function o(e) {
return e && "__vue__" in e
}
n.r(t), n.d(t, {
check: () => s,
load: () => c,
name: () => r,
skip: () => i
});
const r = "[builtin]视频页面前置";
function i({
env: e
}) {
return !e.isVideoPage
}
function a({
document: e
}) {
const t = e.querySelector(".living-page-wrapper"),
n = e.querySelector("#cmcPlayer_container"),
r = e.querySelector(".living-page-wrapper .operate_wrap");
return o(t) && o(n) && r ? {
course: t,
player: n,
wrapper: r,
courseVue: t.__vue__,
playerVue: n.__vue__
} : null
}
function s({
document: e
}) {
return !!a({
document: e
})
}
function c({
logger: e,
document: t,
extendContext: o
}) {
n(756);
const r = a({
document: t
});
e.debug("视频页面元素:", r), o({
elements: r
});
const i = r.wrapper,
s = t.createElement("div");
s.className = "mem-btn-group", i.insertBefore(s, i.firstChild), e.debug("wrapper", i), o({
addButton: function(n, o, r) {
const i = t.createElement("button");
i.className = "mem-btn mem-btn-primary", i.textContent = o, i.style = "display: inline-block", i.setAttribute("data-key", n), i.onclick = () => {
r({
element: i,
setStatus: t => {
e.debug("(button)" + o, "set status:", t), i.innerText = t ? o + "(" + t + ")" : o
}
})
};
for (const e of s.children)
if (Number(e.getAttribute("data-key")) > n) return s.insertBefore(i, e), i;
return s.appendChild(i), i
}
})
}
},
809: (e, t, n) => {
"use strict";
n.r(t), n.d(t, {
check: () => u,
load: () => d,
name: () => a,
options: () => c,
required: () => s
});
var o = n(213),
r = n(99),
i = n(838);
const a = "课件下载",
s = ["builtin-video-pages"],
c = {
"auto-remove": !0
};
function l(e) {
return Array.from(e.courseVue.$data.pptList)
}
function u({
elements: e
}) {
return l(e).length > 0
}
function d({
logger: e,
elements: t,
addButton: n,
loadScript: a
}, s) {
let c = l(t).map((e => ({
...e,
ppt: {
...e.ppt
}
}))).map((e => (e.imgSrc = e.imgSrc.replace("http://", "https://"), e.s_imgSrc = e.s_imgSrc.replace("http://", "https://"), e)));
e.debug(`PPT下载(共${c.length}个):`, c[0]), c = function(e) {
const t = [];
for (let n = 0; n < e.length; n++) n + 1 < e.length && e[n + 1].switchTime === e[n].switchTime || t.push(e[n]);
return t
}(c), e.debug(`删除同一秒内的PPT后(共${c.length}个):`, c[0]), n(1.1, "打包下载", (async ({
setStatus: t
}) => {
t("加载JSZip库"), a("jszip.min.js");
const n = new JSZip;
let i = 0,
s = c.length;
await (0, r.f)(c.map((async (o, r) => {
const a = `ppt-${String(r).padStart(4,"0")}-${o.switchTime.replace(/\:/g,"-")}.jpg`,
c = await fetch(o.imgSrc, {
method: "GET"
}),
l = await c.blob();
e.debug("添加图片", a, l), t(`正在下载(${++i}/${s})`), n.file(a, l, {
binary: !0
})
})), 8), t("生成Zip"), e.debug(n);
const l = await n.generateAsync({
type: "blob"
});
e.debug("完成生成zip", l), t("完成"), (0, o.saveAs)(l, "ppt.zip"), t(null)
})), n(1.2, "导出为PDF", (async ({
setStatus: t
}) => {
let n = "",
o = 0,
a = c.length;
const s = await (0, r.f)(c.map((async (n, r) => {
const i = await fetch(n.imgSrc, {
method: "GET"
});
t(`正在下载(${++o}/${a})`);
const s = await i.blob(),
c = URL.createObjectURL(s);
return e.log(r, c), c
})), 8);
t("生成PDF中");
for (const e of s) n += `<div class="page"><img src="${e}" /></div>`;
await (0, i.j)({
width: 1280,
height: 720,
margin: 0
}, n), t(null)
}))
}
},
238: (e, t, n) => {
"use strict";
n.r(t), n.d(t, {
load: () => i,
name: () => o,
required: () => r
});
const o = "视频链接解析",
r = ["builtin-video-pages"];
function i({
logger: e,
clipboard: t,
elements: n,
addButton: o
}) {
o(2, "解析链接", (({
setStatus: o
}) => {
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("已拷贝"), setTimeout((() => {
o(null)
}), 500)) : alert("获取视频地址失败,请待播放器完全加载后再试。")
}))
}
},
906: (e, t, n) => {
"use strict";
n.r(t), n.d(t, {
check: () => s,
description: () => r,
load: () => c,
name: () => o,
required: () => i,
skip: () => a
});
const o = "示例插件",
r = "这是一个示例插件,他不应该被加载到脚本中。",
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: () => r,
name: () => o
});
const o = "专注模式";
function r({
logger: e,
namespace: t
}) {
"学在浙大" === t ? n(831) : "智云课堂" === t ? n(445) : e.debug("没有可以加载的样式.")
}
},
342: (e, t, n) => {
var o = {
"./better-video-player/index.js": 961,
"./builtin-video-pages/index.js": 15,
"./download-ppt/index.js": 809,
"./download-video/index.js": 238,
"./example-plugin/index.js": 906,
"./focus-mode/index.js": 928
};
function r(e) {
var t = i(e);
return n(t)
}
function i(e) {
if (!n.o(o, e)) {
var t = new Error("Cannot find module '" + e + "'");
throw t.code = "MODULE_NOT_FOUND", t
}
return o[e]
}
r.keys = function() {
return Object.keys(o)
}, r.resolve = i, e.exports = r, r.id = 342
},
838: (e, t, n) => {
"use strict";
n.d(t, {
j: () => i,
l: () => r
});
var o = n(484);
function r(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)
}
async function i(e, t) {
const {
width: n,
height: r,
margin: i
} = e;
t = "<style> /* normalize browsers */ html, body { margin: 0 !important; padding: 0 !important; } </style>" + (t = "<style> /* page settings */ @page { size: " + n + "px " + r + "px; margin: " + i + "px; } </style>" + (t = "<style> div.page { width: " + (n - 2 * i) + "px; height: " + (r - 2 * i) + "px; } </style>" + t));
const {
style: a
} = e;
a && (t += "\n\n\n\x3c!-- additional style --\x3e<style>" + a + "</style>\n\n\n");
const s = new Blob([t], {
type: "text/html;charset=utf-8"
}),
c = URL.createObjectURL(s);
o.Ay.debug("blobUrl:", c);
const l = document.createElement("iframe");
l.style.display = "none", l.src = c, document.body.appendChild(l), l.onload = () => {
setTimeout((() => {
l.focus(), l.contentWindow.print()
}), 1)
}
}
},
99: (e, t, n) => {
"use strict";
async function o(e) {
return new Promise((t => setTimeout(t, e)))
}
function r(e, t) {
return new Promise(((n, o) => {
let r = 0,
i = 0,
a = 0,
s = [];
! function c() {
if (console.log("!! ", i, e.length), i >= e.length) n(s);
else
for (; a < e.length && r < t;) {
let t = a;
e[a].then((e => {
r--, i++, s[t] = e, c()
})).catch((e => {
o(e)
})), r++, a++
}
}()
}))
}
n.d(t, {
f: () => r,
y: () => o
})
},
484: (e, t, n) => {
"use strict";
n.d(t, {
Ay: () => r
});
class o {
log(...e) {
console.log(this.prefix, ...e)
}
warn(...e) {
console.warn(this.prefix, ...e)
}
error(...e) {
console.error(this.prefix, ...e)
}
debug(...e) {
console.debug(this.prefix, ...e)
}
info(...e) {
console.info(this.prefix, ...e)
}
extends(e) {
return new o(this.namespace + ":" + e)
}
constructor(e) {
this.namespace = e, this.prefix = "[" + e + "]"
}
}
const r = new o("zju-helper")
}
},
t = {};
function n(o) {
var r = t[o];
if (void 0 !== r) return r.exports;
var i = t[o] = {
id: o,
exports: {}
};
return e[o].call(i.exports, 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 o in t) n.o(t, o) && !n.o(e, o) && Object.defineProperty(e, o, {
enumerable: !0,
get: t[o]
})
}, n.g = function() {
if ("object" == typeof globalThis) return globalThis;
try {
return this || new Function("return this")()
} catch (e) {
if ("object" == typeof window) return window
}
}(), 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";
var e = n(484),
t = n(99),
o = n(838);
const r = new class {
getNamespace() {
const e = location.hostname;
return "courses.zju.edu.cn" === e ? "学在浙大" : "classroom.zju.edu.cn" === e || "livingroom.cmc.zju.edu.cn" === e || "onlineroom.cmc.zju.edu.cn" === e || "interactivemeta.cmc.zju.edu.cn" === e ? "智云课堂" : void 0
}
loadScript(t) {
if (this.loadedScripts.includes(t)) return;
this.loadedScripts.push(t), e.Ay.debug(t, GM_getResourceText);
const n = GM_getResourceText(t);
null === n ? e.Ay.error(`脚本 ${t} 加载失败`) : (e.Ay.debug(n), unsafeWindow.eval(n))
}
constructor() {
this.plugins = {};
const e = n(342);
e.keys().forEach((t => {
const n = t.slice(2, -9);
"example-plugin" !== n && (this.plugins[n] = e(t), this.plugins[n].slug = n)
})), this.loadedScripts = []
}
async load() {
const n = {
namespace: this.getNamespace(),
clipboard: {
copy: o.l
},
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?"))
},
loadScript: e => this.loadScript(e),
extendContext: e => {
for (const t in e) Object.keys(n).includes(t) && n[t] instanceof Object ? n[t] = {
...n[t],
...e[t]
} : n[t] = e[t]
}
},
r = () => {
for (const e in this.plugins)
if (!this.plugins[e].loaded) return !1;
return !0
};
e.Ay.debug("开始加载插件", this.plugins);
let i = 0;
do {
for (const t in this.plugins) {
const o = this.plugins[t];
if (!o.loaded) {
if (o.required && o.required instanceof Array && o.required.length > 0) {
let t = "ok";
for (const e of o.required) {
if (this.plugins[e].skipped) {
t = "skip";
break
}
if (!this.plugins[e].loaded) {
t = "wait";
break
}
}
if ("skip" === t) {
o.loaded = !0, o.skipped = !0, e.Ay.debug(`跳过加载 ${o.slug} 插件,因为前置插件被跳过`);
continue
}
if ("wait" === t) continue
}
if (o.skip instanceof Function && await o.skip(n)) {
o.loaded = !0, o.skipped = !0, e.Ay.debug(`跳过加载 ${o.slug} 插件`);
continue
}
if (o.check instanceof Function && !await o.check(n)) continue;
await o.load({
...n,
logger: e.Ay.extends(o.slug)
}), o.loaded = !0
}
}
await (0, t.y)(100)
} while (!r() && ++i < 129);
e.Ay.info("插件加载完成!")
}
safe_load() {
(async () => {
try {
await r.load()
} catch (t) {
throw e.Ay.error(t), t
}
})()
}
};
r.safe_load()
})()
})();