byoung
Senior Member Username: byoung
Post Number: 661 Registered: 12-2004
| Posted on Tuesday, May 29, 2007 - 7:38 pm: | |
All, I've been experimenting with GreaseMonkey. Greasemonkey is a Firefox extension that allows you to customize the way webpages look and function. I needed an experiment, and thought I'd try to implement a killfile. If you have greasemonkey, you can install this, configure users in the "killFile" variable (I have conveniently configured myself! ), and you will no longer see posts from said users. You only need to configure each user once, I just have the second one so you can see how lists are formatted. I'd love any feedback you might have (or, heaven forbid, any bugs). Here it is: // ==UserScript== // @name Alembic killfile // @namespace http://alembic.com/club/ // @description Remove the posts of certain users. // @include http://alembic.com/club/* var killFile = [ "byoung", "byoung" ]; var matcher = new RegExp(killFile.map(convertToProfileURL).join("|").toLowerCase()); var tableCells = document.evaluate( '/HTML[1]/BODY[1]/TABLE[1]/TBODY[1]/TR[1]/TD[1]/TABLE[1]/TBODY[1]/TR', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); if (!tableCells || killFile.length == 0) return; for (var i = 0; i < tableCells.snapshotLength; i++) { var firstCell = tableCells.snapshotItem(i).getElementsByTagName("td")[0]; if (!firstCell) {continue} var profileLink = firstCell.getElementsByTagName("a")[1]; if (!profileLink || !profileLink.href) {continue} if (profileLink.href.toLowerCase().match(matcher)) { //alert("here! " + profileLink.href); tableCells.snapshotItem(i).style.display = "none"; } } function convertToProfileURL(name) { return "profile="+name+"-users"; } // ==/UserScript== |