AO3: [Wrangling] Search Term Highlighting

Puts the search result into a table and highlights the search terms in the results

As of 2024-07-28. See the latest version.

Author
escctrl
Ratings
0 0 0
Version
6.0
Created
2024-07-28
Updated
2024-07-28
Size
7.1 KB
License
MIT
Applies to

Adds a "Highlight Search Terms" button at the top of the search results, to highlight where in the results the search term(s) are contained.
When I was a newbie wrangler, this helped me better understand the search logic of AO3, and why I was seeing the results I was getting.

Works on the original Search page, as well as with my script that can turn the results into a table.

The STRICT_HIGHLIGHT configuration at the beginning of the script changes the behavior of the highlighting with special characters a little, when the search term didn't include asterisk:

  • false = like AO3 searches by ignoring special characters
  • true = as you probably meant it, by searching for the literal special character

Examples using a search term of "sugar & spice" in quotation marks, without asterisk. Ao3 search ignores the ampersand in the middle.

I cannot guarantee it will work 100% of the time since the script takes a somewhat simplified approach to reverse-engineering the search matching of AO3 ^_^ Please let me know of specific examples where it behaves weirdly and I'll happily look into it.