// ==UserScript== // @name 云班课高效助手 // @author bellamy.n.h // @namespace http://tampermonkey.net/ // @version 1.32 // @description 添加下载按钮,可批量下载资源,可按资源栏缩小范围进行批量点击资源,高效使用云班课。【***请勿滥用***】【注意:执行完毕后需刷新页面】【自用脚本,根据个人需求开发,只做了chrome适配,其他浏览器可用,但具体操作会有点不同】【如果好用就留着用吧😀,不好用给点建议也好🙇】 // @match https://www.mosoteach.cn/web/index.php* // @include *://www.mosoteach.cn/web/index.php* // @note Version 1.32 优化操作反馈 (可以重置已选择的资源栏数) // @note Version 1.31 修复可能存在的Bug (页面无法自动关闭) // @grant none // @downloadURL none // ==/UserScript== $(function() { 'use strict'; /** * 睡眠函数 * @param numberMillis -- 要睡眠的毫秒数 */ function sleep(numberMillis) { var now = new Date(); var exitTime = now.getTime() + numberMillis; while (true) { now = new Date(); if (now.getTime() > exitTime) return; } } /** *文件下载函数 */ function download(name, href) { var a = document.createElement("a"), //创建a标签 e = document.createEvent("MouseEvents"); //创建鼠标事件对象 e.initEvent("click", false, false); //初始化事件对象 a.href = href; //设置下载地址 a.download = name; //设置下载文件名 a.dispatchEvent(e); //给指定的元素,执行事件click事件 } // css const styleTag = ` `; $(styleTag).appendTo('head'); //为每个资源添加下载按钮 $(".res-row-open-enable").each(function() { if ($(this).find(".download-res-button").length > 0) return;//如果已经存在下载按钮(例如mp3),则不再添加 $(this).find("ul").html('