ahedu文件下载

ahedu文件下载,右击文件名称下载

目前為 2022-02-19 提交的版本,檢視 最新版本

// ==UserScript==
// @name         ahedu文件下载
// @namespace    aheduDownloader.taozhiyu.gitee.io
// @version      0.1
// @description  ahedu文件下载,右击文件名称下载
// @author       涛之雨
// @match        http://www.ahedu.cn/EduResource/index.php?*
// @icon         http://www.ahedu.cn/EduResource/addons/theme/stv_resource/_static/images/favicon.ico
// @grant        none
// @license MIT
// ==/UserScript==

/* global layer */
(function() {
    'use strict';
    document.querySelectorAll('.zuopin_resource_a').forEach(a=>{
        a.oncontextmenu=x=>{
            fetch("http://www.ahedu.cn/EduResource/index.php?app=acy&mod=ResList&act=downloadRes&acy_name=youzhike2020&upload_file_type=", {
                "headers": {
                    "cache-control": "no-cache",
                    "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
                    "pragma": "no-cache",
                },
                "referrer": "http://www.ahedu.cn/EduResource/index.php?app=acy&mod=ResList&act=detail&rid=508573&acy_name=youzhike2020",
                "body": "rid="+ x.target.getAttribute("data-value"),
                "method": "POST"
            }).then(a=>a.json()).then(a=>{
                if(a.code!==200){
                    throw '';
                }
                layer.msg("加载成功,准备下载", {icon: 1});
                window.location.href=a.url;
            }).catch(a=>layer.msg("网络请求出错...", {icon: 5}));
            return false;
        };
    });
    layer.msg("脚本加载成功,右键名称下载文件", {icon: 1});
})();