Skip to content

Commit

Permalink
feat: 智云课堂下载流程优化
Browse files Browse the repository at this point in the history
  • Loading branch information
zjufishboy committed Mar 3, 2021
1 parent 5cc87a2 commit 3268ea9
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 11 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@

## 更新日志

2021-3-2: 更新优化了美剧天堂的播放体验(下一集按钮+播放器直接全屏幕)
- 2021-3-2: 更新优化了美剧天堂的播放体验(下一集按钮+播放器直接全屏幕)
- 2021-3-3:更新优化了智云课堂的下载和播放体验(直接屏幕+下载引导)
Binary file modified src/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@
"matches": ["https://www.imeijutt.com/vodplay/*"],
"css": ["mjtt/index.css"],
"js": ["mjtt/index.js"]
},
{
"run_at": "document_end",
"matches": [
"http://livingroom.cmc.zju.edu.cn/*",
"http://vod.cmc.zju.edu.cn/*"
],
"css": ["zykt/index.css"],
"js": ["zykt/index.js"]
}
]
}
21 changes: 11 additions & 10 deletions src/mjtt/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,6 @@ body {
width: 100vw;
zoom: 1 !important;
}
.wtf-mjtt-button-next {
position: fixed;
right: 10px;
top: 10px;
border-radius: 50%;
width: 80px;
height: 80px;
cursor: pointer;
z-index: 999;
}
#playleft {
position: fixed !important;
top: 0;
Expand Down Expand Up @@ -83,3 +73,14 @@ table {
width: 100vw !important;
height: 100vh !important;
}

.wtf-mjtt-button-next {
position: fixed;
right: 10px;
top: 10px;
border-radius: 50%;
width: 80px;
height: 80px;
cursor: pointer;
z-index: 999;
}
77 changes: 77 additions & 0 deletions src/zykt/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#cmc_player_video {
position: fixed;
top: 0;
left: 0;
height: 100vh;
width: 100vw;
z-index: 999;
}
.cmc-video {
position: fixed;
top: 0;
left: 0;
height: 100vh;
width: 100vw;
z-index: 999;
}
.cmc-expand {
display: none !important;
}
.course-info__small-screen {
display: none !important;
}
.course-info__note {
display: none !important;
}
.course-info__header {
display: none !important;
}
.feedback-botton-group {
display: none !important;
}
.cmc-control {
position: fixed;
bottom: 0;
left: 0;
height: auto;
width: 100vw;
z-index: 999;
}
.custom-footer {
display: none !important;
}
.cmc-blue {
position: fixed;
top: 0;
left: 0;
height: 100vh;
width: 100vw;
z-index: 999;
/* display:none !important; */
}
.custom-header__wrapper {
display: none !important;
}
.course-info__main {
position: fixed;
top: 0;
left: 0;
height: 100vh !important;
width: 100vw !important;
z-index: 999;
}
body {
overflow: hidden;
background: black;
}

.wtf-zykt-button-next {
position: fixed;
right: 10px;
top: 10px;
border-radius: 50%;
width: 80px;
height: 80px;
cursor: pointer;
z-index: 999;
}
29 changes: 29 additions & 0 deletions src/zykt/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* 文件描述:给智云课堂的播放页面做的修复和优化
* 为啥做了一次跳转:因为H5跨域资源不能主动下载
*/

const button = document.createElement("button");
button.className = "wtf-zykt-button-next";
const host = window.location.host;
const isVideoHost = host === "vod.cmc.zju.edu.cn";
button.innerHTML = isVideoHost ? "下载" : "前往下载";

const downloadVideo = () => {
if (isVideoHost) {
const file_url = window.location.href.split("?")[0];
const link = document.createElement("a");
link.href = file_url;
link.download = "video.mp4";
link.click();
} else {
const video = document.getElementById("cmc_player_video");
if (video.src) {
window.location.assign(video.src);
}
}
};

button.addEventListener("click", downloadVideo);

document.body.append(button);

0 comments on commit 3268ea9

Please sign in to comment.