Refactor wegas-gallery.js