StackOverflow Hide Jerky

Hide jerky usernames and avatars on StackOverflow

当前为 2016-01-20 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name StackOverflow Hide Jerky
  3. // @namespace https://gist.github.com/zmwangx/eb968f3f9e5ce8d0c4e4
  4. // @version 0.1
  5. // @description Hide jerky usernames and avatars on StackOverflow
  6. // @author Zhiming Wang
  7. // @match *://stackoverflow.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. // Jerks are everywhere, StackOverflow is no exception. There are idiots who
  12. // wear their political badges everywhere, who take to their SO USERNAMES and
  13. // AVATARS to deliver their crappy political propagenda, and in some cases they
  14. // succeed in distracting me from the programming questions I'm looking at. (I
  15. // don't give a s**t to profiles. It's fine as long as it's out of my way.)
  16. //
  17. // SO moderators keep saying you should report instead of finding a way to
  18. // blacklist. I call bullshit. First, there's no consensus on whether political
  19. // propaganda should or should not be allowed in SO usernames and
  20. // avatars. Secondly, what *I* find annoying or distracting might not be so to
  21. // others, and certainly may not be violating community guidelines (re no
  22. // consensus). Thirdly, arguing with moderators is time consuming, and who
  23. // knows if reporting sensitive matters would lead to retaliation or
  24. // not. Therefore, the perfect solution is to exercise power and judgement on
  25. // the client side, at the cost of some CPU cycles and memory.
  26. //
  27. // This script hides the usernames and avatars of users of your choice from all
  28. // questions, answers, edits, and comments. All content about programming is
  29. // left untouched, so it has minimal side effects on things that you actually
  30. // care about.
  31. //
  32. // This script uses feross/standard style: https://github.com/feross/standard.
  33. //
  34. // This script is licensed under WTFPL v2.
  35.  
  36. // List of numeric user IDs (strings).
  37. //
  38. // As an example, putting '1' in this array will hide Jeff from
  39. // http://stackoverflow.com/a/25486. This script is broken if it doesn't, and
  40. // in that case please email zmwangx@gmail.com (I don't get notified of
  41. // comments on Gists).
  42. const userIds = []
  43.  
  44. const $ = window.$
  45.  
  46. $.each(userIds, function (index, userId) {
  47. // The string we don't want to see in hrefs
  48. var taboo = '/users/' + userId + '/'
  49. // Deal with signatures of questions/answers/edits
  50. $('.user-info').each(function (i, e) {
  51. if (e.innerHTML.indexOf(taboo) !== -1) {
  52. // Remove username
  53. $(e).find('.user-details').remove()
  54. // Remove avatar
  55. $(e).find('.user-gravatar32').remove()
  56. }
  57. })
  58. // Deal with comments
  59. $('.comment-user').each(function (i, e) {
  60. if (e.href.indexOf(taboo) !== -1) {
  61. $(e).remove()
  62. }
  63. })
  64. })