Advertisement
Guest User

Untitled

a guest
Sep 28th, 2013
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. // ==UserScript==
  2. //
  3. //Displayable Name of your script
  4. // @name Freak.no custom frontpage
  5. //
  6. // brief description
  7. // @description Removes unwanted sections from frontpage.
  8. //
  9. //URI (preferably your own site, so browser can avert naming collisions
  10. // @namespace https://github.com/etse
  11. //
  12. // Your name, userscript userid link (optional)
  13. // @author Etse
  14. //
  15. // If you want to license out
  16. // @license GNU GPL v3 (http://www.gnu.org/copyleft/gpl.html)
  17. //
  18. //(optional) may be used by browsers to display an about link
  19. // @homepage https://github.com/etse
  20. //
  21. //Version Number
  22. // @version 1.0
  23. //
  24. // Urls process this user script on
  25. // @include *freak.no/*
  26. //
  27. // Add any library dependencies here, so they are loaded before your script is loaded.
  28. //
  29. // @history 1.0 first version
  30. //
  31. // ==/UserScript==
  32.  
  33. var bannedTopics = ["Kjøp av maskinvare", "Rus på legemidler", "Rusmidler", "Legal highs", "Research Chemicals", "Rusdebatt", "Rusrapporter", "Utvalgte rusforumtråder"];
  34.  
  35.  
  36.  
  37. function inList(myList, value)
  38. {
  39. for(var x=0; x<myList.length; x++)
  40. {
  41. if(value.indexOf(myList[x]) !== -1)
  42. return true;
  43. }
  44. return false;
  45. }
  46.  
  47. if (location.pathname == "/")
  48. {
  49. old_tbody = document.getElementById("collapseobj_module_5");
  50. var rows = document.getElementById("collapseobj_module_5").childNodes;
  51.  
  52. for(var i=rows.length-1; i >= 0 ; i--)
  53. {
  54. var child = rows[i];
  55. if(child.childNodes.length < 13)
  56. continue;
  57.  
  58. var j;
  59. for(j=0; j < child.childNodes.length; j++)
  60. {
  61. if(child.childNodes[j].nodeName == "#text")
  62. continue;
  63.  
  64. if((child.childNodes[j].hasAttribute("title")))
  65. {
  66. if(inList(bannedTopics, child.childNodes[j].title))
  67. {
  68. old_tbody.removeChild(child);
  69. }
  70. break;
  71. }
  72. }
  73. }
  74. }
  75.  
  76. if (location.pathname == "/forum/search.php")
  77. {
  78. var td = document.getElementsByTagName("td");
  79. //for loop? fuck that
  80. var i = td.length - 1;
  81. while (i >= 0)
  82. {
  83. if (inList(bannedTopics, td[i].innerHTML))
  84. td[i].parentNode.parentNode.removeChild(td[i].parentNode);
  85. i--;
  86. }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement