refactor inline product images js