B站網(wǎng)頁主頁回到舊版的辦法[2023年4月9日]
新主頁的字體和寬屏實(shí)在是太難看太難受了,眼睛看的生疼,以前還能退回舊版,
現(xiàn)在已經(jīng)不能回到舊版了,索性就用油猴腳本魔改主頁。把字體變的更清晰,同時(shí)取消鋪滿全屏。
第一步,安裝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");//主內(nèi)容寬度
? ? $(".aside-wrap").css("width","280px");//增加排行榜寬度
? ? $(".eva-extension-area").parent().remove();//刪除推廣區(qū)
? ? $(".recommended-swipe-core").remove();//刪除輪播區(qū)
? ? //字體
? ? $("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");
? ? //監(jiān)聽網(wǎng)頁變化,再次設(shè)置字體
? ? 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";
? ? ? ? ? ? }
? ? ? ? ? ? //評(píng)論區(qū)字體
? ? ? ? ? ? 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);
})();
效果如下,有需要的可以采納。
