Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Metafilter Ignore List
- // @namespace http://www.nowhere.com/nothing
- // @description Ignore users on Metafilter
- // @include http://*.metafilter.com/*
- // @include http://metafilter.com/*
- // ==/UserScript==
- // Last Updated: Thu 05 Feb 2009 07:05:57 PM CST
- if (/.*metafilter\.com\/(\d{1,7}\/|mefi\/|comments\.mefi).*/.test(window.location)) {
- //Add users in the brackets below, enclosed in double quotes, comma separated
- var ignorelist = ["DummyUser01","DummyUser02"];
- var ilist_all = [];
- ilist_main();
- }
- function ilist_main() {
- var elements = document.evaluate('//div/span[@class="smallcopy"]',document.body,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);
- poster = elements.snapshotItem(0).getElementsByTagName('a').item(0).textContent.toString();
- for (var i=0,element;element = elements.snapshotItem(i);i++) {
- var author = element.getElementsByTagName('a').item(0).textContent.toString();
- if (typeof(ilist_all[author]) == "object") {
- ilist_all[author].push(element);
- } else{
- ilist_all[author] = [element,];
- }
- }
- for (var author in ilist_all) {
- for (var i = 0,lim=ilist_all[author].length;i<lim;i++) {
- if (ignorelist.indexOf(author) != -1) {
- //if it was posted by an author on the ignore list, then...
- author_link_e = ilist_all[author][i].getElementsByTagName('a').item(0);
- postedby = author_link_e.parentNode;
- author_link = author_link_e.href;
- //...remove the posted by line, and...
- comment = postedby.parentNode;
- comment.removeChild(postedby);
- // ...the comment itself
- removed_text = document.createElement("p");
- removed_text.setAttribute("class","reason");
- removed_text.innerHTML = "Removed comment by <a href=\"" + author_link + "\">" + author + "</a>, who is on your ignore list";
- //comment.parentNode.removeChild(comment);
- comment.parentNode.replaceChild(removed_text,comment);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement