Move onpopstate listener to script.js