Skip to content

Instantly share code, notes, and snippets.

@DarkStarFTW
Created January 16, 2019 18:27
Show Gist options
  • Save DarkStarFTW/9b281cc74f6f81fff249c685315fb451 to your computer and use it in GitHub Desktop.
Save DarkStarFTW/9b281cc74f6f81fff249c685315fb451 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name BitcoinTalk Poor Comment Blocker
// @version 1.0
// @description Removes comments with ads in signature on the https://bitcointalk.org forum.
// @include https://bitcointalk.org/index.php?topic=*
// @require https://code.jquery.com/jquery-3.3.1.min.js
// @run-at document-end
// ==/UserScript==
/*
* Define block words here. Each item is a regex. Case is ignored.
*/
var blockWords = [
"telegram"
, "whitepaper"
, "discount"
, "\\bjoin\\b"
, "be part of"
, "pre-?sale"
, "\\bico\\b"
, "token"
, "empower"
, "casino"
, "fortune"
, "\\bdice\\b"
];
blockWords = new RegExp(blockWords.join("|"), "i");
$(".signature").each(function () {
var $this = $(this);
if (blockWords.test($this.html())) {
hidePost($this);
}
});
insertCss(
".hidden-post-container {"
+ "background-color: #ECEDF3;"
+ "}"
+ ".hidden-post-inner {"
+ "opacity: 0.05;"
+ "transition: 0.2s opacity;"
+ "}"
+ ".hidden-post-inner:hover {"
+ "opacity: 1;"
+ "transition-delay: 0.5s;"
+ "}"
);
function hidePost($signature) {
$signature.parents("td.windowbg, td.windowbg2").addClass("hidden-post-inner").parent().addClass("hidden-post-container");
}
function insertCss(css) {
var style = document.createElement("style");
style.type = "text/css";
style.innerHTML = css;
document.head.appendChild(style);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment