move inline js into external files

chrome packaged apps are not allowed to use inline script elements and functionally there doesn't seem to be any reason to keep these as inline in index.html