// ==UserScript== // @name 阿里云盘-批量修改文件名-剧集刮削 // @namespace http://tampermonkey.net/ // @version 1.1.1 // @description 用于阿里云盘批量修改文件名,主要为剧集刮削准备 // @author psbc // @match https://www.aliyundrive.com/drive/folder/* // @icon https://gw.alicdn.com/imgextra/i3/O1CN01aj9rdD1GS0E8io11t_!!6000000000620-73-tps-16-16.ico // @require https://cdn.staticfile.org/jquery/3.6.0/jquery.min.js // @run-at document-body // @license GPLv3 // @downloadURL https://update.greasyfork.icu/scripts/459908/%E9%98%BF%E9%87%8C%E4%BA%91%E7%9B%98-%E6%89%B9%E9%87%8F%E4%BF%AE%E6%94%B9%E6%96%87%E4%BB%B6%E5%90%8D-%E5%89%A7%E9%9B%86%E5%88%AE%E5%89%8A.user.js // @updateURL https://update.greasyfork.icu/scripts/459908/%E9%98%BF%E9%87%8C%E4%BA%91%E7%9B%98-%E6%89%B9%E9%87%8F%E4%BF%AE%E6%94%B9%E6%96%87%E4%BB%B6%E5%90%8D-%E5%89%A7%E9%9B%86%E5%88%AE%E5%89%8A.meta.js // ==/UserScript== (function() { 'use strict'; var $ = $ || window.$; var obj = { files: [], randomFillParam: -1, url: location.href }; obj.reset = function () { obj.files = []; obj.randomFillParam = -1; obj.url = location.href; }; obj.initBatchButton = function () { if ($(".button--batch").length) { return; } if ($("#root header").length) { var html = ''; html += '
'; $("#root header:eq(0)").append(html); $(".button--batch").on("click", obj.showModifyPage); }else { setTimeout(obj.initBatchButton, 1000); } }; obj.init = function () { var send = XMLHttpRequest.prototype.send; XMLHttpRequest.prototype.send = function(data) { this.addEventListener("load", function(event) { if(this.readyState == 4 && this.status == 200) { var response = this.response, responseURL = this.responseURL; try { response = JSON.parse(response) } catch (error) { }; if (responseURL.endsWith("/file/get_path")) { obj.initBatchButton(); //设置路径名 if (response instanceof Object && response.items) { obj.path = "/"; var items = response.items; for(var i=items.length-1; i>=0; i--) { obj.path += items[i].name+"/"; } } }else if (responseURL.indexOf("/file/list") > 0) { //if (document.querySelector(".ant-modal-mask")) { //排除【保存 移动 等行为触发】 //return; //} if (response && response.items) { if(obj.url && obj.url == location.href) { obj.files = obj.files.concat(response.items); }else { obj.reset(); obj.files = response.items; } } } } }, false); send.apply(this, arguments); }; }; obj.showModifyPage = function() { //滚动到底,自动获取所有文件 obj.pageScroll(); var html = `