NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Erpolska Dobra Zmiana // @description Removes auto-moderator comment spam from threads // @version 0.1.0 // @author wodzuniu // @license MIT // @include * // @grant none // @namespace https://openuserjs.org/users/wodzuniu // @copyright 2019, wodzuniu (https://openuserjs.org/users/wodzuniu) // @grant none // ==/UserScript== function removeNode(node) { node.parentNode.removeChild(node); } function decreaseCommentCount(node) { node.innerHTML = node.innerHTML.replace(/\d+/, digits => parseInt(digits) - 1); } const theIncident = new Date("2019-10-06T16:59:06+00:00"); if (document.URL.match("reddit.com/r")) { if (document.URL.match("reddit.com/r/Polska/comments/")) { document.querySelectorAll("div.stickied").forEach(stickyCommentNode => { removeNode(stickyCommentNode); document.querySelectorAll("div.panestack-title > .title").forEach(decreaseCommentCount); document.querySelectorAll("#siteTable a.comments").forEach(decreaseCommentCount); }); } else if (document.URL.match("reddit.com/r/Polska(/|hot|new|rising|controversial|top)")) { document.querySelectorAll("#siteTable > div.link").forEach(postNode => { postNode.querySelectorAll("time").forEach(timeNode => { const date = new Date(timeNode.attributes.datetime.value); if (date >= theIncident) { postNode.querySelectorAll("a.comments").forEach(decreaseCommentCount); } }); }); } }