Hack Forums - Unclutter

Removes statistics nobody gives a fuck about to make the postbit slimmer

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

  1. // ==UserScript==
  2. // @name Hack Forums - Unclutter
  3. // @namespace Doctor Blue
  4. // @description Removes statistics nobody gives a fuck about to make the postbit slimmer
  5. // @include *hackforums.net*
  6. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
  7. // @version 0.2
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. // Prevent conflicts with other userscripts
  12. $j = $.noConflict(true)
  13.  
  14. function forumdisplay() {
  15. // Compile regular expressions
  16.  
  17.  
  18. // Get all the thread rows
  19. var $threads = $j('tr:has(.forumdisplay_sticky), tr:has(.forumdisplay_regular)')
  20. console.log($threads.length)
  21.  
  22. // Adjust row height
  23. $threads.css('height', '33px')
  24. $j('.quick_jump')
  25. .css('position', 'relative')
  26. .css('bottom', '2px')
  27. // Remove page list
  28. $threads.find('div > span > .smalltext').remove()
  29. // Put author to the right of title instead of under
  30. $threads.find('.author')
  31. .removeClass('smalltext')
  32. .css('display', 'inline-block')
  33. .before(' - ')
  34. // Remove line break from last post column
  35. $threads.find('.lastpost').each(function() {
  36. var split = $j(this).html().split("<br>")
  37. console.log(split[1] + " - " + split[0])
  38. $j(this).html(split[1] + " - " + split[0])
  39. })
  40. }
  41. function showthread() {
  42. // Compile regular expressions
  43. var rxReputation = new RegExp("(Reputation: .*?</a>)")
  44. var rxPrestige = new RegExp("(Prestige: [0-9]+?)")
  45. var rxWarning = new RegExp("(Warning Level: .*?</a>)")
  46.  
  47. // Resize avatar to a maximum of 50x50 pixels
  48. $j('.post_avatar img')
  49. .css('max-height', '50px')
  50. .css('max-width', '50px')
  51. .removeAttr('height')
  52. .removeAttr('width')
  53.  
  54. // Remove userstars
  55. $j('.userstars').remove()
  56.  
  57. // Put userbar's alt text before usertitle
  58. $j('.post_author').each(function() {
  59. var $userbar = $j(this).find('img[src*="groupimages"]')
  60. var usergroup = $j($userbar).attr('alt')
  61.  
  62. // Replace some group names
  63. switch(usergroup) {
  64. case undefined: usergroup = "Regular"; break;
  65. case "HF l33t": usergroup = "L33T"; break;
  66. case "HF Ub3r": usergroup = "UB3R"; break;
  67. case "HF 3p1c": usergroup = "3P1C"; break;
  68. case "HF Writers": usergroup = "Writer"; break;
  69. case "Mentors": usergroup = "Mentor"; break;
  70. case "Administrators": usergroup = "Administrator"; break;
  71. }
  72. if(usergroup == undefined) usergroup = "Regular"
  73. $j($userbar).remove()
  74. $j(this).find('span.smalltext').prepend(usergroup + " - ")
  75. })
  76.  
  77. // Remove all stats except reputation and warning level
  78. $j('.post_author_info').each(function() {
  79. // Extract interesting statistics
  80. var reputation = $j(this).html().match(rxReputation)
  81. if(reputation === null) reputation = $j(this).html().match(rxPrestige) // Get prestige if staff/admin
  82. reputation = reputation[1]
  83. var warning = $j(this).html().match(rxWarning)[1]
  84.  
  85. // Combine and insert
  86. $j(this).html(reputation + "<br />\n" + warning)
  87. })
  88.  
  89. // Replace online/offline/away icons
  90. $j('img[src*="buddy_online"]').attr('src', 'https://shellsec.pw/images/modern_blue/buddy_online.png')
  91. $j('img[src*="buddy_offline"]').attr('src', 'https://shellsec.pw/images/modern_blue/buddy_offline.png')
  92. $j('img[src*="buddy_away"]').attr('src', 'https://shellsec.pw/images/modern_blue/buddy_offline.png')
  93. $j('img[src*="buddy"]')
  94. .css('position', 'relative')
  95. .css('bottom', '7px')
  96. }
  97.  
  98. if(window.location.href.indexOf("forumdisplay.php") != -1) forumdisplay() // comment out to not change forumdisplay
  99. if(window.location.href.indexOf("showthread.php") != -1) showthread()