Retroactively remove metric url content from buttons

The button's urls are created at page load, which include references to
metric count = n (n -1 in cases of sidebar remove buttons). When n
reduces to n-1, the number of metrics in all these buttons also needs to
change. So, take all urls on the page containing the metric name and
remove it from their href query string.
Only reload the page if the back button was pressed after a manual pushState event

Without this, normal page reloads refresh the page twice. Normal humans
can't see this change (happens to quickly), but Capybara chucks a right
fit and gets very upset.