} }, initialize() { const file = encodeURIComponent(decodeURIComponent(this.model.get('file'))), filenameInfo = file.split('.'); this.model.set({ 'file': file, 'extension': filenameInfo.pop(), 'filename': filenameInfo.join('.') }, { silent: true }); }, render() { this.$el.html(pictureTmpl({ 'model': this.model.toJSON(), 'liked': visitor.doesLike(this.model.get('id')), 'labels': labels })); return this; }, zoom() { window.currentScollPosition = $(window.document).scrollTop(); if (this.model.get('id') !== undefined) { Backbone.history.navigate('/item/' + this.model.get('id'), true); } return false; }, isVisible() { const rect = this.el.getBoundingClientRect();
this.item = item; // update browser title if (this.item.get('description')) { window.document.title = this.item.get('description') + ` - ${WallBlog.title}`; } this.hideLogin(); this.$el.addClass('zoom'); // render with description in header bar this.$el.html(templateZoom({ item: this.item.toJSON(), admin: tools.isLogged(), labels: labels, liked: visitor.doesLike(this.item.get('id')) })); this.root.html(this.el); this.delegateEvents(this.events); }, renderEdit() { this.$el.html(templateEdit({ item: this.item.toJSON(), admin: tools.isLogged(), labels: labels })); this.root.html(this.el); this.delegateEvents(this.events); this.$('input').focus(); },