Even though my short brush with Internet fame appears to be over (Detrumpify has about 920 users today, up only 30 from yesterday), pride required that I update the extension because it was a bit too quick-n-dirty for my taste. Everything in it was hard-coded and that meant that every update I made to add new sites or insults would require users to approve an update. Hard-coding stuff in your programs is a big no-no, starting from CS 101 on.
So, I have a rewritten version available, and intrepid fans can help me out by testing it. You will not find it by searching on the Chrome Web Store, instead, get it directly from here. It is substantially more complicated under the hood than before, so expect bugs. (Github here, in “v2” folder.)
An important difference between this and the classic version is that there is an options page. It looks like this:
The main thing it lets you do is specify an URL from which a configuration file will periodically be downloaded. The config file contains the actual insults as well as some other parameters. I will host and maintain several configuration files ToolsOfOurTools, but anyone who wants to make one (for example, to mock a different presidential candidate) will be able to do so and just point to it.
If you want to make changes locally, you can also load a file, click on the edit button, make changes, and then click on the lock button. From then on the extension will use your custom changes.
The format of the config file is simple. Here’s an example with most of the names removed:
"find_regex": [ "(Donald\\s*(J\\.?\\s*)?)?Trump", "g" ],
- actions is a container that will hold one or more named sets of search and replace instructions. This file just has one for replacing trump variations, but one can make files that will replace many different things according to different rules
- find_regex inside the trump action finds a few variations of Trump, Donald Trump, Donald J. Trump.
- monikers section lists the alternatives.
- randomize_mode can be always , hourly , daily , and tells how often the insult changes. In always , it will change with each appearance in the document.
- refresh_age is how long to wait (in milliseconds) before hitting the server for an update.
- bracket can be set to a two-element array of text to be placed before and after any trump replacement.
- schema is required to ID the format of this file and should look just like that.
- whitelist is a list of sites that are enabled to run the extension. Et voila.
Let me know if you experience issues / bugs! The code that runs this is quite a bit more complex than the version you’re running now. In particular, I’m still struggling a bit with certain websites that turn on “content security policies” that get in the way of the config fetch. Sometimes it works, sometimes it doesn’t.