StackOverflow Hide Jerky

Hide jerky usernames and avatars on StackOverflow

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