Sleazy Fork is available in English.

JableBlock

This script removes unfriendly comments on jable.tv. 移除 jable.tv 不友善的留言及關鍵字。

질문, 리뷰하거나, 이 스크립트를 신고하세요.
  1. // ==UserScript==
  2. // @name JableBlock
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.17
  5. // @description This script removes unfriendly comments on jable.tv. 移除 jable.tv 不友善的留言及關鍵字。
  6. // @author oldhunter
  7. // @match https://jable.tv/videos/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=jable.tv
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. /* https://gist.github.com/raw/2625891/waitForKeyElements.js */
  16.  
  17. /*--- waitForKeyElements(): A utility function, for Greasemonkey scripts,
  18. that detects and handles AJAXed content.
  19.  
  20. Usage example:
  21.  
  22. waitForKeyElements (
  23. "div.comments"
  24. , commentCallbackFunction
  25. );
  26.  
  27. //--- Page-specific function to do what we want when the node is found.
  28. function commentCallbackFunction (jNode) {
  29. jNode.text ("This comment changed by waitForKeyElements().");
  30. }
  31.  
  32. IMPORTANT: This function requires your script to have loaded jQuery.
  33. */
  34. function waitForKeyElements (
  35. selectorTxt, /* Required: The jQuery selector string that
  36. specifies the desired element(s).
  37. */
  38. actionFunction, /* Required: The code to run when elements are
  39. found. It is passed a jNode to the matched
  40. element.
  41. */
  42. bWaitOnce, /* Optional: If false, will continue to scan for
  43. new elements even after the first match is
  44. found.
  45. */
  46. iframeSelector /* Optional: If set, identifies the iframe to
  47. search.
  48. */
  49. ) {
  50. var targetNodes, btargetsFound;
  51.  
  52. if (typeof iframeSelector == "undefined")
  53. targetNodes = $(selectorTxt);
  54. else
  55. targetNodes = $(iframeSelector).contents ()
  56. .find (selectorTxt);
  57.  
  58. if (targetNodes && targetNodes.length > 0) {
  59. btargetsFound = true;
  60. /*--- Found target node(s). Go through each and act if they
  61. are new.
  62. */
  63. targetNodes.each ( function () {
  64. var jThis = $(this);
  65. var alreadyFound = jThis.data ('alreadyFound') || false;
  66.  
  67. if (!alreadyFound) {
  68. //--- Call the payload function.
  69. var cancelFound = actionFunction (jThis);
  70. if (cancelFound)
  71. btargetsFound = false;
  72. else
  73. jThis.data ('alreadyFound', true);
  74. }
  75. } );
  76. }
  77. else {
  78. btargetsFound = false;
  79. }
  80.  
  81. //--- Get the timer-control variable for this selector.
  82. var controlObj = waitForKeyElements.controlObj || {};
  83. var controlKey = selectorTxt.replace (/[^\w]/g, "_");
  84. var timeControl = controlObj [controlKey];
  85.  
  86. //--- Now set or clear the timer as appropriate.
  87. if (btargetsFound && bWaitOnce && timeControl) {
  88. //--- The only condition where we need to clear the timer.
  89. clearInterval (timeControl);
  90. delete controlObj [controlKey]
  91. }
  92. else {
  93. //--- Set a timer, if needed.
  94. if ( ! timeControl) {
  95. timeControl = setInterval ( function () {
  96. waitForKeyElements ( selectorTxt,
  97. actionFunction,
  98. bWaitOnce,
  99. iframeSelector
  100. );
  101. },
  102. 300
  103. );
  104. controlObj [controlKey] = timeControl;
  105. }
  106. }
  107. waitForKeyElements.controlObj = controlObj;
  108. }
  109.  
  110.  
  111. /* My code here */
  112.  
  113. let blocklist = [
  114. 'XXXXOOOO', 'XXXXOOOO ', 'jostar2', 'GG_ininder', 'ХХХХОООО',
  115. 'xxxxටටටට', '口口口口XXXX', 'ooooxxxx'
  116. ];
  117. let blockedIDs = ['445965', '385216', '399011', '477129', '465205', '508122', '102345'];
  118. let keywords = ['XO', 'xo', '不要尻', '再尻', '再打手槍', '在尻', '別尻', '別再尻', '别撸', '别再撸', '不要撸', '别再撸'];
  119.  
  120. function filter() {
  121. console.log('start filter');
  122. let items = document.querySelectorAll('.item');
  123. for (let i = 0; i < items.length; i++) {
  124. let item = items[i];
  125. if (item == null) {
  126. continue;
  127. }
  128.  
  129. let blocked = false;
  130. let author = item.querySelector('a');
  131. let title = '';
  132. let url = '';
  133. let userID = '';
  134.  
  135. if (author) {
  136. title = author.getAttribute('title');
  137. url = author.getAttribute('href');
  138. let pat = /members\/(\d+)/;
  139. let m = url.match(pat);
  140. if (m != null) {
  141. userID = m[1];
  142. }
  143. }
  144. let contentElem = item.querySelector('.original-text');
  145.  
  146. if (contentElem) {
  147. let content = contentElem.textContent;
  148. for (let j = 0; j < keywords.length; j++) {
  149. if (title.includes(keywords[j]) || content.includes(keywords[j])) {
  150. item.style.display = 'none';
  151. blocked = true;
  152. break;
  153. }
  154. }
  155. }
  156.  
  157. if (blocked) {
  158. continue;
  159. }
  160.  
  161. for (let j = 0; j < blocklist.length; j++) {
  162. if (title.includes(blocklist[j])) {
  163. item.style.display = 'none';
  164. blocked = true;
  165. break;
  166. }
  167. }
  168.  
  169. if (blocked) {
  170. continue;
  171. }
  172.  
  173. for (let j = 0; j < blockedIDs.length; j++) {
  174. if (userID == blockedIDs[j]) {
  175. item.style.display = 'none';
  176. blocked = true;
  177. break;
  178. }
  179. }
  180. }
  181. }
  182.  
  183. waitForKeyElements('.item', filter);
  184. })();