Fix photo viewer js and extend to all pages