move some inline scripts to v2.js