目前阿里云盘不支持显示目录内所有文件数,只能不断下拉到底才能或取到文件数,根据需要设置分页数,越大越慢
// ==UserScript==
// @name 阿里云盘分页数自定义-aliyundrive.com
// @namespace https://www.cnblogs.com/steinven/
// @version 0.4
// @description 目前阿里云盘不支持显示目录内所有文件数,只能不断下拉到底才能或取到文件数,根据需要设置分页数,越大越慢
// @author 秒年度
// @match https://www.aliyundrive.com/*
// @icon https://www.google.cn/s2/favicons?domain=www.aliyundrive.com
// @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 = 30;
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 );
});
})();