top | item 47104838

(no title)

krackers | 8 days ago

  (function() {
    const SKIP_PARENTS = new Set(["SCRIPT", "STYLE", "NOSCRIPT", "TEXTAREA"]);
    const walker = document.createTreeWalker(
      document.body,
      NodeFilter.SHOW_TEXT,
      {
        acceptNode(node) {
          const p = node.parentNode;
          if (!p || SKIP_PARENTS.has(p.nodeName)) return NodeFilter.FILTER_REJECT;
          if (p.nodeName === "INPUT") return NodeFilter.FILTER_REJECT;
          return NodeFilter.FILTER_ACCEPT;
        }
      }
    );

    let node;
    while ((node = walker.nextNode())) {
      node.nodeValue = node.nodeValue.replace(/ſ/g, "s");
    }
  })()

discuss

order

NooneAtAll3|8 days ago

what?

krackers|8 days ago

That will replace the long-s with the standard s. You can do the same for the thorn.