edited inView js function