WD Instagram Feed – Instagram Gallery - Version 1.3.1

Version Description

Fixed: Security issues. Reported by Karan Saini https://www.karansaini.com/

Download this release

Release Info

Developer webdorado
Plugin Icon 128x128 WD Instagram Feed – Instagram Gallery
Version 1.3.1
Comparing to
See all releases

Code changes from version 1.3.0 to 1.3.1

changelog.txt CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  = 1.3.0 =
2
  New: Caching of Instagram data. API rate limits do not constrain feed loading anymore.
3
  New: Compatibility with Gutenberg editor.
@@ -19,7 +22,6 @@ Sorry.
19
  Changed: Video play issue on mac safari
20
  Changed: Uninstall moved to settings page
21
 
22
-
23
  = 1.2.16 =
24
  New: Instagram slideshow is supported in popup
25
  New: UX of feeds and themes admin screen, it is now similar to posts list screen
1
+ = 1.3.1 =
2
+ Fixed: Security issues. Reported by Karan Saini https://www.karansaini.com/
3
+
4
  = 1.3.0 =
5
  New: Caching of Instagram data. API rate limits do not constrain feed loading anymore.
6
  New: Compatibility with Gutenberg editor.
22
  Changed: Video play issue on mac safari
23
  Changed: Uninstall moved to settings page
24
 
 
25
  = 1.2.16 =
26
  New: Instagram slideshow is supported in popup
27
  New: UX of feeds and themes admin screen, it is now similar to posts list screen
frontend/views/WDIViewGalleryBox.php CHANGED
@@ -500,7 +500,7 @@ continue;
500
  <div class="wdi_users_img_wrap"><img src="<?php echo $current_image_user_pic;?>" alt=""></div>
501
  </div>
502
  </div>
503
- <div class="wdi_image_description"><?php echo html_entity_decode($current_image_description); ?></div>
504
  </div>
505
  </span>
506
  </div>
@@ -873,7 +873,7 @@ continue;
873
 
874
  /* Change image title, description.*/
875
  jQuery(".wdi_image_title").html(jQuery('<span style="display: block;" />').append(wdi_title_div));
876
- jQuery(".wdi_image_description").html(jQuery('<span style="display: block;" />').html(wdi_data[key]["description"]).text());
877
  jQuery(".wdi_image_info").removeAttr("style");
