Apraxis incarnate. (rakafkaven) wrote,
Apraxis incarnate.
rakafkaven

Make the voices stop: p2

Honesty compels me to admit that this was my second Greasemonkey script. My first was written earlier today, after someone expressed a desire to killfile my comments because:
Raka just strikes me as being another of those people who thinks it's appropriate to try to silence women by vicious attacks, and having run into that kind of online bully before, I'm (a) grateful Raka does not know my real name (b) uninterested in reading anything else Raka has to say.
After I got done laughing, I thought the least I could do to repay such hilarity would be to oblige her desire to make my terrible oppression just go away.
// ==UserScript==
// @name typepad killfile
// @description remove comments from naughty users
// @include http://slacktivist.typepad.com*
// ==/UserScript==
(function () {

  trolllist = new Array("Raka", "Alexela", "teh patriarchy");

  var comfeet = document.evaluate("//p[@class='comment-footer']",
      document,
      null,
      XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
      null);
  var i, trollnumber;
  var cstart, cstop, commentator;

  for( i = 0; i < comfeet.snapshotLength; i++) {
    cstart = comfeet.snapshotItem(i).textContent.indexOf('\n', 10);
    cstop = comfeet.snapshotItem(i).textContent.indexOf(' |', cstart);
    commentator = comfeet.snapshotItem(i).textContent.substring (cstart+1,cstop);
    commentator =commentator.replace(/^\s+|\s+$/g, '');
    for (trollnumber=0; trollnumber < trolllist.length; trollnumber++) {
      if (commentator.toLowerCase() == trolllist[trollnumber].toLowerCase()) {
        comfeet.snapshotItem(i).parentNode.style.display='none';
      }
    }
  }
})();
I'm not going to admit how long that took me. Longer than it should've, but it was a fun learning experience. Now that it's done I see all these bits I want to improve, like making the interface to add trolls more user-friendly (a one-click link after the user's name on the page), or hiding the screened comments with a marker that allows them to be expanded and collapsed, and so on.

But I should probably stop dicking around. So little time, and so much oppressing to do!
  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

  • 1 comment