I wanted to move this JS into an external file, but there is this PHP dependency here which won't work when I do.