Advertisement
Narad

Scienceblogs Greasemonkey killfile

Oct 19th, 2014
1,328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. // sciblogskiller.user.js
  2. //
  3. // Written by: Michael Devore
  4. //
  5. // This is a Greasemonkey script.
  6. //
  7. // ==UserScript==
  8. // @name ScienceBlogs Killer
  9. // @namespace http://www.devoresoftware.com/gm/sciblogs
  10. // @description killfile script for ScienceBlogs
  11. // @include http://scienceblogs.com/*
  12. // @include https://*.scienceblogs.com/*
  13. // @version 1.0
  14. // ==/UserScript==
  15. //
  16.  
  17. // list of people to killfile
  18. // follow all quoted names except last with a comma
  19. // this is only a sample of IDs used for testing. It is in no way a reflection on their actual posts
  20. var killThisIDList = [
  21. "Sample ID 1",
  22. "Sample ID 2",
  23. "Sample ID 3"
  24. ];
  25.  
  26. function scienceBlogsKillerMain()
  27. {
  28. for (var i = 0; i < killThisIDList.length; i++)
  29. {
  30. var xpath = "//li[@class='li-comment']//span[(@class='fn') and text()=";
  31. xpath += "'"+killThisIDList[i] +"']";
  32. var spanNodes = document.evaluate(
  33. xpath,
  34. document,
  35. null,
  36. XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
  37. null
  38. );
  39. var count = spanNodes.snapshotLength;
  40. for (var j = 0; j < count; j++)
  41. {
  42. var theSpan = spanNodes.snapshotItem(j);
  43. if (!theSpan)
  44. {
  45. break;
  46. }
  47. var pNode = theSpan.parentNode;
  48. while (pNode && pNode.getAttribute('class') != "li-comment")
  49. {
  50. pNode = pNode.parentNode;
  51. }
  52. if (pNode)
  53. {
  54. pNode.style.display = "none";
  55. }
  56. }
  57. }
  58. }
  59.  
  60. scienceBlogsKillerMain();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement