var tdfAjaxFlickr={};jQuery().ready(function(){tdfAjaxFlickr.init()});
(function(){tdfAjaxFlickr={_is_modal_open:!1,init:function(){jQuery(document).on("click",function(a){"td-flkr-m-overlay"!==a.target.className&&"td-flkr-m-close"!==a.target.className||!0!==tdfAjaxFlickr._is_modal_open||(a.preventDefault(),jQuery(".td-flkr-m").remove(),tdfAjaxFlickr._is_modal_open=!1)});jQuery("body").on("click",".td-flkr-m-img",function(){var a=jQuery(this);a.hasClass("td-fgm-img-active")||(jQuery(".td-flkr-m-main-img a").attr("data-img-full",a.data("img-full")),jQuery(".td-flkr-m-main-img img").attr("src",
a.data("img-preview")),jQuery(".td-flkr-m-main-img img").attr("title",a.attr("title")),jQuery(".td-flkr-m-img").removeClass("td-flkr-m-img-active"),jQuery(this).addClass("td-flkr-m-img-active"))});jQuery("body").on("click",".td-flkr-album",function(a){a.preventDefault();a.stopPropagation();a=jQuery(this);var b=a.parents(".td_block_wrap").attr("data-td-block-uid")+"_m",c=a.data("flkr-album-id"),d=a.data("flkr-album-title");jQuery("body").prepend('<div id="td-flkr-m" class="td-flkr-m '+b+'"><div class="td-flkr-m-overlay"></div><div class="td-flkr-m-close"><i class="td-icon-modal-close"></i></div><div class="td-flkr-m-main-img"><h3 class="td-flkr-m-title"></h3></div><div class="td-flkr-m-loading"></div><div class="td-flkr-m-album-images"></div></div>');
jQuery.ajax({type:"POST",url:td_ajax_url,data:{action:"td_ajax_flickr_modal",td_flickr_album_id:c},success:function(a){var b=jQuery.parseJSON(a),c=Object.keys(b).length,f=0;jQuery(".td-flkr-m-loading").remove();jQuery(".td-flkr-m-title").html(d);var e={};Object.keys(b).reverse().forEach(function(a){e[a]=b[a]});jQuery(".td-flkr-m-album-images").show();jQuery.each(e,function(){var a=this.title,b=this.preview_img,d=this.full_img,e=this.thumb_img,g="";f===c-1&&(g="td-flkr-m-img-active",jQuery(".td-flkr-m-main-img").append('<a href="'+
d+'" target="blank"><img src="'+b+'" title="'+a+'" /></a>'));jQuery(".td-flkr-m-album-images").prepend('<div class="td-flkr-m-img '+g+'" title="'+a+'" data-img-preview="'+b+'" data-img-full="'+d+'"><div class="td-flkr-m-img-inner" style="background-image:url('+e+')"></div></div>');f++})}});tdfAjaxFlickr._is_modal_open=!0});jQuery("body").on("click",".td-flkr-photo",function(a){a.preventDefault();a.stopPropagation();var b=jQuery(this);a=b.parents(".td_block_wrap").attr("data-td-block-uid")+"_m";var c=
b.find("h3").text(),d=b.find(".td-flkr-feat-img").data("flkr-preview-img");b=b.find(".td-flkr-feat-img").data("flkr-full-img");jQuery("body").prepend('<div id="td-flkr-m" class="td-flkr-m '+a+'"><div class="td-flkr-m-overlay"></div><div class="td-flkr-m-close"><i class="td-icon-modal-close"></i></div><div class="td-flkr-m-main-img"><h3 class="td-flkr-m-title">'+c+'</h3><a href="'+b+'" target="blank"><img src="'+d+'" title="'+c+'" /></a></div><div class="td-flkr-m-loading"></div></div>');jQuery(".td-flkr-m-loading").remove();
tdfAjaxFlickr._is_modal_open=!0})}}})();
