optimize js, add history.