SCP Foundation - No Necroposting

Hides the 'Reply' button under comments older than 5 months.

  1. // ==UserScript==
  2. // @name SCP Foundation - No Necroposting
  3. // @author RandomUsername404
  4. // @namespace https://greatest.deepsurf.us/en/users/105361-randomusername404
  5. // @version 1.01
  6. // @description Hides the 'Reply' button under comments older than 5 months.
  7. // @run-at document-start
  8. // @include *://www.scp-wiki.net/forum/*/*
  9. // @include *://fondationscp.wikidot.com/forum/*/*
  10. // @include *://scp-wiki-cn.wikidot.com/forum/*/*
  11. // @include *://scp-wiki-de.wikidot.com/forum/*/*
  12. // @include *://fondazionescp.wikidot.com/forum/*/*
  13. // @include *://ja.scp-wiki.net/forum/*/*
  14. // @include *://ko.scp-wiki.net/forum/*/*
  15. // @include *://scp-wiki.net.pl/forum/*/*
  16. // @include *://scp-pt-br.wikidot.com/forum/*/*
  17. // @include *://scpfoundation.ru/forum/*/*
  18. // @include *://lafundacionscp.wikidot.com/forum/*/*
  19. // @include *://scp-th.wikidot.com/forum/*/*
  20. // @include *://scp-ukrainian.wikidot.com/forum/*/*
  21. // @require https://code.jquery.com/jquery-3.3.1.min.js
  22. // @grant none
  23. // @icon http://www.scp-wiki.net/local--files/component:theme/logo.png
  24. // ==/UserScript==
  25.  
  26. $.noConflict();
  27. jQuery(document).ready(function($) {
  28.  
  29. var currentDate = (new Date).getTime() / 1000;
  30. preventNecroposts();
  31.  
  32. $(document).on("click", ".target", function() {
  33. setTimeout(function() {
  34. preventNecroposts();
  35. }, 500);
  36. });
  37.  
  38. function preventNecroposts() {
  39.  
  40. $('.post').each(function() {
  41. var postID = $(this).attr('id');
  42. var classList = $('#' + postID + ' .odate').attr('class').split(/\s+/);
  43.  
  44. $.each(classList, function(index, item) {
  45. if (item.includes('time_')) {
  46. var postDate = item.split("_").pop();
  47.  
  48. if (currentDate - postDate > 13150000) { // 5 months in seconds
  49. $('#' + postID + ' .btn-primary').hide();
  50. }
  51. }
  52. });
  53. });
  54. }
  55. });