Convert pushstate to js

`} else if`