rewrite gallery.js and update portfolio pages