隐藏 v2ex 用户头像/页面背景

为了更好地摸鱼

目前為 2022-09-05 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         隐藏 v2ex 用户头像/页面背景
// @namespace    http://tampermonkey.net/
// @version      0.8
// @description  为了更好地摸鱼
// @author       en20
// @match        https://*.v2ex.com/*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
        // 头像列表
        let list = document.querySelectorAll(".avatar")
        for (let i = 0; i < list.length; i++) {
            list[i].style.display='None';
        }

        // 移除背景
        var wrapperDom = document.querySelector('#Wrapper')
        if (wrapperDom) {
            wrapperDom.style.background = '#e2e2e2'
        }

        // 移除头部 V2EX logo
        var logoDom = document.querySelector('#Logo')
        if (logoDom) {
            logoDom.style.background = 'none'
        }

        // 节点 header 图片
        let nodeHeader = document.querySelector('.node_header')
        if (nodeHeader) {
            nodeHeader.style.background = '#001D25'
            nodeHeader.querySelector('img').remove()
        }
        
        // 替换显眼的感谢图标
        var wrapperDom = document.querySelectorAll('.cell .small img')
        for (let elemOld of wrapperDom) {

            var elemParent = elemOld.parentNode
            var elemNew = document.createElement('span')
            elemNew.innerHTML = '感谢: '
            // 如果你需要替换 `感谢` 颜色的话
            // elemNew.style.color = ''
            elemParent.replaceChild(elemNew, elemOld)
        }
})();