moved device index JavaScript to its own file