Moved common javascript out into base.html

Change-Id: I617b747860489a8674b1c1d99f92019e5dc7b6e6