only add badge js if necessary