Skip to content

Instantly share code, notes, and snippets.

@julianh2o
Created April 1, 2016 23:13
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 julianh2o/1a3be7f1dc981982b0428645048c8093 to your computer and use it in GitHub Desktop.
Save julianh2o/1a3be7f1dc981982b0428645048c8093 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Reddit Robin Spam Filter
// @namespace http://julianhartline.com/
// @version 0.13
// @description Adds mute functionality and spam filter
// @author Julian Hartline (julianh2o)
// @match https://www.reddit.com/robin
// @grant none
// ==/UserScript==
var storageKey = "RedditRobinMutedUsers";
var savedMutes = localStorage.getItem(storageKey) || '';
$("#robinDesktopNotifier").after($("<input id='mutedUsers' placeholder='Muted usernames, separated by comma'>").val(savedMutes).change(function() {
localStorage.setItem(storageKey,$(this).val());
}));
$("#robinChatMessageList").on("DOMNodeInserted",function(e) {
if ($(e.target).is(".robin-message")) {
var mutedUsers = $("#mutedUsers").val().replace(/ /g,"").split(",");
var uname = $(e.target).find(".robin--username").text();
if ($.inArray(uname,mutedUsers) !== -1) {
console.log("Spam Filtered Message: ",$(e.target).text());
$(e.target).hide();
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment