Semi-fix {ts} usage: the mix of js/smarty here isn't very practical.

Will be fixed when the js is split out in a separate file eventually.