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

为了更好地摸鱼

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         隐藏 v2ex 用户头像/页面背景
// @namespace    http://tampermonkey.net/
// @version      1.1
// @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()
    }
    const header = document.querySelector('.node-header > .page-content-header')
    if (header) {
        header.style.backgroundColor = '#fff'
        header.style.color = '#000'
    }
    // 替换显眼的感谢图标
    var thinksDom = document.querySelectorAll('.cell .small img')
    for (let elemOld of thinksDom) {

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