先知阅读模式

去除侧边栏,优化title

目前為 2024-12-08 提交的版本,檢視 最新版本

// ==UserScript==
// @name         先知阅读模式
// @namespace    http://tampermonkey.net/
// @version      2024-12-08
// @description  去除侧边栏,优化title
// @author       Mrxn
// @homepage     https://mrxn.net/
// @match        https://xz.aliyun.com/t/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=aliyun.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    function modify_xz(){
        document.getElementsByClassName("span3 pull-right offset sidebar")[0].remove();
        document.title = document.title.replace(" - 先知社区","");
        document.querySelector("#Wrapper > div > div > div.row.box.content").setAttribute("width","1200px !important");
        document.getElementsByClassName("row box content")[0].style.width="1200px";
        if(document.querySelector("#Wrapper > div > div > div:nth-child(6)").textContent.indexOf("动动手指")>-1){
            // 选择所有包含 'row' 和 'box' 类的元素
            const elements = document.querySelectorAll('.row.box');

            // 过滤掉包含其他类的元素
            const filteredElements = Array.prototype.filter.call(elements, function(element) {
                return element.classList.length === 2; // 仅包含 'row' 和 'box' 类
            });

            // 现在 filteredElements 包含仅有 'row' 和 'box' 类的元素
            // console.log(filteredElements);
            // 对过滤后的元素设置样式 display: none
            filteredElements.forEach(function(element) {
                element.style.display = 'none';
            });
        }
    }
    document.addEventListener("scroll", function() {
        if(document.getElementsByClassName("span3 pull-right offset sidebar")[0]){
            modify_xz();
        }
    }
);})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址