SHARE
TWEET

DecemberBoy

a guest Feb 13th, 2009 349 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name           Metafilter Ignore List
  3. // @namespace      http://www.nowhere.com/nothing
  4. // @description    Ignore users on Metafilter
  5. // @include        http://*.metafilter.com/*
  6. // @include        http://metafilter.com/*
  7. // ==/UserScript==
  8. // Last Updated: Thu 05 Feb 2009 07:05:57 PM CST
  9.  
  10. if (/.*metafilter\.com\/(\d{1,7}\/|mefi\/|comments\.mefi).*/.test(window.location)) {
  11.         //Add users in the brackets below, enclosed in double quotes, comma separated
  12.         var ignorelist = ["DummyUser01","DummyUser02"];
  13.         var ilist_all = [];
  14.         ilist_main();
  15. }
  16.  
  17. function ilist_main() {
  18.         var elements = document.evaluate('//div/span[@class="smallcopy"]',document.body,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);
  19.         poster = elements.snapshotItem(0).getElementsByTagName('a').item(0).textContent.toString();
  20.  
  21.         for (var i=0,element;element = elements.snapshotItem(i);i++) {
  22.                 var author = element.getElementsByTagName('a').item(0).textContent.toString();
  23.                 if (typeof(ilist_all[author]) == "object") {
  24.                         ilist_all[author].push(element);
  25.                 } else{
  26.                         ilist_all[author] = [element,];
  27.                 }
  28.         }
  29.  
  30.         for (var author in ilist_all) {
  31.                 for (var i = 0,lim=ilist_all[author].length;i<lim;i++) {
  32.                         if (ignorelist.indexOf(author) != -1) {
  33.                                 //if it was posted by an author on the ignore list, then...
  34.                                 author_link_e = ilist_all[author][i].getElementsByTagName('a').item(0);
  35.                                 postedby = author_link_e.parentNode;
  36.                                 author_link = author_link_e.href;
  37.                                 //...remove the posted by line, and...
  38.                                 comment = postedby.parentNode;
  39.                                 comment.removeChild(postedby);
  40.                                 // ...the comment itself
  41.                                 removed_text = document.createElement("p");
  42.                                 removed_text.setAttribute("class","reason");
  43.                                 removed_text.innerHTML = "Removed comment by <a href=\"" + author_link + "\">" + author + "</a>, who is on your ignore list";
  44.                                 //comment.parentNode.removeChild(comment);
  45.                                 comment.parentNode.replaceChild(removed_text,comment);
  46.                         }
  47.                 }
  48.         }
  49. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top