Completely factorize JavaScript

Now only one file for all pages.