Adjust the speed of the indeterminate loading bar according to the viewer width (issue 4718)

This PR changes the `animation-duration` of the indeterminate loading bar to depend on the viewer width, instead of being constant. 
I settled on 500 pixels / second as a reasonable value for the animation speed, but this can easily be changed.
Compared to a previous attempt to solve this (see PR #4741), this should work for *any* viewer width without the need for a large number of added CSS rules.

*Note:* The first commit is only included to simplify testing, and should *not* be merged.

Fixes #4718.