ips.templates.set('gallery.patchwork.indexItem'," {{#showThumb}} {{/showThumb}} {{^showThumb}} {{/showThumb}} {{#showThumb}} {{#lazyLoad}} {{image.caption}} {{/lazyLoad}} {{^lazyLoad}} {{image.caption}} {{/lazyLoad}} {{/showThumb}}
{{#lang}}by{{/lang}} {{image.author.name}} {{#lang}}in{{/lang}} {{image.container}}
    {{#image.unread}}
  • {{/image.unread}} {{#image.hasState}}
  • {{#image.state.hidden}} {{/image.state.hidden}} {{#image.state.pending}} {{/image.state.pending}} {{#image.state.pinned}} {{/image.state.pinned}} {{#image.state.featured}} {{/image.state.featured}}
  • {{/image.hasState}} {{#image.allowComments}}
  • {{image.comments}}
  • {{/image.allowComments}}
");ips.templates.set('gallery.patchwork.tableItem'," {{#showThumb}}
{{/showThumb}} {{^showThumb}} ");ips.templates.set('gallery.lightbox.wrapper',"
×
");; ;(function($,_,undefined){"use strict";ips.controller.register('gallery.front.browse.list',{initialize:function(){this.on('change','[data-role="moderation"]',this.selectImage);this.on('tableRowsUpdated',this.rowsUpdated);},rowsUpdated:function(){var patchwork=ips.ui.photoLayout.getObj(this.scope);if(patchwork){patchwork.refresh();}},selectImage:function(e){var row=$(e.currentTarget).closest('.cGalleryImageItem');row.toggleClass('cGalleryImageItem_selected',$(e.currentTarget).is(':checked'));}});}(jQuery,_));; ;(function($,_,undefined){"use strict";ips.controller.register('gallery.front.browse.imageLightbox',{initialize:function(){this.on('click','[data-imageLightbox]',this.launchLightbox);this.on(document,'keydown',this.keyDown);this.on(document,'click','.cLightboxClose',this.closeLightbox);History.Adapter.bind(window,'statechange',_.bind(this.stateChange,this));this.setup();},setup:function(){if(!_.isUndefined(this.scope.attr('data-launchLightbox'))){this._launch(this.scope.attr('data-lightboxURL'),document.title);}},stateChange:function(){var state=History.getState();if(state.data.controller!='gallery.front.view.image'){if(state.data.controller=='gallery.front.browse.imageLightbox'&&(_.isUndefined(state.data.initialLaunch)||state.data.initialLaunch!=true)){Debug.log(state.data);this.hideLightbox();} return;} if(_.isUndefined(state.data.direction)){return;} if($('[data-role="tableRows"] div[data-imageId="'+state.data.imageID+'"]').length){return;} if(state.data.direction=='next'){$('#cLightbox').attr('data-originalUrl',$('[data-role="tablePagination"]').find('.ipsPagination_next:not(.ipsPagination_inactive) a').first().attr('href'));$('[data-role="tablePagination"]').find('.ipsPagination_next:not(.ipsPagination_inactive) a').first().click();} if(state.data.direction=='prev'){$('#cLightbox').attr('data-originalUrl',$('[data-role="tablePagination"]').find('.ipsPagination_prev:not(.ipsPagination_inactive) a').first().attr('href'));$('[data-role="tablePagination"]').find('.ipsPagination_prev:not(.ipsPagination_inactive) a').first().click();}},launchLightbox:function(e){e.preventDefault();var url=$(e.currentTarget).attr('href');var title=$(e.currentTarget).attr('title');this._launch(url,title);},_launch:function(url,title){if(url.indexOf('?')==-1){var logUrl=ips.utils.url.removeParams(['lightbox','browse'],url)+'?browse=1&lightbox=1';url=url+'?lightbox=1';}else{var logUrl=ips.utils.url.removeParams(['lightbox','browse'],url)+'&browse=1&lightbox=1';url=url+'&lightbox=1';} if(!$('#cLightbox').length){var newWidget=ips.templates.render('gallery.lightbox.wrapper',{originalUrl:window.location.href,originaltitle:document.title});$('body').append(newWidget);$('#cLightbox').css({zIndex:ips.ui.zIndex()});}else if(!$('#cLightbox').is(':visible')){$('#cLightbox').show();} if(ips.utils.responsive.currentIs('phone')){$(window).scrollTop(0);} History.pushState({controller:'gallery.front.browse.imageLightbox',initialLaunch:true,lightbox:true,realUrl:logUrl},title,ips.utils.url.removeParams(['lightbox','browse'],url));ips.getAjax()(url,{type:'get',showLoading:true}).done(function(response){$('#cLightbox > .cLightboxBack').html(response);$(document).trigger('contentChange',[$('#cLightbox')]);}).fail(function(){window.location=url;});$('body').addClass('ipsNoScroll');},keyDown:function(e){if($(e.target).closest('input, textarea, .ipsComposeArea, .ipsComposeArea_editor').length){return;} switch(e.keyCode){case ips.ui.key.ESCAPE:this.closeLightbox();break;}},closeLightbox:function(e){this.hideLightbox();History.pushState({controller:'gallery.front.browse.imageLightbox',bypassStateAdjustment:true},$('#cLightbox').attr('data-originalTitle'),$('#cLightbox').attr('data-originalUrl'));},hideLightbox:function(){$('#cLightbox').fadeOut(400);$('body').removeClass('ipsNoScroll');if($('#cLightbox video').length){_.each($('#cLightbox video'),function(elem){elem.pause();});}}});}(jQuery,_));;