Skip to content

Instantly share code, notes, and snippets.

@vogelbeere
Last active March 2, 2022 19:21
Show Gist options
  • Save vogelbeere/e9ec4499c70525e3ca83dc23e9493d27 to your computer and use it in GitHub Desktop.
Save vogelbeere/e9ec4499c70525e3ca83dc23e9493d27 to your computer and use it in GitHub Desktop.
A bookmarklet for replacing biologically essentialist language with inclusive language

🏳️‍⚧️ 🏳️‍🌈 Inclusive Lens 🔎

What is it?

A bookmarklet for replacing biologically essentialist language with inclusive language.

How to install

  1. Create a new bookmark on your browser's bookmarks bar.
  2. Right-click on it and select Edit.
  3. Copy the following text and paste it into the field labeled URL:
javascript:function htmlreplace(a,b,element){if(!element)element=document.body;var nodes=element.childNodes;for(var n=0;n<nodes.length;n++){if(nodes[n].nodeType==Node.TEXT_NODE){nodes[n].textContent=nodes[n].textContent.replace(new RegExp(a,'gi'),b);}else{htmlreplace(a,b,nodes[n]);}}}htmlreplace(" women"," AFAB people");htmlreplace(" men"," AMAB people");htmlreplace(" woman"," AFAB person");htmlreplace(" man"," AMAB person");htmlreplace(" female"," AFAB");htmlreplace(" male"," AMAB");
  1. Change the Name: field to a label that works for you.
  2. Click done.

How to use

  1. Whenever you visit a webpage that uses biologically essentialist terms, click the button and voilà, they are replaced with inclusive terms.

Thanks

Based on the Find&Replace bookmarklet by Andrew Miley.

// based on the Find&Replace bookmarklet by Andrew Miley at https://codepen.io/mileym3dia/full/rNLLxNo
javascript:function htmlreplace(a,b,element){if(!element)element=document.body;var nodes=element.childNodes;for(var n=0;n<nodes.length;n++){if(nodes[n].nodeType==Node.TEXT_NODE){nodes[n].textContent=nodes[n].textContent.replace(new RegExp(a,'gi'),b);}else{htmlreplace(a,b,nodes[n]);}}}htmlreplace(" women"," AFAB people");htmlreplace(" men"," AMAB people");htmlreplace(" woman"," AFAB person");htmlreplace(" man"," AMAB person");htmlreplace(" female"," AFAB");htmlreplace(" male"," AMAB");
@vogelbeere
Copy link
Author

vogelbeere commented Mar 1, 2022

Unfortunately it changes " many" to " AMAB persony" as I couldn’t put a space after " man" in my replacement script, otherwise it would ignore " man." (and there is a 2000-character limit in the URL field of bookmarks so I couldn't get too picky) so it’s not perfect but it’s an improvement on bio-essentialist language. What I really need to do is create a regex for each search term, but for that, I think I need to rewrite it as a browser extension.

Here's a regex for man preceded by a space and followed by various punctuation:

\s(m)(a)(n)?(\s|.|,|;|!|\?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment