talichan

Untitled

Mar 26th, 2014
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.39 KB | None | 0 0
  1. // ==UserScript==
  2. // @id foolz-filter1
  3. // @name Kroni filter
  4. // @version 1.0
  5. // @namespace foolz
  6. // @author foolz
  7. // @description this script hides posts that are posted by users in the filter list
  8. // @run-at document-end
  9. // @include *archive.foolz.us/foolz*
  10. // @include *beta.foolz.us/foolz*
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. var filterName = ['Kroni'];
  16. var filterTrip = [];
  17.  
  18. function isFiltered(filter, data)
  19. {
  20. if (data !== '')
  21. {
  22. switch (filter)
  23. {
  24. case 'trip':
  25. return (filterTrip.indexOf(data) == 0);
  26. default:
  27. return (filterName.indexOf(data) == 0);
  28. }
  29. }
  30.  
  31. return false;
  32. }
  33.  
  34.  
  35. function filterPosts()
  36. {
  37. // get the <aside class="posts"> for each thread shown
  38. var threads = document.getElementsByClassName('posts');
  39.  
  40. // process each <aside class="posts">
  41. for (t = 0; t < threads.length; t++)
  42. {
  43. var replies = threads[t].getElementsByTagName('article');
  44.  
  45. // process all replies
  46. for (p = replies.length - 1; p >= 0; p--)
  47. {
  48. var post = replies[p];
  49. var name = post.getElementsByClassName('post_author');
  50. var trip = post.getElementsByClassName('post_tripcode');
  51.  
  52. // does name or trip match ones listed in filtered lists
  53. if ((name && isFiltered('name', name[0].textContent)) || (typeof trip[0] !== 'undefined' && isFiltered('trip', trip[0].textContent)))
  54. {
  55. // the post should be hidden so 'quoted by' doesn't glitch
  56. post.style.display = 'none';
  57. }
  58. }
  59. }
  60. }
  61.  
  62. // filter upon loading dom content
  63. window.addEventListener("DOMContentLoaded", filterPosts, false);
  64.  
  65. // filter ajax requests on dom node inserts
  66. window.addEventListener("DOMNodeInserted", filterPosts, false);
  67. })();
  68.  
  69. // jQuery Alternative
  70. // jQuery('aside.posts span.post_author').filter(function() { return $(this).text() == '??'; }).closest('article').remove();
  71. // jQuery('aside.posts span.post_tripcode').filter(function() { return $(this).text() == '??'; }).closest('article').remove();
  72. (function() {
  73. var filterName = ['Lewd'];
  74. var filterTrip = [];
  75.  
  76. function isFiltered(filter, data)
  77. {
  78. if (data !== '')
  79. {
  80. switch (filter)
  81. {
  82. case 'trip':
  83. return (filterTrip.indexOf(data) == 0);
  84. default:
  85. return (filterName.indexOf(data) == 0);
  86. }
  87. }
  88.  
  89. return false;
  90. }
  91.  
  92.  
  93. function filterPosts()
  94. {
  95. // get the <aside class="posts"> for each thread shown
  96. var threads = document.getElementsByClassName('posts');
  97.  
  98. // process each <aside class="posts">
  99. for (t = 0; t < threads.length; t++)
  100. {
  101. var replies = threads[t].getElementsByTagName('article');
  102.  
  103. // process all replies
  104. for (p = replies.length - 1; p >= 0; p--)
  105. {
  106. var post = replies[p];
  107. var name = post.getElementsByClassName('post_author');
  108. var trip = post.getElementsByClassName('post_tripcode');
  109.  
  110. // does name or trip match ones listed in filtered lists
  111. if ((name && isFiltered('name', name[0].textContent)) || (typeof trip[0] !== 'undefined' && isFiltered('trip', trip[0].textContent)))
  112. {
  113. // the post should be hidden so 'quoted by' doesn't glitch
  114. post.style.display = 'none';
  115. }
  116. }
  117. }
  118. }
  119.  
  120. // filter upon loading dom content
  121. window.addEventListener("DOMContentLoaded", filterPosts, false);
  122.  
  123. // filter ajax requests on dom node inserts
  124. window.addEventListener("DOMNodeInserted", filterPosts, false);
  125. })();
  126.  
  127. // jQuery Alternative
  128. // jQuery('aside.posts span.post_author').filter(function() { return $(this).text() == '??'; }).closest('article').remove();
  129. // jQuery('aside.posts span.post_tripcode').filter(function() { return $(this).text() == '??'; }).closest('article').remove();
  130. (function() {
  131. var filterName = ['Siztra'];
  132. var filterTrip = [];
  133.  
  134. function isFiltered(filter, data)
  135. {
  136. if (data !== '')
  137. {
  138. switch (filter)
  139. {
  140. case 'trip':
  141. return (filterTrip.indexOf(data) == 0);
  142. default:
  143. return (filterName.indexOf(data) == 0);
  144. }
  145. }
  146.  
  147. return false;
  148. }
  149.  
  150.  
  151. function filterPosts()
  152. {
  153. // get the <aside class="posts"> for each thread shown
  154. var threads = document.getElementsByClassName('posts');
  155.  
  156. // process each <aside class="posts">
  157. for (t = 0; t < threads.length; t++)
  158. {
  159. var replies = threads[t].getElementsByTagName('article');
  160.  
  161. // process all replies
  162. for (p = replies.length - 1; p >= 0; p--)
  163. {
  164. var post = replies[p];
  165. var name = post.getElementsByClassName('post_author');
  166. var trip = post.getElementsByClassName('post_tripcode');
  167.  
  168. // does name or trip match ones listed in filtered lists
  169. if ((name && isFiltered('name', name[0].textContent)) || (typeof trip[0] !== 'undefined' && isFiltered('trip', trip[0].textContent)))
  170. {
  171. // the post should be hidden so 'quoted by' doesn't glitch
  172. post.style.display = 'none';
  173. }
  174. }
  175. }
  176. }
  177.  
  178. // filter upon loading dom content
  179. window.addEventListener("DOMContentLoaded", filterPosts, false);
  180.  
  181. // filter ajax requests on dom node inserts
  182. window.addEventListener("DOMNodeInserted", filterPosts, false);
  183. })();
  184.  
  185. // jQuery Alternative
  186. // jQuery('aside.posts span.post_author').filter(function() { return $(this).text() == '??'; }).closest('article').remove();
  187. // jQuery('aside.posts span.post_tripcode').filter(function() { return $(this).text() == '??'; }).closest('article').remove();
Advertisement
Add Comment
Please, Sign In to add comment