Greasy Fork

Greasy Fork is available in English.

超星学习通课程资源直链下载

超星学习通课程资源直链下载,支持ppt(x),doc(x),pdf,mp4,flv,mp3资源的下载。

当前为 2020-03-02 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         超星学习通课程资源直链下载
// @namespace    https://github.com/ColdThunder11/ChaoXingDownload
// @version      0.1
// @description  超星学习通课程资源直链下载,支持ppt(x),doc(x),pdf,mp4,flv,mp3资源的下载。
// @author       ColdThunder11
// @match        https://mooc1-1.chaoxing.com/mycourse/studentstudy?chapterId=*&courseId=*&clazzid=*&enc=*
// @grant        none
// @supportURL   https://github.com/ColdThunder11/ChaoXingDownload/issues
// ==/UserScript==

(function() {
    'use strict';
    setInterval(()=>{
        var iframes=document.getElementsByTagName("iframe");
        for(var i=0;i<iframes.length;i++){
            var frames=iframes[i].contentWindow.document.getElementsByTagName("iframe");
            for(var j=0;j<frames.length;j++){
                var frame=frames[j];
                if(!frame) return;
                var fdiv=frame.parentNode;
                if(!fdiv) return;
                if(iframes[i].contentWindow.document.getElementsByClassName("ct11_dl")[j]!=null) return;
                var data=frame.getAttribute('data');
                if(data!=null){
                    var jsondata=JSON.parse(data);
                    if(jsondata.type==".ppt"||jsondata.type==".ppt"||jsondata.type==".mp4"||jsondata.type==".pdf"||jsondata.type==".flv"||jsondata.type==".doc"||jsondata.type==".docx"){
                        var downloadTag = document.createElement("A");
                        downloadTag.setAttribute("href","https://d0.ananas.chaoxing.com/download/"+jsondata.objectid);
                        downloadTag.setAttribute("class","ct11_dl");
                        downloadTag.innerHTML="点此下载 "+jsondata.name;
                        fdiv.appendChild(downloadTag);
                        continue;
                    }
                }
                if(frame.getAttribute("name").substr(frame.getAttribute("name").length-4,4)==".mp3"){
                    var adownloadTag = document.createElement("A");
                    adownloadTag.setAttribute("href","https://d0.ananas.chaoxing.com/download/"+frame.getAttribute("objectid"));
                    adownloadTag.setAttribute("class","ct11_dl");
                    adownloadTag.innerHTML="点此下载 "+frame.getAttribute("name");
                    fdiv.appendChild(adownloadTag);
                }

            }
        }
    },3000);
})();