Skip to content

Instantly share code, notes, and snippets.

@ihatecsv
Last active January 27, 2025 00:21
Show Gist options
  • Save ihatecsv/2884956a0fa9363c172e2ea9f915ef25 to your computer and use it in GitHub Desktop.
Save ihatecsv/2884956a0fa9363c172e2ea9f915ef25 to your computer and use it in GitHub Desktop.
SLAM SUPLEXER userscript

How to Install a UserScript on Chrome or Edge

Step 1: Install a UserScript Manager Extension

You need a UserScript manager to run the script. Popular choices are:

  1. Open the Chrome Web Store or Edge Add-ons Store.
  2. Search for Tampermonkey or Violentmonkey.
  3. Click Add to Chrome (or Edge) and confirm the installation.

Step 2: Open the Script Editor

Once the UserScript manager is installed:

  1. Click on the extension icon in your browser (Tampermonkey/Violentmonkey).
  2. Select Dashboard or Create a New Script.
  3. A script editor will open.

Step 3: Paste the UserScript

  1. Copy the UserScript code provided below.
  2. Paste it into the script editor, replacing any placeholder text or default template.

Step 4: Save the Script

  1. Click File > Save (or use the save button in the editor).
  2. The script will now be saved and enabled!
// ==UserScript==
// @name SLAM SUPLEXER
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Replaces 'X slams Y' with an appropriate verb.
// @author ihatecsv
// @match *://*/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const verbs = [
"SUPLEXES",
"PILEDRIVES",
"CLOTHESLINES",
"BODY SLAMS",
"CURBSTOMPS",
"DROPKICKS",
"HEADBUTTS",
"HALF NELSONS",
"FULL NELSONS",
"SCISSOR KICKS",
"FLYING KNEES",
"TURBO SLAMS",
"LEG DROPS",
];
function getRandomVerb() {
return verbs[Math.floor(Math.random() * verbs.length)];
}
function walk(node) {
let child, next;
switch (node.nodeType) {
case Node.ELEMENT_NODE:
case Node.DOCUMENT_NODE:
case Node.DOCUMENT_FRAGMENT_NODE:
child = node.firstChild;
while (child) {
next = child.nextSibling;
walk(child);
child = next;
}
break;
case Node.TEXT_NODE:
handleText(node);
break;
}
}
function handleText(textNode) {
let text = textNode.nodeValue;
const regex = /(\S+)\s+slams\s+(\S+)/gi;
text = text.replace(regex, (match, x, y) => {
return `${x} ${getRandomVerb()} ${y}`;
});
textNode.nodeValue = text;
}
walk(document.body);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment