Plug this into GreaseMonkey or TamperMonkey, and hackaday will finally forget about that whole ahmed clock fiasco. This script blacklists posts with certain keywords. Feel free to change the tags as you see fit.
// ==UserScript==
// @name Blacklist Tags
// @namespace http://www.google.com/
// @version 0.1
// @description Change the blacklist_tags array to suit
// @author benchoff
// @match http://hackaday.com/*
// @grant none
// ==/UserScript==
var articles = document.getElementsByTagName("article");
var blacklist_tags = ["clock", "ahmed", "bomb"]
for(var i = 0; i < articles.length; i++){
tag_blocks = articles[i].getElementsByClassName("tags-links");
for (var a = 0; a < tag_blocks.length; a++) {
tags = tag_blocks[a].getElementsByTagName("a");
for (var b = 0; b < tags.length; b++) {
tag_link = tags[b].href
for (var c = 0; c < blacklist_tags.length; c++){
if (tag_link.indexOf(blacklist_tags[c]) > -1 ) {
console.log("Removing Article")
console.log(articles[i])
try {
articles[i].remove();
}
catch(err) {console.log("Article does not exist")}
console.log("Article removed")
}
}
}
}
}
But perhaps blacklisting by keywords isn't good enough? Maybe you don't want 'news' or anything to do with 'arduino'. There's a solution for that. You can blacklist by whatever category the article is in:
// ==UserScript==
// @name Blacklist Category
// @namespace http://www.google.com/
// @version 0.1
// @description Change the blacklist_tags array to suit
// @author benchoff
// @match http://hackaday.com/*
// @grant none
// ==/UserScript==
var articles = document.getElementsByTagName("article");
var blacklist_category = ["news", "Arduino"]
for(var i = 0; i < articles.length; i++){
tag_blocks = articles[i].getElementsByClassName("category");
for (var a = 0; a < tag_blocks.length; a++) {
tags = tag_blocks[a].getElementsByTagName("a");
for (var b = 0; b < category.length; b++) {
tag_link = tags[b].href
for (var c = 0; c < blacklist_category.length; c++){
if (tag_link.indexOf(blacklist_tags[c]) > -1 ) {
console.log("Removing Article")
console.log(articles[i])
try {
articles[i].remove();
}
catch(err) {console.log("Article does not exist")}
console.log("Article removed")
}
}
}
}
}
Still not good enough? Wish you weren't forced to read all my posts? Boy, do I have the solution for you! You can blacklist authors, too:
// ==UserScript==
// @name Blacklist Authors
// @namespace http://www.google.com/
// @version 0.1
// @description Change the blacklist_authors array to suit
// @author dddanmar
// @match http://hackaday.com/*
// @grant none
// ==/UserScript==
var articles = document.getElementsByTagName("article");
var blacklist_authors = ["brianbenchoff"]
for(var i = 0; i < articles.length; i++){
author = articles[i].getElementsByClassName("author");
console.log(author[0].href)
for (var c = 0; c < blacklist_authors.length; c++){
if (author[0].href.indexOf(blacklist_authors[c]) > -1 ) {
console.log("Removing Article")
console.log(articles[i])
try {
articles[i].remove();
}
catch(err) {console.log("Article does not exist")}
console.log("Article removed")
}
}
}
The most discriminating hackaday reader will probably want to try out this script:
// ==UserScript==
// @name Blacklist All
// @namespace http://www.google.com/
// @version 0.1
// @description
// @author benchoff
// @match http://hackaday.com/*
// @grant none
// ==/UserScript==
var articles = document.getElementsByTagName("article");
for(var i = 0; i < articles.length; i++){
try {
articles[i].remove();
}
catch(err) {console.log("Article does not exist")}
}
There you go. No longer will I force myself into your eyeballs. You're free, you're finally free, and you never once had to take responsibility for any of your actions.
Shoutout to Daniel Ward for his project that will remove all of my articles on the hackaday blog.