' } if( this.media.type === 'video' ){ return '
' } }, }, methods: { list_render: function( list ){ var same = true; list.forEach( function(el){ if (el.content !== list[0].content) { same = false; } }); this.$set('list', list ); this.$set('photosSamePhotographer', same ); this.list.forEach( function(el){ misc.on_image_loaded( el.src, function(){ el.is_loaded = true }) }); }, nav_listener: function(){ window.addEventListener('scroll', function(){ scroll = parseInt(document.body.getBoundingClientRect().bottom - document.querySelector('#footer').clientHeight); if ( scroll < window.innerHeight && !this.nav.is_loading ){ if( this.nav.current === this.nav.total_pages ) return false; this.nav.is_loading = true; this.nav.current + 1 <= this.nav.total_pages && this.load_page( this.nav.current + 1 ); } }.bind(this)); }, load_page: function( index , callback ){ archive.get_archive_list( page.list_url + '?page=' + index , function(list , nav ){ this.nav.current = index; list.forEach(function(el){ el.is_loaded = true; this.list.push(el); }.bind(this)); this.nav.is_loading = false; typeof callback === 'function' && callback( nav ) }.bind(this)); } }, ready: function(){ archive.get_header( function( page , media ){ this.$set('page', page); this.$set('media', media); }.bind(this)); if( page.type === 'single' && gallery ){ archive.get_gallery_list(function(list){ this.list_render( list ) }.bind(this)); } console.log(page); console.log(page.list); if( page.type === 'page' && page.list_url ){ this.load_page( 1 , function( nav ){ this.nav.total_pages = nav.total_pages; this.nav_listener(); }.bind(this)); archive.get_gallery_list(function(list){ this.list_render( list ) }.bind(this)); } } })})