Greasy Fork

Greasy Fork is available in English.

一键打包下载国科大sep上的课件

一键打包下载国科大sep上的课件,不用一个个点了

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         一键打包下载国科大sep上的课件
// @version      1.0
// @description  一键打包下载国科大sep上的课件,不用一个个点了
// @author       VnYzm
// @require      https://cdn.bootcss.com/jquery/1.8.3/jquery.min.js
// @require      https://cdn.bootcss.com/jszip/3.2.2/jszip.min.js
// @require      https://cdn.bootcss.com/FileSaver.js/1.3.8/FileSaver.min.js
// @match        https://course.ucas.ac.cn/portal/site/*/tool/*
// @namespace    DownloadPPT
// @license      GPLv2
// ==/UserScript==

(function() {
    'use strict';
    $('button:contains("复制")').after(
        '<input type="button" value="下载" style="margin:0" class="btn btn-default">');
    $(':button').click(function () {
        let zip = new JSZip();
        let files = $('input[name="selectedMembers"]:checked');
        if (files.length == 0) return;
        $(':button').prop('disabled','disabled')
        files.each(function () {
            let a = $(this).parent().next().children().first(); 
            zip.file(
                a.next().find('.hidden-sm').text(),
                fetch(a.prop('href')).then(r => r.blob()));
        });
        zip.generateAsync({type:'blob'}).then(function(content) {
            saveAs(content, '课件.zip');
            $(':button').removeProp('disabled');
        });
    });
})();