Created
June 15, 2021 09:11
-
-
Save lonelyion/308c63f1cb3b188658b86c33ba31388f to your computer and use it in GitHub Desktop.
上海大学超星资料直链获取
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name 上海大学超星资料直链获取 | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Get direct download link of SHU's chaoxing files | |
// @author Lonely_ion | |
// @match http://mooc1.elearning.shu.edu.cn/coursedata?* | |
// @icon https://www.google.com/s2/favicons?domain=shu.edu.cn | |
// @require https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
var trs = document.querySelectorAll("tr"); | |
var ndiv = document.createElement("div"); | |
trs.forEach(function(item) { | |
if(item.getAttribute('objectid')) { | |
var oid = item.getAttribute('objectid'); | |
$.get('http://mooc1.elearning.shu.edu.cn/ananas/status/' + oid + '?flag=normal&_dc=' + Date.now(), function(data, status) { | |
var link = document.createElement('a'); | |
var text = document.createTextNode(data.filename); | |
link.appendChild(text); | |
link.href = data.download; | |
link.target = '_blank'; | |
link.style = "color: blue;"; | |
ndiv.appendChild(link); | |
var linebreak = document.createElement('br'); | |
ndiv.appendChild(linebreak); | |
}); | |
} | |
}); | |
var tmp = document.querySelector("div #pagination"); | |
insertAfter(ndiv, tmp); | |
})(); | |
function insertAfter(newNode, referenceNode) { | |
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
针对的是一些不能直接点下载的文件