Monday, March 8, 2021

shutdown.chat PM Beep Injection

shutdown.chat took away a feature, that some people found useful.

It no longer beeps when you receive a PM.

You can shimmy this feature back in, by doing a few little tweaks. Just keep in mind that it can break at anytime. The site may makes changes on the server side that are no longer compatible with the local objects.

Download shutdown.chat's JavaScript:

Download the following JavaScript from shutdown.chat: furtherchat.js

The script is minified, so you may want to prettify it, so that it is easier to follow.

Get Chrome Extension: Or Firefox, but i wrote this document for Chrome.

You will need a Chrome Extension called "Resource Override", that can be found here: Resource Override

Setup Resource Override:

Add Tab URL: https://www.shutdown.chat/*

  • Add Rule: "URL ---> File"
    • From: https://www.shutdown.chat/js/furtherchat.js*
    • To: [Edit File]

Press the [Edit File] button next to https://www.shutdown.chat/js/furtherchat.js*


Copy and paste the contents of furtherchat.js into the editor window that opened.

Edit the JavaScript:

Search for: "fc_chatbox.prototype.addnormal="

Add the lines to the script denoted by the left curly brace.


Gist Containing the lines of JavaScript, to copy and paste.

Press [Save] or [Save and Close] on the bottom of Resource Override's editor.

Test and Use:

Load up shutdown.chat and test it out.


Optional

Add a toggle to turn it on and off:

Use JavaScript to inject some HTML into the page that contains a speaker icon, for turning the beep on and off.

Setup Beep Toggle:

  • Add Rule under the existing tab that was previous created: "Inject File"
    • Name is whatever you want. I called it "Beep Toggle"
    • Select File Type: JS
    • Select Inject Into: Body

Press the [Edit File] button on this recently added rule.



Populate the file with the lines of code provided in the following Gist.


Notes

I normally wouldn't grab the query string values where I did, but I wanted it self contained, so it would be easy to maintain, if an update happens to the original js.

Resources:

Cheating: You can download my whole copy of the modified file, or my backup of the Resource Override rules.

You're better off doing your own tweaking, to keep up to date.

Relacement JavaScript: shutdown.chat furtherchat.js local replacement

Import Into Resource Override: Shutdown.chat_BeepToggle.json

Updates:

  • 20210317 - shutdown.chat updated their JSP, so had to true up mine.
  • 20210518 - Make so when a message starts with nb & NB, there is no beep.
  • 20210519 - Allow disabling beep via query string.
  • 20230324 - Account for EzcapeChat > shutdown.chat code updates.
  • 20230326 - Less annoying Beep.
  • 20230508 - Added Shutdown.chat_BeepToggle.json Resource Override backup.
  • 20230518 - Account for shutdown.chat code updates.

No comments:

Post a Comment