Greasy Fork

来自缓存

Greasy Fork is available in English.

天翼云盘大文件直接下载,启用分享功能

处理大于50M的文件需要客户端下载的问题

当前为 2021-04-23 提交的版本,查看 最新版本

// ==UserScript==
// @name         天翼云盘大文件直接下载,启用分享功能
// @namespace    http://greasyfork.icu/zh-CN/users/4330
// @version      0.2
// @description  处理大于50M的文件需要客户端下载的问题
// @author       x2009again
// @match        http*://cloud.189.cn/*
// @grant        none
// @run-at       document-end
// ==/UserScript==
(function() {
    'use strict';
    (function(open) {
        XMLHttpRequest.prototype.open = function() {
            this.addEventListener("readystatechange", function() {
                if(this.responseURL.indexOf("listFiles.action")>-1&&this.readyState==3)
                {
                    mainView.options.isSecurity=true;
                    mainView.showButtonGroupHandle=function (buttonGroup, selectedLength) {
                        var that = this,
                            hasFileLength = that.fileListTabObj[that.options.fileId].fileList.hasFile().length,
                            hasFolderLength = that.fileListTabObj[that.options.fileId].fileList.hasFolder().length;
                        $(buttonGroup.allAction).removeClass('disable');
                        0 == selectedLength ? ($(buttonGroup.optionWrap).hide(), $(buttonGroup.allAction).addClass('disable')) : 0 == hasFolderLength ? (1 == hasFileLength ? ($(buttonGroup.singleFile).removeClass('disable'), 1 == that.fileListTabObj[that.options.fileId].fileList.isDoc().length && $(buttonGroup.singleDoc).removeClass('disable'), '' != that.options.keyword && $(buttonGroup.singleSearchFile).removeClass('disable')) : $(buttonGroup.multiFiles).removeClass('disable'), selectedLength == that.fileListTabObj[that.options.fileId].fileList.isPhoto().length && $(buttonGroup.multiPhoto).removeClass('disable')) : 0 == hasFileLength ? 1 == hasFolderLength ? $(buttonGroup.singleFolder).removeClass('disable') : $(buttonGroup.multiFolder).removeClass('disable') : $(buttonGroup.mixedAction).removeClass('disable')
                    }
                }
                else if(window.location.href.indexOf("https://cloud.189.cn/t/")==0&& this.responseURL.indexOf("getWebImUrl.action")>-1&&this.readyState==3){
                    window.fileSize=200;
                    $(".btn-download").removeClass("disable");
                }

            }, false);
            open.apply(this, arguments);
        };
    })(XMLHttpRequest.prototype.open);


})();