js/tsg: clean up click handler