您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
针对百度云新版重命名时提示【文件名不能包含以下字符:<,>,|,*,?,,/】,自动将特殊文件替换成空格
当前为
// ==UserScript== // @name 百度云重命名剔除特殊符号-自用 // @namespace http://tampermonkey.net/ // @version 0.11 // @description 针对百度云新版重命名时提示【文件名不能包含以下字符:<,>,|,*,?,,/】,自动将特殊文件替换成空格 // @author zyb // @match https://pan.baidu.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=baidu.com // @require https://cdn.bootcss.com/jquery/3.1.1/jquery.min.js // @grant GM_addStyle // @license MIT // ==/UserScript== (function() { 'use strict'; // Your code here... document.addEventListener('paste', (event) => { // 获取解析 粘贴的文本 const clipboard = navigator.clipboard; let clipPromise = clipboard.readText(); clipPromise.then(function(clipText){ let oldname = clipText; let newname = clipText.replaceAll(/<|>|\||\*|\?|\,|\/|:/g," "); console.log(newname); clipboard.writeText(newname); let renameInputDom = document.querySelectorAll(".wp-s-pan-list__file-name-edit--title-edit-input input")[0]; let miaochuanInputDom = document.querySelectorAll("#mzf-path-input")[0]; renameInputDom && (renameInputDom.value = newname); miaochuanInputDom && (miaochuanInputDom.value = newname); if(renameInputDom){ // "#/index?category=all&path=%2Fapps" let hashStr = location.hash || ""; let pathStr = decodeURIComponent(hashStr.split('&').filter(function(item){return item.indexOf("path=")>-1})[0].split("path=")[1])+"/"; let path = pathStr + document.querySelectorAll(".nd-detail-filelist__name")[0].textContent; let bdstoken = window.locals.userInfo.bdstoken; let dpLogid = getLogID(); $.ajax(`https://pan.baidu.com/api/filemanager?async=2&onnest=fail&opera=rename&bdstoken=${bdstoken}&clienttype=0&app_id=250528&web=1&dp-logid=${dpLogid}`,{ type:'post', data:{ filelist : JSON.stringify([{ path : path, newname : newname }]) }, complete:function () { console.log("complete!!"); location.reload(); } }); /* fetch(`https://pan.baidu.com/api/filemanager?async=2&onnest=fail&opera=rename&bdstoken=${bdstoken}&clienttype=0&app_id=250528&web=1&dp-logid=${dpLogid}`,{ method: "post", body: JSON.stringify([{ path : path, newname : newname }]) }).then(response => { return response.json(); }).then(data => { console.log("complete!!"); location.reload(); })*/ } }); }) function getLogID() { var n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/~!@#¥%……&"; var r = String.fromCharCode; var a = function(e) { if (e.length < 2) { var t = e.charCodeAt(0); return 128 > t ? e: 2048 > t ? r(192 | t >>> 6) + r(128 | 63 & t) : r(224 | t >>> 12 & 15) + r(128 | t >>> 6 & 63) + r(128 | 63 & t) } var t2 = 65536 + 1024 * (e.charCodeAt(0) - 55296) + (e.charCodeAt(1) - 56320); return r(240 | t2 >>> 18 & 7) + r(128 | t2 >>> 12 & 63) + r(128 | t2 >>> 6 & 63) + r(128 | 63 & t2) }; var o = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g; var c = function(e) { return (e + "" + Math.random()).replace(o, a) }; var i = function(e) { var t = [0, 2, 1][e.length % 3], r = e.charCodeAt(0) << 16 | (e.length > 1 ? e.charCodeAt(1) : 0) << 8 | (e.length > 2 ? e.charCodeAt(2) : 0), a = [n.charAt(r >>> 18), n.charAt(r >>> 12 & 63), t >= 2 ? "=": n.charAt(r >>> 6 & 63), t >= 1 ? "=": n.charAt(63 & r)]; return a.join("") }; var d = function(e) { return e.replace(/[\s\S]{1,3}/g, i) }; var l = function() { return d(c((new Date).getTime())) }; var u = function(e, t) { return t ? l(String(e)).replace(/[+\/]/g, function(e) { return "+" == e ? "-": "_" }).replace(/=/g, "") : l(String(e)) }; var f = function(e) { var t, n; if(document.cookie.length > 0 && (t = document.cookie.indexOf(e + "="), -1 != t)){ t = t + e.length + 1; n = document.cookie.indexOf(";", t); -1 == n && (n = document.cookie.length); return decodeURI(document.cookie.substring(t, n)) }else{ return ""; } // return document.cookie.length > 0 && (t = document.cookie.indexOf(e + "="), -1 != t) ? (t = t + e.length + 1, n = document.cookie.indexOf(";", t), -1 == n && (n = document.cookie.length), decodeURI(document.cookie.substring(t, n))) : "" }; var h = function(e) { var t = new RegExp(e + "=([^#&]*)", "g"), n = t.exec(location.hash); return n ? decodeURIComponent(n[1]) : "" } return u(f('BAIDUID')); } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址