What it does:
Highlights tags containing your chosen text in different colors so you can find them faster within a work blurb
Found at: GreasyFork by Fangirlishness
AO3 comes with a lot of text... just like an archive should. But it's easy to overlook certain tags that you'd love to read—or to avoid.
Install ⇒ AO3: highlight tags V2
This new version lets you define the tag type: characters, relationships, freeforms. For example, you can highlight the relationships featuring your favorite character (in the screenshot above: Bruno), without also highlighting all the freeforms about them (e.g. Parental Bruno Buccellati).
As most scripts that check the tags on works, it cannot guarantee that it highlights all instances correctly, and you have to account for all the ways people might tag for it in the script configuration. For example, if you wish to highlight any "Alternate Universe" type of tag, people might use
the canonical tags that all start with "Alternate Universe", e.g. "Alternate Universe - Modern Setting"
a tag that abbreviates it to "AU", e.g. "modern AU"
a tag that doesn't explicitly state it's an AU because context makes that clear, e.g. "modern setting" in a fantasy fandom
The first two can be covered in the configuration, but the third is hard-to-impossible to catch.
A couple of things to remember as you're setting up your config:
The script configuration is currently case-sensitive. So "AU" will only highlight tags where it's also capital letters.
TBH I highly recommend switching it to case-insensitive by adding the "i" in front of the "g" at the end of the line so the code becomes: var pattern = new RegExp(key, "ig")
The script tries to find any tag that contains the text you configured. That can even be in the middle of the word: configuring "au" would higlight tags including the word author, trauma, etc.
If you know a little bit of RegEx, you've just become so much more powerful! As an example, \b is the RegEx "word boundary" metacharacter, and to make it work in the script, its backslash needs to be escaped with another backslash. To highlight tags including the word "au" like in highschool!au but not in trauma, you can configure "\\bau\\b".
Because RegEx is supported in this script, some characters need to be "escaped" by preceding them with a backslash, so that the highlighting takes them literally within a tag. That includes quotes ", pipes |, parenthesis (), square brackets [], slashes /, or dots... and the backslash of all RegEx metacharacters.
If you want to check for relationships, the tags might include them in either order. You can set up multiple lines in the configuration. With RegEx, you can also do it in a single line. Configure "relationships!(Geralt.*\/.*Jaskier)|(Jaskier.*\/.*Geralt)" and it'll highlight either order of them in a romantic relationship. Now, Jaskier is sometimes called Dandelion, so we could go one step further and make the logic check for either of his names: "relationships!(Geralt.*\/.*(Jaskier|Dandelion))|((Jaskier|Dandelion).*\/.*Geralt)"
If you use and enjoy this userscript, also consider giving its author some feedback!