genevera / Transphobia-away

// ==UserScript==
// @name         Transphobia-away
// @namespace    genevera
// @version      0.1
// @license      MIT
// @description  replace anti-trans slurs used on porn sites with less-offensive alternatives
// @author       Genevera
// @match        *://*xhamster.com/*
// @match        *://*pornhub.com/*
// @match        *://*yespornplease.com/*
// @match        *://*xnxx.com/*
// @match        *://*xvideos.com/*
// @grant        none
// ==/UserScript==

(function sanitizer() {
    'use strict';

    const replaceOnDocument = (pattern, string, {target = document.body} = {}) => {
    [
      target,
      ...target.querySelectorAll("*:not(script):not(noscript):not(style)")
    ].forEach(({childNodes: [...nodes]}) => nodes
      .filter(({nodeType}) => nodeType === document.TEXT_NODE)
      .forEach((textNode) => textNode.textContent = textNode.textContent.replace(pattern, string)));
    };
    window.addEventListener('load', function() {
    var transitions = {
        "trans girl": [ /ladyboy/g, /shemale/g, /trap/g, /tranny/g ],
        "Trans Girl": [ /Ladyboy/g, /Shemale/g, /Trap/g, /Tranny/g ]
    };
    for (var key in transitions) {
          for (var item in transitions[key]) {
              replaceOnDocument(transitions[key][item], key);
          }
      }
  });
})();