// ==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 // @downloadURL 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 ); }); })();