您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
针对百度云新版重命名时提示【文件名不能包含以下字符:<,>,|,*,?,,/】,自动将特殊文件替换成空格
当前为
// ==UserScript== // @name 百度云重命名剔除特殊符号-输入框版 // @namespace http://tampermonkey.net/ // @version 0.19 // @description 针对百度云新版重命名时提示【文件名不能包含以下字符:<,>,|,*,?,,/】,自动将特殊文件替换成空格 // @author zyb // @match https://pan.baidu.com/disk/* // @exclude https://pan.baidu.com/share/* // @icon https://www.google.com/s2/favicons?sz=64&domain=baidu.com // @grant GM_addStyle // @license MIT // ==/UserScript== (function() { 'use strict'; const head = document.head; const style = document.createElement("style"); const styleStr =` #removeSpecialSymbolsInput{ width:20%; position:absolute; top:103px; left:11%; } .u-input__inner{ -webkit-appearance: none; background-color: #fff; background-image: none; border-radius: 4px; border: 1px solid #dcdfe6; box-sizing: border-box; color: #03081a; display: inline-block; font-size: inherit; height: 40px; line-height: 40px; outline: 0; padding: 0 12px; transition: border-color .2s cubic-bezier(.645,.045,.355,1); width: 100%; } ` style.appendChild(document.createTextNode(styleStr)); head.appendChild(style); const inputDom = document.createElement("input"); inputDom.setAttribute("id","removeSpecialSymbolsInput"); inputDom.setAttribute("class","u-input__inner"); inputDom.setAttribute("type","text"); inputDom.setAttribute("autocomplete","off"); inputDom.setAttribute("placeholder","请输入需要去除特殊符号的文本"); const fatherDom = document.querySelectorAll('.nd-main-layout__body .wp-s-core-pan__body-contain--list')[0] || document.querySelectorAll("#layoutMain")[0]; if(document.querySelectorAll("#layoutMain")[0]){ inputDom.setAttribute("style","top:79px;z-index:999;"); } if(!fatherDom){ return; } fatherDom.appendChild(inputDom); let showMsg = null; inputDom.addEventListener('paste', (event) => { // 获取解析 粘贴的文本 const clipboard = navigator.clipboard; let clipPromise = clipboard.readText(); clipPromise.then(function(clipText){ let newname = clipText.replaceAll(/<|>|\||\*|\?|\,|\/|:/g," "); console.log(newname); // 将新文件名回写到剪切板中 clipboard.writeText(newname); inputDom.value = newname; if(!showMsg){ showMsg = new ShowMsg(); } showMsg.toast({ template:"文本已复制到剪贴板", time:3000, }) }); }) class ShowMsg{ constructor(){ this.createClassFuc(); } createClassFuc(){ const head = document.head; let style = document.createElement("style"); const styleStr =` #toastBox{ min-width: 250px; position: absolute; top: -100px; left: 50%; padding: 15px 20px; background: #ebf8f2; border: 1px solid #cfefdf; border-radius: 10px; transform: translate(-50%,0); display: flex; justify-content: center; align-items: center; z-index: 9999; opacity:0; } #toastBox.show{ top:60px; opacity:1; animation-name: showToast; animation-duration: 0.5s; } #toastBox.hide{ top: -100px; opacity:0; animation-name: hideToast; animation-duration: 0.4s; } @keyframes showToast { 0% { top: -100px; opacity:1; } 100% { top:60px; opacity:1; } } @keyframes hideToast { 0% { top:60px; opacity:1; } 99% { top:60px; opacity:0; } 100%{ top:-100px; opacity:0; } } #toastBox i{ width: 20px; height: 20px; background: #00a854; border-radius: 50%; position: relative; translate: -8px 0; } #toastBox i:before{ content: ""; width: 12px; height: 5px; display: inline-block; border: 1px solid #fff; border-width: 0 0 2px 2px; transform: rotate(-45deg); -ms-transform: rotate(-45deg); -moz-transform: rotate(-45deg); -webkit-transform: rotate(-45deg); -o-transform: rotate(-45deg); vertical-align: baseline; position: absolute; left: 3.5px; top: 6px; } ` style.appendChild(document.createTextNode(styleStr)); head.appendChild(style); }; createToastBoxFuc(template){ const body = document.body; let divDom = document.createElement("div"); divDom.setAttribute("id","toastBox"); divDom.innerHTML = `<i></i><p class="content">${template}</p>`; body.appendChild(divDom); this.toastBoxDom = divDom; } toast(obj){ let template="", time = 2500; if(typeof obj !== "String"){ template = obj.template; time = obj.time; }else{ template = obj; } !this.toastBoxDom && this.createToastBoxFuc(template); this.toastBoxDom.setAttribute("class","show"); setTimeout(()=>{ this.toastBoxDom.setAttribute("class","hide"); },time) } } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址