[JavaScript] 纯文本查看 复制代码 // ==UserScript==
// [url=home.php?mod=space&uid=170990]@name[/url] New Userscript
// [url=home.php?mod=space&uid=467642]@namespace[/url] http://tampermonkey.net/
// [url=home.php?mod=space&uid=1248337]@version[/url] 2024-08-09
// @description try to take over the world!
// [url=home.php?mod=space&uid=686208]@AuThor[/url] You
// [url=home.php?mod=space&uid=195849]@match[/url] https://www.sx1211.com/course/playbackView?id=257236&skuId=34562&scheduleId=1038920
// [url=home.php?mod=space&uid=593100]@Icon[/url] https://www.google.com/s2/favicons?sz=64&domain=sx1211.com
// [url=home.php?mod=space&uid=609072]@grant[/url] none
// ==/UserScript==
(function() {
'use strict';
// ==UserScript==
// @name 香山教育下载器
// @namespace https://www.52pojie.cn/thread-1790301-1-1.html
// @version 0.1
// @description 香山教育课程下载器,下载ccr格式,请使用配套的ccr播放器进行播放。
// @AuThor Eqwer
// @match https://www.sx1211.com/course/playbackView?*
// @match https://class.csslcloud.net/*
// @Icon https://statics.sx1211.com/favicon.ico
// @grant GM_addStyle
// ==/UserScript==
(function() {
'use strict';
let style=`
.create-download{
position:absolute;
top:10px;
right:0px;
z-index:999;
}
.create-download a{
color: #ffffff;
background: #056b00;
padding:10px 20px;
border-radius: 10px;
}
`;
GM_addStyle(style);
function getQueryVariable(variable)
{
var query = window.location.href.split("?")[1];
console.log(query);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){
return pair[1];
}
}
return(false);
}
let url = location.hostname;
let roomId,userId,recordId;
if(url == "www.sx1211.com"){
// 获取参数
roomId = document.getElementById("roomId").value;
userId = document.getElementById("userId").value;
recordId = document.getElementById("recordId").value;
}else if(url == "class.csslcloud.net"){
roomId = getQueryVariable("roomid");
userId = getQueryVariable("userid");
console.log(userId);
recordId = getQueryVariable("recordid");
}
// 组装URL
let downloadUrl = 'https://ccr.csslcloud.net/' + userId + '/'+ roomId +'/'+ recordId + '.ccr';
let div = document.createElement("div");
div.className = 'create-download';
div.innerHTML = '<a href="'+downloadUrl+'" target="_blank">点击下载</a>';
document.body.appendChild(div);
})();
})(); |