Added js to sensors and history pages to allow autorefresh only when page is visible