Skip to content

Instantly share code, notes, and snippets.

@b1nary
Last active April 2, 2016 00:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save b1nary/4c7c4e56a92bec5ebb9340dbf07d8b21 to your computer and use it in GitHub Desktop.
Save b1nary/4c7c4e56a92bec5ebb9340dbf07d8b21 to your computer and use it in GitHub Desktop.
Unicorn Robin "ad"block

Unicorn Robin "ad"block

Use Tampermonkey for Chrome or Greasemonkey for Firefox

  • Blocks most vote spam
  • Double click usernames to block them in future
  • no "setInterval" so no flicker or lag!

Click [Raw] (right below from here) to install.

// ==UserScript==
// @name Unicorn Robin "ad"block
// @namespace UnicornRobinAdblock
// @version 0.1
// @description block that shit.
// @author unicorntrash
// @match https://www.reddit.com/robin/
// @grant none
// ==/UserScript==
(function() {
'use strict';
var blocked = [];
$(".footer-parent").prepend('<p><a href="https://gist.github.com/b1nary/4c7c4e56a92bec5ebb9340dbf07d8b21">Unicorn Robin "ad"block</a>: Doubleclick username to block.</p><br>')
$(function(){
$(document).bind('DOMNodeInserted', function(e) {
var target = $(e.target);
var message = target.find('.robin-message--message').text();
var username = target.find('.robin--username').text();
if($.inArray(username, blocked) !== -1){
target.remove();
}
if(message.indexOf('Robin-Grow') > -1 ||
message.indexOf('Robin Autovoter') > -1 ||
message.indexOf('voted to ') > -1){
target.remove();
}
});
$(document).on('dblclick', '.robin--username', function(){
console.log("Now blocking: "+$(this).text());
blocked.push($(this).text());
localStorage.robin_unicorn_blocked = JSON.stringify(blocked);
});
if(localStorage.robin_unicorn_blocked){
blocked = JSON.parse(localStorage.robin_unicorn_blocked);
}
console.log("Unicorn Robin Adblock loaded");
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment