The script I found assumes there's only a single instance of the element you want to adjust. They should have used an ID instead of a class to make that clear. As written, it adjusts all the elements of that class (makes sense once I figured out why it wasn't working) based on whether the first element fits in its container.
I'll have to build a walker to traverse all the elements and adjust each one individually. That can wait a bit.