// ==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
// @run-at document-start
// @version 1.1.0
// @author memset0
// @license MIT
// ==/UserScript==
(() => {
"use strict";
var e = {
297: (e, t, n) => {
n.d(t, {
A: () => c
});
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 c = a
},
513: (e, t, n) => {
n.d(t, {
A: () => c
});
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 c = a
},
314: e => {
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 c = 0; c < this.length; c++) {
var s = this[c][0];
null != s && (a[s] = !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 => {
e.exports = function(e) {
return e[1]
}
},
756: (e, t, n) => {
n.r(t), n.d(t, {
default: () => v
});
var o = n(72),
r = n.n(o),
i = n(825),
a = n.n(i),
c = n(659),
s = n.n(c),
l = n(56),
u = n.n(l),
d = n(540),
p = n.n(d),
f = n(113),
m = n.n(f),
h = n(297),
g = {};
g.styleTagTransform = m(), g.setAttributes = u(), g.insert = s().bind(null, "head"), g.domAPI = a(), g.insertStyleElement = p(), r()(h.A, g);
const v = h.A && h.A.locals ? h.A.locals : void 0
},
242: (e, t, n) => {
n.r(t), n.d(t, {
default: () => v
});
var o = n(72),
r = n.n(o),
i = n(825),
a = n.n(i),
c = n(659),
s = n.n(c),
l = n(56),
u = n.n(l),
d = n(540),
p = n.n(d),
f = n(113),
m = n.n(f),
h = n(513),
g = {};
g.styleTagTransform = m(), g.setAttributes = u(), g.insert = s().bind(null, "head"), g.domAPI = a(), g.insertStyleElement = p(), r()(h.A, g);
const v = h.A && h.A.locals ? h.A.locals : void 0
},
72: e => {
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 = [], c = 0; c < e.length; c++) {
var s = e[c],
l = o.base ? s[0] + o.base : s[0],
u = i[l] || 0,
d = "".concat(l, " ").concat(u);
i[l] = u + 1;
var p = n(d),
f = {
css: s[1],
media: s[2],
sourceMap: s[3],
supports: s[4],
layer: s[5]
};
if (-1 !== p) t[p].references++, t[p].updater(f);
else {
var m = r(f, o);
o.byIndex = c, t.splice(c, 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 c = n(i[a]);
t[c].references--
}
for (var s = 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 = s
}
}
},
659: e => {
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 => {
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) => {
e.exports = function(e) {
var t = n.nc;
t && e.setAttribute("nonce", t)
}
},
825: e => {
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 => {
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) => {
function o(e) {
return e && "__vue__" in e
}
n.r(t), n.d(t, {
check: () => s,
fullname: () => i,
load: () => l,
name: () => r,
skip: () => a
});
const r = "builtin-video-pages",
i = "[builtin]视频页面前置";
function a({
env: e
}) {
return !e.isVideoPage
}
function c({
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 !!c({
document: e
})
}
function l({
logger: e,
document: t,
extendContext: o
}) {
n(756);
const r = c({
document: t
});
o({
elements: r
});
const i = r.wrapper,
a = t.createElement("div");
a.className = "mem-btn-group", i.insertBefore(a, i.firstChild), e.debug("wrapper", i), o({
addButton: function(e, n, o) {
const r = t.createElement("button");
r.className = "mem-btn mem-btn-primary", r.textContent = n, r.onclick = o, r.setAttribute("data-key", e);
for (const t of a.children)
if (Number(t.getAttribute("data-key")) > e) return a.insertBefore(r, t), r;
return a.appendChild(r), r
}
})
}
},
238: (e, t, n) => {
n.r(t), n.d(t, {
fullname: () => r,
load: () => a,
name: () => o,
required: () => i
});
const o = "download-video",
r = "视频链接解析",
i = ["builtin-video-pages"];
function a({
logger: e,
clipboard: t,
elements: n,
addButton: o
}) {
const r = o(0, "解析链接", (() => {
const o = 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
}
}();
o ? (e.info("视频链接:", o), t.copy(o), r.innerText = "解析链接(已拷贝)", setTimeout((() => {
r.innerText = "解析链接"
}), 500)) : alert("获取视频地址失败,请待播放器完全加载后再试。")
}))
}
},
928: (e, t, n) => {
n.r(t), n.d(t, {
fullname: () => r,
load: () => i,
name: () => o
});
const o = "focus-mode",
r = "专注模式";
function i() {
n(242)
}
}
},
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](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.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, (() => {
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 o(e) {
return new Promise((t => setTimeout(t, e)))
}
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)
}
const i = new class {
_load_plugins() {
const e = [n(15), n(928), n(238)],
t = {};
for (const n of e) t[n.name] = n;
return t
}
constructor() {
this.plugins = this._load_plugins()
}
async load() {
const e = {
logger: t,
clipboard: {
copy: r
},
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 o = this.plugins[n];
if (!o.loaded) {
if (o.skip instanceof Function && await o.skip(e)) {
o.loaded = !0, o.skipped = !0, t.debug(`跳过加载 ${o.name} 插件`);
continue
}
if (o.check instanceof Function && !await o.check(e)) continue;
if (o.required && o.required instanceof Array && o.required.length > 0) {
let e = "ok";
for (const t of o.required) {
if (this.plugins[t].skipped) {
e = "skip";
break
}
if (!this.plugins[t].loaded) {
e = "wait";
break
}
}
if ("skip" === e) {
o.loaded = !0, o.skipped = !0, t.debug(`跳过加载 ${o.name} 插件,因为他的前置插件被跳过`);
continue
}
if ("wait" === e) continue
}
await o.load({
...e
}), o.loaded = !0
}
}
await o(100)
} while (!n());
t.info("插件加载完成!")
}
safe_load() {
(async () => {
try {
await i.load()
} catch (e) {
throw t.error(e), e
}
})()
}
};
i.safe_load()
})()
})();