Detrumpify

nbc-fires-donald-trump-after-he-calls-mexicans-rapists-and-drug-runnersApropos of nothing, I wrote a very simple Chrome extension (and a Firefox add-on) that replaces references to the Short-Fingered Vulgarian with any of several other aliases. The initial “seed” for the list came from Jezebel, which published a list of 70 such names for the Cheeto-Faced Ferret’s 70th birthday.

Over the years since I did this, I have taken pains to make this plugin more and more configurable. Most of the insults are loaded from a configuration file you can edit, and a bunch of options are available in the drop-down plugin options. If you want to see the (very simple) code, check it out here on Github. I’ll take pull requests. [Edit 7/6: have now done this and the link above points to the new version. Original version still available here.]

I have added new insults as I’ve come across them (feel free to provide more). Considering that I started this project in summer 2016 and it is now fall 2019, it’s amazing that I still come across new good ones. But I guess we can thank Mango Mussolini for that.

Enjoy!

PS — A few people have noted that the plugin doesn’t run on this or that website. Note that by default it does not run on all websites. In the configuration menu you will see that you can set it to “blacklist” mode or “whitelist” mode, and then specify a list of sites to exclude, or include, respectively. The default is a whitelist of major news sites.

48 thoughts on “Detrumpify”

    1. It depends on whether you are installing for chrome or Firefox. For chrome, you obviously must be running chrome, and I think it may be necessary to be logged into chrome. Then when you bring up the chrome link in the post, there will be an install button. Click it and approve the permissions, and you should be good to go. Alternatively, you can go to the Chrome Web Store and search for detrumpify.

      For Firefox, it is similar, except that you must be running Firefox to start, of course.

      I checked they links in the post and they are correct.

      Please note that detrumpify does not run on all websites. This was to avoid potential compatibility problems and confusion when detrumpify affects your email or banking or whatever. Therefore, it runs only on about 30 sites from major newspapers and media outlets.

  1. Have you created a filter to get rid of his ugly face? I find that the reference to him in words (the filter) is working, but I would love not to look at his stupid expressions and annoying better than everyone look that is overtaking the net!!!

    1. In fact, I have. It doesn’t work all the time, but it works a lot. Go to the options icon in the upper right and then set “Kittenize” to one of the settings other than “Off”. Trump pictures will be replaced by blanks or kittens, depending on what you set. The “More Kittens” setting is more aggressive about finding Trump pictures, at the expense of probably turning some non-Trump pictures into kittens.

  2. LOVE this extension. Makes me laugh every single bloody time!

    Idea for one (I’m sure that you get these a lot): something like “Personification of passing a kidney stone”?

    1. It is no technical work to do McConnell. The work is to get a good list of insults! I’ll do him when I get at least five good ones that cannot be confused with anyone else. I’m open to suggestions!

      Best,
      Dave

  3. I am using Firefox, and I am trying to figure out a way to replace pictures with kittens while not replacing the name “Trump” with an insult (it was funny for a while, but it gets distracting). I would like to continue to see kittens, though. Is there a way to do this?

    Thanks.

    1. Hi Peter,

      Thanks for the note. What you have discovered is a little bit of a bug in Detrumpify. Basically, kittenization is tied to replacement. If you turn one off for a given person, you also lose the other. It’s not a trivial bug for me to fix because it requires some new UI elements to get right.

      In the meantime, what I have done is created a new config file for you. Click the “No T” icon and “No Insults — Just Kittens”. Also, make sure kittenization is turned on. I have only tested it lightly, but it seems to work. You get kittens and no word replacements.

      An alternative, of course, is a different plugin. I think there is a “Trump Kittens” plugin out there. I do not know if it is being maintained.

      PS — there are some minor bugs in the FF plugin that have been fixed in Chrome but not in FF. The reason is that the FF plugin team is harder and slower to work with, and they are more likely to reject a plugin. The last time I sent an update, they noticed that my plugin fetches config files from a third party source (my site) and that they would not approve future updates that continued to do so. But that is how I am able to add new insults in a timely manner and how I was able to help you. This is PARTICULARLY important on FF, where the approval team can take a week or more to approve even a minor update to a plugin. Okay, rant mode off.

      Best,
      Dave

        1. You just click on the detrumpify icon and then in the drop-down for “Config” you choose “No insults — just Kittens”. You still have to leave “Replace Images” set to “Kittens” as well.

          Best,
          Dave

  4. Great idea, Dave! One question: Is it possible to add custom pictures to replace Trump with if you want more than kittens? Like puppies, bunnies, Astronomy Picture of the Day, Pusheen the cat, or the subfolders in %userprofile%\My Pictures where I have literally hundreds of .jpgs of Barack Obama and Justin Trudeau 🙂

    Asking for a friend, of course…

    1. It is certainly possible, but it’s more work than it sounds. The kitten feature relies on an external service that can provide kitten pictures of any requester size and aspect ratio. I don’t know of other services that can do the same thing, but for other fun stuff, and it would be a fair amount of work to curate such a database.

      Still, it could probably be done quick-n-dirty if you were okay with only cycling through a handful of images and stretching them a bit to fit if they are not the right size.

      I’ll definitely consider working on this if I have some free time, but I can’t make any promises. Detrumpify is actually already quite customizable and configurable and very few people have done any customization as far as I know. 🙁

      1. Thanks for the quick reply! I’d still love to replace the Tangerine Nightmare (is that on your list of insults? If not it should be added) with two of my favourite handsome world leaders… but, kitties are always welcome too. A lot better than that roadkill sitting on his head… 🙂

        1. It is now!

          I remember now a bit why I did not already do this. The code to match pictures to placeholders is tricky, but I can write it. However, there is a copyright issue. If I host pictures from around the net, I’ll have to be careful about that. If I allow users to host locally on their computers, I have to request another permission for the extension, which will probably freak out a bunch of potential users (extension wants to read your files) for a feature that few users will use. Chrome has a feature for “optional permissions” so I could ask Chrome to elevate permissions only for users that want to access local file resources. But for some reasons, “file://” type patterns to not work as optional origins, and there is a cross-site blocking problem, too. Basically, Chrome makes this very hard.

          So I decided to punt until I thought of a better way.

          1. I decided to bow to public pressure and try to implement some other image replacement options. A forthcoming version of Detrumpify will allow users to select puppies or bunnies in addition to kittens. Images are hosted on this server, so performance may become an issue. We’ll see…

            Best,
            Dave J

    2. kthxbai,

      I have released a new version (1.2.1) of Detrumpify that has puppy and bunny options. I will probably add other stuff over time as well. Security rules enforces by Chrome and FF make it well nigh impossible to base images on local files, but I can host them on this site.

      Anyway, new version should be live for FF and Chrome, so give it a whirl.

      Perhaps I will make an option for Obama pics…

  5. Just a quick request to re-enable local editing of the config. Go in to do some editing tonight (having already added about 50 of my own monikers over the last week), only to find that that option is now missing completely. NOT happy.

    And we definitely need screaming babies for one of the pic options.

    1. Oh, foo! I had never heard of anyone ever using this feature, and honestly, it was a super hassle to support, and so I yanked it. The config page is hoary enough even with out it.

      Have you tried hosting your config file on DropBox? I just verified that this works, though it is a wee bit tricky:

      – zeroth, create a dropbox account. Hey, it’s free!
      – first, edit your json file and upload it to dropbox
      – in dropbox “share” the file so that anyone one the interwebs can see read it
      – while sharing, click the copy link option.

      You should get a link that looks like this:

      https://www.dropbox.com/s/3qr1gr1hklloa42/clean-daily.json?dl=0

      – now modify that link slightly, removing the parameters, so that it looks like this:

      https://www.dropbox.com/s/3qr1gr1hklloa42/clean-daily.json

      – Next, paste that link into the insult config URL input on the Detrumpify config page and click [save]

      – Finally, verify that the config loaded by clicking “show configuration details”

      I just tested this and it worked.

      I know this is not quite as convenient as being able to paste the JSON in directly, but it does have some small advantages, like being able to share with friends and more easily being able to set up multiple computers (your desktop, your laptop, etc) with the same config. Plus, you can update the file in one place and all your devices pointing to it will update automatically.

      So, what do you say? Will you be satisfied so I don’t have to feel bad about removing that code? Really, it was making my crazy.

      As for the screaming babies, I’ll get right on it. Check in a day or two.

      Best,
      Dave

  6. I don’t know how to configure white lists, or anything that isn’t a simple click. This add-on is NOT working on DemocraticUnderground.com. IT HAS TO WORK THERE. HELP.
    I cannot stand seeing that things face and seeing it’s name. HELP.

    1. Hi Rob, sorry you’re not getting what you want. The easy thing to get it to run anywhere is to click the “run anywhere” checkbox on the configuration page.

      I’ll add democraticunderground to the canned configuration files this weekend.

      If you want to host your own config file, then I’d recommend you download one of the canned files as shown in the URL line of the configuration panel. For example, use wget or curl to pull down the file. Then edit it as you see fit. There is a long array of whitelisted addresses. Then upload that file to dropbpox, share it publicly, and then point the configuration url at your file on dropbox. That should work.

      Unfortunately, I just don’t have the time now to make the config screen much more sophisticated for adding your own white and black listed sites. Maybe I’ll get to it before T is impeached.

      Best,
      Dave

  7. Dave,

    I figured it out. All by myself. Don’t ask. Now I am howling with laughter at all the names I’m seeing. Now it’s hard to find the news, because I can’t see through the tears of laughter. Bless you for this wonderful piece of software. It will keep my brain from frying, more than it already has, and will, no doubt, keep me from a few nightmares. Thank you!!!!

  8. Hi,
    Great and very fun addon.

    I would like to use a custom file but each time I point to a external link, I get the error :

    ERROR:SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data

    Even the dropbox link file up in the comment, also the exact same file I dl from toolsofourtools.org.

    Thanks for your help

    1. I just tried this on Chrome and it did work, but it was a bit tricky, courtesy of Dropbox really not wanting to download a file simply, but insisting on wrapping it up in a bunch of dropbox html. Here’s the trick:

      1. The json file on dropbox must be shared with ayneone
      2. Copy the link for the file from dropbox. It might look like this: https://www.dropbox.com/s/kn0k0iv0vov3ez0/dirty-scare.json?dl=0
      3. Remove the question mark and the parameters that come after: https://www.dropbox.com/s/kn0k0iv0vov3ez0/dirty-scare.json (Detrumpify will behind the scenes add “?dl=1” to the url, which asks dropbox not to try to embellish the file.)
      4. Now paste that into Detrumpify and click save.

      I just tried this and it did work for me.

      Let me know if it doesn’t for you.

  9. Hello

    The custom file doesn’t work on Firefox Quantum.

    I get the error :

    ERROR:SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data

    I would like to add extra people from other country.

    Thanks for you help

    1. This is almost certainly a permissions issue. Please take a look at the response to the comment from eurable.

      I had to set very restrictive permissions, or else all users (the vast, vast majority of which do not want to modify config files) would be presented with a request for a permission to access any site, which most users would find dangerous. Therefore, I set it only to be able to access a file on dropbox, which is one of the only free file hosting services that will allow a simple https get of a file without adding a bunch of cruft.

        1. Okay, Renee,

          I can reproduce the problem. The issue is comes from a combination of the browsers enforcing the restrictive “CORS” security model, and DropBox no longer providing the “access-control-allow-origin” header. This security is supposed to stop cross-site scripting attacks, but it also makes it very difficult for a browser extension to access data on another server that the author of the software doesn’t control. That’s why there have been no problems with getting the config files from my website, but there are issues for pretty much any other website.

          There is a workaround for DropBox that works for the time being, but it could also break soon, too.

          Take your link and change it from:

          https://www.dropbox.com/s/kn0k0iv0vov3ez0/dirty-scare.json

          to

          https://dl.dropboxusercontent.com/s/kn0k0iv0vov3ez0/dirty-scare.json

          When you access the same data from the other server, it does come with the access-control-allow-origin, at least for the time being. DropBox could change that policy at any time.

          There is one last way to load a custom config file that might work for you. The access controls should allow a config file to be loaded from the local host (from the computer running the browser itself). You need to run a little webserver to serve the config file. On Macs, the built-in Python interpreter can provide such a server. You only need to run it for a few moments to allow the extension to load the file. After that, you can shut down the web server because the extension will store its copy.

          I have not tested this recently, but I hope to take some time to do so today and if it works, I’ll add instructions to the “about” page.

          Best,
          Dave J

          1. Hello,

            Would it possible to host this list on a local file, or on inside a text form field in the settings of the addon ?

            I don’t want to create a dropbox account, if it’s possible to selfhost it, I think it would better for privacy reason.

            Thanks for your work on this, it’s been a delight to use it.

          2. He Denis, unfortunately, this is harder than it seems, and sadly, it used to be easier.

            Both Chrome and Firefox have been “refining” their security models and as of recently, neither will allow an extension/add-on to access a local “file://” resource. They used to, they do not now, even if such access is requested in the manifest for the extension. This means you can’t just paste a file. If I want to add the ability to self-host, I will have to modify the extension a fair bit to allow modifying the config in the options screen itself, which I just haven’t had time to do.

            If you are a little bit handy with computers, you can run a little web server on your computer and point Detrumpify at that. You do not have to do this permanently. You can just do this once, have Detrumpify load the file, and then shut down the server.

            For example, if you are on a Mac this can be done with the system Python already installed:

            a. make your edited .json config file and put it somewhere
            b. open a terminal window and cd to that folder
            c. issue the command “python -m SimpleHTTPServer 8000”
            d. use your browser to visit http://localhost:8000/.json to make sure that it works
            e. open the config page on Detrumpify and paste that url into the insult URL and click Save
            f. Use the “view config” option to verify that it loaded.

            You can then kill the server and close the terminal window. Detrumpify will try to reload the config if a few weeks but it will fail to do so because the server is not present, and it will keep the existing config.

  10. thank you for this, it sparks joy for weeks now, I’m still surprised sometimes for a moment. Also, names still do not repeat as far as I can remember. Great job 🙂

  11. This deserves a Nobel Prize! I love it.
    I wish I could finmd in the code where it searches for “Triûmp” to trigger the addon. Could you possibly add Nigel, Farage, Boris, Johnson to this list? And make it easy for us to add others?
    Many thanks!

    1. Hi,

      All the regular experessions that the code searches for and the replacements are handled not in the main code, but in a configuration data structure that is loaded as a JSON file. You can edit this data structure directly in the options window.

      Choose options, then scroll down, and then click “show configuration details.”

      Look for a section like this:

      In this, ‘trump’ is the name of the action, the ‘((Donald|DONALD)\\s*(J\\.?\\s*)?)?(Trump|TRUMP)(?!\\w)’ is the regular expression used to find references to Trump. In the monikers section is an array of possible replacements to be chosen at random. In this case, there is only one to choose from: ‘Individual 1’.

      After you have made changes, you can click the save changes button and the tool will use your modified configuration.

      You might want to copy and paste this entire configuration file into a text editor for editing, and to keep a copy in case an update of Detrumpify wipes your changes.

      Good luck!

      1. It puts the lotion on the skin! Imagine being so deranged you write a plugin to hide someone’s name from websites. Thanks for letting future employers know not to hire you.

        1. I would ask you how the Silence of the Lambs reference is at all relevant, but I don’t actually care.

          I want to thank a different David for making this extension. I feel so lighthearted and lightheaded for the first time in years.

          I will be sharing this with the world as often as I can.

          If I was a Hollywood version of a hacker, this would already be installed on every computer on Earth.

  12. It’s sad and sometimes funny to see how pathetic all you cowardly snowflakes are. Damn grow a pair you woke punks and quit being such babies.
    Oh no, did I trigger you? Suck it up buttercup.

Leave a Reply

Your email address will not be published. Required fields are marked *