StackOverflow Hide Jerky

Hide jerky usernames and avatars on StackOverflow

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         StackOverflow Hide Jerky
// @namespace    https://gist.github.com/zmwangx/eb968f3f9e5ce8d0c4e4
// @version      0.1.1
// @description  Hide jerky usernames and avatars on StackOverflow
// @author       Zhiming Wang
// @match        *://stackoverflow.com/*
// @grant        none
// @require      https://code.jquery.com/jquery-2.2.3.min.js
// ==/UserScript==

// Jerks are everywhere, StackOverflow is no exception. There are idiots who
// wear their political badges everywhere, who take to their SO USERNAMES and
// AVATARS to deliver their crappy political propagenda, and in some cases they
// succeed in distracting me from the programming questions I'm looking at. (I
// don't give a s**t to profiles. It's fine as long as it's out of my way.)
//
// SO moderators keep saying you should report instead of finding a way to
// blacklist. I call bullshit. First, there's no consensus on whether political
// propaganda should or should not be allowed in SO usernames and
// avatars. Secondly, what *I* find annoying or distracting might not be so to
// others, and certainly may not be violating community guidelines (re no
// consensus). Thirdly, arguing with moderators is time consuming, and who
// knows if reporting sensitive matters would lead to retaliation or
// not. Therefore, the perfect solution is to exercise power and judgement on
// the client side, at the cost of some CPU cycles and memory.
//
// This script hides the usernames and avatars of users of your choice from all
// questions, answers, edits, and comments. All content about programming is
// left untouched, so it has minimal side effects on things that you actually
// care about.
//
// This script uses feross/standard style: https://github.com/feross/standard.
//
// This script is licensed under WTFPL v2.

// List of numeric user IDs (strings).
//
// As an example, putting '1' in this array will hide Jeff from
// http://stackoverflow.com/a/25486. This script is broken if it doesn't, and
// in that case please email [email protected] (I don't get notified of
// comments on Gists).
const userIds = []

const $ = window.$

$.each(userIds, function (index, userId) {
  // The string we don't want to see in hrefs
  var taboo = '/users/' + userId + '/'
  // Deal with signatures of questions/answers/edits
  $('.user-info').each(function (i, e) {
    if (e.innerHTML.indexOf(taboo) !== -1) {
      // Remove username
      $(e).find('.user-details').remove()
      // Remove avatar
      $(e).find('.user-gravatar32').remove()
    }
  })
  // Deal with comments
  $('.comment-user').each(function (i, e) {
    if (e.href.indexOf(taboo) !== -1) {
      $(e).remove()
    }
  })
})