visitor can register [finish #79854006 #79854478]

Move this JS to a JS file, not the layout file.