您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
仅在全屏状态下显示SNI栏,非全屏下隐藏
// ==UserScript== // @name SNI 插件 - 仅在全屏模式显示 // @namespace ckyl-bili-sni-fullscreenonly // @version 2025-07-14 // @description 仅在全屏状态下显示SNI栏,非全屏下隐藏 // @author CKylinMC // @match https://*.bilibili.com/* // @exclude https://www.bilibili.com/bangumi/play* // @icon https://www.google.com/s2/favicons?sz=64&domain=bilibili.com // @grant none // @license WTFPL // ==/UserScript== (function() { 'use strict'; function toggleSNI(show=true){ const id = "sni-plugin-fullscreenonly"; let css = document.querySelector("style#"+id); if(!css) { css = document.createElement("style"); css.id = id; document.head.appendChild(css); } css.innerHTML = ''; css.appendChild(document.createTextNode(` #ck-sni-container{ display: ${show?"block":"none"} !important; } `)); } function applyState(){ const element = document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement; return toggleSNI(!!element); } function hookEvents(){ ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange'] .forEach(event => { try{document.removeEventListener(event, applyState);}catch(_){/*ignored*/} document.addEventListener(event, applyState); }); applyState(); } hookEvents(); })();