[Bug 998767] Fix {for not win}

Turns out there was a untested case in the logic for new showfor. I added a test case, and fixed it.

I also fixed a bug in `ui.js` that was introduced recently, because it broke all JS on the page, which made it hard to test this.

r?