Move js into file and remove global var in favour of data attribute