B站网页主页回到旧版的办法[2023年4月9日]
新主页的字体和宽屏实在是太难看太难受了,眼睛看的生疼,以前还能退回旧版,
现在已经不能回到旧版了,索性就用油猴脚本魔改主页。把字体变的更清晰,同时取消铺满全屏。
第一步,安装tampermonkey插件。
第二部,在插件里添加代码:
// ==UserScript==
// @name feckbilibili_font
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.bilibili.com/*
// @match https://www.bilibili.com
// @run-at document-body
// @grant none
// @require http://libs.baidu.com/jquery/2.0.0/jquery.min.js
// ==/UserScript==
(function() {
console.log("in####");
$(".bili-layout").css("width","1280px");//主内容宽度
$(".aside-wrap").css("width","280px");//增加排行榜宽度
$(".eva-extension-area").parent().remove();//删除推广区
$(".recommended-swipe-core").remove();//删除轮播区
//字体
$("a").css("font-family","PingFang SC,Helvetica Neue,Microsoft YaHei,sans-serif");
$("h3").css("font-family","PingFang SC,Helvetica Neue,Microsoft YaHei,sans-serif");
$("span").css("font-family","PingFang SC,Helvetica Neue,Microsoft YaHei,sans-serif");
$("a>p").css("font-family","PingFang SC,Helvetica Neue,Microsoft YaHei,sans-serif");
var container = document.querySelector("body");
//监听网页变化,再次设置字体
container.addEventListener('DOMNodeInserted', function (e) {
if(e.target.nodeName=="DIV"){
let links =e.target.getElementsByTagName("a");
for (var i = 0; i < links.length; i++ ){
links[i].style.fontFamily="PingFang SC,Helvetica Neue,Microsoft YaHei,sans-serif";
}
let h3s =e.target.getElementsByTagName("h3");
for (i = 0; i < h3s.length; i++ ){
h3s[i].style.fontFamily="PingFang SC,Helvetica Neue,Microsoft YaHei,sans-serif";
}
//评论区字体
let spans =e.target.getElementsByTagName("span");
for (i = 0; i < spans.length; i++ ){
spans[i].style.fontFamily="PingFang SC,Helvetica Neue,Microsoft YaHei,sans-serif";
spans[i].style.fontSize="14px";
}
$(".aside-wrap").css("width","280px");//增加排行榜宽度
//console.log("DOMNodeInserted:",e.target.nodeName,e)
}
}, false);
})();
效果如下,有需要的可以采纳。
