Convert pushstate to js

Can the return rather go on the same line as the `if`?