补天社区阅读模式

移除侧边栏,优化title

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         补天社区阅读模式
// @namespace    http://tampermonkey.net/
// @version      2024-09-11
// @description  移除侧边栏,优化title
// @author       Mrxn
// @homepage     https://mrxn.net/
// @match        https://forum.butian.net/share/*
// @match        https://forum.butian.net/article/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=butian.net
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    function modify_title(){
        document.title = document.title.replace('奇安信攻防社区-','');
        setTimeout(function() { document.querySelector("body > div.wrap > div > div > div.col-xs-12.col-md-9.main > div.widget-article > h3").innerText=document.title; },1000);
    }
    function right_remove(){
        document.querySelector("body > div.wrap > div > div > div.col-xs-12.col-md-3.side").remove();
        document.querySelector("#template").remove();
        document.querySelector("body > div.wrap > div > div > div.mobile-toc-wrapper.visible-xs").remove();
        document.getElementsByClassName("col-xs-12 col-md-9 main")[0].style.width="100%";
    }
    document.addEventListener("scroll",function() {
        if(document.querySelector("body > div.wrap > div > div > div.col-xs-12.col-md-3.side")){
            modify_title();
            right_remove();
        }
    });
})();