您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
视频结束时自动关全屏,添加获取视频封面按钮(在播放器右下方三点里面),修改为彩虹进度条高能进度条改灰色,缩窄顶栏,简化动态页并淡化非视频动态,清理链接,不显示视频页面的弹幕盒子、广告等右栏杂物,直接显示推荐视频。
当前为
// ==UserScript== // @name shumin-Bilibili // @namespace https://www.tampermonkey.net/ // @version 4.1.0 // @description 视频结束时自动关全屏,添加获取视频封面按钮(在播放器右下方三点里面),修改为彩虹进度条高能进度条改灰色,缩窄顶栏,简化动态页并淡化非视频动态,清理链接,不显示视频页面的弹幕盒子、广告等右栏杂物,直接显示推荐视频。 // @author 庶民player // @license MIT // @match *.bilibili.com/* // @icon https://static.hdslb.com/images/favicon.ico // @require https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js // @grant none // @run-at document-idle // ==/UserScript== /* $("a:has(span:contains('直播'))").closest("li").remove(); $("a:has(span:contains('游戏中心'))").closest("li").remove(); $("a:has(span:contains('会员购'))").closest("li").remove(); $("a:has(span:contains('赛事'))").closest("li").remove(); */ function go_dn(elem_name){ for( let cur_li = $(elem_name) , next_li = cur_li.next(); next_li.length > 0; next_li = cur_li.next() ){ next_li.after(cur_li); } } function getUrl() { // 获取当前视频的 BV 号 var source_url = window.location.href; var video_BV = /https:\/\/www\.bilibili\.com\/video\/(BV\w+)/i; var match = source_url.match(video_BV); if (!match) { console.error("无法获取BV号"); return; } var bvid = match[1]; // 提取 BV 号 var api_url = `https://api.bilibili.com/x/web-interface/view?bvid=${bvid}`; // 创建 XMLHttpRequest 对象并发送 API 请求 var xhr = new XMLHttpRequest(); xhr.open('GET', api_url, false); xhr.send(); // 解析 API 响应 if (xhr.status === 200) { var response = JSON.parse(xhr.responseText); // 检查响应中是否包含封面地址 if (response.code === 0 && response.data && response.data.pic) { return response.data.pic; // 返回封面图片地址 } else { console.error("未能获取封面信息"); return; } } else { console.error("请求失败,状态码: " + xhr.status); return; } } function thin_top(){ let set_h = 42 function thin_topbar(){ $(".bili-header.fixed-header")[0].style.cssText += 'height: '+set_h+'px !important; min-height: '+set_h+'px !important;'; $(".bili-header__bar.mini-header")[0].style.cssText += 'height: '+set_h+'px !important; min-height: '+set_h+'px !important;'; $(".bili-header__bar.mini-header").css({ "padding-left": "7px", "padding-right": "0px", }); $("#viewbox_report.video-info-container").css({ "padding-top": "13px", "height": "80px", }); $('.header-upload-entry') .css('background-color', '#8FBC8F') .attr('data-darkreader-inline-bgcolor', '#8FBC8F'); // 浅海绿 document.querySelector('.mini-header__logo path').setAttribute('fill', '#DAA520'); // 深香槟黄 } thin_topbar(); const observer = new MutationObserver(() => { $("#biliMainHeader")[0].style.cssText += 'height: '+ set_h +'px !important; min-height: '+set_h+'px !important; top: '+( (set_h-64)/2 )+'px !important;'; thin_topbar(); }); observer.observe(document.body, { childList: true, subtree: true });// 开始观察特定的DOM节点 } $(document).ready(function () { thin_top(); //-=-=-=-=-=-=-=-=-=-=-=-=-t.bili-=-=-=-=-=-=-=-=-=-=-=- if (window.location.href.indexOf("t.bilibili.com") >= 0 ){ if(window.location.href.indexOf("tab=video") < 0) $(".bili-dyn-list-tabs__item:nth-child(2)").click(); //window.location.href = "https://t.bilibili.com/?tab=video"; $(".right").hide(); $(".left").hide(); $(".bili-dyn-publishing").hide(); /*$(".bili-backtop").css({ "right": "0px", "bottom": "300px", });*/ $(document.body).css({'overflow-x':'hidden'}); //$(".left-entry").remove(); //$(".offset-center-search").remove(); function filterContent() { const elements = document.querySelectorAll('.bili-dyn-item__main'); elements.forEach(function(element) { // 遍历所有匹配的元素// 使用 querySelector 来查找内部的子元素 let opct = '0.5'; if ( element.querySelector(".bili-dyn-card-article") || element.querySelector(".bili-dyn-card-audio") || element.querySelector('.bili-dyn-card-video') || element.querySelector('.bili-dyn-card-pgc') ){ opct = '1.0'; } // 白名单 if ( element.querySelector('.dyn-card-opus') || element.querySelector('.bili-dyn-card-courses') || element.querySelector('.reference') || !element.querySelector("div[data-type='comment']") ||//不能评论的 false ){ opct = '0.5'; } // 也许有用也许没用的,回调半透明 if ( element.querySelector(".dyn-goods") || element.querySelector(".bili-dyn-card-goods") || element.querySelector(".bili-dyn-card-reserve") || element.querySelector(".bili-dyn-card-vote") || element.querySelector(".lottery") || element.querySelector(".bili-dyn-card-live") || element.querySelector(".bili-dyn-card-event") || element.querySelector(".bili-dyn-upower-common") || element.querySelector(".dyn-blocked-mask__content") || $(element).find('.bili-dyn-card-common__badge').filter(function() { return $(this).text().trim() === '活动'; }).length > 0 || $(element).find('.bili-dyn-card-video__badge').filter(function() { return ( $(this).text().trim() === '充电专属' || $(this).text().trim() === '直播回放' || false ) }).length > 0 || false ){ opct = '0.2'; } // 含黑名单的,全透明 element.style.opacity = opct; }); } /*const listContainer = document.querySelector('.bili-dyn-list__items'); // 动态列表容器 const observer = new MutationObserver(filterContent); if (listContainer) { observer.observe(listContainer, { childList: true, subtree: true }); }*/ //window.addEventListener('scroll', filterContent); let scroll_inter = 256, scroll_num = scroll_inter; window.addEventListener('scroll', () => { scroll_num++; if (scroll_num > scroll_inter) { filterContent(); scroll_num = 0; setTimeout(() => { scroll_num = scroll_inter; }, 100); } }); return; } //-=-=-=-=-=-=-=-=-=-=-=-=-自动关全屏、封面-=-=-=-=-=-=-=-=-=-=-=- if (window.location.href.indexOf("bilibili.com/video/") >= 0 ){ function waitForElement(selector, callback) { const element = document.querySelector(selector); if(element) { callback(element); } else { setTimeout(() => waitForElement(selector, callback), 500); } } waitForElement('.video-tool-more-dropdown', (container) => { const newButton = document.createElement('div'); newButton.className = 'video-toolbar-right-item dropdown-item'; newButton.innerHTML = ` <svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="video-toolbar-item-icon"> <path fill-rule="evenodd" clip-rule="evenodd" d="M19 3H5C3.89543 3 3 3.89543 3 5V19C3 20.1046 3.89543 21 5 21H19C20.1046 21 21 20.1046 21 19V5C21 3.89543 20.1046 3 19 3ZM5 5H19V15L15.75 11.75C15.3358 11.3358 14.6642 11.3358 14.25 11.75L11 15L9.75 13.75C9.33579 13.3358 8.66421 13.3358 8.25 13.75L5 17V5ZM8 10C9.10457 10 10 9.10457 10 8C10 6.89543 9.10457 6 8 6C6.89543 6 6 6.89543 6 8C6 9.10457 6.89543 10 8 10Z"/> </svg> <span class="video-toolbar-item-text">获取封面</span> `; newButton.addEventListener('click', function() { window.open(getUrl()); }); container.appendChild(newButton); }); let cycle_id = setInterval(() => { if( $(".bpx-player-ending").is(":visible") || $(".bpx-player-electric-box").is(":visible") || false ) { document.webkitCancelFullScreen(); document.exitFullscreen(); document.cancelFullScreen(); } }, 1000); } //-=-=-=-=-=-=-=-=-=-=-=-=-下移、清理链接、高能进度条改绿色-=-=-=-=-=-=-=-=-=-=-=- window.onload = function(){ setTimeout( () => { $('.act-now').hide(); go_dn('.video-card-ad-small'); go_dn('.video-page-game-card-small'); go_dn('#paybar_module'); go_dn('#danmukuBox'); if (window.location.href.indexOf("bilibili.com/video/") >= 0 ) window.history.replaceState( null, null, window.location.pathname); const css = ` rect[clip-path="url(#bpx-player-pbp-played-path)"] { fill: #808080 !important; /* 设置 played 部分为绿色 */ } .header-upload-entry { background-color: #8FBC8F !important; /* 浅海绿 */ } `; // 将 CSS 添加到页面 var style = document.createElement('style'); style.type = 'text/css'; style.appendChild(document.createTextNode(css)); document.head.appendChild(style); }, 5000 ) } //-=-=-=-=-=-=-=-=-=-=-=-=-=-彩虹条=-=-=-=-=-=-=-=-=-=-=-=-= var css = ` /* 进度条样式 */ .bpx-player-progress-schedule-current { /*background: linear-gradient( to left, #FF0000 0%, #FF7F00 16.5%, #FFFF00 33%, #00FF00 50%, #0000FF 66%, #4B0082 83.5%, #9400D3 100% ) !important;*/ background: linear-gradient( to left, #FF004D 0%, #FF6600 16.5%, #FFCC00 33%, #66FF33 50%, #33CCFF 66%, #9933FF 83.5%, #FF3399 100% ) !important; } /* 缓冲条样式*/ .bpx-player-progress-schedule-buffer { background: repeating-linear-gradient( 45deg, #888888 0, #888888 20px, #000000 20px, #000000 40px ); background-size: 200% 200%; animation: barberPole 10s linear infinite; } @keyframes barberPole { 0% { background-position: 0% 0%; } 100% { background-position: 200% 200%; } } `; if (typeof GM_addStyle != "undefined") { GM_addStyle(css); } else if (typeof PRO_addStyle != "undefined") { PRO_addStyle(css); } else if (typeof addStyle != "undefined") { addStyle(css); } else { var node = document.createElement("style"); node.type = "text/css"; node.appendChild(document.createTextNode(css)); var heads = document.getElementsByTagName("head"); if (heads.length > 0) { heads[0].appendChild(node); } else { // no head yet, stick it whereever document.documentElement.appendChild(node); } } });
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址