878
  if (wdi_data[key]["alt"].trim() == "") {
879
  if (wdi_data[key]["description"].trim() == "") {
500
  <div class="wdi_users_img_wrap"><img src="<?php echo $current_image_user_pic;?>" alt=""></div>
501
  </div>
502
  </div>
503
+ <div class="wdi_image_description"><?php echo esc_html($current_image_description); ?></div>
504
  </div>
505
  </span>
506
  </div>
873
 
874
  /* Change image title, description.*/
875
  jQuery(".wdi_image_title").html(jQuery('<span style="display: block;" />').append(wdi_title_div));
876
+ jQuery(".wdi_image_description").html(jQuery('<span style="display: block;" />').text(wdi_data[key]["description"]).text());
877
  jQuery(".wdi_image_info").removeAttr("style");
878
  if (wdi_data[key]["alt"].trim() == "") {
879
  if (wdi_data[key]["description"].trim() == "") {
js/gallerybox/wdi_gallery_box.js CHANGED
@@ -189,7 +189,7 @@ var wdi_construct_popup = function (popup, currentFeed, image_rows, current_imag
189
  wdi_data[i]["number"] = i + 1;
190
  wdi_data[i]["id"] = image_rows[i].id;
191
  wdi_data[i]["alt"] = image_rows[i].alt;
192
- wdi_data[i]["description"] = image_rows[i].description;
193
  wdi_data[i]["username"] = image_rows[i].username;
194
  wdi_data[i]["profile_picture"] = image_rows[i].profile_picture;
195
  wdi_data[i]["image_url"] = image_rows[i].image_url;
@@ -407,6 +407,7 @@ wdi_comments_manager = {
407
  for (i = Object.size(comments) - counter - 1; i >= Object.size(comments) - counter - count; i--) {
408
  this.commentCounter++;
409
  var commentText = (comments[i]['text']);
 
410
  commentText = this.filterCommentText(commentText);
411
  var username = (comments[i]['from']['username']);
412
  var profile_picture = (comments[i]['from']['profile_picture']);
189
  wdi_data[i]["number"] = i + 1;
190
  wdi_data[i]["id"] = image_rows[i].id;
191
  wdi_data[i]["alt"] = image_rows[i].alt;
192
+ wdi_data[i]["description"] = wdi_front.escape_tags(image_rows[i].description);
193
  wdi_data[i]["username"] = image_rows[i].username;
194
  wdi_data[i]["profile_picture"] = image_rows[i].profile_picture;
195
  wdi_data[i]["image_url"] = image_rows[i].image_url;
407
  for (i = Object.size(comments) - counter - 1; i >= Object.size(comments) - counter - count; i--) {
408
  this.commentCounter++;
409
  var commentText = (comments[i]['text']);
410
+ commentText = wdi_front.escape_tags(commentText);
411
  commentText = this.filterCommentText(commentText);
412
  var username = (comments[i]['from']['username']);
413
  var profile_picture = (comments[i]['from']['profile_picture']);
js/gallerybox/wdi_gallery_box.min.js CHANGED
@@ -1 +1 @@
1
- var isPopUpOpened=false;var wdi_data=[];function wdi_spider_createpopup(a,k,b,m,e,l,f,j,h){a=a.replace(/&#038;/g,"&");if(isPopUpOpened){return}isPopUpOpened=true;if(wdi_spider_hasalreadyreceivedpopup(l)||wdi_spider_isunsupporteduseragent()){return}jQuery("html").attr("style","overflow:hidden !important;");jQuery("#wdi_spider_popup_loading_"+k).css({display:"block"});jQuery("#wdi_spider_popup_overlay_"+k).css({display:"block"});var d=0;var c;for(var g=0;g<j.parsedData.length;g++){if(j.parsedData[g].id===h){d=g;c=[j.parsedData[g]];break}}jQuery.ajax({type:"POST",url:a,dataType:"text",data:{action:"WDIGalleryBox",image_rows:JSON.stringify(c),feed_id:j.feed_row.id,feed_counter:j.feed_row.wdi_feed_counter,current_image_index:d,image_rows_count:j.parsedData.length,carousel_media_row:JSON.stringify(c[0].carousel_media)},success:function(o){var n=jQuery('<div id="wdi_spider_popup_wrap" class="wdi_spider_popup_wrap wdi_lightbox_theme_'+j.feed_row.theme_id+'" style="width:'+b+"px;height:"+m+"px;margin-top:-"+(m/2)+"px;margin-left: -"+(b/2)+'px; ">'+o+"</div>");var p=new wdi_construct_popup(n,j,j.parsedData,h);p.construct();n.hide().appendTo("body");wdi_spider_showpopup(l,f,n,e);jQuery("#wdi_spider_popup_loading_"+k).css({display:"none !important;"})}})}var wdi_construct_popup=function(a,b,c,d){this.theme_row={};this.construct=function(){this.theme_row=window["wdi_theme_"+b.feed_row.theme_id];if(b.feed_row.popup_enable_filmstrip&&b.feed_row.popup_enable_filmstrip==="1"){this.add_filmstrip()}this.set_wdi_data()};this.add_filmstrip=function(){var l="horizontal";if(this.theme_row.lightbox_filmstrip_pos==="right"||this.theme_row.lightbox_filmstrip_pos==="left"){l="vertical"}var y=(l==="horizontal")?"fa-angle-left":"fa-angle-up";var x=(l==="horizontal")?"fa-angle-right":"fa-angle-down";var h="";var q,f;if(l==="horizontal"){f=q=(typeof b.feed_row.popup_filmstrip_height!=="undefined")?(b.feed_row.popup_filmstrip_height):"20"}else{f=q=(typeof b.feed_row.popup_filmstrip_height!=="undefined")?(b.feed_row.popup_filmstrip_height):"50"}q=f=parseInt(f);for(var w=0;w<c.length;w++){var e=c[w];var s,k,A;if(e.resolution&&e.resolution!==""){var n=e.resolution.split(" ");var p=intval($resolution_arr[0]);var z=intval($resolution_arr[2]);if(p!==0&&z!==0){A=Math.max(f/p,q/z);s=p*A;k=z*A}else{s=f;k=q}}else{s=f;k=q}A=Math.max(f/s,q/k);s*=A;k*=A;var g=(f-s)/2;var j=(q-k)/2;var u="wdi_filmstrip_thumbnail "+((parseInt(e.id)===parseInt(d))?"wdi_thumb_active":"wdi_thumb_deactive");var t="width:"+s+"px;height:"+k+"px;margin-left:"+g+"px;margin-top:"+j+"px;";var m=(typeof e.images[b.feedImageResolution]["url"]!=="undefined")?e.images[b.feedImageResolution]["url"]:e.thumb_url;var B="wdi_change_image(parseInt(jQuery('#wdi_current_image_key').val()), '"+w+"', wdi_data)";var v="wdi_change_image(parseInt(jQuery('#wdi_current_image_key').val()), '"+w+"', wdi_data)";var r='<img style="'+t+'" class="wdi_filmstrip_thumbnail_img" src="'+m+'" onclick="'+B+'" ontouchend="'+v+'" image_id="'+e.id+'" image_key="'+w+'" alt="'+e.alt+'" />';h+='<div id="wdi_filmstrip_thumbnail_'+w+'" class="'+u+'">'+r+"</div>"}var o='<div class="wdi_filmstrip_left"><i class="fa '+y+'"></i></div><div class="wdi_filmstrip"><div class="wdi_filmstrip_thumbnails">'+h+'</div></div><div class="wdi_filmstrip_right"><i class="fa '+x+'"></i></div>';a.find(".wdi_filmstrip_container").append(o)};this.set_wdi_data=function(){wdi_data=[];for(var e=0;e<c.length;e++){wdi_data[e]=[];wdi_data[e]["number"]=e+1;wdi_data[e]["id"]=c[e].id;wdi_data[e]["alt"]=c[e].alt;wdi_data[e]["description"]=c[e].description;wdi_data[e]["username"]=c[e].username;wdi_data[e]["profile_picture"]=c[e].profile_picture;wdi_data[e]["image_url"]=c[e].image_url;wdi_data[e]["thumb_url"]=c[e].thumb_url;wdi_data[e]["date"]=c[e].date;wdi_data[e]["comment_count"]=c[e].comment_count;wdi_data[e]["filetype"]=c[e].filetype;wdi_data[e]["filename"]=c[e].filename;wdi_data[e]["avg_rating"]=c[e].avg_rating;wdi_data[e]["rate"]=c[e].rate;wdi_data[e]["rate_count"]=c[e].rate_count;wdi_data[e]["hit_count"]=c[e].hit_count;wdi_data[e]["comments_data"]=(typeof c[e].comments_data!=="undefined")?c[e].comments_data:"null";wdi_data[e]["carousel_media"]=(typeof c[e]["carousel_media"]!=="undefined")?c[e]["carousel_media"]:null}}};function wdi_spider_showpopup(c,a,b,d){isPopUpOpened=true;b.show();wdi_spider_receivedpopup(c,a)}function wdi_spider_hasalreadyreceivedpopup(a){if(document.cookie.indexOf(a)>-1){delete document.cookie[document.cookie.indexOf(a)]}return false}function wdi_spider_receivedpopup(c,a){var b=new Date();b.setDate(b.getDate()+a);document.cookie=c+"=true;expires="+b.toUTCString()+";path=/"}function wdi_spider_isunsupporteduseragent(){return(!window.XMLHttpRequest)}function wdi_spider_destroypopup(d){if(document.getElementById("wdi_spider_popup_wrap")!=null){wdi_comments_manager.popup_destroyed();if(typeof jQuery().fullscreen!=="undefined"&&jQuery.isFunction(jQuery().fullscreen)){if(jQuery.fullscreen.isFullScreen()){jQuery.fullscreen.exit()}}if(typeof enable_addthis!="undefined"&&enable_addthis){jQuery(".at4-share-outer").hide()}setTimeout(function(){jQuery(".wdi_spider_popup_wrap").remove();jQuery(".wdi_spider_popup_loading").css({display:"none"});jQuery(".wdi_spider_popup_overlay").css({display:"none"});jQuery(document).off("keydown");jQuery("html").attr("style","")},20)}isPopUpOpened=false;var a=(/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));var c=document.querySelector('meta[name="viewport"]');if(a&&c){c.content="width=device-width, initial-scale=1"}var b=jQuery(document).scrollTop();window.location.hash="";jQuery(document).scrollTop(b);if(typeof wdi_playInterval!="undefined"){clearInterval(wdi_playInterval)}}Object.size=function(c){var b=0,a;for(a in c){if(c.hasOwnProperty(a)){b++}}return b};function wdi_spider_ajax_save(a,b){wdi_comments_manager.init(b);return false}wdi_comments_manager={media_id:"",mediaComments:[],load_more_count:10,commentCounter:0,currentKey:-1,init:function(a){this.instagram=new WDIInstagram();this.instagram.addToken(wdi_front.access_token);if(this.currentKey!=a){this.currentKey=a;this.reset_comments()}else{}},reset_comments:function(){jQuery("#wdi_load_more_comments").remove();jQuery("#wdi_added_comments").html("");this.commentCounter=0;this.media_id=wdi_data[this.currentKey]["id"];this.getAjaxComments(this.currentKey)},popup_destroyed:function(){this.media_id="";this.mediaComments=[];this.commentCounter=0;this.currentKey=-1},showComments:function(f,e){if(Object.size(f)-this.commentCounter-e<0||e===undefined){e=Object.size(f)-this.commentCounter}var b=this.commentCounter;for(i=Object.size(f)-b-1;i>=Object.size(f)-b-e;i--){this.commentCounter++;var d=(f[i]["text"]);d=this.filterCommentText(d);var g=(f[i]["from"]["username"]);var c=(f[i]["from"]["profile_picture"]);var a=jQuery('<div class="wdi_single_comment"></div>');a.append(jQuery('<p class="wdi_comment_header_p"><span class="wdi_comment_header"><a target="_blank" href="//instagram.com/'+g+'">'+g+'</a></span><span class="wdi_comment_date">'+wdi_front.convertUnixDate(f[i]["created_time"])+"</span></p>"));a.append(jQuery('<div class="wdi_comment_body_p"><span class="wdi_comment_body"><p>'+d+"</p></span></div>"));jQuery("#wdi_added_comments").prepend(a)}this.updateScrollbar()},updateScrollbar:function(){var b=jQuery("#wdi_comments");var a=jQuery("#wdi_added_comments");jQuery(".wdi_comments").attr("class","wdi_comments");jQuery(".wdi_comments").html("");jQuery(".wdi_comments").append(b);jQuery(".wdi_comments").append(a);jQuery(".wdi_comments_close_btn").on("click",wdi_comment)},getAjaxComments:function(){this.instagram.getRecentMediaComments(this.media_id,{success:function(a){if(a==""||a==undefined||a==null){errorMessage="Network Error, please try again later :(";console.log("%c"+errorMessage,"color:#cc0000;");return}if(a.meta["code"]!=200){errorMessage=a.meta["error_message"];console.log("%c"+errorMessage,"color:#cc0000;");return}wdi_comments_manager.mediaComments=a.data;var b=wdi_data[wdi_comments_manager.currentKey];b.comments_data=a.data;wdi_comments_manager.showComments(b.comments_data,wdi_comments_manager.load_more_count);wdi_comments_manager.ajax_comments_ready(a.data)}})},ajax_comments_ready:function(a){this.createLoadMoreAndBindEvent()},createLoadMoreAndBindEvent:function(){jQuery("#wdi_added_comments").prepend(jQuery('<p id="wdi_load_more_comments" class="wdi_load_more_comments">load more comments</p>'));jQuery(".wdi_comment_container #wdi_load_more_comments").on("click",function(){jQuery(this).remove();wdi_comments_manager.showComments(wdi_comments_manager.mediaComments,wdi_comments_manager.load_more_count);wdi_comments_manager.createLoadMoreAndBindEvent()})},filterCommentText:function(d){var c=d.split(" ");var b="";for(var a=0;a<c.length;a++){switch(c[a][0]){case"@":b+='<a target="blank" class="wdi_comm_text_link" href="//instagram.com/'+c[a].substring(1,c[a].length)+'">'+c[a]+"</a> ";break;case"#":b+='<a target="blank" class="wdi_comm_text_link" href="//instagram.com/explore/tags/'+c[a].substring(1,c[a].length)+'">'+c[a]+"</a> ";break;default:b+=c[a]+" "}}b=b.substring(0,b.length-1);return b}};function wdi_spider_set_input_value(b,a){if(document.getElementById(b)){document.getElementById(b).value=a}}function wdi_spider_form_submit(b,a){if(document.getElementById(a)){document.getElementById(a).submit()}if(b.preventDefault){b.preventDefault()}else{b.returnValue=false}}function wdi_spider_check_required(b,a){if(jQuery("#"+b).val()==""){wdi_front.show_alert(a+"* "+wdi_objectL10n.wdi_field_required);jQuery("#"+b).attr("style","border-color: #FF0000;");jQuery("#"+b).focus();return true}else{return false}}function wdi_spider_check_email(b){if(jQuery("#"+b).val()!=""){var a=jQuery("#"+b).val().replace(/^\s+|\s+$/g,"");if(a.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)==-1){wdi_front.show_alert(wdi_objectL10n.wdi_mail_validation);return true}return false}}function wdi_captcha_refresh(a){if(document.getElementById(a+"_img")&&document.getElementById(a+"_input")){srcArr=document.getElementById(a+"_img").src.split("&r=");document.getElementById(a+"_img").src=srcArr[0]+"&r="+Math.floor(Math.random()*100);document.getElementById(a+"_img").style.display="inline-block";document.getElementById(a+"_input").value=""}}function wdi_play_pause(e){var f=navigator.userAgent.indexOf("Chrome")>-1;var d=navigator.userAgent.indexOf("Safari")>-1;if((f)&&(d)){d=false}if(d){return}var c=e.get(0);var b=/firefox/i;var a=false;if(navigator.userAgent.match(b)){a=true}if(!a){if(!c.paused){c.pause()}else{c.play()}}}function wdi_spider_display_embed(m,n,j,g){var b="";switch(m){case"EMBED_OEMBED_YOUTUBE_VIDEO":var k="<iframe ";if(n!=""){k+=' src="//www.youtube.com/embed/'+n+'?enablejsapi=1&wmode=transparent"'}for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){k+=" "+attr+'="'+j[attr]+'"'}}}k+=" ></iframe>";b+=k;break;case"EMBED_OEMBED_VIMEO_VIDEO":var f="<iframe ";if(n!=""){f+=' src="//player.vimeo.com/video/'+n+'?enablejsapi=1"'}for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){f+=" "+attr+'="'+j[attr]+'"'}}}f+=" ></iframe>";b+=f;break;case"EMBED_OEMBED_FLICKR_IMAGE":var d="<div ";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){d+=" "+attr+'="'+j[attr]+'"'}}}d+=" >";if(n!=""){d+='<img src="'+n+'" style="max-width:100% !important; max-height:100% !important; width:auto !important; height:auto !important;">'}d+="</div>";b+=d;break;case"EMBED_OEMBED_FLICKR_VIDEO":break;case"EMBED_OEMBED_INSTAGRAM_VIDEO":var e="<div ";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){e+=" "+attr+'="'+j[attr]+'"'}}}e+=" >";if(n!=""){e+='<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls><source src="'+n+'" type="video/mp4"> Your browser does not support the video tag. </video>'}e+="</div>";b+=e;break;case"EMBED_OEMBED_INSTAGRAM_IMAGE":var e="<div ";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){e+=" "+attr+'="'+j[attr]+'"'}}}e+=" >";if(g!=null&&g.length){for(var c=0;c<g.length;c++){if(g[c]["type"]=="image"){e+='<img src="'+g[c]["images"]["standard_resolution"]["url"]+'" style="max-width:100% !important; max-height:100% !important; width:auto !important; height:auto !important;" data-id="'+c+'" class="carousel_media '+(c==0?"active":"")+'">'}else{if(g[c]["type"]=="video"){e+='<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls data-id="'+c+'" class="carousel_media '+(c==0?"active":"")+'"><source src="'+g[c]["videos"]["standard_resolution"]["url"]+'" type="video/mp4"> Your browser does not support the video tag. </video>'}}}}else{if(n!=""){e+='<img src="//instagram.com/p/'+n+'/media/?size=l" style=" max-width:100% !important; max-height:100% !important; width:auto; height:auto;">'}}e+="</div>";b+=e;break;case"EMBED_OEMBED_INSTAGRAM_POST":var e="<div ";var a="";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){e+=" "+attr+'="'+j[attr]+'"';if(attr=="CLASS"||attr=="class"||attr=="Class"){obj_class=j[attr]}}}}e+=" >";if(n!=""){e+='<iframe class="inner_instagram_iframe_'+obj_class+'" src="//instagr.am/p/'+n+'/embed/?enablejsapi=1" style="max-width:100% !important; max-height:100% !important; width:100%; height:100%; margin:0; display:table-cell; vertical-align:middle;"frameborder="0" scrolling="no" allowtransparency="false" allowfullscreen></iframe>'}e+="</div>";b+=e;break;case"EMBED_OEMBED_DAILYMOTION_VIDEO":var l="<iframe ";if(n!=""){l+=' src="//www.dailymotion.com/embed/video/'+n+'?api=postMessage"'}for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){l+=" "+attr+'="'+j[attr]+'"'}}}l+=" ></iframe>";b+=l;break;case"EMBED_OEMBED_IMGUR":var h="<div ";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){e+=" "+attr+'="'+j[attr]+'"'}}}h+=" >";if(n!=""){h+='<img src="'+n+'" style="max-width:100% !important; max-height:100% !important; width:auto; height:auto !important;">'}h+="</div>";b+=h;break;default:}return b}function wdi_testBrowser_cssTransitions(){return wdi_testDom("Transition")}function wdi_testBrowser_cssTransforms3d(){return wdi_testDom("Perspective")}function wdi_testDom(d){var a=["","-webkit-","-moz-","-ms-","-o-","-khtml-"];var c=["","Webkit","Moz","ms","O","Khtml"];var b=c.length;while(b--){if(typeof document.body.style[c[b]+d]!=="undefined"){return true}}return false}function wdi_cube(c,d,b,a,k,l,h,j,e,g){if(!wdi_testBrowser_cssTransitions()){return wdi_fallback(j,e,g)}if(!wdi_testBrowser_cssTransforms3d()){return wdi_fallback3d(j,e,g)}wdi_trans_in_progress=true;jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive");jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");jQuery(".wdi_slide_bg").css("perspective",1000);jQuery(j).css({transform:"translateZ("+c+"px)",backfaceVisibility:"hidden"});jQuery(e).css({opacity:1,filter:"Alpha(opacity=100)",backfaceVisibility:"hidden",transform:"translateY("+b+"px) translateX("+d+"px) rotateY("+k+"deg) rotateX("+a+"deg)"});jQuery(".wdi_slider").css({transform:"translateZ(-"+c+"px)",transformStyle:"preserve-3d"});setTimeout(function(){jQuery(".wdi_slider").css({transition:"all "+wdi_transition_duration+"ms ease-in-out",transform:"translateZ(-"+c+"px) rotateX("+l+"deg) rotateY("+h+"deg)"})},20);jQuery(".wdi_slider").one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(f));function f(){jQuery(j).removeAttr("style");jQuery(e).removeAttr("style");jQuery(".wdi_slider").removeAttr("style");jQuery(j).css({opacity:0,filter:"Alpha(opacity=0)","z-index":1});jQuery(e).css({opacity:1,filter:"Alpha(opacity=100)","z-index":2});wdi_trans_in_progress=false;jQuery(j).html("");if(typeof event_stack!=="undefined"){if(event_stack.length>0){key=event_stack[0].split("-");event_stack.shift();wdi_change_image(key[0],key[1],wdi_data,true)}}wdi_change_watermark_container()}}function wdi_cubeH(b,a,d){var c=jQuery(b).width()/2;if(d=="right"){wdi_cube(c,c,0,0,90,0,-90,b,a,d)}else{if(d=="left"){wdi_cube(c,-c,0,0,-90,0,90,b,a,d)}}}function wdi_cubeV(b,a,d){var c=jQuery(b).height()/2;if(d=="right"){wdi_cube(c,0,-c,90,0,-90,0,b,a,d)}else{if(d=="left"){wdi_cube(c,0,c,-90,0,90,0,b,a,d)}}}function wdi_fallback(b,a,c){wdi_fade(b,a,c)}function wdi_fallback3d(b,a,c){wdi_sliceV(b,a,c)}function wdi_none(b,a,c){jQuery(b).css({opacity:0,"z-index":1});jQuery(a).css({opacity:1,"z-index":2});jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive");jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");wdi_trans_in_progress=false;jQuery(b).html("");wdi_change_watermark_container()}function wdi_fade(b,a,c){jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive");jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");if(wdi_testBrowser_cssTransitions()){jQuery(a).css("transition","opacity "+wdi_transition_duration+"ms linear");jQuery(b).css({opacity:0,"z-index":1});jQuery(a).css({opacity:1,"z-index":2});wdi_change_watermark_container()}else{jQuery(b).animate({opacity:0,"z-index":1},wdi_transition_duration);jQuery(a).animate({opacity:1,"z-index":2},{duration:wdi_transition_duration,complete:function(){wdi_trans_in_progress=false;jQuery(b).html("");wdi_change_watermark_container()}});jQuery(b).fadeTo(wdi_transition_duration,0);jQuery(a).fadeTo(wdi_transition_duration,1)}}function wdi_grid(k,L,w,I,H,o,u,A,M,g){if(!wdi_testBrowser_cssTransitions()){return wdi_fallback(A,M,g)}wdi_trans_in_progress=true;jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive");jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");var F=(wdi_transition_duration)/(k+L);function x(P,Y,V,R,Q,X,O,W,U,T,j){var S=(T+j)*F;return jQuery('<span class="wdi_gridlet" />').css({display:"block",width:P,height:Y,top:V,left:Q,backgroundImage:'url("'+O+'")',backgroundColor:jQuery(".wdi_spider_popup_wrap").css("background-color"),backgroundRepeat:"no-repeat",backgroundPosition:X+"px "+R+"px",backgroundSize:W+"px "+U+"px",transition:"all "+wdi_transition_duration+"ms ease-in-out "+S+"ms",transform:"none"})}var v=jQuery(A).find("img");var D=jQuery('<span style="display: block;" />').addClass("wdi_grid");jQuery(A).prepend(D);var z=jQuery(".wdi_slide_bg");var n=v.width();var b=v.height();var C=z.width(),h=z.height(),q=Math.floor(C/k),e=Math.floor(h/L),d=C-(k*q),G=Math.ceil(d/k),p=h-(L*e),f=Math.ceil(p/L),t=0,y=Math.ceil((jQuery(".wdi_slide_bg").width()-v.width())/2);var E=typeof v.attr("src")=="undefined"?"":v.attr("src");I=I==="auto"?C:I;I=I==="min-auto"?-C:I;H=H==="auto"?h:H;H=H==="min-auto"?-h:H;for(var K=0;K<k;K++){var N=0,m=Math.floor((jQuery(".wdi_slide_bg").height()-v.height())/2),B=q;if(d>0){var c=d>=G?G:d;B+=c;d-=c}for(var J=0;J<L;J++){var r=e,s=p;if(s>0){c=s>=f?f:p;r+=c;s-=c}D.append(x(B,r,N,m,t,y,E,n,b,K,J));N+=r;m-=r}y-=B;t+=B}var a=D.children().last();D.show();v.css("opacity",0);D.children().first().addClass("rs-top-left");D.children().last().addClass("rs-bottom-right");D.children().eq(L-1).addClass("rs-bottom-left");D.children().eq(-L).addClass("rs-top-right");setTimeout(function(){D.children().css({opacity:u,transform:"rotate("+w+"deg) translateX("+I+"px) translateY("+H+"px) scale("+o+")"})},1);jQuery(M).css("opacity",1);jQuery(a).one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(l));function l(){jQuery(A).css({opacity:0,"z-index":1});jQuery(M).css({opacity:1,"z-index":2});v.css("opacity",1);D.remove();wdi_trans_in_progress=false;jQuery(A).html("");if(typeof event_stack!=="undefined"){if(event_stack.length>0){key=event_stack[0].split("-");event_stack.shift();wdi_change_image(key[0],key[1],wdi_data,true)}}wdi_change_watermark_container()}}function wdi_sliceH(b,a,c){if(c=="right"){var d="min-auto"}else{if(c=="left"){var d="auto"}}wdi_grid(1,8,0,d,0,1,0,b,a,c)}function wdi_sliceV(b,a,d){if(d=="right"){var c="min-auto"}else{if(d=="left"){var c="auto"}}wdi_grid(10,1,0,0,c,1,0,b,a,d)}function wdi_slideV(b,a,d){if(d=="right"){var c="auto"}else{if(d=="left"){var c="min-auto"}}wdi_grid(1,1,0,0,c,1,1,b,a,d)}function wdi_slideH(b,a,c){if(c=="right"){var d="min-auto"}else{if(c=="left"){var d="auto"}}wdi_grid(1,1,0,d,0,1,1,b,a,c)}function wdi_scaleOut(b,a,c){wdi_grid(1,1,0,0,0,1.5,0,b,a,c)}function wdi_scaleIn(b,a,c){wdi_grid(1,1,0,0,0,0.5,0,b,a,c)}function wdi_blockScale(b,a,c){wdi_grid(8,6,0,0,0,0.6,0,b,a,c)}function wdi_kaleidoscope(b,a,c){wdi_grid(10,8,0,0,0,1,0,b,a,c)}function wdi_fan(b,a,d){if(d=="right"){var c=45;var e=100}else{if(d=="left"){var c=-45;var e=-100}}wdi_grid(1,10,c,e,0,1,0,b,a,d)}function wdi_blindV(b,a,c){wdi_grid(1,8,0,0,0,0.7,0,b,a)}function wdi_blindH(b,a,c){wdi_grid(10,1,0,0,0,0.7,0,b,a)}function wdi_random(c,b,d){var a=["sliceH","sliceV","slideH","slideV","scaleOut","scaleIn","blockScale","kaleidoscope","fan","blindH","blindV"];this["wdi_"+a[Math.floor(Math.random()*a.length)]](c,b,d)}function wdi_pause_stream(a){jQuery(a).find("video").each(function(){jQuery(this).get(0).pause()})}function wdi_reset_zoom(){var a=(/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));var b=document.querySelector('meta[name="viewport"]');if(a){if(b){b.content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0"}}};
1
+ var isPopUpOpened=false;var wdi_data=[];function wdi_spider_createpopup(a,k,b,m,e,l,f,j,h){a=a.replace(/&#038;/g,"&");if(isPopUpOpened){return}isPopUpOpened=true;if(wdi_spider_hasalreadyreceivedpopup(l)||wdi_spider_isunsupporteduseragent()){return}jQuery("html").attr("style","overflow:hidden !important;");jQuery("#wdi_spider_popup_loading_"+k).css({display:"block"});jQuery("#wdi_spider_popup_overlay_"+k).css({display:"block"});var d=0;var c;for(var g=0;g<j.parsedData.length;g++){if(j.parsedData[g].id===h){d=g;c=[j.parsedData[g]];break}}jQuery.ajax({type:"POST",url:a,dataType:"text",data:{action:"WDIGalleryBox",image_rows:JSON.stringify(c),feed_id:j.feed_row.id,feed_counter:j.feed_row.wdi_feed_counter,current_image_index:d,image_rows_count:j.parsedData.length,carousel_media_row:JSON.stringify(c[0].carousel_media)},success:function(o){var n=jQuery('<div id="wdi_spider_popup_wrap" class="wdi_spider_popup_wrap wdi_lightbox_theme_'+j.feed_row.theme_id+'" style="width:'+b+"px;height:"+m+"px;margin-top:-"+(m/2)+"px;margin-left: -"+(b/2)+'px; ">'+o+"</div>");var p=new wdi_construct_popup(n,j,j.parsedData,h);p.construct();n.hide().appendTo("body");wdi_spider_showpopup(l,f,n,e);jQuery("#wdi_spider_popup_loading_"+k).css({display:"none !important;"})}})}var wdi_construct_popup=function(a,b,c,d){this.theme_row={};this.construct=function(){this.theme_row=window["wdi_theme_"+b.feed_row.theme_id];if(b.feed_row.popup_enable_filmstrip&&b.feed_row.popup_enable_filmstrip==="1"){this.add_filmstrip()}this.set_wdi_data()};this.add_filmstrip=function(){var l="horizontal";if(this.theme_row.lightbox_filmstrip_pos==="right"||this.theme_row.lightbox_filmstrip_pos==="left"){l="vertical"}var y=(l==="horizontal")?"fa-angle-left":"fa-angle-up";var x=(l==="horizontal")?"fa-angle-right":"fa-angle-down";var h="";var q,f;if(l==="horizontal"){f=q=(typeof b.feed_row.popup_filmstrip_height!=="undefined")?(b.feed_row.popup_filmstrip_height):"20"}else{f=q=(typeof b.feed_row.popup_filmstrip_height!=="undefined")?(b.feed_row.popup_filmstrip_height):"50"}q=f=parseInt(f);for(var w=0;w<c.length;w++){var e=c[w];var s,k,A;if(e.resolution&&e.resolution!==""){var n=e.resolution.split(" ");var p=intval($resolution_arr[0]);var z=intval($resolution_arr[2]);if(p!==0&&z!==0){A=Math.max(f/p,q/z);s=p*A;k=z*A}else{s=f;k=q}}else{s=f;k=q}A=Math.max(f/s,q/k);s*=A;k*=A;var g=(f-s)/2;var j=(q-k)/2;var u="wdi_filmstrip_thumbnail "+((parseInt(e.id)===parseInt(d))?"wdi_thumb_active":"wdi_thumb_deactive");var t="width:"+s+"px;height:"+k+"px;margin-left:"+g+"px;margin-top:"+j+"px;";var m=(typeof e.images[b.feedImageResolution]["url"]!=="undefined")?e.images[b.feedImageResolution]["url"]:e.thumb_url;var B="wdi_change_image(parseInt(jQuery('#wdi_current_image_key').val()), '"+w+"', wdi_data)";var v="wdi_change_image(parseInt(jQuery('#wdi_current_image_key').val()), '"+w+"', wdi_data)";var r='<img style="'+t+'" class="wdi_filmstrip_thumbnail_img" src="'+m+'" onclick="'+B+'" ontouchend="'+v+'" image_id="'+e.id+'" image_key="'+w+'" alt="'+e.alt+'" />';h+='<div id="wdi_filmstrip_thumbnail_'+w+'" class="'+u+'">'+r+"</div>"}var o='<div class="wdi_filmstrip_left"><i class="fa '+y+'"></i></div><div class="wdi_filmstrip"><div class="wdi_filmstrip_thumbnails">'+h+'</div></div><div class="wdi_filmstrip_right"><i class="fa '+x+'"></i></div>';a.find(".wdi_filmstrip_container").append(o)};this.set_wdi_data=function(){wdi_data=[];for(var e=0;e<c.length;e++){wdi_data[e]=[];wdi_data[e]["number"]=e+1;wdi_data[e]["id"]=c[e].id;wdi_data[e]["alt"]=c[e].alt;wdi_data[e]["description"]=wdi_front.escape_tags(c[e].description);wdi_data[e]["username"]=c[e].username;wdi_data[e]["profile_picture"]=c[e].profile_picture;wdi_data[e]["image_url"]=c[e].image_url;wdi_data[e]["thumb_url"]=c[e].thumb_url;wdi_data[e]["date"]=c[e].date;wdi_data[e]["comment_count"]=c[e].comment_count;wdi_data[e]["filetype"]=c[e].filetype;wdi_data[e]["filename"]=c[e].filename;wdi_data[e]["avg_rating"]=c[e].avg_rating;wdi_data[e]["rate"]=c[e].rate;wdi_data[e]["rate_count"]=c[e].rate_count;wdi_data[e]["hit_count"]=c[e].hit_count;wdi_data[e]["comments_data"]=(typeof c[e].comments_data!=="undefined")?c[e].comments_data:"null";wdi_data[e]["carousel_media"]=(typeof c[e]["carousel_media"]!=="undefined")?c[e]["carousel_media"]:null}}};function wdi_spider_showpopup(c,a,b,d){isPopUpOpened=true;b.show();wdi_spider_receivedpopup(c,a)}function wdi_spider_hasalreadyreceivedpopup(a){if(document.cookie.indexOf(a)>-1){delete document.cookie[document.cookie.indexOf(a)]}return false}function wdi_spider_receivedpopup(c,a){var b=new Date();b.setDate(b.getDate()+a);document.cookie=c+"=true;expires="+b.toUTCString()+";path=/"}function wdi_spider_isunsupporteduseragent(){return(!window.XMLHttpRequest)}function wdi_spider_destroypopup(d){if(document.getElementById("wdi_spider_popup_wrap")!=null){wdi_comments_manager.popup_destroyed();if(typeof jQuery().fullscreen!=="undefined"&&jQuery.isFunction(jQuery().fullscreen)){if(jQuery.fullscreen.isFullScreen()){jQuery.fullscreen.exit()}}if(typeof enable_addthis!="undefined"&&enable_addthis){jQuery(".at4-share-outer").hide()}setTimeout(function(){jQuery(".wdi_spider_popup_wrap").remove();jQuery(".wdi_spider_popup_loading").css({display:"none"});jQuery(".wdi_spider_popup_overlay").css({display:"none"});jQuery(document).off("keydown");jQuery("html").attr("style","")},20)}isPopUpOpened=false;var a=(/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));var c=document.querySelector('meta[name="viewport"]');if(a&&c){c.content="width=device-width, initial-scale=1"}var b=jQuery(document).scrollTop();window.location.hash="";jQuery(document).scrollTop(b);if(typeof wdi_playInterval!="undefined"){clearInterval(wdi_playInterval)}}Object.size=function(c){var b=0,a;for(a in c){if(c.hasOwnProperty(a)){b++}}return b};function wdi_spider_ajax_save(a,b){wdi_comments_manager.init(b);return false}wdi_comments_manager={media_id:"",mediaComments:[],load_more_count:10,commentCounter:0,currentKey:-1,init:function(a){this.instagram=new WDIInstagram();this.instagram.addToken(wdi_front.access_token);if(this.currentKey!=a){this.currentKey=a;this.reset_comments()}else{}},reset_comments:function(){jQuery("#wdi_load_more_comments").remove();jQuery("#wdi_added_comments").html("");this.commentCounter=0;this.media_id=wdi_data[this.currentKey]["id"];this.getAjaxComments(this.currentKey)},popup_destroyed:function(){this.media_id="";this.mediaComments=[];this.commentCounter=0;this.currentKey=-1},showComments:function(f,e){if(Object.size(f)-this.commentCounter-e<0||e===undefined){e=Object.size(f)-this.commentCounter}var b=this.commentCounter;for(i=Object.size(f)-b-1;i>=Object.size(f)-b-e;i--){this.commentCounter++;var d=(f[i]["text"]);d=wdi_front.escape_tags(d);d=this.filterCommentText(d);var g=(f[i]["from"]["username"]);var c=(f[i]["from"]["profile_picture"]);var a=jQuery('<div class="wdi_single_comment"></div>');a.append(jQuery('<p class="wdi_comment_header_p"><span class="wdi_comment_header"><a target="_blank" href="//instagram.com/'+g+'">'+g+'</a></span><span class="wdi_comment_date">'+wdi_front.convertUnixDate(f[i]["created_time"])+"</span></p>"));a.append(jQuery('<div class="wdi_comment_body_p"><span class="wdi_comment_body"><p>'+d+"</p></span></div>"));jQuery("#wdi_added_comments").prepend(a)}this.updateScrollbar()},updateScrollbar:function(){var b=jQuery("#wdi_comments");var a=jQuery("#wdi_added_comments");jQuery(".wdi_comments").attr("class","wdi_comments");jQuery(".wdi_comments").html("");jQuery(".wdi_comments").append(b);jQuery(".wdi_comments").append(a);jQuery(".wdi_comments_close_btn").on("click",wdi_comment)},getAjaxComments:function(){this.instagram.getRecentMediaComments(this.media_id,{success:function(a){if(a==""||a==undefined||a==null){errorMessage="Network Error, please try again later :(";console.log("%c"+errorMessage,"color:#cc0000;");return}if(a.meta["code"]!=200){errorMessage=a.meta["error_message"];console.log("%c"+errorMessage,"color:#cc0000;");return}wdi_comments_manager.mediaComments=a.data;var b=wdi_data[wdi_comments_manager.currentKey];b.comments_data=a.data;wdi_comments_manager.showComments(b.comments_data,wdi_comments_manager.load_more_count);wdi_comments_manager.ajax_comments_ready(a.data)}})},ajax_comments_ready:function(a){this.createLoadMoreAndBindEvent()},createLoadMoreAndBindEvent:function(){jQuery("#wdi_added_comments").prepend(jQuery('<p id="wdi_load_more_comments" class="wdi_load_more_comments">load more comments</p>'));jQuery(".wdi_comment_container #wdi_load_more_comments").on("click",function(){jQuery(this).remove();wdi_comments_manager.showComments(wdi_comments_manager.mediaComments,wdi_comments_manager.load_more_count);wdi_comments_manager.createLoadMoreAndBindEvent()})},filterCommentText:function(d){var c=d.split(" ");var b="";for(var a=0;a<c.length;a++){switch(c[a][0]){case"@":b+='<a target="blank" class="wdi_comm_text_link" href="//instagram.com/'+c[a].substring(1,c[a].length)+'">'+c[a]+"</a> ";break;case"#":b+='<a target="blank" class="wdi_comm_text_link" href="//instagram.com/explore/tags/'+c[a].substring(1,c[a].length)+'">'+c[a]+"</a> ";break;default:b+=c[a]+" "}}b=b.substring(0,b.length-1);return b}};function wdi_spider_set_input_value(b,a){if(document.getElementById(b)){document.getElementById(b).value=a}}function wdi_spider_form_submit(b,a){if(document.getElementById(a)){document.getElementById(a).submit()}if(b.preventDefault){b.preventDefault()}else{b.returnValue=false}}function wdi_spider_check_required(b,a){if(jQuery("#"+b).val()==""){wdi_front.show_alert(a+"* "+wdi_objectL10n.wdi_field_required);jQuery("#"+b).attr("style","border-color: #FF0000;");jQuery("#"+b).focus();return true}else{return false}}function wdi_spider_check_email(b){if(jQuery("#"+b).val()!=""){var a=jQuery("#"+b).val().replace(/^\s+|\s+$/g,"");if(a.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)==-1){wdi_front.show_alert(wdi_objectL10n.wdi_mail_validation);return true}return false}}function wdi_captcha_refresh(a){if(document.getElementById(a+"_img")&&document.getElementById(a+"_input")){srcArr=document.getElementById(a+"_img").src.split("&r=");document.getElementById(a+"_img").src=srcArr[0]+"&r="+Math.floor(Math.random()*100);document.getElementById(a+"_img").style.display="inline-block";document.getElementById(a+"_input").value=""}}function wdi_play_pause(e){var f=navigator.userAgent.indexOf("Chrome")>-1;var d=navigator.userAgent.indexOf("Safari")>-1;if((f)&&(d)){d=false}if(d){return}var c=e.get(0);var b=/firefox/i;var a=false;if(navigator.userAgent.match(b)){a=true}if(!a){if(!c.paused){c.pause()}else{c.play()}}}function wdi_spider_display_embed(m,n,j,g){var b="";switch(m){case"EMBED_OEMBED_YOUTUBE_VIDEO":var k="<iframe ";if(n!=""){k+=' src="//www.youtube.com/embed/'+n+'?enablejsapi=1&wmode=transparent"'}for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){k+=" "+attr+'="'+j[attr]+'"'}}}k+=" ></iframe>";b+=k;break;case"EMBED_OEMBED_VIMEO_VIDEO":var f="<iframe ";if(n!=""){f+=' src="//player.vimeo.com/video/'+n+'?enablejsapi=1"'}for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){f+=" "+attr+'="'+j[attr]+'"'}}}f+=" ></iframe>";b+=f;break;case"EMBED_OEMBED_FLICKR_IMAGE":var d="<div ";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){d+=" "+attr+'="'+j[attr]+'"'}}}d+=" >";if(n!=""){d+='<img src="'+n+'" style="max-width:100% !important; max-height:100% !important; width:auto !important; height:auto !important;">'}d+="</div>";b+=d;break;case"EMBED_OEMBED_FLICKR_VIDEO":break;case"EMBED_OEMBED_INSTAGRAM_VIDEO":var e="<div ";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){e+=" "+attr+'="'+j[attr]+'"'}}}e+=" >";if(n!=""){e+='<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls><source src="'+n+'" type="video/mp4"> Your browser does not support the video tag. </video>'}e+="</div>";b+=e;break;case"EMBED_OEMBED_INSTAGRAM_IMAGE":var e="<div ";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){e+=" "+attr+'="'+j[attr]+'"'}}}e+=" >";if(g!=null&&g.length){for(var c=0;c<g.length;c++){if(g[c]["type"]=="image"){e+='<img src="'+g[c]["images"]["standard_resolution"]["url"]+'" style="max-width:100% !important; max-height:100% !important; width:auto !important; height:auto !important;" data-id="'+c+'" class="carousel_media '+(c==0?"active":"")+'">'}else{if(g[c]["type"]=="video"){e+='<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls data-id="'+c+'" class="carousel_media '+(c==0?"active":"")+'"><source src="'+g[c]["videos"]["standard_resolution"]["url"]+'" type="video/mp4"> Your browser does not support the video tag. </video>'}}}}else{if(n!=""){e+='<img src="//instagram.com/p/'+n+'/media/?size=l" style=" max-width:100% !important; max-height:100% !important; width:auto; height:auto;">'}}e+="</div>";b+=e;break;case"EMBED_OEMBED_INSTAGRAM_POST":var e="<div ";var a="";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){e+=" "+attr+'="'+j[attr]+'"';if(attr=="CLASS"||attr=="class"||attr=="Class"){obj_class=j[attr]}}}}e+=" >";if(n!=""){e+='<iframe class="inner_instagram_iframe_'+obj_class+'" src="//instagr.am/p/'+n+'/embed/?enablejsapi=1" style="max-width:100% !important; max-height:100% !important; width:100%; height:100%; margin:0; display:table-cell; vertical-align:middle;"frameborder="0" scrolling="no" allowtransparency="false" allowfullscreen></iframe>'}e+="</div>";b+=e;break;case"EMBED_OEMBED_DAILYMOTION_VIDEO":var l="<iframe ";if(n!=""){l+=' src="//www.dailymotion.com/embed/video/'+n+'?api=postMessage"'}for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){l+=" "+attr+'="'+j[attr]+'"'}}}l+=" ></iframe>";b+=l;break;case"EMBED_OEMBED_IMGUR":var h="<div ";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){e+=" "+attr+'="'+j[attr]+'"'}}}h+=" >";if(n!=""){h+='<img src="'+n+'" style="max-width:100% !important; max-height:100% !important; width:auto; height:auto !important;">'}h+="</div>";b+=h;break;default:}return b}function wdi_testBrowser_cssTransitions(){return wdi_testDom("Transition")}function wdi_testBrowser_cssTransforms3d(){return wdi_testDom("Perspective")}function wdi_testDom(d){var a=["","-webkit-","-moz-","-ms-","-o-","-khtml-"];var c=["","Webkit","Moz","ms","O","Khtml"];var b=c.length;while(b--){if(typeof document.body.style[c[b]+d]!=="undefined"){return true}}return false}function wdi_cube(c,d,b,a,k,l,h,j,e,g){if(!wdi_testBrowser_cssTransitions()){return wdi_fallback(j,e,g)}if(!wdi_testBrowser_cssTransforms3d()){return wdi_fallback3d(j,e,g)}wdi_trans_in_progress=true;jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive");jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");jQuery(".wdi_slide_bg").css("perspective",1000);jQuery(j).css({transform:"translateZ("+c+"px)",backfaceVisibility:"hidden"});jQuery(e).css({opacity:1,filter:"Alpha(opacity=100)",backfaceVisibility:"hidden",transform:"translateY("+b+"px) translateX("+d+"px) rotateY("+k+"deg) rotateX("+a+"deg)"});jQuery(".wdi_slider").css({transform:"translateZ(-"+c+"px)",transformStyle:"preserve-3d"});setTimeout(function(){jQuery(".wdi_slider").css({transition:"all "+wdi_transition_duration+"ms ease-in-out",transform:"translateZ(-"+c+"px) rotateX("+l+"deg) rotateY("+h+"deg)"})},20);jQuery(".wdi_slider").one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(f));function f(){jQuery(j).removeAttr("style");jQuery(e).removeAttr("style");jQuery(".wdi_slider").removeAttr("style");jQuery(j).css({opacity:0,filter:"Alpha(opacity=0)","z-index":1});jQuery(e).css({opacity:1,filter:"Alpha(opacity=100)","z-index":2});wdi_trans_in_progress=false;jQuery(j).html("");if(typeof event_stack!=="undefined"){if(event_stack.length>0){key=event_stack[0].split("-");event_stack.shift();wdi_change_image(key[0],key[1],wdi_data,true)}}wdi_change_watermark_container()}}function wdi_cubeH(b,a,d){var c=jQuery(b).width()/2;if(d=="right"){wdi_cube(c,c,0,0,90,0,-90,b,a,d)}else{if(d=="left"){wdi_cube(c,-c,0,0,-90,0,90,b,a,d)}}}function wdi_cubeV(b,a,d){var c=jQuery(b).height()/2;if(d=="right"){wdi_cube(c,0,-c,90,0,-90,0,b,a,d)}else{if(d=="left"){wdi_cube(c,0,c,-90,0,90,0,b,a,d)}}}function wdi_fallback(b,a,c){wdi_fade(b,a,c)}function wdi_fallback3d(b,a,c){wdi_sliceV(b,a,c)}function wdi_none(b,a,c){jQuery(b).css({opacity:0,"z-index":1});jQuery(a).css({opacity:1,"z-index":2});jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive");jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");wdi_trans_in_progress=false;jQuery(b).html("");wdi_change_watermark_container()}function wdi_fade(b,a,c){jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive");jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");if(wdi_testBrowser_cssTransitions()){jQuery(a).css("transition","opacity "+wdi_transition_duration+"ms linear");jQuery(b).css({opacity:0,"z-index":1});jQuery(a).css({opacity:1,"z-index":2});wdi_change_watermark_container()}else{jQuery(b).animate({opacity:0,"z-index":1},wdi_transition_duration);jQuery(a).animate({opacity:1,"z-index":2},{duration:wdi_transition_duration,complete:function(){wdi_trans_in_progress=false;jQuery(b).html("");wdi_change_watermark_container()}});jQuery(b).fadeTo(wdi_transition_duration,0);jQuery(a).fadeTo(wdi_transition_duration,1)}}function wdi_grid(k,L,w,I,H,o,u,A,M,g){if(!wdi_testBrowser_cssTransitions()){return wdi_fallback(A,M,g)}wdi_trans_in_progress=true;jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive");jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");var F=(wdi_transition_duration)/(k+L);function x(P,Y,V,R,Q,X,O,W,U,T,j){var S=(T+j)*F;return jQuery('<span class="wdi_gridlet" />').css({display:"block",width:P,height:Y,top:V,left:Q,backgroundImage:'url("'+O+'")',backgroundColor:jQuery(".wdi_spider_popup_wrap").css("background-color"),backgroundRepeat:"no-repeat",backgroundPosition:X+"px "+R+"px",backgroundSize:W+"px "+U+"px",transition:"all "+wdi_transition_duration+"ms ease-in-out "+S+"ms",transform:"none"})}var v=jQuery(A).find("img");var D=jQuery('<span style="display: block;" />').addClass("wdi_grid");jQuery(A).prepend(D);var z=jQuery(".wdi_slide_bg");var n=v.width();var b=v.height();var C=z.width(),h=z.height(),q=Math.floor(C/k),e=Math.floor(h/L),d=C-(k*q),G=Math.ceil(d/k),p=h-(L*e),f=Math.ceil(p/L),t=0,y=Math.ceil((jQuery(".wdi_slide_bg").width()-v.width())/2);var E=typeof v.attr("src")=="undefined"?"":v.attr("src");I=I==="auto"?C:I;I=I==="min-auto"?-C:I;H=H==="auto"?h:H;H=H==="min-auto"?-h:H;for(var K=0;K<k;K++){var N=0,m=Math.floor((jQuery(".wdi_slide_bg").height()-v.height())/2),B=q;if(d>0){var c=d>=G?G:d;B+=c;d-=c}for(var J=0;J<L;J++){var r=e,s=p;if(s>0){c=s>=f?f:p;r+=c;s-=c}D.append(x(B,r,N,m,t,y,E,n,b,K,J));N+=r;m-=r}y-=B;t+=B}var a=D.children().last();D.show();v.css("opacity",0);D.children().first().addClass("rs-top-left");D.children().last().addClass("rs-bottom-right");D.children().eq(L-1).addClass("rs-bottom-left");D.children().eq(-L).addClass("rs-top-right");setTimeout(function(){D.children().css({opacity:u,transform:"rotate("+w+"deg) translateX("+I+"px) translateY("+H+"px) scale("+o+")"})},1);jQuery(M).css("opacity",1);jQuery(a).one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(l));function l(){jQuery(A).css({opacity:0,"z-index":1});jQuery(M).css({opacity:1,"z-index":2});v.css("opacity",1);D.remove();wdi_trans_in_progress=false;jQuery(A).html("");if(typeof event_stack!=="undefined"){if(event_stack.length>0){key=event_stack[0].split("-");event_stack.shift();wdi_change_image(key[0],key[1],wdi_data,true)}}wdi_change_watermark_container()}}function wdi_sliceH(b,a,c){if(c=="right"){var d="min-auto"}else{if(c=="left"){var d="auto"}}wdi_grid(1,8,0,d,0,1,0,b,a,c)}function wdi_sliceV(b,a,d){if(d=="right"){var c="min-auto"}else{if(d=="left"){var c="auto"}}wdi_grid(10,1,0,0,c,1,0,b,a,d)}function wdi_slideV(b,a,d){if(d=="right"){var c="auto"}else{if(d=="left"){var c="min-auto"}}wdi_grid(1,1,0,0,c,1,1,b,a,d)}function wdi_slideH(b,a,c){if(c=="right"){var d="min-auto"}else{if(c=="left"){var d="auto"}}wdi_grid(1,1,0,d,0,1,1,b,a,c)}function wdi_scaleOut(b,a,c){wdi_grid(1,1,0,0,0,1.5,0,b,a,c)}function wdi_scaleIn(b,a,c){wdi_grid(1,1,0,0,0,0.5,0,b,a,c)}function wdi_blockScale(b,a,c){wdi_grid(8,6,0,0,0,0.6,0,b,a,c)}function wdi_kaleidoscope(b,a,c){wdi_grid(10,8,0,0,0,1,0,b,a,c)}function wdi_fan(b,a,d){if(d=="right"){var c=45;var e=100}else{if(d=="left"){var c=-45;var e=-100}}wdi_grid(1,10,c,e,0,1,0,b,a,d)}function wdi_blindV(b,a,c){wdi_grid(1,8,0,0,0,0.7,0,b,a)}function wdi_blindH(b,a,c){wdi_grid(10,1,0,0,0,0.7,0,b,a)}function wdi_random(c,b,d){var a=["sliceH","sliceV","slideH","slideV","scaleOut","scaleIn","blockScale","kaleidoscope","fan","blindH","blindV"];this["wdi_"+a[Math.floor(Math.random()*a.length)]](c,b,d)}function wdi_pause_stream(a){jQuery(a).find("video").each(function(){jQuery(this).get(0).pause()})}function wdi_reset_zoom(){var a=(/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));var b=document.querySelector('meta[name="viewport"]');if(a){if(b){b.content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0"}}};
js/wdi_frontend.js CHANGED
@@ -19,6 +19,22 @@ wdi_front.detectEvent = function ()
19
  var wdi_error_show = false;
20
 
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  wdi_front.show_alert = function (message, response, wdi_current_feed)
23
  {
24
  wdi_current_feed = jQuery('#wdi_feed_' + wdi_current_feed.feed_row.wdi_feed_counter);
@@ -1434,7 +1450,7 @@ wdi_front.createObject = function (obj, currentFeed)
1434
  }
1435
  var photoObject = {
1436
  'id': obj['id'],
1437
- 'caption': caption,
1438
  'image_url': image_url,
1439
  'likes': obj['likes']['count'],
1440
  'comments': obj['comments']['count'],
@@ -2470,10 +2486,10 @@ wdi_front.show = function (name, currentFeed)
2470
  id: response['data']['id'],
2471
  name: response['data']['username'],
2472
  url: response['data']['profile_picture'],
2473
- bio: response['data']['bio'],
2474
  counts: response['data']['counts'],
2475
- website: response['data']['website'],
2476
- full_name: response['data']['full_name']
2477
  }
2478
  currentFeed.headerUserinfo.push(obj);
2479
  i++;
@@ -2545,10 +2561,10 @@ wdi_front.show = function (name, currentFeed)
2545
  id: response['data']['id'],
2546
  name: response['data']['username'],
2547
  url: response['data']['profile_picture'],
2548
- bio: response['data']['bio'],
2549
  counts: response['data']['counts'],
2550
- website: response['data']['website'],
2551
- full_name: response['data']['full_name']
2552
  }
2553
  currentFeed.headerUserinfo.push(obj);
2554
  i++;
@@ -2589,7 +2605,7 @@ wdi_front.show = function (name, currentFeed)
2589
  'counts': info[k]["counts"],
2590
  'feed_counter': currentFeed.feed_row.wdi_feed_counter,
2591
  'user_name': info[k]['name'],
2592
- 'bio': info[k]['bio'],
2593
  'usersCount': currentFeed.feed_row.feed_users.length,
2594
  'hashtagClass': hashtagClass
2595
 
@@ -2837,7 +2853,7 @@ wdi_front.parseLighboxData = function (currentFeed, filterFlag)
2837
  'avg_rating': '',
2838
  'comment_count': data[i]['comments']['count'],
2839
  'date': wdi_front.convertUnixDate(data[i]['created_time']),
2840
- 'description': wdi_front.getDescription((data[i]['caption'] !== null) ? data[i]['caption']['text'] : ''),
2841
  'filename': wdi_front.getFileName(data[i]),
2842
  'filetype': wdi_front.getFileType(data[i]),
2843
  'hit_count': '0',
19
  var wdi_error_show = false;
20
 
21
 
22
+ wdi_front.escape_tags = function (text)
23
+ {
24
+ var lt = /</g,
25
+ gt = />/g,
26
+ ap = /'/g,
27
+ ic = /"/g;
28
+ if(typeof text == 'undefined'){
29
+ text = '';
30
+ }
31
+ text = text.toString().replace(lt, "&lt;").replace(gt, "&gt;").replace(ap, "&#39;").replace(ic, "&#34;");
32
+
33
+ return text;
34
+
35
+ }
36
+
37
+
38
  wdi_front.show_alert = function (message, response, wdi_current_feed)
39
  {
40
  wdi_current_feed = jQuery('#wdi_feed_' + wdi_current_feed.feed_row.wdi_feed_counter);
1450
  }
1451
  var photoObject = {
1452
  'id': obj['id'],
1453
+ 'caption': wdi_front.escape_tags(caption),
1454
  'image_url': image_url,
1455
  'likes': obj['likes']['count'],
1456
  'comments': obj['comments']['count'],
2486
  id: response['data']['id'],
2487
  name: response['data']['username'],
2488
  url: response['data']['profile_picture'],
2489
+ bio: wdi_front.escape_tags(response['data']['bio']),
2490
  counts: response['data']['counts'],
2491
+ website: wdi_front.escape_tags(response['data']['website']),
2492
+ full_name: wdi_front.escape_tags(response['data']['full_name'])
2493
  }
2494
  currentFeed.headerUserinfo.push(obj);
2495
  i++;
2561
  id: response['data']['id'],
2562
  name: response['data']['username'],
2563
  url: response['data']['profile_picture'],
2564
+ bio: wdi_front.escape_tags(response['data']['bio']),
2565
  counts: response['data']['counts'],
2566
+ website: wdi_front.escape_tags(response['data']['website']),
2567
+ full_name: wdi_front.escape_tags(response['data']['full_name'])
2568
  }
2569
  currentFeed.headerUserinfo.push(obj);
2570
  i++;
2605
  'counts': info[k]["counts"],
2606
  'feed_counter': currentFeed.feed_row.wdi_feed_counter,
2607
  'user_name': info[k]['name'],
2608
+ 'bio': wdi_front.escape_tags(info[k]['bio']),
2609
  'usersCount': currentFeed.feed_row.feed_users.length,
2610
  'hashtagClass': hashtagClass
2611
 
2853
  'avg_rating': '',
2854
  'comment_count': data[i]['comments']['count'],
2855
  'date': wdi_front.convertUnixDate(data[i]['created_time']),
2856
+ 'description': wdi_front.getDescription((data[i]['caption'] !== null) ? wdi_front.escape_tags(data[i]['caption']['text']) : ''),
2857
  'filename': wdi_front.getFileName(data[i]),
2858
  'filetype': wdi_front.getFileType(data[i]),
2859
  'hit_count': '0',
js/wdi_frontend.min.js CHANGED
@@ -1 +1 @@
1
- if(typeof wdi_front=="undefined"){wdi_front={type:"not_declared"}}wdi_front.detectEvent=function(){var a=(/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));if(a){return"touchend"}else{return"click"}};var wdi_error_show=false;wdi_front.show_alert=function(e,b,f){f=jQuery("#wdi_feed_"+f.feed_row.wdi_feed_counter);if(b.meta["code"]===400&&b.meta["error_type"]==="APINotAllowedError"){if(typeof b.wdi_current_feed_name!="undefined"){var a=b.wdi_current_feed_name;var d=f.find(".wdi_private_feed_names");d.html(a);f.find(".wdi_private_feed_error").removeClass("wdi_hidden")}f.find(".wdi_spinner").remove()}if(typeof f!="undefined"&&b.meta["error_type"]!="APINotAllowedError"){f.find(".wdi_spinner").remove();wdi_error_show=true;var c=f.find(".wdi_js_error");var g=f.find(".wdi_token_error");if(b!=false&&typeof b.meta!=undefined&&b.meta.error_type==="OAuthAccessTokenException"){g.removeClass("wdi_hidden");if(wdi_front_messages.wdi_token_error_flag!="1"){jQuery.ajax({type:"POST",url:wdi_url.ajax_url,dataType:"json",data:{action:"wdi_token_flag",wdi_token_flag_nonce:wdi_front_messages.wdi_token_flag_nonce},success:function(h){}})}}else{c.removeClass("wdi_js_error");c.addClass("wdi_js_error_no_animate");jQuery(".wdi_js_error_no_animate").show()}if(wdi_front_messages.show_alerts){}else{console.log("%c"+e,"color:#cc0000;")}}wdi_error_show=true};wdi_front.globalInit=function(){var a=wdi_front.feed_counter;if(typeof wdi_ajax.ajax_response!="undefined"){var c=wdi_feed_counter_init.wdi_feed_counter_init}else{var c=0}for(var b=c;b<=a;b++){if(jQuery("#wdi_feed_"+b).length===0){continue}var d=new WDIFeed(window["wdi_feed_"+b]);d.instagram=new WDIInstagram();d.instagram.filterArguments={feed:d};d.instagram.filters=[{where:"getUserRecentMedia",what:function(f,g,e){return g.feed.conditionalFilter(f,e)}},{where:"getTagRecentMedia",what:function(f,g,e){return g.feed.conditionalFilter(f,e)}},{where:"getRecentLikedMedia",what:function(f,g,e){return g.feed.conditionalFilter(f,e)}},{where:"requestByUrl",what:function(f,g,e){return g.feed.conditionalFilter(f,e)}}];d.instagram.addToken(d.feed_row["access_token"]);wdi_front.access_token=d.feed_row["access_token"];d.dataStorageRaw=[];d.dataStorage=[];d.dataStorageList=[];d.allResponseLength=0;d.currentResponseLength=0;d.temproraryUsersData=[];d.removedUsers=0;d.nowLoadingImages=true;d.imageIndex=0;d.resIndex=0;d.currentPage=1;d.userSortFlags=[];d.customFilterChanged=false;d.maxConditionalFiltersRequestCount=10;d.instagramRequestCounter=0;d.mediaRequestsDone=false;d.conditionalFilterBuffer=[];d.stopInfiniteScrollFlag=false;if(d.feed_row.feed_type=="masonry"){d.displayedData=[]}if(d.feed_row.feed_display_view=="pagination"){d.feed_row.resort_after_load_more=0;if(d.feed_row.feed_type!="image_browser"){d.feed_row.load_more_number=parseInt(d.feed_row.pagination_per_page_number);d.feed_row.number_of_photos=(1+parseInt(d.feed_row.pagination_preload_number))*d.feed_row.load_more_number}else{d.feed_row.number_of_photos=1+parseInt(d.feed_row.image_browser_preload_number);d.feed_row.load_more_number=parseInt(d.feed_row.image_browser_load_number)}d.freeSpaces=(Math.floor(d.feed_row.pagination_per_page_number/d.feed_row.number_of_columns)+1)*d.feed_row.number_of_columns-d.feed_row.pagination_per_page_number}else{d.freeSpaces=0}d.galleryBox=function(e){wdi_spider_createpopup(wdi_url.ajax_url+"?gallery_id="+this.feed_row.id+"&image_id="+e,this.feed_row.wdi_feed_counter,this.feed_row.lightbox_width,this.feed_row.lightbox_height,1,"testpopup",5,this,e)};wdi_responsive.columnControl(d);if(d.feed_row.feed_type=="masonry"){jQuery(window).trigger("resize")}wdi_front.bindEvents(d);window["wdi_feed_"+b]=d;wdi_front.init(d)}};wdi_front.init=function(c){jQuery(".wdi_js_error").hide();c.photoCounter=c.feed_row.number_of_photos;if(c.feed_row.liked_feed=="liked"){c.feed_users=["self"]}else{if(wdi_front.isJsonString(c.feed_row.feed_users)){c.feed_users=JSON.parse(c.feed_row.feed_users)}else{wdi_front.show_alert(wdi_front_messages.invalid_users_format,false,c);return}}c.dataCount=c.feed_users.length;var a=wdi_front.getFeedItemResolution(c);c.feedImageResolution=a.image;c.feedVideoResolution=a.video;for(var b=0;b<c.dataCount;b++){wdi_front.instagramRequest(b,c)}if(c.feed_row.number_of_photos>0){wdi_front.ajaxLoader(c)}if(c.feed_row["display_header"]==="1"){wdi_front.show("header",c)}if(c.feed_row["show_usernames"]==="1"){wdi_front.show("users",c)}};wdi_front.getFeedItemResolution=function(g){var d={image:"standard_resolution",video:"standard_resolution"};if(g.feed_row.feed_resolution==="thumbnail"){return{image:"thumbnail",video:"low_bandwidth"}}else{if(g.feed_row.feed_resolution==="low"){return{image:"low_resolution",video:"low_resolution"}}else{if(g.feed_row.feed_resolution==="standard"){return{image:"standard_resolution",video:"standard_resolution"}}}}var c=jQuery("#wdi_feed_"+g.feed_row.wdi_feed_counter).find(".wdi_feed_wrapper");c.append('<div class="wdi_feed_item" id="wdi_feed_item_example"></div>');wdi_responsive.columnControl(g,1);var b=c.attr("wdi-res").split("wdi_col_");c.find("#wdi_feed_item_example").remove();if(b.length!==2){return d}var a=parseInt(b[1]);if(a<=0){return d}var f=(c.width()/a)-10;var e=d;if(f<=150){e.image="thumbnail";e.video="low_bandwidth"}else{if(f>150&&f<=320){e.image="low_resolution";e.video="low_resolution"}else{e.image="standard_resolution";e.video="standard_resolution"}}return e};wdi_front.isJsonString=function(b){try{JSON.parse(b)}catch(a){return false}return true};wdi_front.instagramRequest=function(d,b){var a=b.feed_users,c=this;if(typeof a[d]==="string"&&a[d]==="self"){b.instagram.getRecentLikedMedia({success:function(e){if(typeof e.meta!="undefined"&&typeof e.meta.error_type!="undefined"){wdi_front.show_alert(false,e,b)}b.mediaRequestsDone=true;e=c.checkMediaResponse(e,b);if(e!=false){c.saveSelfUserData(e,b)}}})}else{if(this.getInputType(a[d]["username"])=="hashtag"){b.instagram.getTagRecentMedia(this.stripHashtag(a[d]["username"]),{success:function(e){if(typeof e.meta!="undefined"&&typeof e.meta.error_type!="undefined"){wdi_front.show_alert(false,e,b)}b.mediaRequestsDone=true;e=c.checkMediaResponse(e,b);if(e!=false){c.saveUserData(e,b.feed_users[d],b)}}})}else{if(this.getInputType(a[d]["username"])=="user"){b.instagram.getSelfRecentMedia({success:function(e){if(typeof e.meta!="undefined"&&typeof e.meta.error_type!="undefined"){e.wdi_current_feed_name=a[d].username;wdi_front.show_alert(false,e,b)}b.mediaRequestsDone=true;e=c.checkMediaResponse(e,b);if(e!=false){c.saveUserData(e,b.feed_users[d],b)}}})}}}};wdi_front.isHashtag=function(a){return(a[0]==="#")};wdi_front.saveUserData=function(d,a,b){d.username=a.username;d.user_id=a.id;if(d.user_id[0]==="#"){d.data=wdi_front.appendRequestHashtag(d.data,d.user_id)}b.usersData.push(d);b.currentResponseLength=wdi_front.getArrayContentLength(b.usersData,"data");b.allResponseLength+=b.currentResponseLength;if(b.dataCount==b.usersData.length){if(b.currentResponseLength<b.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(b)){wdi_front.loadMore("initial-keep",b)}else{wdi_front.displayFeed(b);wdi_front.applyFilters(b);if(!wdi_front.activeUsersCount(b)){if(b.feed_row.feed_display_view=="load_more_btn"){var c=jQuery("#wdi_feed_"+b.feed_row.wdi_feed_counter);c.find(".wdi_load_more").addClass("wdi_hidden");c.find(".wdi_spinner").addClass("wdi_hidden")}}}}};wdi_front.saveSelfUserData=function(c,a){c.username="";c.user_id="";a.usersData.push(c);a.currentResponseLength=wdi_front.getArrayContentLength(a.usersData,"data");a.allResponseLength+=a.currentResponseLength;if(a.dataCount==a.usersData.length){if(a.currentResponseLength<a.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(a)){wdi_front.loadMore("initial-keep",a)}else{wdi_front.displayFeed(a);wdi_front.applyFilters(a);if(!wdi_front.activeUsersCount(a)){if(a.feed_row.feed_display_view=="load_more_btn"){var b=jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter);b.find(".wdi_load_more").addClass("wdi_hidden");b.find(".wdi_spinner").addClass("wdi_hidden")}}}}};wdi_front.userHasNoPhoto=function(c,e){var a=0;var d=c.usersData;if(typeof e!="undefined"){d=e}for(var b=0;b<d.length;b++){if(typeof d[b]["pagination"]=="undefined"){d[b]["pagination"]=[]}if(c.feed_row.liked_feed==="liked"){if(typeof d[b]["pagination"]["next_max_like_id"]=="undefined"){a++}}else{if(typeof d[b]["pagination"]["next_max_id"]=="undefined"){a++}}}if(a==d.length){return 1}else{return 0}};wdi_front.appendRequestHashtag=function(c,b){for(var a=0;a<c.length;a++){c[a]["wdi_hashtag"]=b}return c};wdi_front.displayFeed=function(c,b){if(c.customFilterChanged==false){var d=wdi_front.feedSort(c,b)}var a=c.customFilterChanged;if(c.customFilterChanged==true){var d=c.customFilteredData;c.parsedData=wdi_front.parseLighboxData(c,true)}if(c.feed_row.resort_after_load_more!="1"){if(c.customFilterChanged==false){c.dataStorageList=c.dataStorageList.concat(d)}}else{if(c.customFilterChanged==false){c.dataStorageList=d}}if(c.feed_row.feed_type=="masonry"){wdi_front.masonryDisplayFeedItems(d,c)}if(c.feed_row.feed_type=="thumbnails"||c.feed_row.feed_type=="blog_style"||c.feed_row.feed_type=="image_browser"){wdi_front.displayFeedItems(d,c)}var e=wdi_front.getDataLength(c);if(e<c.photoCounter&&!a&&c.instagramRequestCounter<=c.maxConditionalFiltersRequestCount&&!wdi_front.allDataHasFinished(c)){wdi_front.loadMore("",c)}else{wdi_front.allImagesLoaded(c)}if(c.instagramRequestCounter>c.maxConditionalFiltersRequestCount){wdi_front.allImagesLoaded(c);if(d.length==0){c.stopInfiniteScrollFlag=true}}if(c.feed_row.feed_display_view=="pagination"&&c.currentPage<c.paginator){jQuery("#wdi_feed_"+c.feed_row.wdi_feed_counter).find("#wdi_last_page").removeClass("wdi_disabled")}c.instagramRequestCounter=0;c.conditionalFilterBuffer=[];wdi_front.updateUsersImages(c)};wdi_front.updateUsersImages=function(a){var b=jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter).find(".wdi_single_user .wdi_user_img_wrap img");b.each(function(){if(jQuery(this).attr("src")==wdi_url.plugin_url+"images/missing.png"||jQuery(this).attr("src")==""){if(a.feed_row.liked_feed=="liked"){return}for(var c=0;c<a.usersData.length;c++){if(a.usersData[c]["username"]==jQuery(this).parent().parent().find("h3").text()){if(a.usersData[c]["data"].length!=0){jQuery(this).attr("src",a.usersData[c]["data"][0]["images"]["thumbnail"]["url"])}}}}})};wdi_front.masonryDisplayFeedItems=function(d,h){var b=[];var p=[];if(jQuery("#wdi_feed_"+h.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length==0){return}jQuery("#wdi_feed_"+h.feed_row.wdi_feed_counter+" .wdi_masonry_column").each(function(){if(h.feed_row.resort_after_load_more==1){jQuery(this).html("");h.imageIndex=0}if(h.customFilterChanged==true){jQuery(this).html("");h.imageIndex=0}if(h.feed_row.feed_display_view=="pagination"){b.push(0)}else{b.push(jQuery(this).height())}p.push(jQuery(this))});if(h.customFilterChanged==true){h.customFilterChanged=false}for(var e=0;e<d.length;e++){h.displayedData.push(d[e]);if(d[e]["type"]=="image"){var n=wdi_front.getPhotoTemplate(h)}else{if(d[e].hasOwnProperty("videos")){var n=wdi_front.getVideoTemplate(h)}else{var n=wdi_front.getSliderTemplate(h)}}var g=d[e];var o=wdi_front.createObject(g,h);var f=n(o);var m=wdi_front.array_min(b);var l=wdi_front.getImageResolution(d[e]);p[m.index].html(p[m.index].html()+f);b[m.index]+=p[m.index].width()*l;h.imageIndex++;if(h.feed_row.feed_display_view=="pagination"){if((e+1)%h.feed_row.pagination_per_page_number===0){h.resIndex+=h.freeSpaces+1}else{h.resIndex++}}}h.wdi_loadedImages=0;var j=false;h.wdi_load_count=e;var a=h.feed_row.wdi_feed_counter;var k=jQuery("#wdi_feed_"+a+" img.wdi_img").on("load",function(){h.wdi_loadedImages++;c();if(j===false){wdi_responsive.columnControl(h,1);j=true}});c();function c(){if(h.wdi_load_count===h.wdi_loadedImages&&h.wdi_loadedImages!=0){h.loadedImages=0;h.wdi_load_count=0;wdi_front.allImagesLoaded(h)}}if(h.paginatorNextFlag==true){wdi_front.updatePagination(h,"next")}h.infiniteScrollFlag=false};wdi_front.getImageResolution=function(c){var d=c.images["standard_resolution"]["width"];var b=c.images["standard_resolution"]["height"];var a=b/d;return a};wdi_front.getDataLength=function(b,d){var c=0;if(typeof d==="undefined"){for(var a=0;a<b.dataStorage.length;a++){c+=b.dataStorage[a].length}}else{for(var a=0;a<d.length;a++){c+=d[a].length}}return c};wdi_front.getArrayContentLength=function(d,c){var b=0;for(var a=0;a<d.length;a++){if(d[a]["finished"]=="finished"){continue}b+=d[a][c].length}return b};wdi_front.displayFeedItems=function(d,j){if(jQuery("#wdi_feed_"+j.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length==0){return}var a=j.feed_row.wdi_feed_counter;var l=jQuery("#wdi_feed_"+a+" .wdi_feed_wrapper");if(j.feed_row.resort_after_load_more==="1"){l.html("");j.imageIndex=0}if(j.customFilterChanged==true){l.html("");j.imageIndex=0;j.customFilterChanged=false}var g=wdi_front.getImgCount(j)-d.length-1;if(j.feed_row.feed_display_view=="pagination"){var b=j.feed_row.load_more_number;if(j.feed_row.feed_type=="image_browser"){b=1}if(jQuery("#wdi_feed_"+j.feed_row.wdi_feed_counter+' [wdi_page="'+(j.currentPage-1)+'"]').length<b||d.length==0){j.currentPage=(--j.currentPage<=1)?1:j.currentPage}}for(var e=0;e<d.length;e++){if(d[e]["type"]=="image"){var m=wdi_front.getPhotoTemplate(j)}else{if(d[e].hasOwnProperty("videos")){var m=wdi_front.getVideoTemplate(j)}else{var m=wdi_front.getSliderTemplate(j)}}var h=d[e];var n=wdi_front.createObject(h,j);var f=m(n);l.html(l.html()+f);j.imageIndex++;if(j.feed_row.feed_display_view=="pagination"){if((e+1)%j.feed_row.pagination_per_page_number===0){j.resIndex+=j.freeSpaces+1}else{j.resIndex++}}}j.wdi_loadedImages=0;var k=false;j.wdi_load_count=e;var a=j.feed_row.wdi_feed_counter;var l=jQuery("#wdi_feed_"+a+" img.wdi_img").on("load",function(){j.wdi_loadedImages++;c();if(k===false){wdi_responsive.columnControl(j,1);k=true}});function c(){if(j.wdi_load_count===j.wdi_loadedImages&&j.wdi_loadedImages!=0){j.loadedImages=0;j.wdi_load_count=0;wdi_front.allImagesLoaded(j)}}if(j.paginatorNextFlag==true){wdi_front.updatePagination(j,"next")}j.infiniteScrollFlag=false};wdi_front.checkFeedFinished=function(b){for(var a=0;a<b.usersData.length;a++){if(typeof b.usersData[a]["finished"]=="undefined"){return false}}return true};wdi_front.sortingOperator=function(c,b){var a;switch(c){case"date":switch(b){case"asc":a=function(e,d){return(e.created_time>d.created_time)?1:-1};break;case"desc":a=function(e,d){return(e.created_time>d.created_time)?-1:1};break}break;case"likes":switch(b){case"asc":a=function(e,d){return(e.likes["count"]<d.likes["count"])?-1:1};break;case"desc":a=function(e,d){return(e.likes["count"]<d.likes["count"])?1:-1};break}break;case"comments":switch(b){case"asc":a=function(e,d){return(e.comments["count"]<d.comments["count"])?-1:1};break;case"desc":a=function(e,d){return(e.comments["count"]<d.comments["count"])?1:-1};break}break;case"random":a=function(e,d){var f=Math.random();return(f>0.5)?1:-1};break}return a};wdi_front.feedSort=function(e,b){var d=e.feed_row.sort_images_by;var c=e.feed_row.display_order;if(e.feed_row.resort_after_load_more==="1"){e.data=e.data.concat(wdi_front.smartPicker(e,b))}else{e.data=wdi_front.smartPicker(e,b)}var a=wdi_front.sortingOperator(d,c);e.data.sort(a);return e.data};wdi_front.smartPicker=function(l,c){var g=[];var a=0;var k=[];var f=Math.ceil(l.feed_row["number_of_photos"]/l.usersData.length);var b=parseInt(l.feed_row["number_of_photos"]);var n=0;if(c!=""&&typeof c!="undefined"&&c!=null){b=parseInt(c);f=Math.ceil(b/wdi_front.activeUsersCount(l))}var j=function(p,i){return(p.data.length>i.data.length)?1:-1};var e=function(p,i){return(p.length()>i.length())?1:-1};l.storeRawData(l.usersData,"dataStorageRaw");var o=l.dataStorageRaw.sort(e);var h=l.usersData.sort(j);for(var d=0;d<h.length;d++){n+=f;if(o[d].length()<=n){n-=o[d].length();g.push(o[d].getData(o[d].length()));a+=g[g.length-1].length}else{if(a+n>b){n=b-a}var m=[];if(l.auto_trigger===false){m=m.concat(o[d].getData(n))}else{if(m.length+wdi_front.getDataLength(l)+wdi_front.getDataLength(l,g)<l.feed_row["number_of_photos"]){m=m.concat(o[d].getData(n))}}n=0;a+=m.length;g.push(m)}}for(d=0;d<g.length;d++){if(typeof l.dataStorage[d]==="undefined"){l.dataStorage.push(g[d])}else{l.dataStorage[d]=l.dataStorage[d].concat(g[d])}}l.parsedData=wdi_front.parseLighboxData(l);for(d=0;d<g.length;d++){k=k.concat(g[d])}return k};wdi_front.createObject=function(e,h){var j=(e.caption!=null)?e.caption["text"]:"&nbsp";var i="";if(e.type=="video"){i=e.hasOwnProperty("videos")?e.videos[h.feedVideoResolution]["url"]:""}var f=e.images[h.feedImageResolution].url;var a=h.imageIndex;var b="square";var d=e.images["standard_resolution"]["height"];var g=e.images["standard_resolution"]["width"];if(d>g){b="portrait"}else{if(d<g){b="landscape"}}var c={id:e.id,caption:j,image_url:f,likes:e.likes["count"],comments:e.comments["count"],wdi_index:a,wdi_res_index:h.resIndex,wdi_media_user:e.user["username"],link:e.link,video_url:i,wdi_username:e.user["username"],wdi_shape:b};return c};wdi_front.setPage=function(c){var b=c.feed_row.feed_display_view;var e=c.feed_row.feed_type;if(b!="pagination"){return""}var a=c.imageIndex;if(e=="image_browser"){var d=1}else{var d=Math.abs(c.feed_row.pagination_per_page_number)}c.paginator=Math.ceil((a+1)/d);return c.paginator};wdi_front.getPhotoTemplate=function(g){var e=wdi_front.setPage(g);var j="";var k="";var l="";var d="";var m="fa-arrows-alt";var c="";if(g.feed_row.feed_type=="blog_style"||g.feed_row.feed_type=="image_browser"){m=""}if(e!=""){k='wdi_page="'+e+'"';sourceAttr="src"}else{sourceAttr="src"}if(e!=""&&e!=1){j="wdi_hidden"}if(g.feed_row.show_username_on_thumb=="1"){c='<span class="wdi_media_user">@<%= wdi_username%></span>'}if(g.feed_row.show_full_description==1&&g.feed_row.feed_type=="masonry"){j+=" wdi_full_caption"}var f="";if(g.feed_row.feed_type!=="blog_style"){if(g.feed_row.feed_type=="masonry"){f="wdi_responsive.showMasonryCaption(jQuery(this),"+g.feed_row.wdi_feed_counter+");"}else{f="wdi_responsive.showCaption(jQuery(this),"+g.feed_row.wdi_feed_counter+");"}}switch(g.feed_row.feed_item_onclick){case"lightbox":l="onclick=wdi_feed_"+g.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":l="onclick=\"window.open ('<%= link%>','_blank')\"";d="wdi_hover_off";m="";break;case"custom_redirect":l="onclick=\"window.open ('"+g.feed_row.redirect_url+"','_self')\"";d="wdi_hover_off";m="";break;case"none":l="";d="wdi_cursor_off wdi_hover_off";m=""}var h="<%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>";var b=g.feed_row.wdi_feed_counter;var a='<div class="wdi_feed_item '+j+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+k+' wdi_type="image" id="wdi_'+b+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img '+h+'"><img class="wdi_img" '+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+d+'" >'+c+'<div class="wdi_thumb_icon" '+l+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="fa '+m+'"></i></div></div></div></div></div></div>';if(g.feed_row["show_likes"]==="1"||g.feed_row["show_comments"]==="1"||g.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_meta">';if(g.feed_row["show_likes"]==="1"){a+='<div class="wdi_thumb_likes"><i class="fa fa-heart-o">&nbsp;<%= likes%></i></div>'}if(g.feed_row["show_comments"]==="1"){a+='<div class="wdi_thumb_comments"><i class="fa fa-comment-o">&nbsp;<%= comments%></i></div>'}a+='<div class="wdi_clear"></div>';if(g.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_title" onclick='+f+" ><%=caption%></div>"}a+="</div>"}a+="</div>";var i=_.template(a);return i};wdi_front.getSliderTemplate=function(g){var e=wdi_front.setPage(g);var j="";var k="";var l="";var d="";var m="fa-clone";var c="";if(g.feed_row.feed_type=="blog_style"||g.feed_row.feed_type=="image_browser"){m=""}if(e!=""){k='wdi_page="'+e+'"';sourceAttr="src"}else{sourceAttr="src"}if(e!=""&&e!=1){j="wdi_hidden"}if(g.feed_row.show_username_on_thumb=="1"){c='<span class="wdi_media_user">@<%= wdi_username%></span>'}if(g.feed_row.show_full_description==1&&g.feed_row.feed_type=="masonry"){j+=" wdi_full_caption"}var f="";if(g.feed_row.feed_type!=="blog_style"){if(g.feed_row.feed_type=="masonry"){f="wdi_responsive.showMasonryCaption(jQuery(this),"+g.feed_row.wdi_feed_counter+");"}else{f="wdi_responsive.showCaption(jQuery(this),"+g.feed_row.wdi_feed_counter+");"}}switch(g.feed_row.feed_item_onclick){case"lightbox":l="onclick=wdi_feed_"+g.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":l="onclick=\"window.open ('<%= link%>','_blank')\"";d="wdi_hover_off";m="fa-clone";break;case"custom_redirect":l="onclick=\"window.open ('"+g.feed_row.redirect_url+"','_self')\"";d="wdi_hover_off";m="";break;case"none":l="";d="wdi_cursor_off wdi_hover_off";m=""}var h="<%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>";var b=g.feed_row.wdi_feed_counter;var a='<div class="wdi_feed_item '+j+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+k+' wdi_type="slideshow" id="wdi_'+b+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img '+h+'"><img class="wdi_img" '+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+d+'" >'+c+'<div class="wdi_thumb_icon" '+l+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="fa '+m+'"></i></div></div></div></div></div></div>';if(g.feed_row["show_likes"]==="1"||g.feed_row["show_comments"]==="1"||g.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_meta">';if(g.feed_row["show_likes"]==="1"){a+='<div class="wdi_thumb_likes"><i class="fa fa-heart-o">&nbsp;<%= likes%></i></div>'}if(g.feed_row["show_comments"]==="1"){a+='<div class="wdi_thumb_comments"><i class="fa fa-comment-o">&nbsp;<%= comments%></i></div>'}a+='<div class="wdi_clear"></div>';if(g.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_title" onclick='+f+" ><%=caption%></div>"}a+="</div>"}a+="</div>";var i=_.template(a);return i};wdi_front.replaceToVideo=function(b,a,c){overlayHtml="<video style='width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;' controls=''><source src='"+b+"' type='video/mp4'>Your browser does not support the video tag. </video>";jQuery("#wdi_feed_"+c+' [wdi_index="'+a+'"] .wdi_photo_wrap_inner').html(overlayHtml);jQuery("#wdi_feed_"+c+' [wdi_index="'+a+'"] .wdi_photo_wrap_inner video').get(0).play()};wdi_front.getVideoTemplate=function(h){var f=wdi_front.setPage(h);var k="";var l="";var n="fa-play";var m="";var d="";var e;var c="";if(f!=""){l='wdi_page="'+f+'"';e="src"}else{e="src"}if(f!=""&&f!=1){k="wdi_hidden"}if(h.feed_row.show_username_on_thumb=="1"){c='<span class="wdi_media_user">@<%= wdi_username%></span>'}if(h.feed_row.show_full_description==1&&h.feed_row.feed_type=="masonry"){k+=" wdi_full_caption"}var g="";if(h.feed_row.feed_type!=="blog_style"){if(h.feed_row.feed_type=="masonry"){g="wdi_responsive.showMasonryCaption(jQuery(this),"+h.feed_row.wdi_feed_counter+");"}else{g="wdi_responsive.showCaption(jQuery(this),"+h.feed_row.wdi_feed_counter+");"}}switch(h.feed_row.feed_item_onclick){case"lightbox":m="onclick=wdi_feed_"+h.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":m="onclick=\"window.open ('<%= link%>','_blank')\"";d="wdi_hover_off";n="fa-play";break;case"custom_redirect":m="onclick=\"window.open ('"+h.feed_row.redirect_url+"','_self')\"";d="wdi_hover_off";n="";break;case"none":d="wdi_cursor_off wdi_hover_off";n="";if(h.feed_row.feed_type=="blog_style"||h.feed_row.feed_type=="image_browser"){m="onclick=wdi_front.replaceToVideo('<%= video_url%>','<%= wdi_index%>',"+h.feed_row.wdi_feed_counter+")";d="";n="fa-play"}}var i="<%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>";var b=h.feed_row.wdi_feed_counter;var a='<div class="wdi_feed_item '+k+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+l+' wdi_type="image" id="wdi_'+b+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img '+i+'"><img class="wdi_img" '+e+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+d+'" '+m+">"+c+'<div class="wdi_thumb_icon" style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="fa '+n+'"></i></div></div></div></div></div></div>';if(h.feed_row["show_likes"]==="1"||h.feed_row["show_comments"]==="1"||h.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_meta">';if(h.feed_row["show_likes"]==="1"){a+='<div class="wdi_thumb_likes"><i class="fa fa-heart-o">&nbsp;<%= likes%></i></div>'}if(h.feed_row["show_comments"]==="1"){a+='<div class="wdi_thumb_comments"><i class="fa fa-comment-o">&nbsp;<%= comments%></i></div>'}a+='<div class="wdi_clear"></div>';if(h.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_title" onclick='+g+" ><%=caption%></div>"}a+="</div>"}a+="</div>";var j=_.template(a);return j};wdi_front.bindEvents=function(a){if(jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length==0){return}if(a.feed_row.feed_display_view=="load_more_btn"){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_load_more_container").on(wdi_front.clickOrTouch,function(){wdi_front.loadMore(jQuery(this).find(".wdi_load_more_wrap"))})}if(a.feed_row.feed_display_view=="pagination"){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_next").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorNext(jQuery(this),a)});jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_prev").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorPrev(jQuery(this),a)});jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_last_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationLastPage(jQuery(this),a)});jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_first_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationFirstPage(jQuery(this),a)});a.paginatorNextFlag=false}if(a.feed_row.feed_display_view=="infinite_scroll"){jQuery(window).on("scroll",function(){wdi_front.infiniteScroll(a)});a.infiniteScrollFlag=false}};wdi_front.infiniteScroll=function(a){if((jQuery(window).scrollTop()+jQuery(window).height()-100)>=jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_infinite_scroll").offset().top){if(a.infiniteScrollFlag===false&&a.stopInfiniteScrollFlag==false){a.infiniteScrollFlag=true;wdi_front.loadMore(jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_infinite_scroll"),a)}else{if(a.stopInfiniteScrollFlag){wdi_front.allImagesLoaded(a)}}}};wdi_front.paginationFirstPage=function(b,c){if(c.paginator==1||c.currentPage==1){b.addClass("wdi_disabled");return}var d=c.currentPage;c.currentPage=1;wdi_front.updatePagination(c,"custom",d);var a=b.parent().find("#wdi_last_page");a.removeClass("wdi_disabled");b.addClass("wdi_disabled")};wdi_front.paginationLastPage=function(a,b){if(b.paginator==1||b.currentPage==b.paginator){return}var d=b.currentPage;b.currentPage=b.paginator;wdi_front.updatePagination(b,"custom",d);a.addClass("wdi_disabled");var c=a.parent().find("#wdi_first_page");c.removeClass("wdi_disabled")};wdi_front.paginatorNext=function(b,c){var a=b.parent().find("#wdi_last_page");var d=b.parent().find("#wdi_first_page");c.paginatorNextFlag=true;if(c.paginator==c.currentPage&&!wdi_front.checkFeedFinished(c)){c.currentPage++;var e=c.feed_row.number_of_photos;wdi_front.loadMore(b,c,e);a.addClass("wdi_disabled")}else{if(c.paginator>c.currentPage){c.currentPage++;wdi_front.updatePagination(c,"next");if(c.paginator>c.currentPage){a.removeClass("wdi_disabled")}else{a.addClass("wdi_disabled")}}}d.removeClass("wdi_disabled")};wdi_front.paginatorPrev=function(b,c){var a=b.parent().find("#wdi_last_page");var d=b.parent().find("#wdi_first_page");if(c.currentPage==1){d.addClass("wdi_disabled");return}c.currentPage--;wdi_front.updatePagination(c,"prev");a.removeClass("wdi_disabled");if(c.currentPage==1){d.addClass("wdi_disabled")}};wdi_front.updatePagination=function(b,a,d){var c="#wdi_feed_"+b.feed_row.wdi_feed_counter;jQuery(c+' [wdi_page="'+b.currentPage+'"]').each(function(){jQuery(this).removeClass("wdi_hidden")});switch(a){case"next":var d=b.currentPage-1;jQuery(c+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height());jQuery(c+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"prev":var d=b.currentPage+1;jQuery(c+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height());jQuery(c+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"custom":var d=d;if(d!=b.currentPage){jQuery(c+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height());jQuery(c+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")})}break}b.paginatorNextFlag=false;jQuery(c+" .wdi_feed_wrapper").css("height","auto");jQuery(c+" #wdi_current_page").text(b.currentPage)};wdi_front.loadMore=function(f,k){var b=0;if(f!=""&&typeof f!="undefined"&&f!="initial"&&f!="initial-keep"){var l=window[f.parent().parent().parent().parent().attr("id")]}if(typeof k!="undefined"){var l=k}var n=0,g=0;for(var e=0;e<l.userSortFlags.length;e++){if(l.userSortFlags[e].flag===true){n++;for(var d=0;d<l.usersData.length;d++){if(l.userSortFlags[e]["id"]===l.usersData[d]["user_id"]){if(l.usersData[d]["finished"]==="finished"){g++}}}}}if(n===g&&n!=0){return}if(f===""){l.auto_trigger=true}else{l.auto_trigger=false}wdi_front.ajaxLoader(l);if(l.feed_row.feed_type==="masonry"&&l.feed_row.feed_display_view=="pagination"){jQuery("#wdi_feed_"+wdi_front.feed_counter+" .wdi_full_caption").each(function(){jQuery(this).find(".wdi_photo_title").trigger(wdi_front.clickOrTouch)})}for(var e=0;e<l.usersData.length;e++){if(l.usersData[e]["finished"]==="finished"){b++}}if(b===l.usersData.length){wdi_front.allImagesLoaded(l);jQuery("#wdi_feed_"+l.feed_row["wdi_feed_counter"]+" .wdi_load_more").remove()}var h=l.usersData;l.loadMoreDataCount=l.feed_users.length;for(var e=0;e<h.length;e++){var m=h[e]["pagination"];var c={user_id:h[e]["user_id"],username:h[e]["username"]};if(m.next_url!=""&&m.next_url!=null&&typeof m.next_url!="undefined"){var a=m.next_url;wdi_front.loadMoreRequest(c,a,l,f)}else{if(f=="initial-keep"){l.temproraryUsersData[e]=l.usersData[e]}l.loadMoreDataCount--;wdi_front.checkForLoadMoreDone(l,f);continue}}};wdi_front.loadMoreRequest=function(b,a,e,d){if(!e.mediaRequestsDone){return}var f=e.usersData;var c="";e.instagram.requestByUrl(a,{success:function(g){if(typeof g.meta!="undefined"&&typeof g.meta.error_type!="undefined"){wdi_front.show_alert(false,g,e)}if(g===""||typeof g=="undefined"||g==null){c=wdi_front_messages.network_error;e.loadMoreDataCount--;wdi_front.show_alert(c,g,e);return}if(g.meta["code"]!=200){c=g.meta["error_message"];e.loadMoreDataCount--;wdi_front.show_alert(c,g,e);return}g.user_id=b.user_id;g.username=b.username;for(var h=0;h<e.usersData.length;h++){if(g.user_id===e.usersData[h]["user_id"]){if(g.user_id[0]==="#"){g.data=wdi_front.appendRequestHashtag(g.data,g.user_id)}if(d=="initial-keep"){e.temproraryUsersData[h]=e.usersData[h]}e.usersData[h]=g;e.loadMoreDataCount--}}wdi_front.checkForLoadMoreDone(e,d)}})};wdi_front.checkForLoadMoreDone=function(c,b){var a=c.feed_row.load_more_number;var e=c.feed_row.number_of_photos;if(c.loadMoreDataCount==0){c.temproraryUsersData=wdi_front.mergeData(c.temproraryUsersData,c.usersData);var d=wdi_front.getArrayContentLength(c.temproraryUsersData,"data");if(b=="initial-keep"){b="initial"}if(b=="initial"){if(d<e&&!wdi_front.userHasNoPhoto(c,c.temproraryUsersData)&&c.instagramRequestCounter<=c.maxConditionalFiltersRequestCount){wdi_front.loadMore("initial",c)}else{c.usersData=c.temproraryUsersData;wdi_front.displayFeed(c);wdi_front.applyFilters(c);c.temproraryUsersData=[]}}else{if(d<a&&!wdi_front.userHasNoPhoto(c,c.temproraryUsersData)&&c.instagramRequestCounter<=c.maxConditionalFiltersRequestCount){wdi_front.loadMore(undefined,c)}else{c.usersData=c.temproraryUsersData;if(!wdi_front.activeUsersCount(c)){return}wdi_front.displayFeed(c,a);wdi_front.applyFilters(c);c.temproraryUsersData=[]}}}};wdi_front.allDataHasFinished=function(b){var d=0;for(var a=0;a<b.dataStorageRaw.length;a++){if(b.dataStorageRaw[a].length()==0&&b.dataStorageRaw[a].locked==true){d++}}return(d==b.dataStorageRaw.length)};wdi_front.mergeData=function(c,b){for(var a=0;a<b.length;a++){if(typeof c[a]!="undefined"){if(b[a]["finished"]=="finished"){continue}if(typeof c[a]["pagination"]["next_max_id"]=="undefined"&&typeof c[a]["pagination"]["next_max_like_id"]=="undefined"){continue}c[a]["data"]=c[a]["data"].concat(b[a]["data"]);c[a]["pagination"]=b[a]["pagination"];c[a]["user_id"]=b[a]["user_id"];c[a]["username"]=b[a]["username"];c[a]["meta"]=b[a]["meta"]}else{c.push(b[a])}}return c};wdi_front.brokenImageHandler=function(a){a.src=wdi_url.plugin_url+"images/missing.png";a.onerror="";return true};wdi_front.ajaxLoader=function(a){var d=a.feed_row.wdi_feed_counter;var c=jQuery("#wdi_feed_"+d);if(a.feed_row.feed_display_view=="load_more_btn"){c.find(".wdi_load_more").addClass("wdi_hidden");c.find(".wdi_spinner").removeClass("wdi_hidden")}if(a.feed_row.feed_display_view=="infinite_scroll"){var b;if(c.find(".wdi_ajax_loading").length==0){b=jQuery('<div class="wdi_ajax_loading"><div><div><img class="wdi_load_more_spinner" src="'+wdi_url.plugin_url+'images/ajax_loader.png"></div></div></div>');c.append(b)}else{b=c.find(".wdi_ajax_loading")}b.removeClass("wdi_hidden")}};wdi_front.allImagesLoaded=function(a){var d=wdi_front.getDataLength(a);if(!a.mediaRequestsDone){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").remove("wdi_nomedia")}if(d==0&&a.mediaRequestsDone&&(a.feed_row.conditional_filters.length==0||a.feed_row.conditional_filter_enable==0)){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").append("<p class='wdi_nomedia'>"+wdi_front_messages.feed_nomedia+"</p>")}var c=a.feed_row.wdi_feed_counter;var b=jQuery("#wdi_feed_"+c);if(a.feed_row.feed_display_view=="load_more_btn"){b.find(".wdi_load_more").removeClass("wdi_hidden");b.find(".wdi_spinner").addClass("wdi_hidden")}if(a.feed_row.feed_display_view=="infinite_scroll"){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_ajax_loading").addClass("wdi_hidden")}b.trigger("wdi_feed_loaded")};wdi_front.show=function(b,c){var e=c.feed_row.wdi_feed_counter;var d=jQuery("#wdi_feed_"+e+" .wdi_feed_container");var g=this;switch(b){case"header":f();break;case"users":a(c);break}function f(){var i={feed_thumb:c.feed_row["feed_thumb"],feed_name:c.feed_row["feed_name"]};var k=wdi_front.getHeaderTemplate(),h=k(i),j=d.find(".wdi_feed_header").html();d.find(".wdi_feed_header").html(j+h)}function a(j){d.find(".wdi_feed_users").html("");var n=j.feed_users;var m=j.feed_row["access_token"];var h=0;j.headerUserinfo=[];k();function k(){if(j.headerUserinfo.length==n.length){l(j.headerUserinfo,j);return}var i=n[j.headerUserinfo.length];if(typeof i==="string"&&i==="self"){j.instagram.getSelfInfo({success:function(o){if(typeof o.meta!="undefined"&&typeof o.meta.error_type!="undefined"){wdi_front.show_alert(false,o,j)}o=g.checkMediaResponse(o,j);if(o!=false&&o.meta["code"]===400&&o.meta["error_type"]==="APINotAllowedError"){var p=null;j.headerUserinfo.push(p);h++;k()}if(o!=false&&o.meta["code"]===200){var p={id:o.data["id"],name:o.data["username"],url:o.data["profile_picture"],bio:o.data["bio"],counts:o.data["counts"],website:o.data["website"],full_name:o.data["full_name"]};j.headerUserinfo.push(p);h++;k()}},args:{ignoreFiltering:true}})}else{if(g.getInputType(i.username)=="hashtag"){j.instagram.searchForTagsByName(g.stripHashtag(i.username),{success:function(o){if(typeof o.meta!="undefined"&&typeof o.meta.error_type!="undefined"){wdi_front.show_alert(false,o,j)}o=g.checkMediaResponse(o,j);if(o!=false){if(o.data.length==0){var p="";var q={media:""}}else{var p="";var q={media:o.data[0]["media_count"]}}var r={name:n[h]["username"],url:p,counts:q};h++;j.headerUserinfo.push(r);k()}},args:{ignoreFiltering:true}})}else{if(g.getInputType(i.username)=="user"){j.instagram.getSelfInfo({success:function(o){if(typeof o.meta!="undefined"&&typeof o.meta.error_type!="undefined"){wdi_front.show_alert(false,o,j)}o=g.checkMediaResponse(o,j);if(o!=false&&o.meta["code"]===400&&o.meta["error_type"]==="APINotAllowedError"){var p=null;j.headerUserinfo.push(p);h++;k()}if(o!=false&&o.meta["code"]===200){var p={id:o.data["id"],name:o.data["username"],url:o.data["profile_picture"],bio:o.data["bio"],counts:o.data["counts"],website:o.data["website"],full_name:o.data["full_name"]};j.headerUserinfo.push(p);h++;k()}},args:{ignoreFiltering:true}})}}}}function l(i,t){d.find(".wdi_feed_users").html("");for(var q=0;q<i.length;q++){if(i[q]===null){continue}var u={flag:false,id:i[q]["id"],name:i[q]["name"]};var p=(i[q]["name"][0]=="#")?"wdi_header_hashtag":"";var o={user_index:q,user_img_url:i[q]["url"],counts:i[q]["counts"],feed_counter:t.feed_row.wdi_feed_counter,user_name:i[q]["name"],bio:i[q]["bio"],usersCount:t.feed_row.feed_users.length,hashtagClass:p};var w=wdi_front.getUserTemplate(t,i[q]["name"]),r=w(o),s=d.find(".wdi_feed_users").html();d.find(".wdi_feed_users").html(s+r);t.userSortFlags.push(u);var v=jQuery('<div class="wdi_clear"></div>')}d.find(".wdi_feed_users").append(v);wdi_front.updateUsersImages(t)}}};wdi_front.getUserTemplate=function(c,h){var a=c.dataCount,d,f,g;switch(h[0]){case"#":d="//instagram.com/explore/tags/"+h.substr(1,h.length);break;default:d="//instagram.com/"+h;break}g='window.open("'+d+'","_blank")';f="onclick='"+g+"'";var e='<div class="wdi_single_user" user_index="<%=user_index%>"><div class="wdi_header_user_text <%=hashtagClass%>"><div class="wdi_user_img_wrap"><img onerror="wdi_front.brokenImageHandler(this);" src="<%= user_img_url%>">';if(a>1){e+='<div title="'+wdi_front_messages.filter_title+'" class="wdi_filter_overlay"><div class="wdi_filter_icon"><span onclick="wdi_front.addFilter(<%=user_index%>,<%=feed_counter%>);" class="fa fa-filter"></span></div></div>'}e+="</div>";e+="<h3 "+f+"><%= user_name%></h3>";if(h[0]!=="#"){if(c.feed_row.follow_on_instagram_btn=="1"){e+='<div class="wdi_user_controls"><div class="wdi_follow_btn" onclick="window.open(\'//instagram.com/<%= user_name%>\',\'_blank\')"><span> '+wdi_front_messages.follow+"</span></div></div>"}e+='<div class="wdi_media_info"><p class="wdi_posts"><span class="fa fa-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span class="fa fa-user"></span><%= counts.followed_by%></p></div>'}else{e+='<div class="wdi_user_controls"></div><div class="wdi_media_info"><p class="wdi_posts"><span class="fa fa-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span></span></p></div>'}e+='<div class="wdi_clear"></div>';if(a==1&&h[0]!=="#"&&c.feed_row.display_user_info=="1"){e+='<div class="wdi_bio"><%= bio%></div>'}e+="</div></div>";var b=_.template(e);return b};wdi_front.getHeaderTemplate=function(){var b='<div class="wdi_header_wrapper"><div class="wdi_header_img_wrap"><img src="<%=feed_thumb%>"></div><div class="wdi_header_text"><%=feed_name%></div><div class="wdi_clear"></div>';var a=_.template(b);return a};wdi_front.addFilter=function(e,g){var f=window["wdi_feed_"+g];var d=f.dataCount;if(d<2){return}if(f.nowLoadingImages!=false){return}else{var c=jQuery("#wdi_feed_"+f.feed_row.wdi_feed_counter+'_users [user_index="'+e+'"]');c.find(".wdi_filter_overlay").toggleClass("wdi_filter_active_bg");c.find(".wdi_header_user_text h3").toggleClass("wdi_filter_active_col");c.find(".wdi_media_info").toggleClass("wdi_filter_active_col");c.find(".wdi_follow_btn").toggleClass("wdi_filter_active_col");f.customFilterChanged=true;if(f.userSortFlags[e]["flag"]==false){f.userSortFlags[e]["flag"]=true}else{f.userSortFlags[e]["flag"]=false}var a=0;for(var b=0;b<f.userSortFlags.length;b++){if(f.userSortFlags[b]["flag"]==true){a++}}if(f.feed_row.feed_display_view=="pagination"){f.resIndex=0}if(a!=0){wdi_front.filterData(f);wdi_front.displayFeed(f)}else{f.customFilteredData=f.dataStorageList;wdi_front.displayFeed(f)}if(f.feed_row.feed_display_view=="pagination"){f.paginator=Math.ceil((f.imageIndex)/parseInt(f.feed_row.pagination_per_page_number));f.currentPage=f.paginator;wdi_front.updatePagination(f,"custom",1);jQuery("#wdi_first_page").removeClass("wdi_disabled");jQuery("#wdi_last_page").addClass("wdi_disabled")}}};wdi_front.filterData=function(c){var d=c.userSortFlags;c.customFilteredData=[];for(var b=0;b<c.dataStorageList.length;b++){for(var a=0;a<d.length;a++){if((c.dataStorageList[b]["user"]["id"]==d[a]["id"]||c.dataStorageList[b]["wdi_hashtag"]==d[a]["name"])&&d[a]["flag"]==true){c.customFilteredData.push(c.dataStorageList[b])}}}};wdi_front.applyFilters=function(c){for(var b=0;b<c.userSortFlags.length;b++){if(c.userSortFlags[b]["flag"]==true){var a=jQuery("#wdi_feed_"+c.feed_row.wdi_feed_counter+'[user_index="'+b+'"]');wdi_front.addFilter(b,c.feed_row.wdi_feed_counter);wdi_front.addFilter(b,c.feed_row.wdi_feed_counter)}}};wdi_front.getImgCount=function(b){var d=b.dataStorage;var c=0;for(var a=0;a<d.length;a++){c+=d[a].length}return c};wdi_front.parseLighboxData=function(k,m){var g=k.dataStorage;var l=k.feed_row.sort_images_by;var a=k.feed_row.display_order;var h=wdi_front.sortingOperator(l,a);var f=[];var b=[];var e={};if(m==true){f=k.customFilteredData}else{for(var d=0;d<g.length;d++){for(var c=0;c<g[d].length;c++){f.push(g[d][c])}}f.sort(h)}for(d=0;d<f.length;d++){e={alt:"",avg_rating:"",comment_count:f[d]["comments"]["count"],date:wdi_front.convertUnixDate(f[d]["created_time"]),description:wdi_front.getDescription((f[d]["caption"]!==null)?f[d]["caption"]["text"]:""),filename:wdi_front.getFileName(f[d]),filetype:wdi_front.getFileType(f[d]),hit_count:"0",id:f[d]["id"],image_url:f[d]["link"],number:0,rate:"",rate_count:"0",username:f[d]["user"]["username"],profile_picture:f[d]["user"]["profile_picture"],thumb_url:f[d]["link"]+"media/?size=t",comments_data:f[d]["comments"]["data"],images:f[d]["images"],carousel_media:(typeof f[d]["carousel_media"]!=="undefined")?f[d]["carousel_media"]:null};b.push(e)}return b};wdi_front.convertUnixDate=function(b){var c=parseInt(b);var a=new Date(0);a.setUTCSeconds(c);var d=a.getFullYear()+"-"+a.getMonth()+"-"+a.getDate();d+=" "+a.getHours()+":"+a.getMinutes();return d};wdi_front.getDescription=function(a){a=a.replace(/\r?\n|\r/g," ");return a};wdi_front.getFileName=function(d){var c=d.link;var b=d.type;if(b==="video"&&d.hasOwnProperty("videos")){return d.videos["standard_resolution"]["url"]}else{var a=c.split("/");return a[a.length-2]}};wdi_front.getFileType=function(a){if(a.type=="video"&&a.hasOwnProperty("videos")){return"EMBED_OEMBED_INSTAGRAM_VIDEO"}else{return"EMBED_OEMBED_INSTAGRAM_IMAGE"}};wdi_front.array_max=function(d){var a=d[0];var b=0;for(var c=1;c<d.length;c++){if(a<d[c]){a=d[c];b=c}}return{value:a,index:b}};wdi_front.array_min=function(d){var c=d[0];var a=0;for(var b=1;b<d.length;b++){if(c>d[b]){c=d[b];a=b}}return{value:c,index:a}};wdi_front.activeUsersCount=function(c){var a=0;for(var b=0;b<c.usersData.length;b++){if(c.usersData[b].finished!="finished"){a++}}return a};wdi_front.checkMediaResponse=function(a,b){if(a!=""&&typeof a!="undefined"&&a!=null&&a.meta["code"]===400&&a.meta["error_type"]==="APINotAllowedError"){return a}if(a==""||typeof a=="undefined"||a==null){errorMessage=wdi_front_messages.connection_error;wdi_front.show_alert(errorMessage,a,b);return false}if(a.meta["code"]!=200){errorMessage=a.meta["error_message"];wdi_front.show_alert(errorMessage,a,b);return false}return a};wdi_front.stripHashtag=function(a){switch(a[0]){case"#":return a.substr(1,a.length);break;default:return a;break}};wdi_front.getInputType=function(a){switch(a[0]){case"#":return"hashtag";break;case"%":return"location";break;default:return"user";break}};wdi_front.regexpTestCaption=function(h,e){var d=false,b=false,f=[],g=e.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&"),c=new RegExp("(?:^|\\s)"+g+"(?:^|\\s)"),a=new RegExp("(?:^|\\s)"+g,"g");if(c.exec(h)!=null){d=true}while((match=a.exec(h))!=null){if(match.index==h.length-e.length-1){b=true}}if(d==true||b==true){return true}else{return false}};wdi_front.replaceNewLines=function(c){var b="vUkCJvN2ps3t",a=[],g;c=c.replace(/\r?\n|\r/g,b);g=new RegExp(b,"g");while((match=g.exec(c))!=null){a.push(match.index)}var f=c.split(b);var e=0;for(var d=0;d<f.length;d++){if(f[d]==""){e++}else{e=0}if(e>0){f.splice(d,1);e--;d--}}c=f.join(" ");return c};wdi_front.isEmptyObject=function(a){for(var b in a){if(a.hasOwnProperty(b)){return false}}return true};var WDIFeed=function(a){this["data"]=a.data;this["dataCount"]=a.dataCount;this["feed_row"]=a.feed_row;this["usersData"]=a.usersData;_this=this;this.set_images_loading_flag=function(b){window.addEventListener("load",function(){b.nowLoadingImages=false})};this.set_images_loading_flag(_this)};WDIFeed.prototype.conditionalFilter=function(a,c){var d=this,b=d.feed_row.conditional_filter_type,e=d.feed_row.conditional_filters;if(c.ignoreFiltering==true){}else{a=this.avoidDuplicateMedia(a)}if(!wdi_front.isJsonString(e)){return a}else{e=JSON.parse(e);if(e.length==0){return a}}if(d.feed_row.conditional_filter_enable=="0"){return a}d.instagramRequestCounter++;switch(b){case"AND":a=this.applyANDLogic(a,e,d);break;case"OR":a=this.applyORLogic(a,e,d);break;case"NOR":a=this.applyNORLogic(a,e,d);break;default:break}return a};WDIFeed.prototype.applyANDLogic=function(a,d){var c=this;for(var b=0;b<d.length;b++){a=this.filterResponse(a,d[b])}return a};WDIFeed.prototype.applyORLogic=function(d,c){var h=this;var a=[],g,j=[],f,b;for(var e=0;e<c.length;e++){g=this.filterResponse(d,c[e]);a=a.concat(g.data);g={}}for(e=0;e<a.length;e++){b=a[e];if(!this.mediaExists(b,j)&&!this.mediaExists(b,h.dataStorageList)){j.push(b)}}f={data:j,meta:d.meta,pagination:d.pagination};return f};WDIFeed.prototype.applyNORLogic=function(c,h){var f=c,g=this,b=this.applyORLogic(c,h,g),d=[],a;for(var e=0;e<f.data.length;e++){if(!this.mediaExists(f.data[e],b.data)){d.push(f.data[e])}}a={data:d,meta:f.meta,pagination:f.pagination};return a};WDIFeed.prototype.mediaExists=function(b,c){for(var a=0;a<c.length;a++){if(b.id==c[a]["id"]){return true}}return false};WDIFeed.prototype.filterResponse=function(a,b){switch(b.filter_type){case"hashtag":return this.filterByHashtag(a,b);break;case"username":return this.filterByUsername(a,b);break;case"mention":return this.filterByMention(a,b);break;case"description":return this.filterByDescription(a,b);break;case"location":return this.filterByLocation(a,b);break;case"url":return this.filterByUrl(a,b);break}};WDIFeed.prototype.filterByHashtag=function(b,g){var d=[],f,h,a;for(var e=0;e<b.data.length;e++){h=b.data[e];for(var c=0;c<h.tags.length;c++){tag=h.tags[c];if(tag.toLowerCase()==g.filter_by.toLowerCase()){d.push(h)}}}a={data:d,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.filterByUsername=function(b,e){var c=[],f,a;for(var d=0;d<b.data.length;d++){f=b.data[d];if(f.user.username.toLowerCase()==e.filter_by.toLowerCase()){c.push(f)}}a={data:c,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.filterByMention=function(b,e){var c=[],f,g,a;for(var d=0;d<b.data.length;d++){f=b.data[d];if(f.caption!==null){g=f.caption["text"].toLowerCase();if(g.indexOf("@"+e.filter_by.toLowerCase())!=-1){c.push(f)}}}a={data:c,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.filterByDescription=function(c,f){var d=[],g,h,b;for(var e=0;e<c.data.length;e++){g=c.data[e];if(g.caption!==null){h=g.caption["text"].toLowerCase();h=wdi_front.replaceNewLines(h);var a=f.filter_by.toLowerCase();if(wdi_front.regexpTestCaption(h,a)){d.push(g)}}}b={data:d,meta:c.meta,pagination:c.pagination};return b};WDIFeed.prototype.filterByLocation=function(b,f){var c=[],g,e,a;for(var d=0;d<b.data.length;d++){g=b.data[d];if(g.location!==null){e=g.location["id"];if(e==f.filter_by){c.push(g)}}}a={data:c,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.filterByUrl=function(b,e){var c=[],g,h,a,f;e.filter_by=this.getIdFromUrl(e.filter_by);for(var d=0;d<b.data.length;d++){g=b.data[d];if(g.link!==null){h=this.getIdFromUrl(g.link);if(h==e.filter_by){c.push(g)}}}a={data:c,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.getIdFromUrl=function(a){var c=a.split("/"),d=false;for(var b=0;b<c.length;b++){if(c[b]=="p"){if(typeof c[b+1]!="undefined"){d=c[b+1];break}}}return d};WDIFeed.prototype.avoidDuplicateMedia=function(b){var e=b.data,d=[],a={};if(typeof e=="undefined"){e=[]}for(var c=0;c<e.length;c++){if(!this.mediaExists(e[c],this.dataStorageList)&&!this.mediaExists(e[c],d)&&!this.mediaExists(e[c],this.conditionalFilterBuffer)){d.push(e[c])}}this.conditionalFilterBuffer=this.conditionalFilterBuffer.concat(d);a={data:d,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.storeRawData=function(c,a){var e=this;if(typeof this[a]=="object"&&typeof this[a].length=="number"){for(var b=0;b<c.length;b++){var d="";if(wdi_front.isHashtag(c[b].user_id)){d=c[b].pagination.next_max_tag_id}else{if(e.feed_row.liked_feed=="liked"){d=c[b].pagination.next_max_like_id;if(typeof d=="undefined"){d=""}}else{if(c[b].pagination==null){c[b].pagination=[]}d=c[b].pagination.next_max_id;if(typeof d=="undefined"){d=""}}}if(typeof this[a][b]=="undefined"){this[a].push({data:c[b].data,index:0,locked:false,hash_id:d,usersDataFinished:false,userId:c[b].user_id,length:function(){return this.data.length-this.index},getData:function(g){var h=this.data.slice(this.index,this.index+g);this.index+=Math.min(g,this.length());if(this.index==this.data.length&&this.locked==true&&this.usersDataFinished==false){for(var f=0;f<e.usersData.length;f++){if(e.usersData[f]["user_id"]==this.userId){e.usersData[f].finished="finished";this.usersDataFinished=true;break}}}return h}})}else{if(this[a][b].locked==false){if(d!=this[a][b].hash_id){this[a][b].data=this[a][b].data.concat(c[b].data);this[a][b].hash_id=d}else{this[a][b].locked=true}}}}}};wdi_front.updateUsersIfNecessary=function(c){var d=c.feed_users;var a=false;for(var b=0;b<d.length;b++){if("#"==d[b].username.substr(0,1)){d[b].id=d[b].username;continue}if(""==d[b].id||"username"==d[b].id){a=true;c.instagram.searchForUsersByName(d[b].username,{success:function(i){if(typeof i.meta!="undefined"&&typeof i.meta.error_type!="undefined"){wdi_front.show_alert(false,i,c)}if(i.meta.code==200&&i.data.length>0){var l=false;for(var g=0;g<i.data.length;g++){if(i.data[g].username==i.args.username){l=true;break}}if(l){for(var h=0;h<d.length;h++){if(i.data[g].username==d[h].username){d[h].id=i.data[g].id}}}}var f=false;for(var e=0;e<d.length;e++){if(d[e].id==""||d[e].id=="username"){f=true;break}}if(!f){c.feed_row.feed_users=JSON.stringify(d);wdi_front.init(c)}},username:d[b].username})}}return a};if(typeof wdi_ajax.ajax_response!="undefined"){jQuery(document).one("ajaxStop",function(){if(wdi_front.type!="not_declared"){wdi_front.clickOrTouch=wdi_front.detectEvent();wdi_front.globalInit()}else{return}})}else{jQuery(document).ready(function(){if(wdi_front.type!="not_declared"){wdi_front.clickOrTouch=wdi_front.detectEvent();wdi_front.globalInit()}else{return}})}jQuery(document).ready(function(){setTimeout(function(){if(wdi_front_messages.show_alerts==="1"&&jQuery(".wdi_check_fontawesome .fa-instagram").prop("tagName")!=="I"){console.log("Font Awesome is not loaded properly. Please ask for support https://wordpress.org/support/plugin/wd-instagram-feed/")}},2000)});
1
+ if(typeof wdi_front=="undefined"){wdi_front={type:"not_declared"}}wdi_front.detectEvent=function(){var a=(/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));if(a){return"touchend"}else{return"click"}};var wdi_error_show=false;wdi_front.escape_tags=function(e){var b=/</g,c=/>/g,d=/'/g,a=/"/g;if(typeof e=="undefined"){e=""}e=e.toString().replace(b,"&lt;").replace(c,"&gt;").replace(d,"&#39;").replace(a,"&#34;");return e};wdi_front.show_alert=function(e,b,f){f=jQuery("#wdi_feed_"+f.feed_row.wdi_feed_counter);if(b.meta["code"]===400&&b.meta["error_type"]==="APINotAllowedError"){if(typeof b.wdi_current_feed_name!="undefined"){var a=b.wdi_current_feed_name;var d=f.find(".wdi_private_feed_names");d.html(a);f.find(".wdi_private_feed_error").removeClass("wdi_hidden")}f.find(".wdi_spinner").remove()}if(typeof f!="undefined"&&b.meta["error_type"]!="APINotAllowedError"){f.find(".wdi_spinner").remove();wdi_error_show=true;var c=f.find(".wdi_js_error");var g=f.find(".wdi_token_error");if(b!=false&&typeof b.meta!=undefined&&b.meta.error_type==="OAuthAccessTokenException"){g.removeClass("wdi_hidden");if(wdi_front_messages.wdi_token_error_flag!="1"){jQuery.ajax({type:"POST",url:wdi_url.ajax_url,dataType:"json",data:{action:"wdi_token_flag",wdi_token_flag_nonce:wdi_front_messages.wdi_token_flag_nonce},success:function(h){}})}}else{c.removeClass("wdi_js_error");c.addClass("wdi_js_error_no_animate");jQuery(".wdi_js_error_no_animate").show()}if(wdi_front_messages.show_alerts){}else{console.log("%c"+e,"color:#cc0000;")}}wdi_error_show=true};wdi_front.globalInit=function(){var a=wdi_front.feed_counter;if(typeof wdi_ajax.ajax_response!="undefined"){var c=wdi_feed_counter_init.wdi_feed_counter_init}else{var c=0}for(var b=c;b<=a;b++){if(jQuery("#wdi_feed_"+b).length===0){continue}var d=new WDIFeed(window["wdi_feed_"+b]);d.instagram=new WDIInstagram();d.instagram.filterArguments={feed:d};d.instagram.filters=[{where:"getUserRecentMedia",what:function(f,g,e){return g.feed.conditionalFilter(f,e)}},{where:"getTagRecentMedia",what:function(f,g,e){return g.feed.conditionalFilter(f,e)}},{where:"getRecentLikedMedia",what:function(f,g,e){return g.feed.conditionalFilter(f,e)}},{where:"requestByUrl",what:function(f,g,e){return g.feed.conditionalFilter(f,e)}}];d.instagram.addToken(d.feed_row["access_token"]);wdi_front.access_token=d.feed_row["access_token"];d.dataStorageRaw=[];d.dataStorage=[];d.dataStorageList=[];d.allResponseLength=0;d.currentResponseLength=0;d.temproraryUsersData=[];d.removedUsers=0;d.nowLoadingImages=true;d.imageIndex=0;d.resIndex=0;d.currentPage=1;d.userSortFlags=[];d.customFilterChanged=false;d.maxConditionalFiltersRequestCount=10;d.instagramRequestCounter=0;d.mediaRequestsDone=false;d.conditionalFilterBuffer=[];d.stopInfiniteScrollFlag=false;if(d.feed_row.feed_type=="masonry"){d.displayedData=[]}if(d.feed_row.feed_display_view=="pagination"){d.feed_row.resort_after_load_more=0;if(d.feed_row.feed_type!="image_browser"){d.feed_row.load_more_number=parseInt(d.feed_row.pagination_per_page_number);d.feed_row.number_of_photos=(1+parseInt(d.feed_row.pagination_preload_number))*d.feed_row.load_more_number}else{d.feed_row.number_of_photos=1+parseInt(d.feed_row.image_browser_preload_number);d.feed_row.load_more_number=parseInt(d.feed_row.image_browser_load_number)}d.freeSpaces=(Math.floor(d.feed_row.pagination_per_page_number/d.feed_row.number_of_columns)+1)*d.feed_row.number_of_columns-d.feed_row.pagination_per_page_number}else{d.freeSpaces=0}d.galleryBox=function(e){wdi_spider_createpopup(wdi_url.ajax_url+"?gallery_id="+this.feed_row.id+"&image_id="+e,this.feed_row.wdi_feed_counter,this.feed_row.lightbox_width,this.feed_row.lightbox_height,1,"testpopup",5,this,e)};wdi_responsive.columnControl(d);if(d.feed_row.feed_type=="masonry"){jQuery(window).trigger("resize")}wdi_front.bindEvents(d);window["wdi_feed_"+b]=d;wdi_front.init(d)}};wdi_front.init=function(c){jQuery(".wdi_js_error").hide();c.photoCounter=c.feed_row.number_of_photos;if(c.feed_row.liked_feed=="liked"){c.feed_users=["self"]}else{if(wdi_front.isJsonString(c.feed_row.feed_users)){c.feed_users=JSON.parse(c.feed_row.feed_users)}else{wdi_front.show_alert(wdi_front_messages.invalid_users_format,false,c);return}}c.dataCount=c.feed_users.length;var a=wdi_front.getFeedItemResolution(c);c.feedImageResolution=a.image;c.feedVideoResolution=a.video;for(var b=0;b<c.dataCount;b++){wdi_front.instagramRequest(b,c)}if(c.feed_row.number_of_photos>0){wdi_front.ajaxLoader(c)}if(c.feed_row["display_header"]==="1"){wdi_front.show("header",c)}if(c.feed_row["show_usernames"]==="1"){wdi_front.show("users",c)}};wdi_front.getFeedItemResolution=function(g){var d={image:"standard_resolution",video:"standard_resolution"};if(g.feed_row.feed_resolution==="thumbnail"){return{image:"thumbnail",video:"low_bandwidth"}}else{if(g.feed_row.feed_resolution==="low"){return{image:"low_resolution",video:"low_resolution"}}else{if(g.feed_row.feed_resolution==="standard"){return{image:"standard_resolution",video:"standard_resolution"}}}}var c=jQuery("#wdi_feed_"+g.feed_row.wdi_feed_counter).find(".wdi_feed_wrapper");c.append('<div class="wdi_feed_item" id="wdi_feed_item_example"></div>');wdi_responsive.columnControl(g,1);var b=c.attr("wdi-res").split("wdi_col_");c.find("#wdi_feed_item_example").remove();if(b.length!==2){return d}var a=parseInt(b[1]);if(a<=0){return d}var f=(c.width()/a)-10;var e=d;if(f<=150){e.image="thumbnail";e.video="low_bandwidth"}else{if(f>150&&f<=320){e.image="low_resolution";e.video="low_resolution"}else{e.image="standard_resolution";e.video="standard_resolution"}}return e};wdi_front.isJsonString=function(b){try{JSON.parse(b)}catch(a){return false}return true};wdi_front.instagramRequest=function(d,b){var a=b.feed_users,c=this;if(typeof a[d]==="string"&&a[d]==="self"){b.instagram.getRecentLikedMedia({success:function(e){if(typeof e.meta!="undefined"&&typeof e.meta.error_type!="undefined"){wdi_front.show_alert(false,e,b)}b.mediaRequestsDone=true;e=c.checkMediaResponse(e,b);if(e!=false){c.saveSelfUserData(e,b)}}})}else{if(this.getInputType(a[d]["username"])=="hashtag"){b.instagram.getTagRecentMedia(this.stripHashtag(a[d]["username"]),{success:function(e){if(typeof e.meta!="undefined"&&typeof e.meta.error_type!="undefined"){wdi_front.show_alert(false,e,b)}b.mediaRequestsDone=true;e=c.checkMediaResponse(e,b);if(e!=false){c.saveUserData(e,b.feed_users[d],b)}}})}else{if(this.getInputType(a[d]["username"])=="user"){b.instagram.getSelfRecentMedia({success:function(e){if(typeof e.meta!="undefined"&&typeof e.meta.error_type!="undefined"){e.wdi_current_feed_name=a[d].username;wdi_front.show_alert(false,e,b)}b.mediaRequestsDone=true;e=c.checkMediaResponse(e,b);if(e!=false){c.saveUserData(e,b.feed_users[d],b)}}})}}}};wdi_front.isHashtag=function(a){return(a[0]==="#")};wdi_front.saveUserData=function(d,a,b){d.username=a.username;d.user_id=a.id;if(d.user_id[0]==="#"){d.data=wdi_front.appendRequestHashtag(d.data,d.user_id)}b.usersData.push(d);b.currentResponseLength=wdi_front.getArrayContentLength(b.usersData,"data");b.allResponseLength+=b.currentResponseLength;if(b.dataCount==b.usersData.length){if(b.currentResponseLength<b.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(b)){wdi_front.loadMore("initial-keep",b)}else{wdi_front.displayFeed(b);wdi_front.applyFilters(b);if(!wdi_front.activeUsersCount(b)){if(b.feed_row.feed_display_view=="load_more_btn"){var c=jQuery("#wdi_feed_"+b.feed_row.wdi_feed_counter);c.find(".wdi_load_more").addClass("wdi_hidden");c.find(".wdi_spinner").addClass("wdi_hidden")}}}}};wdi_front.saveSelfUserData=function(c,a){c.username="";c.user_id="";a.usersData.push(c);a.currentResponseLength=wdi_front.getArrayContentLength(a.usersData,"data");a.allResponseLength+=a.currentResponseLength;if(a.dataCount==a.usersData.length){if(a.currentResponseLength<a.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(a)){wdi_front.loadMore("initial-keep",a)}else{wdi_front.displayFeed(a);wdi_front.applyFilters(a);if(!wdi_front.activeUsersCount(a)){if(a.feed_row.feed_display_view=="load_more_btn"){var b=jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter);b.find(".wdi_load_more").addClass("wdi_hidden");b.find(".wdi_spinner").addClass("wdi_hidden")}}}}};wdi_front.userHasNoPhoto=function(c,e){var a=0;var d=c.usersData;if(typeof e!="undefined"){d=e}for(var b=0;b<d.length;b++){if(typeof d[b]["pagination"]=="undefined"){d[b]["pagination"]=[]}if(c.feed_row.liked_feed==="liked"){if(typeof d[b]["pagination"]["next_max_like_id"]=="undefined"){a++}}else{if(typeof d[b]["pagination"]["next_max_id"]=="undefined"){a++}}}if(a==d.length){return 1}else{return 0}};wdi_front.appendRequestHashtag=function(c,b){for(var a=0;a<c.length;a++){c[a]["wdi_hashtag"]=b}return c};wdi_front.displayFeed=function(c,b){if(c.customFilterChanged==false){var d=wdi_front.feedSort(c,b)}var a=c.customFilterChanged;if(c.customFilterChanged==true){var d=c.customFilteredData;c.parsedData=wdi_front.parseLighboxData(c,true)}if(c.feed_row.resort_after_load_more!="1"){if(c.customFilterChanged==false){c.dataStorageList=c.dataStorageList.concat(d)}}else{if(c.customFilterChanged==false){c.dataStorageList=d}}if(c.feed_row.feed_type=="masonry"){wdi_front.masonryDisplayFeedItems(d,c)}if(c.feed_row.feed_type=="thumbnails"||c.feed_row.feed_type=="blog_style"||c.feed_row.feed_type=="image_browser"){wdi_front.displayFeedItems(d,c)}var e=wdi_front.getDataLength(c);if(e<c.photoCounter&&!a&&c.instagramRequestCounter<=c.maxConditionalFiltersRequestCount&&!wdi_front.allDataHasFinished(c)){wdi_front.loadMore("",c)}else{wdi_front.allImagesLoaded(c)}if(c.instagramRequestCounter>c.maxConditionalFiltersRequestCount){wdi_front.allImagesLoaded(c);if(d.length==0){c.stopInfiniteScrollFlag=true}}if(c.feed_row.feed_display_view=="pagination"&&c.currentPage<c.paginator){jQuery("#wdi_feed_"+c.feed_row.wdi_feed_counter).find("#wdi_last_page").removeClass("wdi_disabled")}c.instagramRequestCounter=0;c.conditionalFilterBuffer=[];wdi_front.updateUsersImages(c)};wdi_front.updateUsersImages=function(a){var b=jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter).find(".wdi_single_user .wdi_user_img_wrap img");b.each(function(){if(jQuery(this).attr("src")==wdi_url.plugin_url+"images/missing.png"||jQuery(this).attr("src")==""){if(a.feed_row.liked_feed=="liked"){return}for(var c=0;c<a.usersData.length;c++){if(a.usersData[c]["username"]==jQuery(this).parent().parent().find("h3").text()){if(a.usersData[c]["data"].length!=0){jQuery(this).attr("src",a.usersData[c]["data"][0]["images"]["thumbnail"]["url"])}}}}})};wdi_front.masonryDisplayFeedItems=function(d,h){var b=[];var p=[];if(jQuery("#wdi_feed_"+h.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length==0){return}jQuery("#wdi_feed_"+h.feed_row.wdi_feed_counter+" .wdi_masonry_column").each(function(){if(h.feed_row.resort_after_load_more==1){jQuery(this).html("");h.imageIndex=0}if(h.customFilterChanged==true){jQuery(this).html("");h.imageIndex=0}if(h.feed_row.feed_display_view=="pagination"){b.push(0)}else{b.push(jQuery(this).height())}p.push(jQuery(this))});if(h.customFilterChanged==true){h.customFilterChanged=false}for(var e=0;e<d.length;e++){h.displayedData.push(d[e]);if(d[e]["type"]=="image"){var n=wdi_front.getPhotoTemplate(h)}else{if(d[e].hasOwnProperty("videos")){var n=wdi_front.getVideoTemplate(h)}else{var n=wdi_front.getSliderTemplate(h)}}var g=d[e];var o=wdi_front.createObject(g,h);var f=n(o);var m=wdi_front.array_min(b);var l=wdi_front.getImageResolution(d[e]);p[m.index].html(p[m.index].html()+f);b[m.index]+=p[m.index].width()*l;h.imageIndex++;if(h.feed_row.feed_display_view=="pagination"){if((e+1)%h.feed_row.pagination_per_page_number===0){h.resIndex+=h.freeSpaces+1}else{h.resIndex++}}}h.wdi_loadedImages=0;var j=false;h.wdi_load_count=e;var a=h.feed_row.wdi_feed_counter;var k=jQuery("#wdi_feed_"+a+" img.wdi_img").on("load",function(){h.wdi_loadedImages++;c();if(j===false){wdi_responsive.columnControl(h,1);j=true}});c();function c(){if(h.wdi_load_count===h.wdi_loadedImages&&h.wdi_loadedImages!=0){h.loadedImages=0;h.wdi_load_count=0;wdi_front.allImagesLoaded(h)}}if(h.paginatorNextFlag==true){wdi_front.updatePagination(h,"next")}h.infiniteScrollFlag=false};wdi_front.getImageResolution=function(c){var d=c.images["standard_resolution"]["width"];var b=c.images["standard_resolution"]["height"];var a=b/d;return a};wdi_front.getDataLength=function(b,d){var c=0;if(typeof d==="undefined"){for(var a=0;a<b.dataStorage.length;a++){c+=b.dataStorage[a].length}}else{for(var a=0;a<d.length;a++){c+=d[a].length}}return c};wdi_front.getArrayContentLength=function(d,c){var b=0;for(var a=0;a<d.length;a++){if(d[a]["finished"]=="finished"){continue}b+=d[a][c].length}return b};wdi_front.displayFeedItems=function(d,j){if(jQuery("#wdi_feed_"+j.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length==0){return}var a=j.feed_row.wdi_feed_counter;var l=jQuery("#wdi_feed_"+a+" .wdi_feed_wrapper");if(j.feed_row.resort_after_load_more==="1"){l.html("");j.imageIndex=0}if(j.customFilterChanged==true){l.html("");j.imageIndex=0;j.customFilterChanged=false}var g=wdi_front.getImgCount(j)-d.length-1;if(j.feed_row.feed_display_view=="pagination"){var b=j.feed_row.load_more_number;if(j.feed_row.feed_type=="image_browser"){b=1}if(jQuery("#wdi_feed_"+j.feed_row.wdi_feed_counter+' [wdi_page="'+(j.currentPage-1)+'"]').length<b||d.length==0){j.currentPage=(--j.currentPage<=1)?1:j.currentPage}}for(var e=0;e<d.length;e++){if(d[e]["type"]=="image"){var m=wdi_front.getPhotoTemplate(j)}else{if(d[e].hasOwnProperty("videos")){var m=wdi_front.getVideoTemplate(j)}else{var m=wdi_front.getSliderTemplate(j)}}var h=d[e];var n=wdi_front.createObject(h,j);var f=m(n);l.html(l.html()+f);j.imageIndex++;if(j.feed_row.feed_display_view=="pagination"){if((e+1)%j.feed_row.pagination_per_page_number===0){j.resIndex+=j.freeSpaces+1}else{j.resIndex++}}}j.wdi_loadedImages=0;var k=false;j.wdi_load_count=e;var a=j.feed_row.wdi_feed_counter;var l=jQuery("#wdi_feed_"+a+" img.wdi_img").on("load",function(){j.wdi_loadedImages++;c();if(k===false){wdi_responsive.columnControl(j,1);k=true}});function c(){if(j.wdi_load_count===j.wdi_loadedImages&&j.wdi_loadedImages!=0){j.loadedImages=0;j.wdi_load_count=0;wdi_front.allImagesLoaded(j)}}if(j.paginatorNextFlag==true){wdi_front.updatePagination(j,"next")}j.infiniteScrollFlag=false};wdi_front.checkFeedFinished=function(b){for(var a=0;a<b.usersData.length;a++){if(typeof b.usersData[a]["finished"]=="undefined"){return false}}return true};wdi_front.sortingOperator=function(c,b){var a;switch(c){case"date":switch(b){case"asc":a=function(e,d){return(e.created_time>d.created_time)?1:-1};break;case"desc":a=function(e,d){return(e.created_time>d.created_time)?-1:1};break}break;case"likes":switch(b){case"asc":a=function(e,d){return(e.likes["count"]<d.likes["count"])?-1:1};break;case"desc":a=function(e,d){return(e.likes["count"]<d.likes["count"])?1:-1};break}break;case"comments":switch(b){case"asc":a=function(e,d){return(e.comments["count"]<d.comments["count"])?-1:1};break;case"desc":a=function(e,d){return(e.comments["count"]<d.comments["count"])?1:-1};break}break;case"random":a=function(e,d){var f=Math.random();return(f>0.5)?1:-1};break}return a};wdi_front.feedSort=function(e,b){var d=e.feed_row.sort_images_by;var c=e.feed_row.display_order;if(e.feed_row.resort_after_load_more==="1"){e.data=e.data.concat(wdi_front.smartPicker(e,b))}else{e.data=wdi_front.smartPicker(e,b)}var a=wdi_front.sortingOperator(d,c);e.data.sort(a);return e.data};wdi_front.smartPicker=function(l,c){var g=[];var a=0;var k=[];var f=Math.ceil(l.feed_row["number_of_photos"]/l.usersData.length);var b=parseInt(l.feed_row["number_of_photos"]);var n=0;if(c!=""&&typeof c!="undefined"&&c!=null){b=parseInt(c);f=Math.ceil(b/wdi_front.activeUsersCount(l))}var j=function(p,i){return(p.data.length>i.data.length)?1:-1};var e=function(p,i){return(p.length()>i.length())?1:-1};l.storeRawData(l.usersData,"dataStorageRaw");var o=l.dataStorageRaw.sort(e);var h=l.usersData.sort(j);for(var d=0;d<h.length;d++){n+=f;if(o[d].length()<=n){n-=o[d].length();g.push(o[d].getData(o[d].length()));a+=g[g.length-1].length}else{if(a+n>b){n=b-a}var m=[];if(l.auto_trigger===false){m=m.concat(o[d].getData(n))}else{if(m.length+wdi_front.getDataLength(l)+wdi_front.getDataLength(l,g)<l.feed_row["number_of_photos"]){m=m.concat(o[d].getData(n))}}n=0;a+=m.length;g.push(m)}}for(d=0;d<g.length;d++){if(typeof l.dataStorage[d]==="undefined"){l.dataStorage.push(g[d])}else{l.dataStorage[d]=l.dataStorage[d].concat(g[d])}}l.parsedData=wdi_front.parseLighboxData(l);for(d=0;d<g.length;d++){k=k.concat(g[d])}return k};wdi_front.createObject=function(e,h){var j=(e.caption!=null)?e.caption["text"]:"&nbsp";var i="";if(e.type=="video"){i=e.hasOwnProperty("videos")?e.videos[h.feedVideoResolution]["url"]:""}var f=e.images[h.feedImageResolution].url;var a=h.imageIndex;var b="square";var d=e.images["standard_resolution"]["height"];var g=e.images["standard_resolution"]["width"];if(d>g){b="portrait"}else{if(d<g){b="landscape"}}var c={id:e.id,caption:wdi_front.escape_tags(j),image_url:f,likes:e.likes["count"],comments:e.comments["count"],wdi_index:a,wdi_res_index:h.resIndex,wdi_media_user:e.user["username"],link:e.link,video_url:i,wdi_username:e.user["username"],wdi_shape:b};return c};wdi_front.setPage=function(c){var b=c.feed_row.feed_display_view;var e=c.feed_row.feed_type;if(b!="pagination"){return""}var a=c.imageIndex;if(e=="image_browser"){var d=1}else{var d=Math.abs(c.feed_row.pagination_per_page_number)}c.paginator=Math.ceil((a+1)/d);return c.paginator};wdi_front.getPhotoTemplate=function(g){var e=wdi_front.setPage(g);var j="";var k="";var l="";var d="";var m="fa-arrows-alt";var c="";if(g.feed_row.feed_type=="blog_style"||g.feed_row.feed_type=="image_browser"){m=""}if(e!=""){k='wdi_page="'+e+'"';sourceAttr="src"}else{sourceAttr="src"}if(e!=""&&e!=1){j="wdi_hidden"}if(g.feed_row.show_username_on_thumb=="1"){c='<span class="wdi_media_user">@<%= wdi_username%></span>'}if(g.feed_row.show_full_description==1&&g.feed_row.feed_type=="masonry"){j+=" wdi_full_caption"}var f="";if(g.feed_row.feed_type!=="blog_style"){if(g.feed_row.feed_type=="masonry"){f="wdi_responsive.showMasonryCaption(jQuery(this),"+g.feed_row.wdi_feed_counter+");"}else{f="wdi_responsive.showCaption(jQuery(this),"+g.feed_row.wdi_feed_counter+");"}}switch(g.feed_row.feed_item_onclick){case"lightbox":l="onclick=wdi_feed_"+g.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":l="onclick=\"window.open ('<%= link%>','_blank')\"";d="wdi_hover_off";m="";break;case"custom_redirect":l="onclick=\"window.open ('"+g.feed_row.redirect_url+"','_self')\"";d="wdi_hover_off";m="";break;case"none":l="";d="wdi_cursor_off wdi_hover_off";m=""}var h="<%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>";var b=g.feed_row.wdi_feed_counter;var a='<div class="wdi_feed_item '+j+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+k+' wdi_type="image" id="wdi_'+b+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img '+h+'"><img class="wdi_img" '+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+d+'" >'+c+'<div class="wdi_thumb_icon" '+l+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="fa '+m+'"></i></div></div></div></div></div></div>';if(g.feed_row["show_likes"]==="1"||g.feed_row["show_comments"]==="1"||g.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_meta">';if(g.feed_row["show_likes"]==="1"){a+='<div class="wdi_thumb_likes"><i class="fa fa-heart-o">&nbsp;<%= likes%></i></div>'}if(g.feed_row["show_comments"]==="1"){a+='<div class="wdi_thumb_comments"><i class="fa fa-comment-o">&nbsp;<%= comments%></i></div>'}a+='<div class="wdi_clear"></div>';if(g.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_title" onclick='+f+" ><%=caption%></div>"}a+="</div>"}a+="</div>";var i=_.template(a);return i};wdi_front.getSliderTemplate=function(g){var e=wdi_front.setPage(g);var j="";var k="";var l="";var d="";var m="fa-clone";var c="";if(g.feed_row.feed_type=="blog_style"||g.feed_row.feed_type=="image_browser"){m=""}if(e!=""){k='wdi_page="'+e+'"';sourceAttr="src"}else{sourceAttr="src"}if(e!=""&&e!=1){j="wdi_hidden"}if(g.feed_row.show_username_on_thumb=="1"){c='<span class="wdi_media_user">@<%= wdi_username%></span>'}if(g.feed_row.show_full_description==1&&g.feed_row.feed_type=="masonry"){j+=" wdi_full_caption"}var f="";if(g.feed_row.feed_type!=="blog_style"){if(g.feed_row.feed_type=="masonry"){f="wdi_responsive.showMasonryCaption(jQuery(this),"+g.feed_row.wdi_feed_counter+");"}else{f="wdi_responsive.showCaption(jQuery(this),"+g.feed_row.wdi_feed_counter+");"}}switch(g.feed_row.feed_item_onclick){case"lightbox":l="onclick=wdi_feed_"+g.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":l="onclick=\"window.open ('<%= link%>','_blank')\"";d="wdi_hover_off";m="fa-clone";break;case"custom_redirect":l="onclick=\"window.open ('"+g.feed_row.redirect_url+"','_self')\"";d="wdi_hover_off";m="";break;case"none":l="";d="wdi_cursor_off wdi_hover_off";m=""}var h="<%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>";var b=g.feed_row.wdi_feed_counter;var a='<div class="wdi_feed_item '+j+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+k+' wdi_type="slideshow" id="wdi_'+b+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img '+h+'"><img class="wdi_img" '+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+d+'" >'+c+'<div class="wdi_thumb_icon" '+l+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="fa '+m+'"></i></div></div></div></div></div></div>';if(g.feed_row["show_likes"]==="1"||g.feed_row["show_comments"]==="1"||g.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_meta">';if(g.feed_row["show_likes"]==="1"){a+='<div class="wdi_thumb_likes"><i class="fa fa-heart-o">&nbsp;<%= likes%></i></div>'}if(g.feed_row["show_comments"]==="1"){a+='<div class="wdi_thumb_comments"><i class="fa fa-comment-o">&nbsp;<%= comments%></i></div>'}a+='<div class="wdi_clear"></div>';if(g.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_title" onclick='+f+" ><%=caption%></div>"}a+="</div>"}a+="</div>";var i=_.template(a);return i};wdi_front.replaceToVideo=function(b,a,c){overlayHtml="<video style='width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;' controls=''><source src='"+b+"' type='video/mp4'>Your browser does not support the video tag. </video>";jQuery("#wdi_feed_"+c+' [wdi_index="'+a+'"] .wdi_photo_wrap_inner').html(overlayHtml);jQuery("#wdi_feed_"+c+' [wdi_index="'+a+'"] .wdi_photo_wrap_inner video').get(0).play()};wdi_front.getVideoTemplate=function(h){var f=wdi_front.setPage(h);var k="";var l="";var n="fa-play";var m="";var d="";var e;var c="";if(f!=""){l='wdi_page="'+f+'"';e="src"}else{e="src"}if(f!=""&&f!=1){k="wdi_hidden"}if(h.feed_row.show_username_on_thumb=="1"){c='<span class="wdi_media_user">@<%= wdi_username%></span>'}if(h.feed_row.show_full_description==1&&h.feed_row.feed_type=="masonry"){k+=" wdi_full_caption"}var g="";if(h.feed_row.feed_type!=="blog_style"){if(h.feed_row.feed_type=="masonry"){g="wdi_responsive.showMasonryCaption(jQuery(this),"+h.feed_row.wdi_feed_counter+");"}else{g="wdi_responsive.showCaption(jQuery(this),"+h.feed_row.wdi_feed_counter+");"}}switch(h.feed_row.feed_item_onclick){case"lightbox":m="onclick=wdi_feed_"+h.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":m="onclick=\"window.open ('<%= link%>','_blank')\"";d="wdi_hover_off";n="fa-play";break;case"custom_redirect":m="onclick=\"window.open ('"+h.feed_row.redirect_url+"','_self')\"";d="wdi_hover_off";n="";break;case"none":d="wdi_cursor_off wdi_hover_off";n="";if(h.feed_row.feed_type=="blog_style"||h.feed_row.feed_type=="image_browser"){m="onclick=wdi_front.replaceToVideo('<%= video_url%>','<%= wdi_index%>',"+h.feed_row.wdi_feed_counter+")";d="";n="fa-play"}}var i="<%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>";var b=h.feed_row.wdi_feed_counter;var a='<div class="wdi_feed_item '+k+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+l+' wdi_type="image" id="wdi_'+b+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img '+i+'"><img class="wdi_img" '+e+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+d+'" '+m+">"+c+'<div class="wdi_thumb_icon" style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="fa '+n+'"></i></div></div></div></div></div></div>';if(h.feed_row["show_likes"]==="1"||h.feed_row["show_comments"]==="1"||h.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_meta">';if(h.feed_row["show_likes"]==="1"){a+='<div class="wdi_thumb_likes"><i class="fa fa-heart-o">&nbsp;<%= likes%></i></div>'}if(h.feed_row["show_comments"]==="1"){a+='<div class="wdi_thumb_comments"><i class="fa fa-comment-o">&nbsp;<%= comments%></i></div>'}a+='<div class="wdi_clear"></div>';if(h.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_title" onclick='+g+" ><%=caption%></div>"}a+="</div>"}a+="</div>";var j=_.template(a);return j};wdi_front.bindEvents=function(a){if(jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length==0){return}if(a.feed_row.feed_display_view=="load_more_btn"){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_load_more_container").on(wdi_front.clickOrTouch,function(){wdi_front.loadMore(jQuery(this).find(".wdi_load_more_wrap"))})}if(a.feed_row.feed_display_view=="pagination"){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_next").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorNext(jQuery(this),a)});jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_prev").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorPrev(jQuery(this),a)});jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_last_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationLastPage(jQuery(this),a)});jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_first_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationFirstPage(jQuery(this),a)});a.paginatorNextFlag=false}if(a.feed_row.feed_display_view=="infinite_scroll"){jQuery(window).on("scroll",function(){wdi_front.infiniteScroll(a)});a.infiniteScrollFlag=false}};wdi_front.infiniteScroll=function(a){if((jQuery(window).scrollTop()+jQuery(window).height()-100)>=jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_infinite_scroll").offset().top){if(a.infiniteScrollFlag===false&&a.stopInfiniteScrollFlag==false){a.infiniteScrollFlag=true;wdi_front.loadMore(jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_infinite_scroll"),a)}else{if(a.stopInfiniteScrollFlag){wdi_front.allImagesLoaded(a)}}}};wdi_front.paginationFirstPage=function(b,c){if(c.paginator==1||c.currentPage==1){b.addClass("wdi_disabled");return}var d=c.currentPage;c.currentPage=1;wdi_front.updatePagination(c,"custom",d);var a=b.parent().find("#wdi_last_page");a.removeClass("wdi_disabled");b.addClass("wdi_disabled")};wdi_front.paginationLastPage=function(a,b){if(b.paginator==1||b.currentPage==b.paginator){return}var d=b.currentPage;b.currentPage=b.paginator;wdi_front.updatePagination(b,"custom",d);a.addClass("wdi_disabled");var c=a.parent().find("#wdi_first_page");c.removeClass("wdi_disabled")};wdi_front.paginatorNext=function(b,c){var a=b.parent().find("#wdi_last_page");var d=b.parent().find("#wdi_first_page");c.paginatorNextFlag=true;if(c.paginator==c.currentPage&&!wdi_front.checkFeedFinished(c)){c.currentPage++;var e=c.feed_row.number_of_photos;wdi_front.loadMore(b,c,e);a.addClass("wdi_disabled")}else{if(c.paginator>c.currentPage){c.currentPage++;wdi_front.updatePagination(c,"next");if(c.paginator>c.currentPage){a.removeClass("wdi_disabled")}else{a.addClass("wdi_disabled")}}}d.removeClass("wdi_disabled")};wdi_front.paginatorPrev=function(b,c){var a=b.parent().find("#wdi_last_page");var d=b.parent().find("#wdi_first_page");if(c.currentPage==1){d.addClass("wdi_disabled");return}c.currentPage--;wdi_front.updatePagination(c,"prev");a.removeClass("wdi_disabled");if(c.currentPage==1){d.addClass("wdi_disabled")}};wdi_front.updatePagination=function(b,a,d){var c="#wdi_feed_"+b.feed_row.wdi_feed_counter;jQuery(c+' [wdi_page="'+b.currentPage+'"]').each(function(){jQuery(this).removeClass("wdi_hidden")});switch(a){case"next":var d=b.currentPage-1;jQuery(c+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height());jQuery(c+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"prev":var d=b.currentPage+1;jQuery(c+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height());jQuery(c+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"custom":var d=d;if(d!=b.currentPage){jQuery(c+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height());jQuery(c+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")})}break}b.paginatorNextFlag=false;jQuery(c+" .wdi_feed_wrapper").css("height","auto");jQuery(c+" #wdi_current_page").text(b.currentPage)};wdi_front.loadMore=function(f,k){var b=0;if(f!=""&&typeof f!="undefined"&&f!="initial"&&f!="initial-keep"){var l=window[f.parent().parent().parent().parent().attr("id")]}if(typeof k!="undefined"){var l=k}var n=0,g=0;for(var e=0;e<l.userSortFlags.length;e++){if(l.userSortFlags[e].flag===true){n++;for(var d=0;d<l.usersData.length;d++){if(l.userSortFlags[e]["id"]===l.usersData[d]["user_id"]){if(l.usersData[d]["finished"]==="finished"){g++}}}}}if(n===g&&n!=0){return}if(f===""){l.auto_trigger=true}else{l.auto_trigger=false}wdi_front.ajaxLoader(l);if(l.feed_row.feed_type==="masonry"&&l.feed_row.feed_display_view=="pagination"){jQuery("#wdi_feed_"+wdi_front.feed_counter+" .wdi_full_caption").each(function(){jQuery(this).find(".wdi_photo_title").trigger(wdi_front.clickOrTouch)})}for(var e=0;e<l.usersData.length;e++){if(l.usersData[e]["finished"]==="finished"){b++}}if(b===l.usersData.length){wdi_front.allImagesLoaded(l);jQuery("#wdi_feed_"+l.feed_row["wdi_feed_counter"]+" .wdi_load_more").remove()}var h=l.usersData;l.loadMoreDataCount=l.feed_users.length;for(var e=0;e<h.length;e++){var m=h[e]["pagination"];var c={user_id:h[e]["user_id"],username:h[e]["username"]};if(m.next_url!=""&&m.next_url!=null&&typeof m.next_url!="undefined"){var a=m.next_url;wdi_front.loadMoreRequest(c,a,l,f)}else{if(f=="initial-keep"){l.temproraryUsersData[e]=l.usersData[e]}l.loadMoreDataCount--;wdi_front.checkForLoadMoreDone(l,f);continue}}};wdi_front.loadMoreRequest=function(b,a,e,d){if(!e.mediaRequestsDone){return}var f=e.usersData;var c="";e.instagram.requestByUrl(a,{success:function(g){if(typeof g.meta!="undefined"&&typeof g.meta.error_type!="undefined"){wdi_front.show_alert(false,g,e)}if(g===""||typeof g=="undefined"||g==null){c=wdi_front_messages.network_error;e.loadMoreDataCount--;wdi_front.show_alert(c,g,e);return}if(g.meta["code"]!=200){c=g.meta["error_message"];e.loadMoreDataCount--;wdi_front.show_alert(c,g,e);return}g.user_id=b.user_id;g.username=b.username;for(var h=0;h<e.usersData.length;h++){if(g.user_id===e.usersData[h]["user_id"]){if(g.user_id[0]==="#"){g.data=wdi_front.appendRequestHashtag(g.data,g.user_id)}if(d=="initial-keep"){e.temproraryUsersData[h]=e.usersData[h]}e.usersData[h]=g;e.loadMoreDataCount--}}wdi_front.checkForLoadMoreDone(e,d)}})};wdi_front.checkForLoadMoreDone=function(c,b){var a=c.feed_row.load_more_number;var e=c.feed_row.number_of_photos;if(c.loadMoreDataCount==0){c.temproraryUsersData=wdi_front.mergeData(c.temproraryUsersData,c.usersData);var d=wdi_front.getArrayContentLength(c.temproraryUsersData,"data");if(b=="initial-keep"){b="initial"}if(b=="initial"){if(d<e&&!wdi_front.userHasNoPhoto(c,c.temproraryUsersData)&&c.instagramRequestCounter<=c.maxConditionalFiltersRequestCount){wdi_front.loadMore("initial",c)}else{c.usersData=c.temproraryUsersData;wdi_front.displayFeed(c);wdi_front.applyFilters(c);c.temproraryUsersData=[]}}else{if(d<a&&!wdi_front.userHasNoPhoto(c,c.temproraryUsersData)&&c.instagramRequestCounter<=c.maxConditionalFiltersRequestCount){wdi_front.loadMore(undefined,c)}else{c.usersData=c.temproraryUsersData;if(!wdi_front.activeUsersCount(c)){return}wdi_front.displayFeed(c,a);wdi_front.applyFilters(c);c.temproraryUsersData=[]}}}};wdi_front.allDataHasFinished=function(b){var d=0;for(var a=0;a<b.dataStorageRaw.length;a++){if(b.dataStorageRaw[a].length()==0&&b.dataStorageRaw[a].locked==true){d++}}return(d==b.dataStorageRaw.length)};wdi_front.mergeData=function(c,b){for(var a=0;a<b.length;a++){if(typeof c[a]!="undefined"){if(b[a]["finished"]=="finished"){continue}if(typeof c[a]["pagination"]["next_max_id"]=="undefined"&&typeof c[a]["pagination"]["next_max_like_id"]=="undefined"){continue}c[a]["data"]=c[a]["data"].concat(b[a]["data"]);c[a]["pagination"]=b[a]["pagination"];c[a]["user_id"]=b[a]["user_id"];c[a]["username"]=b[a]["username"];c[a]["meta"]=b[a]["meta"]}else{c.push(b[a])}}return c};wdi_front.brokenImageHandler=function(a){a.src=wdi_url.plugin_url+"images/missing.png";a.onerror="";return true};wdi_front.ajaxLoader=function(a){var d=a.feed_row.wdi_feed_counter;var c=jQuery("#wdi_feed_"+d);if(a.feed_row.feed_display_view=="load_more_btn"){c.find(".wdi_load_more").addClass("wdi_hidden");c.find(".wdi_spinner").removeClass("wdi_hidden")}if(a.feed_row.feed_display_view=="infinite_scroll"){var b;if(c.find(".wdi_ajax_loading").length==0){b=jQuery('<div class="wdi_ajax_loading"><div><div><img class="wdi_load_more_spinner" src="'+wdi_url.plugin_url+'images/ajax_loader.png"></div></div></div>');c.append(b)}else{b=c.find(".wdi_ajax_loading")}b.removeClass("wdi_hidden")}};wdi_front.allImagesLoaded=function(a){var d=wdi_front.getDataLength(a);if(!a.mediaRequestsDone){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").remove("wdi_nomedia")}if(d==0&&a.mediaRequestsDone&&(a.feed_row.conditional_filters.length==0||a.feed_row.conditional_filter_enable==0)){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").append("<p class='wdi_nomedia'>"+wdi_front_messages.feed_nomedia+"</p>")}var c=a.feed_row.wdi_feed_counter;var b=jQuery("#wdi_feed_"+c);if(a.feed_row.feed_display_view=="load_more_btn"){b.find(".wdi_load_more").removeClass("wdi_hidden");b.find(".wdi_spinner").addClass("wdi_hidden")}if(a.feed_row.feed_display_view=="infinite_scroll"){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_ajax_loading").addClass("wdi_hidden")}b.trigger("wdi_feed_loaded")};wdi_front.show=function(b,c){var e=c.feed_row.wdi_feed_counter;var d=jQuery("#wdi_feed_"+e+" .wdi_feed_container");var g=this;switch(b){case"header":f();break;case"users":a(c);break}function f(){var i={feed_thumb:c.feed_row["feed_thumb"],feed_name:c.feed_row["feed_name"]};var k=wdi_front.getHeaderTemplate(),h=k(i),j=d.find(".wdi_feed_header").html();d.find(".wdi_feed_header").html(j+h)}function a(j){d.find(".wdi_feed_users").html("");var n=j.feed_users;var m=j.feed_row["access_token"];var h=0;j.headerUserinfo=[];k();function k(){if(j.headerUserinfo.length==n.length){l(j.headerUserinfo,j);return}var i=n[j.headerUserinfo.length];if(typeof i==="string"&&i==="self"){j.instagram.getSelfInfo({success:function(o){if(typeof o.meta!="undefined"&&typeof o.meta.error_type!="undefined"){wdi_front.show_alert(false,o,j)}o=g.checkMediaResponse(o,j);if(o!=false&&o.meta["code"]===400&&o.meta["error_type"]==="APINotAllowedError"){var p=null;j.headerUserinfo.push(p);h++;k()}if(o!=false&&o.meta["code"]===200){var p={id:o.data["id"],name:o.data["username"],url:o.data["profile_picture"],bio:wdi_front.escape_tags(o.data["bio"]),counts:o.data["counts"],website:wdi_front.escape_tags(o.data["website"]),full_name:wdi_front.escape_tags(o.data["full_name"])};j.headerUserinfo.push(p);h++;k()}},args:{ignoreFiltering:true}})}else{if(g.getInputType(i.username)=="hashtag"){j.instagram.searchForTagsByName(g.stripHashtag(i.username),{success:function(o){if(typeof o.meta!="undefined"&&typeof o.meta.error_type!="undefined"){wdi_front.show_alert(false,o,j)}o=g.checkMediaResponse(o,j);if(o!=false){if(o.data.length==0){var p="";var q={media:""}}else{var p="";var q={media:o.data[0]["media_count"]}}var r={name:n[h]["username"],url:p,counts:q};h++;j.headerUserinfo.push(r);k()}},args:{ignoreFiltering:true}})}else{if(g.getInputType(i.username)=="user"){j.instagram.getSelfInfo({success:function(o){if(typeof o.meta!="undefined"&&typeof o.meta.error_type!="undefined"){wdi_front.show_alert(false,o,j)}o=g.checkMediaResponse(o,j);if(o!=false&&o.meta["code"]===400&&o.meta["error_type"]==="APINotAllowedError"){var p=null;j.headerUserinfo.push(p);h++;k()}if(o!=false&&o.meta["code"]===200){var p={id:o.data["id"],name:o.data["username"],url:o.data["profile_picture"],bio:wdi_front.escape_tags(o.data["bio"]),counts:o.data["counts"],website:wdi_front.escape_tags(o.data["website"]),full_name:wdi_front.escape_tags(o.data["full_name"])};j.headerUserinfo.push(p);h++;k()}},args:{ignoreFiltering:true}})}}}}function l(i,t){d.find(".wdi_feed_users").html("");for(var q=0;q<i.length;q++){if(i[q]===null){continue}var u={flag:false,id:i[q]["id"],name:i[q]["name"]};var p=(i[q]["name"][0]=="#")?"wdi_header_hashtag":"";var o={user_index:q,user_img_url:i[q]["url"],counts:i[q]["counts"],feed_counter:t.feed_row.wdi_feed_counter,user_name:i[q]["name"],bio:wdi_front.escape_tags(i[q]["bio"]),usersCount:t.feed_row.feed_users.length,hashtagClass:p};var w=wdi_front.getUserTemplate(t,i[q]["name"]),r=w(o),s=d.find(".wdi_feed_users").html();d.find(".wdi_feed_users").html(s+r);t.userSortFlags.push(u);var v=jQuery('<div class="wdi_clear"></div>')}d.find(".wdi_feed_users").append(v);wdi_front.updateUsersImages(t)}}};wdi_front.getUserTemplate=function(c,h){var a=c.dataCount,d,f,g;switch(h[0]){case"#":d="//instagram.com/explore/tags/"+h.substr(1,h.length);break;default:d="//instagram.com/"+h;break}g='window.open("'+d+'","_blank")';f="onclick='"+g+"'";var e='<div class="wdi_single_user" user_index="<%=user_index%>"><div class="wdi_header_user_text <%=hashtagClass%>"><div class="wdi_user_img_wrap"><img onerror="wdi_front.brokenImageHandler(this);" src="<%= user_img_url%>">';if(a>1){e+='<div title="'+wdi_front_messages.filter_title+'" class="wdi_filter_overlay"><div class="wdi_filter_icon"><span onclick="wdi_front.addFilter(<%=user_index%>,<%=feed_counter%>);" class="fa fa-filter"></span></div></div>'}e+="</div>";e+="<h3 "+f+"><%= user_name%></h3>";if(h[0]!=="#"){if(c.feed_row.follow_on_instagram_btn=="1"){e+='<div class="wdi_user_controls"><div class="wdi_follow_btn" onclick="window.open(\'//instagram.com/<%= user_name%>\',\'_blank\')"><span> '+wdi_front_messages.follow+"</span></div></div>"}e+='<div class="wdi_media_info"><p class="wdi_posts"><span class="fa fa-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span class="fa fa-user"></span><%= counts.followed_by%></p></div>'}else{e+='<div class="wdi_user_controls"></div><div class="wdi_media_info"><p class="wdi_posts"><span class="fa fa-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span></span></p></div>'}e+='<div class="wdi_clear"></div>';if(a==1&&h[0]!=="#"&&c.feed_row.display_user_info=="1"){e+='<div class="wdi_bio"><%= bio%></div>'}e+="</div></div>";var b=_.template(e);return b};wdi_front.getHeaderTemplate=function(){var b='<div class="wdi_header_wrapper"><div class="wdi_header_img_wrap"><img src="<%=feed_thumb%>"></div><div class="wdi_header_text"><%=feed_name%></div><div class="wdi_clear"></div>';var a=_.template(b);return a};wdi_front.addFilter=function(e,g){var f=window["wdi_feed_"+g];var d=f.dataCount;if(d<2){return}if(f.nowLoadingImages!=false){return}else{var c=jQuery("#wdi_feed_"+f.feed_row.wdi_feed_counter+'_users [user_index="'+e+'"]');c.find(".wdi_filter_overlay").toggleClass("wdi_filter_active_bg");c.find(".wdi_header_user_text h3").toggleClass("wdi_filter_active_col");c.find(".wdi_media_info").toggleClass("wdi_filter_active_col");c.find(".wdi_follow_btn").toggleClass("wdi_filter_active_col");f.customFilterChanged=true;if(f.userSortFlags[e]["flag"]==false){f.userSortFlags[e]["flag"]=true}else{f.userSortFlags[e]["flag"]=false}var a=0;for(var b=0;b<f.userSortFlags.length;b++){if(f.userSortFlags[b]["flag"]==true){a++}}if(f.feed_row.feed_display_view=="pagination"){f.resIndex=0}if(a!=0){wdi_front.filterData(f);wdi_front.displayFeed(f)}else{f.customFilteredData=f.dataStorageList;wdi_front.displayFeed(f)}if(f.feed_row.feed_display_view=="pagination"){f.paginator=Math.ceil((f.imageIndex)/parseInt(f.feed_row.pagination_per_page_number));f.currentPage=f.paginator;wdi_front.updatePagination(f,"custom",1);jQuery("#wdi_first_page").removeClass("wdi_disabled");jQuery("#wdi_last_page").addClass("wdi_disabled")}}};wdi_front.filterData=function(c){var d=c.userSortFlags;c.customFilteredData=[];for(var b=0;b<c.dataStorageList.length;b++){for(var a=0;a<d.length;a++){if((c.dataStorageList[b]["user"]["id"]==d[a]["id"]||c.dataStorageList[b]["wdi_hashtag"]==d[a]["name"])&&d[a]["flag"]==true){c.customFilteredData.push(c.dataStorageList[b])}}}};wdi_front.applyFilters=function(c){for(var b=0;b<c.userSortFlags.length;b++){if(c.userSortFlags[b]["flag"]==true){var a=jQuery("#wdi_feed_"+c.feed_row.wdi_feed_counter+'[user_index="'+b+'"]');wdi_front.addFilter(b,c.feed_row.wdi_feed_counter);wdi_front.addFilter(b,c.feed_row.wdi_feed_counter)}}};wdi_front.getImgCount=function(b){var d=b.dataStorage;var c=0;for(var a=0;a<d.length;a++){c+=d[a].length}return c};wdi_front.parseLighboxData=function(k,m){var g=k.dataStorage;var l=k.feed_row.sort_images_by;var a=k.feed_row.display_order;var h=wdi_front.sortingOperator(l,a);var f=[];var b=[];var e={};if(m==true){f=k.customFilteredData}else{for(var d=0;d<g.length;d++){for(var c=0;c<g[d].length;c++){f.push(g[d][c])}}f.sort(h)}for(d=0;d<f.length;d++){e={alt:"",avg_rating:"",comment_count:f[d]["comments"]["count"],date:wdi_front.convertUnixDate(f[d]["created_time"]),description:wdi_front.getDescription((f[d]["caption"]!==null)?wdi_front.escape_tags(f[d]["caption"]["text"]):""),filename:wdi_front.getFileName(f[d]),filetype:wdi_front.getFileType(f[d]),hit_count:"0",id:f[d]["id"],image_url:f[d]["link"],number:0,rate:"",rate_count:"0",username:f[d]["user"]["username"],profile_picture:f[d]["user"]["profile_picture"],thumb_url:f[d]["link"]+"media/?size=t",comments_data:f[d]["comments"]["data"],images:f[d]["images"],carousel_media:(typeof f[d]["carousel_media"]!=="undefined")?f[d]["carousel_media"]:null};b.push(e)}return b};wdi_front.convertUnixDate=function(b){var c=parseInt(b);var a=new Date(0);a.setUTCSeconds(c);var d=a.getFullYear()+"-"+a.getMonth()+"-"+a.getDate();d+=" "+a.getHours()+":"+a.getMinutes();return d};wdi_front.getDescription=function(a){a=a.replace(/\r?\n|\r/g," ");return a};wdi_front.getFileName=function(d){var c=d.link;var b=d.type;if(b==="video"&&d.hasOwnProperty("videos")){return d.videos["standard_resolution"]["url"]}else{var a=c.split("/");return a[a.length-2]}};wdi_front.getFileType=function(a){if(a.type=="video"&&a.hasOwnProperty("videos")){return"EMBED_OEMBED_INSTAGRAM_VIDEO"}else{return"EMBED_OEMBED_INSTAGRAM_IMAGE"}};wdi_front.array_max=function(d){var a=d[0];var b=0;for(var c=1;c<d.length;c++){if(a<d[c]){a=d[c];b=c}}return{value:a,index:b}};wdi_front.array_min=function(d){var c=d[0];var a=0;for(var b=1;b<d.length;b++){if(c>d[b]){c=d[b];a=b}}return{value:c,index:a}};wdi_front.activeUsersCount=function(c){var a=0;for(var b=0;b<c.usersData.length;b++){if(c.usersData[b].finished!="finished"){a++}}return a};wdi_front.checkMediaResponse=function(a,b){if(a!=""&&typeof a!="undefined"&&a!=null&&a.meta["code"]===400&&a.meta["error_type"]==="APINotAllowedError"){return a}if(a==""||typeof a=="undefined"||a==null){errorMessage=wdi_front_messages.connection_error;wdi_front.show_alert(errorMessage,a,b);return false}if(a.meta["code"]!=200){errorMessage=a.meta["error_message"];wdi_front.show_alert(errorMessage,a,b);return false}return a};wdi_front.stripHashtag=function(a){switch(a[0]){case"#":return a.substr(1,a.length);break;default:return a;break}};wdi_front.getInputType=function(a){switch(a[0]){case"#":return"hashtag";break;case"%":return"location";break;default:return"user";break}};wdi_front.regexpTestCaption=function(h,e){var d=false,b=false,f=[],g=e.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&"),c=new RegExp("(?:^|\\s)"+g+"(?:^|\\s)"),a=new RegExp("(?:^|\\s)"+g,"g");if(c.exec(h)!=null){d=true}while((match=a.exec(h))!=null){if(match.index==h.length-e.length-1){b=true}}if(d==true||b==true){return true}else{return false}};wdi_front.replaceNewLines=function(c){var b="vUkCJvN2ps3t",a=[],g;c=c.replace(/\r?\n|\r/g,b);g=new RegExp(b,"g");while((match=g.exec(c))!=null){a.push(match.index)}var f=c.split(b);var e=0;for(var d=0;d<f.length;d++){if(f[d]==""){e++}else{e=0}if(e>0){f.splice(d,1);e--;d--}}c=f.join(" ");return c};wdi_front.isEmptyObject=function(a){for(var b in a){if(a.hasOwnProperty(b)){return false}}return true};var WDIFeed=function(a){this["data"]=a.data;this["dataCount"]=a.dataCount;this["feed_row"]=a.feed_row;this["usersData"]=a.usersData;_this=this;this.set_images_loading_flag=function(b){window.addEventListener("load",function(){b.nowLoadingImages=false})};this.set_images_loading_flag(_this)};WDIFeed.prototype.conditionalFilter=function(a,c){var d=this,b=d.feed_row.conditional_filter_type,e=d.feed_row.conditional_filters;if(c.ignoreFiltering==true){}else{a=this.avoidDuplicateMedia(a)}if(!wdi_front.isJsonString(e)){return a}else{e=JSON.parse(e);if(e.length==0){return a}}if(d.feed_row.conditional_filter_enable=="0"){return a}d.instagramRequestCounter++;switch(b){case"AND":a=this.applyANDLogic(a,e,d);break;case"OR":a=this.applyORLogic(a,e,d);break;case"NOR":a=this.applyNORLogic(a,e,d);break;default:break}return a};WDIFeed.prototype.applyANDLogic=function(a,d){var c=this;for(var b=0;b<d.length;b++){a=this.filterResponse(a,d[b])}return a};WDIFeed.prototype.applyORLogic=function(d,c){var h=this;var a=[],g,j=[],f,b;for(var e=0;e<c.length;e++){g=this.filterResponse(d,c[e]);a=a.concat(g.data);g={}}for(e=0;e<a.length;e++){b=a[e];if(!this.mediaExists(b,j)&&!this.mediaExists(b,h.dataStorageList)){j.push(b)}}f={data:j,meta:d.meta,pagination:d.pagination};return f};WDIFeed.prototype.applyNORLogic=function(c,h){var f=c,g=this,b=this.applyORLogic(c,h,g),d=[],a;for(var e=0;e<f.data.length;e++){if(!this.mediaExists(f.data[e],b.data)){d.push(f.data[e])}}a={data:d,meta:f.meta,pagination:f.pagination};return a};WDIFeed.prototype.mediaExists=function(b,c){for(var a=0;a<c.length;a++){if(b.id==c[a]["id"]){return true}}return false};WDIFeed.prototype.filterResponse=function(a,b){switch(b.filter_type){case"hashtag":return this.filterByHashtag(a,b);break;case"username":return this.filterByUsername(a,b);break;case"mention":return this.filterByMention(a,b);break;case"description":return this.filterByDescription(a,b);break;case"location":return this.filterByLocation(a,b);break;case"url":return this.filterByUrl(a,b);break}};WDIFeed.prototype.filterByHashtag=function(b,g){var d=[],f,h,a;for(var e=0;e<b.data.length;e++){h=b.data[e];for(var c=0;c<h.tags.length;c++){tag=h.tags[c];if(tag.toLowerCase()==g.filter_by.toLowerCase()){d.push(h)}}}a={data:d,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.filterByUsername=function(b,e){var c=[],f,a;for(var d=0;d<b.data.length;d++){f=b.data[d];if(f.user.username.toLowerCase()==e.filter_by.toLowerCase()){c.push(f)}}a={data:c,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.filterByMention=function(b,e){var c=[],f,g,a;for(var d=0;d<b.data.length;d++){f=b.data[d];if(f.caption!==null){g=f.caption["text"].toLowerCase();if(g.indexOf("@"+e.filter_by.toLowerCase())!=-1){c.push(f)}}}a={data:c,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.filterByDescription=function(c,f){var d=[],g,h,b;for(var e=0;e<c.data.length;e++){g=c.data[e];if(g.caption!==null){h=g.caption["text"].toLowerCase();h=wdi_front.replaceNewLines(h);var a=f.filter_by.toLowerCase();if(wdi_front.regexpTestCaption(h,a)){d.push(g)}}}b={data:d,meta:c.meta,pagination:c.pagination};return b};WDIFeed.prototype.filterByLocation=function(b,f){var c=[],g,e,a;for(var d=0;d<b.data.length;d++){g=b.data[d];if(g.location!==null){e=g.location["id"];if(e==f.filter_by){c.push(g)}}}a={data:c,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.filterByUrl=function(b,e){var c=[],g,h,a,f;e.filter_by=this.getIdFromUrl(e.filter_by);for(var d=0;d<b.data.length;d++){g=b.data[d];if(g.link!==null){h=this.getIdFromUrl(g.link);if(h==e.filter_by){c.push(g)}}}a={data:c,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.getIdFromUrl=function(a){var c=a.split("/"),d=false;for(var b=0;b<c.length;b++){if(c[b]=="p"){if(typeof c[b+1]!="undefined"){d=c[b+1];break}}}return d};WDIFeed.prototype.avoidDuplicateMedia=function(b){var e=b.data,d=[],a={};if(typeof e=="undefined"){e=[]}for(var c=0;c<e.length;c++){if(!this.mediaExists(e[c],this.dataStorageList)&&!this.mediaExists(e[c],d)&&!this.mediaExists(e[c],this.conditionalFilterBuffer)){d.push(e[c])}}this.conditionalFilterBuffer=this.conditionalFilterBuffer.concat(d);a={data:d,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.storeRawData=function(c,a){var e=this;if(typeof this[a]=="object"&&typeof this[a].length=="number"){for(var b=0;b<c.length;b++){var d="";if(wdi_front.isHashtag(c[b].user_id)){d=c[b].pagination.next_max_tag_id}else{if(e.feed_row.liked_feed=="liked"){d=c[b].pagination.next_max_like_id;if(typeof d=="undefined"){d=""}}else{if(c[b].pagination==null){c[b].pagination=[]}d=c[b].pagination.next_max_id;if(typeof d=="undefined"){d=""}}}if(typeof this[a][b]=="undefined"){this[a].push({data:c[b].data,index:0,locked:false,hash_id:d,usersDataFinished:false,userId:c[b].user_id,length:function(){return this.data.length-this.index},getData:function(g){var h=this.data.slice(this.index,this.index+g);this.index+=Math.min(g,this.length());if(this.index==this.data.length&&this.locked==true&&this.usersDataFinished==false){for(var f=0;f<e.usersData.length;f++){if(e.usersData[f]["user_id"]==this.userId){e.usersData[f].finished="finished";this.usersDataFinished=true;break}}}return h}})}else{if(this[a][b].locked==false){if(d!=this[a][b].hash_id){this[a][b].data=this[a][b].data.concat(c[b].data);this[a][b].hash_id=d}else{this[a][b].locked=true}}}}}};wdi_front.updateUsersIfNecessary=function(c){var d=c.feed_users;var a=false;for(var b=0;b<d.length;b++){if("#"==d[b].username.substr(0,1)){d[b].id=d[b].username;continue}if(""==d[b].id||"username"==d[b].id){a=true;c.instagram.searchForUsersByName(d[b].username,{success:function(i){if(typeof i.meta!="undefined"&&typeof i.meta.error_type!="undefined"){wdi_front.show_alert(false,i,c)}if(i.meta.code==200&&i.data.length>0){var l=false;for(var g=0;g<i.data.length;g++){if(i.data[g].username==i.args.username){l=true;break}}if(l){for(var h=0;h<d.length;h++){if(i.data[g].username==d[h].username){d[h].id=i.data[g].id}}}}var f=false;for(var e=0;e<d.length;e++){if(d[e].id==""||d[e].id=="username"){f=true;break}}if(!f){c.feed_row.feed_users=JSON.stringify(d);wdi_front.init(c)}},username:d[b].username})}}return a};if(typeof wdi_ajax.ajax_response!="undefined"){jQuery(document).one("ajaxStop",function(){if(wdi_front.type!="not_declared"){wdi_front.clickOrTouch=wdi_front.detectEvent();wdi_front.globalInit()}else{return}})}else{jQuery(document).ready(function(){if(wdi_front.type!="not_declared"){wdi_front.clickOrTouch=wdi_front.detectEvent();wdi_front.globalInit()}else{return}})}jQuery(document).ready(function(){setTimeout(function(){if(wdi_front_messages.show_alerts==="1"&&jQuery(".wdi_check_fontawesome .fa-instagram").prop("tagName")!=="I"){console.log("Font Awesome is not loaded properly. Please ask for support https://wordpress.org/support/plugin/wd-instagram-feed/")}},2000)});
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: custom instagram feed, feed, instagram, hashtag, Instagram feed, instagram
4
  Requires at least: 3.9
5
  Requires PHP: 5.2
6
  Tested up to: 4.9
7
- Stable tag: 1.3.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -498,6 +498,9 @@ Please make sure you don't have any important information before you proceed.
498
 
499
  == Changelog ==
500
 
 
 
 
501
  = 1.3.0 =
502
  New: Caching of Instagram data. API rate limits do not constrain feed loading anymore.
503
  New: Compatibility with Gutenberg editor.
4
  Requires at least: 3.9
5
  Requires PHP: 5.2
6
  Tested up to: 4.9
7
+ Stable tag: 1.3.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
498
 
499
  == Changelog ==
500
 
501
+ = 1.3.1 =
502
+ Fixed: Security issues. Reported by Karan Saini https://www.karansaini.com/
503
+
504
  = 1.3.0 =
505
  New: Caching of Instagram data. API rate limits do not constrain feed loading anymore.
506
  New: Compatibility with Gutenberg editor.
wd-instagram-feed.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WD Instagram Feed
4
  Plugin URI: https://web-dorado.com/products/wordpress-instagram-feed-wd.html
5
  Description: WD Instagram Feed is a user-friendly tool for displaying user or hashtag-based feeds on your website. You can create feeds with one of the available layouts. It allows displaying image metadata, open up images in lightbox, download them and even share in social networking websites.
6
- Version: 1.3.0
7
  Author: WebDorado
8
  Author URI: https://web-dorado.com/wordpress-plugins-bundle.html
9
  License: GPLv2 or later
@@ -21,7 +21,7 @@ define("WDI_META", "_".WDI_VAR."_meta");
21
  //define("wdi",'wdi');
22
  define('WDI_FEED_TABLE','wdi_feeds');
23
  define('WDI_THEME_TABLE','wdi_themes');
24
- define('WDI_VERSION','1.3.0');
25
  define('WDI_IS_PRO','false');
26
  $wdi_minify = ((isset($_GET['wdi_no_minify']) && $_GET['wdi_no_minify'] == "true") ? false : true);
27
  define('WDI_MINIFY', $wdi_minify);
3
  Plugin Name: WD Instagram Feed
4
  Plugin URI: https://web-dorado.com/products/wordpress-instagram-feed-wd.html
5
  Description: WD Instagram Feed is a user-friendly tool for displaying user or hashtag-based feeds on your website. You can create feeds with one of the available layouts. It allows displaying image metadata, open up images in lightbox, download them and even share in social networking websites.
6
+ Version: 1.3.1
7
  Author: WebDorado
8
  Author URI: https://web-dorado.com/wordpress-plugins-bundle.html
9
  License: GPLv2 or later
21
  //define("wdi",'wdi');
22
  define('WDI_FEED_TABLE','wdi_feeds');
23
  define('WDI_THEME_TABLE','wdi_themes');
24
+ define('WDI_VERSION','1.3.1');
25
  define('WDI_IS_PRO','false');
26
  $wdi_minify = ((isset($_GET['wdi_no_minify']) && $_GET['wdi_no_minify'] == "true") ? false : true);
27
  define('WDI_MINIFY', $wdi_minify);