coofoUtils-tampermonkeyUtils

tampermonkeyUtils扩展包

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.gf.qytechs.cn/scripts/453330/1541594/coofoUtils-tampermonkeyUtils.js

// ==UserScript==
// @name         coofoUtils-tampermonkeyUtils
// @namespace    https://github.com/coofo/someScript
// @version      0.0.2
// @license      MIT License
// @description  tampermonkeyUtils扩展包
// @author       coofo
// @downloadURL  https://github.com/coofo/someScript/raw/main/tampermonkey/coofoUtils-tampermonkeyUtils.user.js
// @supportURL   https://github.com/coofo/someScript/issues
// @grant        GM_download
// @grant        GM_xmlhttpRequest
// ==/UserScript==

(function () {
    'use strict';
    window.coofoUtils.tampermonkeyUtils = {
        downloadHelp: {
            toBlob: {
                asBlob: function (url, onSuccess) {
                    GM_xmlhttpRequest({
                        method: "GET",
                        url: url,
                        nocache: true,
                        responseType: "arraybuffer",
                        onload: function (responseDetails) {
                            onSuccess(responseDetails);
                        }
                    });
                }
            },
            toUser: {
                asGMdownload: function (url, fileName, setting) {
                    let details;
                    if (typeof setting === "object" && typeof setting.gmDownload === "object") {
                        details = setting.gmDownload;
                    } else {
                        details = {saveAs: false};
                    }
                    details.url = url;
                    details.name = fileName;
                    // console.log(details.url);
                    // console.log(details.name);
                    GM_download(details);
                }
            }
        }
    };
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址