Created
March 26, 2026 00:03
-
-
Save aadishv/347ad2df07e2d74b9ffc0d15d08ac41e to your computer and use it in GitHub Desktop.
install using a userscript manager like tampermonkey (may take a few minutes to get set up). can easily modify code to change the replacement character
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Pronto Underscore Messages | |
| // @namespace http://tampermonkey.net/ | |
| // @version 1.1 | |
| // @description Replaces spaces with underscores in outgoing messages on Pronto | |
| // @match https://stanfordohs.pronto.io/* | |
| // @grant none | |
| // @run-at document-start | |
| // ==/UserScript== | |
| (function () { | |
| const originalOpen = XMLHttpRequest.prototype.open; | |
| const originalSend = XMLHttpRequest.prototype.send; | |
| XMLHttpRequest.prototype.open = function (method, url, ...rest) { | |
| this._url = url; | |
| return originalOpen.call(this, method, url, ...rest); | |
| }; | |
| XMLHttpRequest.prototype.send = function (body) { | |
| if (this._url?.includes("/api/v1/message.create") && body) { | |
| try { | |
| const parsed = JSON.parse(body); | |
| if (typeof parsed.message === "string") { | |
| parsed.message = parsed.message.replace(/ /g, "_"); | |
| body = JSON.stringify(parsed); | |
| } | |
| } catch (e) { | |
| console.warn("[Pronto Underscores] Failed to parse body:", e); | |
| } | |
| } | |
| return originalSend.call(this, body); | |
| }; | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment