FFA Foul Language Enhanced

Enhanced script for detecting and counting occurrences of specific words.

当前为 2024-11-19 提交的版本,查看 最新版本

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.cn-greasyfork.org/scripts/515949/1487141/FFA%20Foul%20Language%20Enhanced.js

  1. // ==UserScript==
  2. // @name FFA Foul Language Enhanced
  3. // @licence MIT
  4. // @author krcanacu & jgonzzz
  5. // @namespace FFA_FL_Script
  6. // @description Enhanced script for detecting and counting occurrences of specific words.
  7. // @match http://vcc-review-caption-alpha.corp.amazon.com/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=amazon.com
  9. // @version 1.0.4
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. const popup = executeScript();
  15. popup.style.position = 'fixed';
  16. popup.style.top = '10px';
  17. popup.style.right = '10px';
  18. document.body.appendChild(popup);
  19. })();
  20.  
  21. function executeScript(){
  22. //Keywords definition
  23. // Severe Words //
  24. //RoDS = Racial or derogatory slurs
  25. const RoDSWords = ["nigger", "beaner", "nigga", "coon", "negro", "dyke", "chink", "faggy", "chinky", "faggot", "jap", "fag", "paki", "retard", "retarded", "wog", "queer", "gook", "kike"];
  26.  
  27. //Fuckwords = Self explanatory
  28. const Fuckwords = ["fuck", "fucked", "fucker", "fucking", "fuckin", "motherfuck", "motherfucker", "fuckface"];
  29.  
  30. //EuSR = Explicit use of sexual terminology
  31. const EuSRwords = ["porn", "ho", "pornography", "hoe", "hoes", "porno", "wanker", "masturbate", "masturbation", "jerk off", "hand job", "blowjob", "whore", "hooker", "stripper", "prostitution", "prostitute", "sex worker", "brothel", "pimp"];
  32.  
  33. //ERoSV = Explicit references of sexual violence
  34. const ERoSV = ["sexual assault", "sexual abuse", "rape", "rapist", "raped", "molest", "molested"];
  35.  
  36. //RtHD = References to hard drugs
  37. const RtHDwords = ["LSD", "crack", "meth", "acid", "meth-head", "molly", "methamphetamine", "ecstasy", "heroin", "cocaine", "MDMA", "DMT"];
  38.  
  39. //NCSR = Non-comedic sexual reference
  40. const NCSRwords = ["orgy", "BDSM", "dildo", "vibrator", "lubricant", "orgasm"];
  41.  
  42. // Moderate words //
  43. //TenIoS = 10+ Instances of shit, ass, asshole, bitch, piss, etc.
  44. const TenIoSwords = ["shit", "wanker", "ass", "retard", "asshole", "wank", "bitch", "piss", "bollocks", "shitty", "bullshit", "bastard", "slut", "cocksucker"];
  45.  
  46. // DiSR = Dick/cock, pussy/cunt, cum in a sexual reference
  47. const DiSRwords = ["penis", "dick", "tits", "cock", "clit", "pussy", "condom", "cum", "cunt", "balls", "semen", "twat"];
  48.  
  49. //RtDUwords = References to drugs or drug use
  50. const RtDUwords = ["weed", "opioids", "marihuana", "opium", "marijuana", "pot", "cannabis", "mary jane", "opioid"];
  51.  
  52. //CSR = Comedic sexual reference
  53. const CSRwords = ["orgy", "BDSM", "dildo", "vibrator", "lubricant", "orgasm"];
  54.  
  55. //RtS = References to Suicide
  56. const RtSWords = ["suicide", "self-harm", "kill myself", "kill herself", "kill himself", "kill yourself"];
  57.  
  58. //NErtSV = Non-explicit references to Sexual Violence
  59. const SErtSV = ["sexual harassment"];
  60.  
  61. //MuoSR = Moderate use of sexual references
  62. const MuoSRWords = ["harlot"];
  63.  
  64. // Categories config of threshold and label
  65. const targetCategories = [
  66. { words: RoDSWords, threshold: 1, label: "Racial or derogatory slurs" },
  67. { words: Fuckwords, threshold: 3, label: "3+ instances of fuck" },
  68. { words: EuSRwords, threshold: 1, label: "Explicit use of sexual terminology" },
  69. { words: ERoSV, threshold: 1, label: "Explicit references to sexual violence" },
  70. { words: RtHDwords, threshold: 1, label: "References to hard drugs" },
  71. { words: NCSRwords, threshold: 1, label: "Non-comedic sexual reference" },
  72. { words: TenIoSwords, threshold: 10, label: "10+ Instances of shit, ass, asshole, bitch, piss, etc." },
  73. { words: DiSRwords, threshold: 2, label: "Dick/cock, pussy/cunt, cum in a sexual reference" },
  74. { words: RtDUwords, threshold: 3, label: "References to drugs or drug use" },
  75. { words: CSRwords, threshold: 3, label: "Comedic sexual reference" },
  76. { words: RtSWords, threshold: 3, label: "References to Suicide"},
  77. { words: MuoSRWords, threshold: 3, label: "Moderate use of Sexual References"}
  78. ];
  79.  
  80. const subTitleDiv = document.getElementById('full-caps');
  81.  
  82. if (subTitleDiv) {
  83. const textNodes = document.createTreeWalker(subTitleDiv, NodeFilter.SHOW_TEXT, null, false);
  84. let categoryCounts = {};
  85. let detectedWords = {};
  86.  
  87. targetCategories.forEach(category => {
  88. categoryCounts[category.label] = 0;
  89. detectedWords[category.label] = new Set();
  90. });
  91.  
  92. while (textNodes.nextNode()) {
  93. const textContent = textNodes.currentNode.textContent.toLowerCase();
  94. const lines = textContent.split('\n');
  95.  
  96. lines.forEach(line => {
  97. targetCategories.forEach(category => {
  98. category.words.forEach(word => {
  99. const regex = new RegExp(`\\b${word}(s?|ers|es|s)?\\b`, 'gi');
  100. if (regex.test(line)) {
  101. console.log(`Detected word: ${word} in line: ${line}`);
  102. categoryCounts[category.label]++;
  103. detectedWords[category.label].add(word);
  104. }
  105. });
  106. });
  107. });
  108. }
  109.  
  110. let popupContent = '';
  111. let foulLanguageDetected = false;
  112.  
  113. targetCategories.forEach(category => {
  114. if (categoryCounts[category.label] >= category.threshold) {
  115. const wordsList = [...detectedWords[category.label]].join(', ');
  116. popupContent += `${category.label}: ${categoryCounts[category.label]} (${wordsList})<br>`;
  117. foulLanguageDetected = true; // Mark that foul language was detected
  118. }
  119. });
  120.  
  121. // If no foul language was detected, add the fallback message
  122. if (!foulLanguageDetected) {
  123. popupContent = 'Not enough foul language was found, check the title for NFF content';
  124. }
  125.  
  126. if (popupContent.trim() !== '') {
  127. const popup = document.createElement('div');
  128. popup.style.backgroundColor = 'white';
  129. popup.style.padding = '10px';
  130. popup.style.border = '1px solid black';
  131. if (popupContent === 'Not enough foul language was found, check the title for NFF content') {
  132. popup.innerHTML = popupContent;
  133. } else {
  134. popup.innerHTML = `Possible NFF (check for ambiguity):<br>${popupContent}`;
  135. }
  136.  
  137. return(popup);
  138. }
  139. }
  140. }