a thoughtful web.
Good ideas and conversation. No ads, no tracking.   Login or Take a Tour!
comment by user-inactivated
user-inactivated  ·  2492 days ago  ·  link  ·    ·  parent  ·  post: Pubski: June 21, 2017

why the fuck am i wasting time doing this i have philosophy exam tomorrow

A.S. Don't copy anything from here. Formatting screws up the code.

Go to the page where you'd like to see the replacement.

Open console (or web inspector or whatever).

Copy the following string.

  var choices = ["the fuck", "in the fuck", "in the name of Jesus Fucking Christ"];

Paste the string into the console. Press Enter.

Copy the following string.

  document.querySelector('body').innerText = document.querySelector('body').innerText.replace(/[w
    W]hy/g, function (match) { return match " " choices[Math.floor(Math.random() choices.length)] });

Paste the string into the console. Press Enter.

You should now see the replacement at work.

It's crude and the changes are temporary, but this should amuse you for a couple of minutes with various websites. The above function will return a different choice for replacement every time. To keep the same choice, copy/paste/Enter the following two strings separately instead:

  var choiceIndex = Math.floor(Math.random()  choices.length);

and

  document.querySelector('body').innerText = document.querySelector('body').innerText.replace(/[wW]hy/g, function (match) { return match  " "  choices[choiceIndex] });

EDIT: Fuck. mk, check this out. I thought the two-space prefix was supposed to make it a <code>/<pre>.