您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
更改B站视频播放页面标题,更改播放控件大小,展开AutoHotkey论坛帖子代码框,MD2去掉顶部悬浮推荐,重定向淘宝主页到个人页面,移除Github页面的CSK快捷键,百度bing翻译页面添加转换语言快捷键CtrlShiftS
当前为
// ==UserScript== // @name 小而杂微调网页合集 // @license MIT // @namespace http://tampermonkey.net/ // @version 1.0.1 // @description 更改B站视频播放页面标题,更改播放控件大小,展开AutoHotkey论坛帖子代码框,MD2去掉顶部悬浮推荐,重定向淘宝主页到个人页面,移除Github页面的CSK快捷键,百度bing翻译页面添加转换语言快捷键CtrlShiftS // @author AiniyoMua // @home-url https://greasyfork.org/zh-CN/scripts/460556 // @homepageURL https://greasyfork.org/zh-CN/scripts/460556 // @supportURL https://greasyfork.org/zh-CN/scripts/460556/feedback // @match *://tianqi.2345.com/* // @match *://*.bilibili.com/list/* // @match *://*.bilibili.com/video/* // @match *://*.bilibili.com/watchlater/* // @match *://*.bilibili.com/bangumi/play/* // @match *://*.bilibili.com/medialist/play/* // @match *://*.autohotkey.com/boards/* // @match *://m2.material.io/* // @match *://taobao.com/ // @match *://*.taobao.com/ // @match *://github.com/* // @match *://*.github.com/* // @match *://fanyi.baidu.com/* // @match *://*.bing.com/translator* // @run-at document-start // @icon data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0JveD0iMCAwIDI0IDI0Ij48ZyBmaWxsPSJAYW5kcm9pZDpjb2xvci93aGl0ZSI+PHBhdGggZD0ibTIxLjcgMTguMi01LjMtNS4zaC0xbC0yLjYgMi41djFsNS4zIDUuM2MuNC40IDEgLjQgMS40IDBsMi4yLTIuMWMuNC0uNC40LTEgMC0xLjR6Ii8+PHBhdGggZD0ibTE3LjMgMTAuMiAxLjQtMS40IDIuMiAyLjFhMyAzIDAgMCAwIDAtNC4yTDE3LjMgMyAxNiA0LjVWMS43bC0uNy0uNy0zLjUgMy41LjcuOGgyLjhsLTEuNCAxLjQgMSAxLTIuOCAzLTQuMi00LjJWNWwtMy0zTDIgNC44bDMgM2gxLjRsNC4yIDQuMS0uOS45SDcuNmwtNS4zIDUuM2ExIDEgMCAwIDAgMCAxLjRsMi4xIDIuMWMuNC40IDEgLjQgMS40IDBsNS4zLTUuM3YtMi4xTDE2LjMgOWwxIDF6Ii8+PC9nPjwvc3ZnPg== // @grant GM_addStyle // @grant GM_registerMenuCommand // @grant GM_getValue // @grant GM_setValue // ==/UserScript== (function() { // 获取用户脚本保存配置参数 true or false var isNeedChangeBilibiliTitle = GM_getValue("pref_is_change_bilibili_title",false); GM_registerMenuCommand("更改B站播放页面标题", function() { const name = prompt("是否更改B站播放页面标题?(true false)", isNeedChangeBilibiliTitle).toLowerCase(); GM_setValue("pref_is_change_bilibili_title",getTrueOrFalse(name)); }); var isNeedChangeBilibiliPlayerSize = GM_getValue("pref_is_change_bilibili_player_size",false); GM_registerMenuCommand("更改B站播放控件大小", function() { const name = prompt("是否更改B站播放控件大小?(true false)", isNeedChangeBilibiliPlayerSize).toLowerCase(); GM_setValue("pref_is_change_bilibili_player_size",getTrueOrFalse(name)); }); var isNeedTaobaoReplaceUrl = GM_getValue("pref_is_taobao_replace_url",true); GM_registerMenuCommand("重定向淘宝至个人淘宝页面", function() { const name = prompt("是否重定向淘宝至个人淘宝页面?(true false)", isNeedTaobaoReplaceUrl).toLowerCase(); GM_setValue("pref_is_taobao_replace_url",getTrueOrFalse(name)); }); // 获取用户输入的文本,是表示 true 还是 false function getTrueOrFalse(name){ return !(name==="不" || name==="否" || name==="0" || name==="false" || name==="no" || name==="not" || name==="不移除" || name==="非" || name==="f" || name==="nul" || name==="null" || name==="n") } // 匹配域名,并运行小脚本 const hostname = window.location.hostname; if(hostname.includes("bilibili")){ if(isNeedChangeBilibiliTitle){changeBilibiliVideoTitle();} if(isNeedChangeBilibiliPlayerSize){changeBilibiliVideoWidgetSize();} }else if(hostname.includes("autohotkey")){ // 强行展开AutoHotkey论坛帖子代码框 GM_addStyle(`code.language-autohotkey{height: auto !important;}`); }else if(hostname.includes("material")){ // Material Design2 去掉顶部推荐,把顶栏压扁一些 GM_addStyle(`mio-communication-banner{display: none !important;}header{height: 50px !important; }`); }else if(hostname.includes("taobao")){ // 重定向淘宝主页到个人淘宝页面 if(isNeedTaobaoReplaceUrl){window.location.replace("https://login.taobao.com/member/login.jhtml");} }else if(hostname.includes("github")){ githubRemoveHotkeyCSK() }else if(hostname.includes("baidu")){ baiduFanyi(); }else if(hostname.includes("bing")){ bingFanyi(); } /** 更改B站视频标题 */ function changeBilibiliVideoTitle() { // 摸鱼标题字符串数组 const moyuTitleArr = [ "Android 截屏实现的几种方式_android adb 截图_jun_tong的博客-CSDN博客", "Android Caused by: java.net.SocketException: Connection reset", "Android:获取 Resources$NotFoundException for abc_ic_ab_back_material - Stack Overflow", "android内存泄露:2、非静态的内部类错误使用_情形2_mkeyedtags in constraintlayout 泄漏_华哥折腾历险记的博客-CSDN博客", "android recyclerview滑动删除 android recyclerview item动画_clghxq的技术博客_51CTO博客" ]; // 随机获取数组中的一个值 const randomIndex = Math.floor(Math.random() * moyuTitleArr.length); const randomTitle = moyuTitleArr[randomIndex]; window.addEventListener('load', setMoyuTitle); setTimeout(setMoyuTitle, 2000); setTimeout(setMoyuTitle, 5000); setTimeout(setMoyuTitle, 10000); // 更改网页标题 function setMoyuTitle(){ document.title = randomTitle; } } /** 更改B站视频控件大小,强制1080px,(2K屏时使用) */ function changeBilibiliVideoWidgetSize() { const css1 = ` @media screen and (min-width: 2000px) { div.text-info{display: none !important;} div.bili-header__bar.mini-header{padding-right: 120px !important;} div.bpx-player-video-area{ max-width: 1920px !important; max-height: 1080px !important; } div.bpx-player-container{ max-width: 1922px !important; } } ` GM_addStyle(css1); } /** 移除所有 Github 页面的 Ctrl + Shift + K 快捷键占用 */ function githubRemoveHotkeyCSK() { document.addEventListener('keydown', function(event) { if (event.ctrlKey && event.shiftKey && event.key.toLowerCase() === 'k') { event.stopImmediatePropagation(); } }, true); } /** 百度翻译,添加语音掉转,快捷键 */ function baiduFanyi(){ document.addEventListener("keydown", function(event) { if (event.ctrlKey && event.shiftKey && event.key === "S") { document.querySelector(".from-to-exchange").click(); } }); } /** Bing翻译,添加语音掉转,快捷键 */ function bingFanyi(){ document.addEventListener("keydown", function(event) { if (event.ctrlKey && event.shiftKey && event.key === "S") { document.querySelector("#tta_revIcon").click(); } }); } /** */ function materialdesign2() { } })();