VID-2015 Modularize gallery js & trigger on preview as well

space after ```function```