Update gallery.js

Fix to stop js errors when logging in to admin.