阿里云盘最大分页显示文件-aliyundrive.com

目前阿里云盘不支持显示目录内所有文件数,只能不断下拉到底才能或取到文件数,以最大分页数显示文件,设置limit参数为200

目前為 2021-05-28 提交的版本,檢視 最新版本

// ==UserScript==
// @name         阿里云盘最大分页显示文件-aliyundrive.com
// @namespace    https://www.cnblogs.com/steinven/
// @version      0.3
// @description  目前阿里云盘不支持显示目录内所有文件数,只能不断下拉到底才能或取到文件数,以最大分页数显示文件,设置limit参数为200
// @author       秒年度
// @match        https://www.aliyundrive.com/drive/*
// @grant        none
// ==/UserScript==


(function() {
    'use strict';
    function addXMLRequestCallback(callback){
        var oldSend, i;
        if( XMLHttpRequest.callbacks ) {
            // we've already overridden send() so just add the callback
            XMLHttpRequest.callbacks.push( callback );
        } else {
            // create a callback queue
            XMLHttpRequest.callbacks = [callback];
            // store the native send()
            oldSend = XMLHttpRequest.prototype.send;
            // override the native send()
            XMLHttpRequest.prototype.send = function(){
                for( i = 0; i < XMLHttpRequest.callbacks.length; i++ ) {
                    XMLHttpRequest.callbacks[i]( this );
                }
                if(arguments[0].indexOf!=undefined){
                    if(arguments[0].indexOf('limit')!==-1)
                    {
                        var json_obj = JSON.parse(arguments[0]);
                        json_obj.limit = 200;
                        arguments[0]= JSON.stringify(json_obj);
                    }
                }

                //FileList=[{name:item.next_marker,list:item.items}]
                oldSend.apply(this, arguments);
            }
        }
    }

    addXMLRequestCallback( function( xhr ) {
        console.dir(  xhr.responseText  );
    });
})();

QingJ © 2025

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