WD Instagram Feed – Instagram Gallery - Version 1.4.24

Version Description

Fixed: Recent Hashtags ordering. Fixed: Large images height in the lightbox. Fixed: Image in Pinterest share preview.

Download this release

Release Info

Developer 10web
Plugin Icon 128x128 WD Instagram Feed – Instagram Gallery
Version 1.4.24
Comparing to
See all releases

Code changes from version 1.4.23 to 1.4.24

admin/models/feeds.php CHANGED
@@ -304,7 +304,8 @@ class Feeds_model_wdi {
304
  $users = $data['feed_users'];
305
  $conditional_filters = $data['conditional_filters'];
306
  $conditional_filter_type = $data['conditional_filter_type'];
307
- $count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(id) FROM ". $wpdb->prefix.WDI_FEED_TABLE. " WHERE id ='%d' AND feed_users='%s' AND conditional_filters='%s' AND conditional_filter_type='%s'", $feed_id, $users, $conditional_filters, $conditional_filter_type));
 
308
  if ( $count == 0 ) {
309
  return 1;
310
  } else {
304
  $users = $data['feed_users'];
305
  $conditional_filters = $data['conditional_filters'];
306
  $conditional_filter_type = $data['conditional_filter_type'];
307
+ $top_recent = $data['hashtag_top_recent'];
308
+ $count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(id) FROM ". $wpdb->prefix.WDI_FEED_TABLE. " WHERE id ='%d' AND feed_users='%s' AND conditional_filters='%s' AND conditional_filter_type='%s' AND hashtag_top_recent='%s'", $feed_id, $users, $conditional_filters, $conditional_filter_type, $top_recent));
309
  if ( $count == 0 ) {
310
  return 1;
311
  } else {
config.php CHANGED
@@ -3,7 +3,7 @@ if ( !defined('ABSPATH') ) {
3
  exit;
4
  }
5
 
6
- define('WDI_VERSION', '1.4.23');
7
  define('WDI_IS_FREE', TRUE);
8
  define('WDI_PREFIX', 'wdi');
9
  define('WDI_DIR', WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__)));
3
  exit;
4
  }
5
 
6
+ define('WDI_VERSION', '1.4.24');
7
  define('WDI_IS_FREE', TRUE);
8
  define('WDI_PREFIX', 'wdi');
9
  define('WDI_DIR', WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__)));
framework/WDICache.php CHANGED
@@ -91,7 +91,7 @@ class WDICache {
91
  'wdi_transient_time' => $wdi_transient_time,
92
  ),
93
  );
94
- $data = update_option($transient_key, $data);
95
  $current_time = current_time('timestamp',1);
96
  add_option('wdi_current_cache_time', $current_time, 0);
97
  return $data;
91
  'wdi_transient_time' => $wdi_transient_time,
92
  ),
93
  );
94
+ $data = update_option($transient_key, $data, false);
95
  $current_time = current_time('timestamp',1);
96
  add_option('wdi_current_cache_time', $current_time, 0);
97
  return $data;
framework/WDIInstagram.php CHANGED
@@ -33,8 +33,7 @@ class WDIInstagram {
33
  public function get_filters( $feed_id ) {
34
  global $wpdb;
35
  $row = $wpdb->get_row("SELECT conditional_filter_enable, conditional_filter_type, conditional_filters FROM " . $wpdb->prefix . WDI_FEED_TABLE . " WHERE id = " . $feed_id, ARRAY_A);
36
-
37
- if( $row['conditional_filter_enable'] ) {
38
  $conditional_filters = json_decode($row['conditional_filters'], 1);
39
  if( empty($conditional_filters) ) {
40
  return array();
@@ -153,7 +152,7 @@ class WDIInstagram {
153
  if ( isset($cache_data) && $cache_data["success"] && isset($cache_data["cache_data"]) ) {
154
  $cache_data = base64_decode($cache_data["cache_data"]);
155
  $cache_data = json_decode($cache_data, 1);
156
- $data = array_merge( $cache_data['data'], $data );
157
  } else {
158
  break;
159
  }
33
  public function get_filters( $feed_id ) {
34
  global $wpdb;
35
  $row = $wpdb->get_row("SELECT conditional_filter_enable, conditional_filter_type, conditional_filters FROM " . $wpdb->prefix . WDI_FEED_TABLE . " WHERE id = " . $feed_id, ARRAY_A);
36
+ if( !empty($row) && $row['conditional_filter_enable'] ) {
 
37
  $conditional_filters = json_decode($row['conditional_filters'], 1);
38
  if( empty($conditional_filters) ) {
39
  return array();
152
  if ( isset($cache_data) && $cache_data["success"] && isset($cache_data["cache_data"]) ) {
153
  $cache_data = base64_decode($cache_data["cache_data"]);
154
  $cache_data = json_decode($cache_data, 1);
155
+ $data = array_merge( $data, $cache_data['data'] );
156
  } else {
157
  break;
158
  }
frontend/views/WDIViewGalleryBox.php CHANGED
@@ -171,6 +171,7 @@ class WDIViewGalleryBox {
171
  'popup_enable_rate' => $popup_enable_rate,
172
  'slideshow_interval' => $slideshow_interval,
173
  'enable_comment_social' => $enable_comment_social,
 
174
  'enable_image_facebook' => $enable_image_facebook,
175
  'enable_image_twitter' => $enable_image_twitter,
176
  'enable_image_google' => $enable_image_google,
@@ -437,7 +438,7 @@ class WDIViewGalleryBox {
437
  <a id="wdi_popup_fb" href="https://www.facebook.com/sharer/sharer.php?u=<?php echo $current_image_url;?>" target="_blank" class='wdi_share_popup_btn wdi_facebook tenweb-i tenweb-i-facebook-square'></a>
438
  <a id="wdi_popup_tw" href="https://twitter.com/intent/tweet?url=<?php echo $current_image_url;?>" target="_blank" class='wdi_share_popup_btn wdi_twitter tenweb-i tenweb-i-twitter-square'></a>
439
  <a id="wdi_popup_li" href="https://www.linkedin.com/shareArticle?mini=true&url=<?php echo $current_image_url;?>&title=<?php echo $current_image_description?>" target="_blank" class='wdi_share_popup_btn wdi_linkedin tenweb-i tenweb-i-linkedin'></a>
440
- <a id="wdi_popup_pt" href="https://pinterest.com/pin/create/button/?url=<?php echo $current_image_url;?>&media=<?php echo $current_image_url;?>media/?size=l&description=<?php echo $current_image_description?>" target="_blank" class='wdi_share_popup_btn wdi_pinterest tenweb-i tenweb-i-pinterest-square'></a>
441
  </p>
442
  <i class="wdi_share_caret " style="display:none;"></i>
443
  </span>
@@ -541,7 +542,7 @@ class WDIViewGalleryBox {
541
  <span class="wdi_popup_embed wdi_popup_watermark" style="display:table; table-layout:fixed;">
542
  <?php
543
  $url = isset($image_row->images->standard_resolution->url) ? $image_row->images->standard_resolution->url : $image_row->thumb_url;
544
- WDILibraryEmbed::display_embed(sanitize_text_field($image_row->filetype), $image_row->filename, array('class'=>"wdi_embed_frame", 'frameborder'=>"0", 'allowfullscreen'=>"allowfullscreen", 'style'=>"width:inherit; height:inherit; vertical-align:middle; display:table-cell;"), $carousel_media, $url );
545
  ?>
546
  </span>
547
  <?php
@@ -736,7 +737,6 @@ class WDIViewGalleryBox {
736
  /* Change image id.*/
737
  jQuery("#wdi_popup_image").attr('image_id', wdi_data[key]["id"]);
738
 
739
-
740
  //creating image title template
741
  var wdi_title_div = jQuery('<div class="wdi_title"></div>').on('click',function(){window.open('//instagram.com/'+wdi_data[key]['username'],'_blank');});
742
  wdi_title_div.append(jQuery('<div class="wdi_header_text">' +wdi_data[key]['username']+'</div>'));
@@ -843,7 +843,6 @@ class WDIViewGalleryBox {
843
  jQuery("#wdi_download").attr("download", image_arr[image_arr.length - 1]);
844
  /* Change image social networks urls.*/
845
  var wdi_share_url = encodeURIComponent("<?php echo add_query_arg(array('action' => 'Share', 'curr_url' => $current_url, 'image_id' => ''), admin_url('admin-ajax.php')); ?>") + "=" + wdi_data[key]['id'] + encodeURIComponent('#wdi<?php echo $gallery_id; ?>/') + wdi_data[key]['id'];
846
-
847
  if (is_embed) {
848
  var wdi_share_image_url = encodeURIComponent(wdi_data[key]['thumb_url']);
849
  }
@@ -853,18 +852,18 @@ class WDIViewGalleryBox {
853
  if (typeof addthis_share != "undefined") {
854
  addthis_share.url = wdi_share_url;
855
  }
 
856
  jQuery("#wdi_facebook_a").attr("href", "https://www.facebook.com/sharer/sharer.php?u=" + wdi_share_url);
857
  jQuery("#wdi_twitter_a").attr("href", "https://twitter.com/intent/tweet?url=" + wdi_share_url);
858
  jQuery("#wdi_google_a").attr("href", "https://plus.google.com/share?url=" + wdi_share_url);
859
  jQuery("#wdi_pinterest_a").attr("href", "http://pinterest.com/pin/create/button/?s=100&url=" + wdi_share_url + "&media=" + wdi_share_image_url + "&description=" + wdi_data[key]['description']);
860
  jQuery("#wdi_tumblr_a").attr("href", "https://www.tumblr.com/share/photo?source=" + wdi_share_image_url + "&caption=" + wdi_data[key]['alt'] + "&clickthru=" + wdi_share_url);
861
 
862
-
863
  //share popup urls
864
  jQuery("#wdi_popup_fb").attr('href',"https://www.facebook.com/sharer/sharer.php?u="+wdi_image_url);
865
  jQuery("#wdi_popup_tw").attr('href',"https://twitter.com/intent/tweet?url=" + wdi_image_url);
866
  jQuery('#wdi_popup_li').attr('href',"https://www.linkedin.com/shareArticle?mini=true&url="+wdi_image_url+"&title="+wdi_image_description);
867
- jQuery('#wdi_popup_pt').attr('href',"https://pinterest.com/pin/create/button/?url="+wdi_image_url+"&media="+wdi_image_url+"media/?size=l&description="+wdi_image_description);
868
  /* Load comments.*/
869
  if (jQuery(".wdi_comment_container").hasClass("wdi_open")) {
870
  if (wdi_data[key]["comment_count"] !== 0 && typeof wdi_data[key]["comments_data"]['data'] !== 'undefined') {
171
  'popup_enable_rate' => $popup_enable_rate,
172
  'slideshow_interval' => $slideshow_interval,
173
  'enable_comment_social' => $enable_comment_social,
174
+ /* @TODO: These variables and their actions are not used should be removed 'enable_image_facebook', 'enable_image_twitter', 'enable_image_google', 'enable_image_pinterest', 'enable_image_tumblr'. */
175
  'enable_image_facebook' => $enable_image_facebook,
176
  'enable_image_twitter' => $enable_image_twitter,
177
  'enable_image_google' => $enable_image_google,
438
  <a id="wdi_popup_fb" href="https://www.facebook.com/sharer/sharer.php?u=<?php echo $current_image_url;?>" target="_blank" class='wdi_share_popup_btn wdi_facebook tenweb-i tenweb-i-facebook-square'></a>
439
  <a id="wdi_popup_tw" href="https://twitter.com/intent/tweet?url=<?php echo $current_image_url;?>" target="_blank" class='wdi_share_popup_btn wdi_twitter tenweb-i tenweb-i-twitter-square'></a>
440
  <a id="wdi_popup_li" href="https://www.linkedin.com/shareArticle?mini=true&url=<?php echo $current_image_url;?>&title=<?php echo $current_image_description?>" target="_blank" class='wdi_share_popup_btn wdi_linkedin tenweb-i tenweb-i-linkedin'></a>
441
+ <a id="wdi_popup_pt" href="https://pinterest.com/pin/create/button/?url=<?php echo $current_image_url;?>&media=<?php echo urlencode($current_thumb_url); ?>&description=<?php echo $current_image_description?>" target="_blank" class='wdi_share_popup_btn wdi_pinterest tenweb-i tenweb-i-pinterest-square'></a>
442
  </p>
443
  <i class="wdi_share_caret " style="display:none;"></i>
444
  </span>
542
  <span class="wdi_popup_embed wdi_popup_watermark" style="display:table; table-layout:fixed;">
543
  <?php
544
  $url = isset($image_row->images->standard_resolution->url) ? $image_row->images->standard_resolution->url : $image_row->thumb_url;
545
+ WDILibraryEmbed::display_embed(sanitize_text_field($image_row->filetype), $image_row->filename, array('class'=>"wdi_embed_frame", 'frameborder'=>"0", 'allowfullscreen'=>"allowfullscreen", 'style'=>"width:inherit; height:inherit; vertical-align:middle; display:table-cell;"), $carousel_media, $url );
546
  ?>
547
  </span>
548
  <?php
737
  /* Change image id.*/
738
  jQuery("#wdi_popup_image").attr('image_id', wdi_data[key]["id"]);
739
 
 
740
  //creating image title template
741
  var wdi_title_div = jQuery('<div class="wdi_title"></div>').on('click',function(){window.open('//instagram.com/'+wdi_data[key]['username'],'_blank');});
742
  wdi_title_div.append(jQuery('<div class="wdi_header_text">' +wdi_data[key]['username']+'</div>'));
843
  jQuery("#wdi_download").attr("download", image_arr[image_arr.length - 1]);
844
  /* Change image social networks urls.*/
845
  var wdi_share_url = encodeURIComponent("<?php echo add_query_arg(array('action' => 'Share', 'curr_url' => $current_url, 'image_id' => ''), admin_url('admin-ajax.php')); ?>") + "=" + wdi_data[key]['id'] + encodeURIComponent('#wdi<?php echo $gallery_id; ?>/') + wdi_data[key]['id'];
 
846
  if (is_embed) {
847
  var wdi_share_image_url = encodeURIComponent(wdi_data[key]['thumb_url']);
848
  }
852
  if (typeof addthis_share != "undefined") {
853
  addthis_share.url = wdi_share_url;
854
  }
855
+
856
  jQuery("#wdi_facebook_a").attr("href", "https://www.facebook.com/sharer/sharer.php?u=" + wdi_share_url);
857
  jQuery("#wdi_twitter_a").attr("href", "https://twitter.com/intent/tweet?url=" + wdi_share_url);
858
  jQuery("#wdi_google_a").attr("href", "https://plus.google.com/share?url=" + wdi_share_url);
859
  jQuery("#wdi_pinterest_a").attr("href", "http://pinterest.com/pin/create/button/?s=100&url=" + wdi_share_url + "&media=" + wdi_share_image_url + "&description=" + wdi_data[key]['description']);
860
  jQuery("#wdi_tumblr_a").attr("href", "https://www.tumblr.com/share/photo?source=" + wdi_share_image_url + "&caption=" + wdi_data[key]['alt'] + "&clickthru=" + wdi_share_url);
861
 
 
862
  //share popup urls
863
  jQuery("#wdi_popup_fb").attr('href',"https://www.facebook.com/sharer/sharer.php?u="+wdi_image_url);
864
  jQuery("#wdi_popup_tw").attr('href',"https://twitter.com/intent/tweet?url=" + wdi_image_url);
865
  jQuery('#wdi_popup_li').attr('href',"https://www.linkedin.com/shareArticle?mini=true&url="+wdi_image_url+"&title="+wdi_image_description);
866
+ jQuery('#wdi_popup_pt').attr('href',"https://pinterest.com/pin/create/button/?url="+wdi_image_url+"&media="+wdi_share_image_url+"&description="+wdi_image_description);
867
  /* Load comments.*/
868
  if (jQuery(".wdi_comment_container").hasClass("wdi_open")) {
869
  if (wdi_data[key]["comment_count"] !== 0 && typeof wdi_data[key]["comments_data"]['data'] !== 'undefined') {
js/wdi_admin.js CHANGED
@@ -610,6 +610,7 @@ wdi_controller.makeInstagramUserRequest = function ( user_input, ignoreConfirm )
610
  username,
611
  userObj;
612
  var is_hashtag = input_type === 'hashtag';
 
613
  if ( user_input == '' ) {
614
  alert(wdi_messages.please_write_hashtag);
615
  return false;
@@ -640,6 +641,7 @@ wdi_controller.makeInstagramUserRequest = function ( user_input, ignoreConfirm )
640
  action : 'wdi_getHashtagId',
641
  wdi_nonce: wdi_ajax.wdi_nonce,
642
  user_name: username,
 
643
  };
644
  jQuery.ajax({
645
  type: "POST",
610
  username,
611
  userObj;
612
  var is_hashtag = input_type === 'hashtag';
613
+ var feed_id = jQuery("#wdi_add_or_edit").val();
614
  if ( user_input == '' ) {
615
  alert(wdi_messages.please_write_hashtag);
616
  return false;
641
  action : 'wdi_getHashtagId',
642
  wdi_nonce: wdi_ajax.wdi_nonce,
643
  user_name: username,
644
+ feed_id: feed_id
645
  };
646
  jQuery.ajax({
647
  type: "POST",
js/wdi_admin.min.js CHANGED
@@ -1 +1 @@
1
- function wdi_multiple_accounts_option_controller(){var e=jQuery(jQuery("#wdi_user_id").closest("form").find(".form-table").get(1));e.addClass("wdi_multiple_accounts_section");var t="";if(wdi_options.wdi_authenticated_users_list){var i,r=JSON.parse(wdi_options.wdi_authenticated_users_list),a=0;for(i in r)t+="<tr data-multiple-account='"+a+"'>",t+="<th>Access Token</th>",t+='<td><input type="text" name="wdi_instagram_options[wdi_authenticated_users_list][access_token][]" size="53" required="" value="'+r[i].access_token+'"></td>',t+="</tr>",t+="<tr data-multiple-account='"+a+"' class='wdi_username_tr'>",t+="<th>Username</th>",t+='<td><div class="wdi_input_wrapper"><input type="text" name="wdi_instagram_options[wdi_authenticated_users_list][user_name][]" size="53" required="" value="'+r[i].user_name+'"></div><div class="wdi_remove_auth_user">Delete</div></td>',t+='<input type="hidden" name="wdi_instagram_options[wdi_authenticated_users_list][user_id][]" size="53" required="" value="'+r[i].user_id+'">',t+="</tr>",a++;e.append(t)}jQuery(".wdi_remove_auth_user").on("click",function(e){e.preventDefault();e=jQuery(this).closest(".wdi_username_tr").data("multiple-account");return jQuery(this).closest(".wdi_multiple_accounts_section").find('tr[data-multiple-account="'+e+'"]').remove(),!1})}function wdi_advanced_option_controller(){var e=jQuery(jQuery("#wdi_user_id").closest("form").find(".form-table").get(1));e.addClass("wdi_advanced_option wdi_advanced_option_close");$tr=jQuery("<tr class='wdi_advanced_option_head'><th style='width: 100%;'>ADVANCED OPTIONS AND MULTIPLE INSTAGRAM ACCOUNTS</th><td><div class='wdi_advanced_option_icon'></div></td></tr>"),e.prepend($tr),$tr.on("click",function(){e.hasClass("wdi_advanced_option_open")?(e.removeClass("wdi_advanced_option_open"),e.addClass("wdi_advanced_option_close")):(e.removeClass("wdi_advanced_option_close"),e.addClass("wdi_advanced_option_open"))})}function wdi_controller(){}jQuery(document).ready(function(){function e(e){if(!1===e){var t=JSON.parse(localStorage.getItem("wdi_sections"));for(i in null!==t&&!1!==t||(t={wdi_layout_section:"show",wdi_media:"show",wdi_layout:"hide",wdi_advanced:"hide",wdi_lightbox_general:"show",wdi_lightbox_advanced:"hide",wdi_conditional_filters:"show",wdi_how_to_publish:"show"},localStorage.setItem("wdi_sections",JSON.stringify(t))),t){var r=jQuery("#wdi_save_feed").find("[data-section_name='"+i+"']");n(t[i],r)}}else{var a=jQuery(e).data("section_name"),s=null;e.hasClass("wdi_section_open")?(n("show",e),s="show"):e.hasClass("wdi_section_close")&&(n("hide",e),s="hide"),null!=s&&((e=JSON.parse(localStorage.getItem("wdi_sections"))||{})[a]=s,localStorage.setItem("wdi_sections",JSON.stringify(e)))}}function n(e,t){"show"===e?("table"===(e=t.closest(".wdi_section").find(".wdi_elements")).data("display")?e.css({display:"table"}):e.css({display:"block"}),t.css({"border-bottom":"1px solid #f1f1f1",margin:"0 auto 15px"}),t.removeClass("wdi_section_open"),t.addClass("wdi_section_close")):(t.closest(".wdi_section").find(".wdi_elements").css({display:"none"}),t.css({"border-bottom":"0px",margin:"0 auto 0px"}),t.removeClass("wdi_section_close"),t.addClass("wdi_section_open"))}jQuery("#wdi_reset_cache").click(function(e){jQuery(".wdi_reset_cache_success").remove(),jQuery("#wdi_save_loading").removeClass("wdi_hidden"),e.preventDefault(),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,task:"reset",action:"wdi_cache"},success:function(e){!1===e.success?jQuery("#wdi_reset_cache").after("<span class='wdi_reset_cache_success' style='color: #fc0000; margin-left: 15px; line-height: 2;'>Failed</span>"):(wdi_controller.instagram=new WDIInstagram,jQuery.each(e.data,function(e,t){var i=JSON.parse(t.users),r="",a="",s="",n=t.endpoint;jQuery.each(i,function(e,t){""!==t.tag_id?(a=(a=(a=t.username).substr(1,a.length)).replace(" ",""),s=t.tag_id):r=(r=wdi_controller.getUserObj(t.username))&&r.user_name});t=t.feed_id;wdi_controller.instagram.set_cache_data("",r,t,"",0,0,a,s,n,"")}),jQuery("#wdi_reset_cache").after("<span class='wdi_reset_cache_success' style='color: #029117; margin-left: 15px; line-height: 2;'>Success</span>"))}})}),jQuery(".wdi_account_refresh").click(function(){var t=jQuery(this),e=t.data("wdi_account");jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{page:"wdi_settings",action:"wdi_account_refresh",nonce:wdi_ajax.wdi_nonce,user_name:e},success:function(e){t.closest("div").find(".wdi_reset_cache_success").remove(),!0===e.success?(t.after("<span class='wdi_reset_cache_success' style='color: #029117; margin-left: 15px; line-height: 2;'>Success</span>"),t.closest("div").find(".wdi_user_token").val(e.token)):t.after("<span class='wdi_reset_cache_success' style='color: #fc0000; margin-left: 15px; line-height: 2;'>Failed</span>")}})}),wdi_controller.bindSaveFeedEvent(),wdi_controller.bindAddNewUserOrHashtagEvent(),jQuery(".display_type input").on("click",function(){wdi_controller.displaySettingsSection(jQuery(this))}),wdi_controller.conditionalFiltersTabInit(),wdi_controller.bindSaveThemeEvent(),jQuery("body").hasClass("instagram-feed_page_wdi_settings")&&wdi_advanced_option_controller(),jQuery(".wdi_section_name").click(function(){e(jQuery(this))}),e(!1),jQuery(document).on("click",".wdi-account-show-token",function(){jQuery(this).find("i").toggleClass("dashicons-arrow-up-alt2 dashicons-arrow-down-alt2"),jQuery(this).parents("li").find(".wdi-account-accesstoken").slideToggle(300)}),jQuery(document).on("click",".wdi-advanced-options .wdi-advanced-headline",function(){jQuery(this).find("i").toggleClass("dashicons-arrow-up-alt2 dashicons-arrow-down-alt2"),jQuery(this).parents(".wdi-advanced-options").find(".wdi-advanced-body").slideToggle(500)}),jQuery(document).on("click","#wdi_verify",function(){jQuery("#wdi_submit").prop("disabled",!0),jQuery(this).is(":checked")&&jQuery("#wdi_submit").prop("disabled",!1)}),jQuery(document).on("click","#wdi_submit",function(){return confirm(wdi_messages.uninstall_plugin)&&jQuery("#wdi_uninstall_form").submit(),!1}),jQuery("#WDI_feed_name").on("keypress",function(){jQuery(this).removeAttr("style")})}),wdi_controller.getParameterByName=function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");e=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(location.search);return null===e?"":decodeURIComponent(e[1].replace(/\+/g," "))},wdi_controller.apiRedirected=function(){var e=this.getParameterByName("access_token").split("."),t=/^[^\\\/&?><"']*$/;for(i=0;i<e.length;i++)if(null===e[i].match(t))return;var r=e.join(".");jQuery(document).ready(function(){""===wdi_options.wdi_access_token?jQuery("#wdi_access_token").attr("value",r):(jQuery(".wdi_more_token_template .wdi_more_access_token").prop("disabled",!1),jQuery(".wdi_more_token_template .wdi_more_access_token").attr("value",r))}),wdi_controller.instagram.addToken(r),wdi_controller.getUserInfo(r)},wdi_controller.getUserInfo=function(e){this.instagram.getSelfInfo({success:function(e){""===wdi_options.wdi_access_token?(jQuery("#wdi_user_name").attr("value",e.data.username),jQuery("#wdi_user_id").attr("value",e.data.id)):(jQuery(".wdi_more_token_template .wdi_more_user_name").prop("disabled",!1),jQuery(".wdi_more_token_template .wdi_more_user_id").prop("disabled",!1),jQuery(".wdi_more_token_template .wdi_more_user_name").attr("value",e.data.username),jQuery(".wdi_more_token_template .wdi_more_user_id").attr("value",e.data.id)),jQuery(document).trigger("wdi_settings_filled")}})},wdi_controller.oldDisplayType={},wdi_controller.displayTypeMemory={},wdi_controller.switchFeedTabs=function(e,t){jQuery("#wdi_refresh_tab").attr("value",e),jQuery(".wdi_tab").hide(),jQuery("#"+e+"_tab").show(),jQuery(".wdi_element_name_popup_enable_comment").hide(),"business"===jQuery("#WDI_user_name option:selected").data("type")&&jQuery(".wdi_element_name_popup_enable_comment").show(),jQuery(".display_type").css("display","none"),jQuery('.display_type[tab="'+e+'"]').css("display","block"),jQuery('.display_type[tab="'+e+'"]').length?jQuery(".display_type_content").show():jQuery(".display_type_content").hide(),jQuery(".wdi_feed_tabs").filter(".wdi_feed_tab_active").each(function(){jQuery(this).removeClass("wdi_feed_tab_active")}),jQuery("#wdi_"+e).addClass("wdi_feed_tab_active");var i=jQuery(),r=!1;null!=t&&""!=t&&(i=jQuery(".display_type #"+t).prop("checked",!0),jQuery("#wdi_feed_type").attr("value",t)),r||0!=(i=jQuery('.display_type[tab="'+e+'"] input[name="feed_type"]:checked')).length&&(r=!0),r||0!=(i=jQuery('.display_type[tab="'+e+'"] #thumbnails')).length&&(r=!0,i.prop("checked",!0),jQuery("#wdi_feed_type").attr("value","thumbnails")),r&&wdi_controller.displaySettingsSection(i),"conditional_filters"==e&&wdi_controller.updateConditionalFiltersUi()},wdi_controller.displaySettingsSection=function(e){var i=e.attr("id").toLowerCase().trim(),t=e.parent().parent().attr("tab"),e=jQuery("#wdi_refresh_section");wdi_controller.oldDisplayType={section:i,tab:t},wdi_controller.displayTypeMemory[t]=wdi_controller.oldDisplayType,null!=e&&e.attr("value",i);e=jQuery(".wdi_border_wrapper .form-table");jQuery("#wdi_feed_type").attr("value",i);var r=0,a=!1;e.find(".wdi_element").each(function(){0;var e=jQuery(this).find(".wdwt_param").children().children().children().attr("section");if(void 0!==e){a=!1;var t=e.toLowerCase().trim().split(",");for(r=0;r<t.length;r++)t[r]===i&&(jQuery(this).css("display","block"),a=!0);!1===a&&jQuery(this).css("display","none")}})},wdi_controller.switchThemeTabs=function(e,t){jQuery(".wdi_feed_tabs").filter(".wdi_feed_tab_active").each(function(){jQuery(this).removeClass("wdi_feed_tab_active")}),jQuery("#wdi_"+e).addClass("wdi_feed_tab_active"),jQuery("[tab]").each(function(){jQuery(this).attr("tab")!=e?jQuery(this).parent().parent().parent().parent().parent().filter("tr").css("display","none"):jQuery(this).parent().parent().parent().parent().parent().filter("tr").css("display","block")}),jQuery(".display_type").css("display","none"),jQuery('.display_type[tab="'+e+'"]').css("display","block"),jQuery("#wdi_refresh_tab").attr("value",e),null!=t&&""!=t&&jQuery("#wdi_refresh_section").attr("value",t),(null==t&&""!=t?null!=wdi_controller.displayTypeMemory[e]?jQuery(".display_type #"+wdi_controller.displayTypeMemory[e].section):jQuery('.display_type[tab="'+e+'"]').first().find("input"):jQuery(".display_type #"+t)).trigger("click")},wdi_controller.bindSaveFeedEvent=function(){var e=this;jQuery("#wdi_save_feed_submit").on("click",function(){e.save_feed("save_feed")}),jQuery("#wdi_save_feed_apply").on("click",function(){e.save_feed("apply_changes")}),jQuery("#wdi_cancel_changes").on("click",function(){e.save_feed("cancel")})},wdi_controller.save_feed=function(e){var t,i,r,a=[],s={};"cancel"==e&&(window.location=window.location.href),t=jQuery("#WDI_user_name option:selected").data("type"),n=jQuery("#WDI_user_name option:selected").val(),i=jQuery("#WDI_feed_name");var n=wdi_controller.getUserObj(n);if(""==i.val())return alert(wdi_messages.feed_title_field_required),i.focus().attr("style","border-color: #FF0000;"),!1;if(!n)return alert(wdi_messages.user_field_required),!1;if(r={id:n.user_id,username:n.user_name},wdi_controller.checkIfUserNotSaved(e),0==wdi_controller.waitingAjaxRequestEnd.button){if(s=jQuery("#WDI_feed_users").val(),this.isJsonString(s)){for(var d in s=JSON.parse(s))"business"==t&&"#"===s[d].username.charAt(0)&&a.push(s[d]);a.push(r)}else a.push(r);users=this.stringifyUserData(a),jQuery("#WDI_feed_users").val(users),jQuery("#wdi_feed_thumb").val(""),"business"==t&&jQuery("#wdi_feed_thumb").val(n.profile_picture_url),"apply_changes"!=e&&"save_feed"!=e||(n=jQuery("#wdi_add_or_edit").val(),jQuery("#wdi_current_id").val(n)),jQuery("#task").attr("value",e),submit_ajax()}};var comlete_redirect_url="";function submit_ajax(){var e=jQuery("#wdi_save_feed").serialize();e+="&action=wdi_apply_changes&page=wdi_feeds",jQuery("#wdi_save_loading").removeClass("wdi_hidden"),jQuery.ajax({url:wdi_ajax.ajax_url,type:"POST",dataType:"json",data:e,success:function(e){comlete_redirect_url=e.url;var t=e.feed_id;1==e.need_cache?(jQuery(".caching-process-message").removeClass("wdi_hidden"),setTimeout(function(){wdi_controller.instagram.set_cache_data(comlete_redirect_url,"",t,"",0,0,"","","","")},1e3)):(jQuery("#wdi_save_loading").addClass("wdi_hidden"),window.location=comlete_redirect_url)},error:function(e,t,i){window.location=comlete_redirect_url}})}function wdi_spider_select_value(e){e.focus(),e.select()}function wdi_spider_set_input_value(e,t){"add"===t&&""==jQuery("#wdi_access_token").attr("value")&&alert("Please get your access token"),document.getElementById(e)&&(document.getElementById(e).value=t)}function wdi_spider_form_submit(e,t){document.getElementById(t)&&document.getElementById(t).submit(),e.preventDefault?e.preventDefault():e.returnValue=!1}function wdi_bulk_actions(e){e=jQuery(e).val();return""!=e&&(!("delete_all"==e&&!confirm(wdi_messages.do_you_want_to_delete_selected_items))&&(wdi_spider_set_input_value("task",e),jQuery("#wdi_feed_form").submit(),!0))}function wdi_spider_check_all_items(){wdi_spider_check_all_items_checkbox(),jQuery("#check_all").trigger("click")}function wdi_spider_check_all_items_checkbox(){var e;jQuery("#check_all_items").prop("checked")?(jQuery("#check_all_items").prop("checked",!1),jQuery("#draganddrop").hide()):(e=parseInt(jQuery(".displaying-num").html())?parseInt(jQuery(".displaying-num").html()):0,e=(jQuery('input[id^="check_pr_"]').length?parseInt(jQuery('input[id^="check_pr_"]').length):0)+e,jQuery("#check_all_items").prop("checked",!0),e&&(jQuery("#draganddrop").html("<strong><p>Selected "+e+" item"+(1<e?"s":"")+".</p></strong>"),jQuery("#draganddrop").show()))}function wdi_spider_check_all(e){jQuery(e).prop("checked")||(jQuery("#check_all_items").prop("checked",!1),jQuery("#draganddrop").hide())}function wdi_spider_set_input_value(e,t){"add"===t&&""==jQuery("#wdi_access_token").attr("value")&&alert("Please get your access token"),document.getElementById(e)&&(document.getElementById(e).value=t)}function wdi_account_remove(e,t){jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{page:"wdi_settings",action:"wdi_account_disconnect",nonce:wdi_ajax.wdi_nonce,user_name:e,user_id:t},success:function(e){e.success&&(1==jQuery('[class*="wdi-account-list"]').length?((e=jQuery(".wdi-account-list-"+t).parent()).prev().remove(),e.remove(),jQuery("#toplevel_page_wdi_feeds ul").remove(),jQuery("#toplevel_page_wdi_feeds a").attr("href","admin.php?page=wdi_settings")):jQuery(".wdi-account-list-"+t).remove())}})}function wdi_popup_open(){jQuery(".wdi-popup").show()}function wdi_popup_close(){jQuery(".wdi-popup").hide()}wdi_controller.makeInstagramUserRequest=function(e,t){var i,r=this,a=this.getInputType(e),s="hashtag"===a;if(""==e)return alert(wdi_messages.please_write_hashtag),!1;if(""!=e&&!s)return alert(wdi_messages.invalid_hashtag),!1;if(r.checkForDuplicateUser(e))return alert(e+" "+wdi_messages.already_added),!1;switch(i=jQuery("#WDI_user_name option:selected").val(),(s=wdi_controller.getUserObj(i))&&(this.instagram.user=s),a){case"user":break;case"hashtag":var n=(n=e.substr(1,e.length)).replace(" ",""),d=(jQuery("input[name='wdi_feed_settings[hashtag_top_recent]']:checked").val(),{tagname:n,action:"wdi_getHashtagId",wdi_nonce:wdi_ajax.wdi_nonce,user_name:i});jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:d,success:function(e){jQuery("#wdi_add_user_ajax").removeAttr("disabled");var t=r.isValidResponse(e);t.valid?r.addHashtag(n,e):alert(t.msg)},error:function(e,t,i){}})}},wdi_controller.checkForDuplicateUser=function(e){var t=jQuery("#WDI_feed_users").val();if(this.isJsonString(t)){t=JSON.parse(t);for(var i=0;i<t.length;i++)if(e==t[i].username)return!0}return!1},wdi_controller.getInputType=function(e){switch(e[0]){case"#":return"hashtag";case"%":return"location";default:return"user"}},wdi_controller.stringifyUserData=function(e){for(var t=[],i=0;i<e.length;i++)t.push({id:e[i].id,username:e[i].username,tag_id:void 0!==e[i].tag_id?e[i].tag_id:""});return JSON.stringify(t)},wdi_controller.bindAddNewUserOrHashtagEvent=function(){jQuery("#wdi_add_user_ajax").on("click",function(){void 0!==jQuery(this).prop("disabled")||jQuery(this).prop("disabled",!0);var e=jQuery("#wdi_add_user_ajax_input").val().trim().toLowerCase();!1===wdi_controller.makeInstagramUserRequest(e)&&jQuery(this).removeAttr("disabled","disabled")}),jQuery("#wdi_add_user_ajax_input").on("keypress",function(e){if(13==e.keyCode){void 0!==jQuery("#wdi_add_user_ajax").prop("disabled")||jQuery("#wdi_add_user_ajax").prop("disabled",!0);e=jQuery("#wdi_add_user_ajax_input").val().trim().toLowerCase();return!1===wdi_controller.makeInstagramUserRequest(e)&&jQuery("#wdi_add_user_ajax").removeAttr("disabled","disabled"),!1}})},wdi_controller.removeFeedUser=function(e){var t,i=e.parent().find("a span").text();e.parent().find("a span").hasClass("wdi_hashtag")&&(i="#"+i),0!=this.feed_users.length||void 0!==(t=jQuery("#WDI_feed_users").val())&&this.isJsonString(t)&&(this.feed_users=JSON.parse(t));for(var r=0;r<this.feed_users.length;r++)if(this.feed_users[r].username==i){this.feed_users.splice(r,1);break}for(r=0;r<this.feed_users.length;r++)"#"!==this.feed_users[r].username.charAt(0)&&this.feed_users.splice(r,1);jQuery("#WDI_feed_users").val(this.stringifyUserData(this.feed_users)),e.parent().remove(),wdi_controller.changed_users()},wdi_controller.bindSaveThemeEvent=function(){jQuery("#wdi_save_theme_submit").on("click",function(){jQuery("#task").attr("value","save_feed"),jQuery("#wdi_save_feed").submit()}),jQuery("#wdi_save_theme_apply").on("click",function(){jQuery("#task").attr("value","apply_changes");var e=jQuery("#wdi_add_or_edit").attr("value");jQuery("#wdi_current_id").attr("value",e),jQuery("#wdi_save_feed").submit()}),jQuery("#wdi_save_theme_reset").on("click",function(){jQuery("#task").attr("value","reset_changes");var e=jQuery("#wdi_add_or_edit").attr("value");jQuery("#wdi_current_id").attr("value",e),jQuery("#wdi_save_feed").submit()})},wdi_controller.checkIfUserNotSaved=function(e){switch(e){case"save_feed":e="submit";break;case"apply_changes":e="apply";break;case"reset_changes":e="reset"}if(""==jQuery("#wdi_add_user_ajax_input").val().trim())return wdi_controller.waitingAjaxRequestEnd={button:0},0;var t=jQuery("#wdi_add_user_ajax_input").val().trim().toLowerCase();return wdi_controller.waitingAjaxRequestEnd={button:e},wdi_controller.makeInstagramUserRequest(t),1},wdi_controller.saveFeedAfterAjaxWait=function(e){var t;null!=wdi_controller.waitingAjaxRequestEnd&&(t=wdi_controller.waitingAjaxRequestEnd.button,e&&0!=t&&jQuery("#wdi_save_feed_"+t).trigger("click"),wdi_controller.waitingAjaxRequestEnd=void 0)},wdi_controller.getCookie=function(e){e=("; "+document.cookie).split("; "+e+"=");if(2==e.length)return e.pop().split(";").shift()},wdi_controller.isValidResponse=function(e){var t={};return void 0===e||void 0===e.meta.code||200!=e.meta.code?(t.valid=!1,void 0===e?t.msg=wdi_messages.instagram_server_error:200!==e.meta.code?t.msg=e.meta.message:t.msg=""):(t.valid=!0,t.msg="success"),t},wdi_controller.hasData=function(e){return void 0!==e&&void 0!==e.data&&0!=e.data.length},wdi_controller.thumbUser=function(e){return 0<this.feed_users.length&&this.feed_users[0].username===e},wdi_controller.findUser=function(e,t){var i=[];void 0!==t&&void 0!==t.data&&(i=t.data);for(var r=0;r<i.length;r++)if(i[r].username==e)return i[r];return!1},wdi_controller.addHashtag=function(e,t){if(null==e.match(/[~!@$%&*#^()<>?]/)){var i=jQuery('<div class="wdi_user"><a target="_blank" href="https://instagram.com/explore/tags/'+e+'"><img class="wdi_profile_pic" src="'+wdi_url.plugin_url+'images/hashtag.png"><span class="wdi_hashtag">'+e+'</span><i style="display:table-cell;width:25px;"></i></a><img class="wdi_remove_user" onclick="wdi_controller.removeFeedUser(jQuery(this))" src="'+wdi_url.plugin_url+'/images/delete_user.png"></div>');jQuery("#wdi_feed_users_ajax").append(i),jQuery("#wdi_add_user_ajax_input").val("");var r=jQuery("#WDI_feed_users").val();if(this.isJsonString(r)){r=JSON.parse(r);for(var a=0;a<r.length;a++)"#"!==r[a].username.charAt(0)&&r.splice(a,1)}else r=[];t={id:"#"+e,username:"#"+e,profile_picture:"",tag_id:t.tag_id};r.push(t),this.feed_users=r,jQuery("#WDI_feed_users").val(this.stringifyUserData(this.feed_users))}else alert(wdi_messages.invalid_hashtag);this.updateConditionalFiltersUi(),wdi_controller.saveFeedAfterAjaxWait(!0),wdi_controller.changed_users()},wdi_controller.changed_users=function(){for(var e=!1,t=0;t<this.feed_users.length;t++)if("#"===this.feed_users[t].username[0]){e=!0;break}e?(jQuery(".wdi_element_name_hashtag_top_recent").show(),jQuery(".wdi_element_name_show_username_on_thumb").hide()):(jQuery(".wdi_element_name_hashtag_top_recent").hide(),jQuery(".wdi_element_name_show_username_on_thumb").show())},wdi_controller.addUser=function(e){e.username=e.user_name,0==this.checkForDuplicateUser(e.username)?(newUser=jQuery('<div class="wdi_user"><a target="_blank" href="http://www.instagram.com/'+e.username+'"><span class="wdi_username">'+e.username+'</span><i style="display:table-cell;width:25px;"></i></a><img class="wdi_remove_user" onclick="wdi_controller.removeFeedUser(jQuery(this))" src="'+wdi_url.plugin_url+'images/delete_user.png"></div>'),jQuery("#wdi_feed_users_ajax").append(newUser),jQuery("#wdi_add_user_ajax_input").val(""),this.feed_users.push({id:e.id,username:e.username,profile_picture:""})):alert(e.username+" "+wdi_messages.already_added),this.updateConditionalFiltersUi(),wdi_controller.saveFeedAfterAjaxWait(!0)},wdi_controller.getUserProfilePic=function(e){for(var t=0;t<this.feed_users.length;t++)if(e==this.feed_users[t].username)return this.feed_users[t].profile_picture;return"false"},wdi_controller.conditionalFiltersTabInit=function(){this.setInitialFilters(),this.updateFiltersUi();var t=this;function e(){switch(jQuery("#WDI_wrap_conditional_filter_enable input:checked").val()){case"0":jQuery("#WDI_conditional_filters").parent().parent().addClass("wdi_hidden"),jQuery("#WDI_conditional_filter_type").parent().parent().parent().parent().parent().addClass("wdi_hidden"),jQuery("#wdi_final_condition").addClass("wdi_hidden"),jQuery("#WDI_filter_source").addClass("wdi_hidden");break;case"1":jQuery("#WDI_conditional_filters").parent().parent().removeClass("wdi_hidden"),jQuery("#WDI_conditional_filter_type").parent().parent().parent().parent().parent().removeClass("wdi_hidden"),jQuery("#wdi_final_condition").removeClass("wdi_hidden"),jQuery("#WDI_filter_source").removeClass("wdi_hidden")}}jQuery("#wdi_add_filter").on("click",function(){t.addConditionalFilter()&&jQuery("#wdi_filter_input").val("")}),jQuery(".wdi_filter_radio").on("click",function(){jQuery("#wdi_filter_input").trigger("focus")}),jQuery("#wdi_filter_input").on("keypress",function(e){if(13==e.keyCode)return t.addConditionalFilter()&&jQuery(this).val(""),!1}),e(),jQuery("#WDI_wrap_conditional_filter_enable input").on("change",function(){e()}),jQuery("#WDI_conditional_filter_type").on("change",function(){switch("none"==jQuery(this).val()||jQuery("#WDI_conditional_filters").css("display","block"),jQuery(this).parent().find("label").css({display:"inline-block"}),jQuery(this).val()){case"AND":jQuery("#WDI_conditional_filters").css("display","block"),jQuery(this).parent().find("label").html(wdi_messages.and_descr);break;case"OR":jQuery("#WDI_conditional_filters").css("display","block"),jQuery(this).parent().find("label").html(wdi_messages.or_descr);break;case"NOR":jQuery("#WDI_conditional_filters").css("display","block"),jQuery(this).parent().find("label").html(wdi_messages.nor_descr)}wdi_controller.updateFiltersUi()}),jQuery("#WDI_conditional_filter_type").trigger("change")},wdi_controller.addConditionalFilter=function(){var e=jQuery("#wdi_filter_input").val(),t=jQuery("#wdi_filter_type").val();if(filter={},""==e)return!1;switch(e=e.trim(),null==t&&("@"==e[0]?t="mention":"#"==e[0]?t="hashtag":"http"!=e.split("://")[0]&&"https"!=e.split("://")[0]||(t="url")),t){case"username":case"mention":"@"==e[0]&&(e=e.substr(1,e.length));break;case"hashtag":"#"==e[0]&&(e=e.substr(1,e.length));break;case"url":if(!/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(e))return alert(wdi_messages.invalid_url),!1}return filter={filter_type:t,filter_by:e,id:this.randomId()},null!=t?this.filterExists(filter)?(alert(e+" "+wdi_messages.already_added),!1):(this.conditionalFilters.push(filter),this.updateFiltersUi(),!0):(alert(wdi_messages.selectConditionType),!1)},wdi_controller.filterExists=function(e){for(var t=0;t<this.conditionalFilters.length;t++)if(this.conditionalFilters[t].filter_type==e.filter_type&&this.conditionalFilters[t].filter_by==e.filter_by)return!0;return!1},wdi_controller.updateFiltersUi=function(){for(var e,t=jQuery("#wdi_filters_ui").html(""),i=0;i<this.conditionalFilters.length;i++){if(0==i)if(1!=this.conditionalFilters.length)switch(jQuery("#WDI_conditional_filter_type").val()){case"AND":break;case"OR":t.append(jQuery('<span class="wdi_logic">'+wdi_messages.either+"</span>"));break;case"NOR":t.append(jQuery('<span class="wdi_logic">'+wdi_messages.neither+"</span>"))}else switch(jQuery("#WDI_conditional_filter_type").val()){case"AND":case"OR":break;case"NOR":t.append(jQuery('<span class="wdi_logic">'+wdi_messages.not+"</span>"))}switch(jQuery("#WDI_conditional_filter_type").val()){case"AND":e=wdi_messages.and;break;case"OR":e=wdi_messages.or;break;case"NOR":e=wdi_messages.nor}1<=i&&t.append(jQuery('<span class="wdi_logic">'+e+"</span>")),t.append(this.createUiElement(this.conditionalFilters[i]))}this.updateFilterTextarea()},wdi_controller.createUiElement=function(e){var t;switch(e.filter_type){case"mention":t="@";break;case"hashtag":t="#";break;case"location":t="%";break;default:t=""}return jQuery('<span data-id="'+e.id+'" class="wdi_filter_item wdi_filter_by_'+e.filter_type+'"></span>').html(t+e.filter_by+'<span onclick="wdi_controller.removeConditionalFilter(jQuery(this));" class="wdi_remove_filter">X</span>')},wdi_controller.randomId=function(){for(var e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=0;i<5;i++)e+=t.charAt(Math.floor(Math.random()*t.length));return e},wdi_controller.removeConditionalFilter=function(e){for(var t=e.parent().attr("data-id"),i=0;i<this.conditionalFilters.length;i++)this.conditionalFilters[i].id==t&&this.conditionalFilters.splice(i,1);this.updateFiltersUi()},wdi_controller.updateFilterTextarea=function(){var e=this.conditionalFilters,e=JSON.stringify(e);jQuery("#wdi_conditional_filters_textarea").val(e)},wdi_controller.setInitialFilters=function(){var e=[],t=jQuery("#wdi_conditional_filters_textarea").val();this.isJsonString(t)&&(e=JSON.parse(t)),this.conditionalFilters=e},wdi_controller.updateConditionalFiltersUi=function(){wdi_controller.updateFilterSource()},wdi_controller.updateFilterSource=function(){if("liked"!=jQuery('input[name="wdi_feed_settings[liked_feed]"]:checked').val()){var e,t,i=[];jQuery(".wdi_user").each(function(){e=(0!=jQuery(this).find(".wdi_username").length?jQuery(this).find(".wdi_username"):jQuery(this).find(".wdi_hashtag")).text(),t=jQuery(this).find("img").attr("src"),i.push({username:e,image:t})});for(var r=jQuery("#wdi_filter_source").html(""),a=0;a<i.length;a++){s="<div class='wdi_source_user'><span class='wdi_source_img'><img src='"+i[a].image+"'></span><span class='wdi_source_username'>"+i[a].username+"</span></div>";r.html(r.html()+s)}}else{var r,s="<div class='wdi_source_user'><span class='wdi_source_username'>Media I liked</span></div>";(r=jQuery("#wdi_filter_source").html("")).html(r.html()+s)}},wdi_controller.isJsonString=function(e){try{JSON.parse(e)}catch(e){return!1}return!0},wdi_controller.getUserObj=function(e){var t=JSON.parse(wdi_options.wdi_authenticated_users_list);if("object"==typeof t){if("object"==typeof t[e]&&""!=t[e])return t[e];console.log("Error: User not exist on Users object")}else console.log("Error: Wrong response when parsed on users (JSON.parse)");return!1};
1
+ function wdi_multiple_accounts_option_controller(){var e=jQuery(jQuery("#wdi_user_id").closest("form").find(".form-table").get(1));e.addClass("wdi_multiple_accounts_section");var t="";if(wdi_options.wdi_authenticated_users_list){var i,r=JSON.parse(wdi_options.wdi_authenticated_users_list),a=0;for(i in r)t+="<tr data-multiple-account='"+a+"'>",t+="<th>Access Token</th>",t+='<td><input type="text" name="wdi_instagram_options[wdi_authenticated_users_list][access_token][]" size="53" required="" value="'+r[i].access_token+'"></td>',t+="</tr>",t+="<tr data-multiple-account='"+a+"' class='wdi_username_tr'>",t+="<th>Username</th>",t+='<td><div class="wdi_input_wrapper"><input type="text" name="wdi_instagram_options[wdi_authenticated_users_list][user_name][]" size="53" required="" value="'+r[i].user_name+'"></div><div class="wdi_remove_auth_user">Delete</div></td>',t+='<input type="hidden" name="wdi_instagram_options[wdi_authenticated_users_list][user_id][]" size="53" required="" value="'+r[i].user_id+'">',t+="</tr>",a++;e.append(t)}jQuery(".wdi_remove_auth_user").on("click",function(e){e.preventDefault();e=jQuery(this).closest(".wdi_username_tr").data("multiple-account");return jQuery(this).closest(".wdi_multiple_accounts_section").find('tr[data-multiple-account="'+e+'"]').remove(),!1})}function wdi_advanced_option_controller(){var e=jQuery(jQuery("#wdi_user_id").closest("form").find(".form-table").get(1));e.addClass("wdi_advanced_option wdi_advanced_option_close");$tr=jQuery("<tr class='wdi_advanced_option_head'><th style='width: 100%;'>ADVANCED OPTIONS AND MULTIPLE INSTAGRAM ACCOUNTS</th><td><div class='wdi_advanced_option_icon'></div></td></tr>"),e.prepend($tr),$tr.on("click",function(){e.hasClass("wdi_advanced_option_open")?(e.removeClass("wdi_advanced_option_open"),e.addClass("wdi_advanced_option_close")):(e.removeClass("wdi_advanced_option_close"),e.addClass("wdi_advanced_option_open"))})}function wdi_controller(){}jQuery(document).ready(function(){function e(e){if(!1===e){var t=JSON.parse(localStorage.getItem("wdi_sections"));for(i in null!==t&&!1!==t||(t={wdi_layout_section:"show",wdi_media:"show",wdi_layout:"hide",wdi_advanced:"hide",wdi_lightbox_general:"show",wdi_lightbox_advanced:"hide",wdi_conditional_filters:"show",wdi_how_to_publish:"show"},localStorage.setItem("wdi_sections",JSON.stringify(t))),t){var r=jQuery("#wdi_save_feed").find("[data-section_name='"+i+"']");n(t[i],r)}}else{var a=jQuery(e).data("section_name"),s=null;e.hasClass("wdi_section_open")?(n("show",e),s="show"):e.hasClass("wdi_section_close")&&(n("hide",e),s="hide"),null!=s&&((e=JSON.parse(localStorage.getItem("wdi_sections"))||{})[a]=s,localStorage.setItem("wdi_sections",JSON.stringify(e)))}}function n(e,t){"show"===e?("table"===(e=t.closest(".wdi_section").find(".wdi_elements")).data("display")?e.css({display:"table"}):e.css({display:"block"}),t.css({"border-bottom":"1px solid #f1f1f1",margin:"0 auto 15px"}),t.removeClass("wdi_section_open"),t.addClass("wdi_section_close")):(t.closest(".wdi_section").find(".wdi_elements").css({display:"none"}),t.css({"border-bottom":"0px",margin:"0 auto 0px"}),t.removeClass("wdi_section_close"),t.addClass("wdi_section_open"))}jQuery("#wdi_reset_cache").click(function(e){jQuery(".wdi_reset_cache_success").remove(),jQuery("#wdi_save_loading").removeClass("wdi_hidden"),e.preventDefault(),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,task:"reset",action:"wdi_cache"},success:function(e){!1===e.success?jQuery("#wdi_reset_cache").after("<span class='wdi_reset_cache_success' style='color: #fc0000; margin-left: 15px; line-height: 2;'>Failed</span>"):(wdi_controller.instagram=new WDIInstagram,jQuery.each(e.data,function(e,t){var i=JSON.parse(t.users),r="",a="",s="",n=t.endpoint;jQuery.each(i,function(e,t){""!==t.tag_id?(a=(a=(a=t.username).substr(1,a.length)).replace(" ",""),s=t.tag_id):r=(r=wdi_controller.getUserObj(t.username))&&r.user_name});t=t.feed_id;wdi_controller.instagram.set_cache_data("",r,t,"",0,0,a,s,n,"")}),jQuery("#wdi_reset_cache").after("<span class='wdi_reset_cache_success' style='color: #029117; margin-left: 15px; line-height: 2;'>Success</span>"))}})}),jQuery(".wdi_account_refresh").click(function(){var t=jQuery(this),e=t.data("wdi_account");jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{page:"wdi_settings",action:"wdi_account_refresh",nonce:wdi_ajax.wdi_nonce,user_name:e},success:function(e){t.closest("div").find(".wdi_reset_cache_success").remove(),!0===e.success?(t.after("<span class='wdi_reset_cache_success' style='color: #029117; margin-left: 15px; line-height: 2;'>Success</span>"),t.closest("div").find(".wdi_user_token").val(e.token)):t.after("<span class='wdi_reset_cache_success' style='color: #fc0000; margin-left: 15px; line-height: 2;'>Failed</span>")}})}),wdi_controller.bindSaveFeedEvent(),wdi_controller.bindAddNewUserOrHashtagEvent(),jQuery(".display_type input").on("click",function(){wdi_controller.displaySettingsSection(jQuery(this))}),wdi_controller.conditionalFiltersTabInit(),wdi_controller.bindSaveThemeEvent(),jQuery("body").hasClass("instagram-feed_page_wdi_settings")&&wdi_advanced_option_controller(),jQuery(".wdi_section_name").click(function(){e(jQuery(this))}),e(!1),jQuery(document).on("click",".wdi-account-show-token",function(){jQuery(this).find("i").toggleClass("dashicons-arrow-up-alt2 dashicons-arrow-down-alt2"),jQuery(this).parents("li").find(".wdi-account-accesstoken").slideToggle(300)}),jQuery(document).on("click",".wdi-advanced-options .wdi-advanced-headline",function(){jQuery(this).find("i").toggleClass("dashicons-arrow-up-alt2 dashicons-arrow-down-alt2"),jQuery(this).parents(".wdi-advanced-options").find(".wdi-advanced-body").slideToggle(500)}),jQuery(document).on("click","#wdi_verify",function(){jQuery("#wdi_submit").prop("disabled",!0),jQuery(this).is(":checked")&&jQuery("#wdi_submit").prop("disabled",!1)}),jQuery(document).on("click","#wdi_submit",function(){return confirm(wdi_messages.uninstall_plugin)&&jQuery("#wdi_uninstall_form").submit(),!1}),jQuery("#WDI_feed_name").on("keypress",function(){jQuery(this).removeAttr("style")})}),wdi_controller.getParameterByName=function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");e=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(location.search);return null===e?"":decodeURIComponent(e[1].replace(/\+/g," "))},wdi_controller.apiRedirected=function(){var e=this.getParameterByName("access_token").split("."),t=/^[^\\\/&?><"']*$/;for(i=0;i<e.length;i++)if(null===e[i].match(t))return;var r=e.join(".");jQuery(document).ready(function(){""===wdi_options.wdi_access_token?jQuery("#wdi_access_token").attr("value",r):(jQuery(".wdi_more_token_template .wdi_more_access_token").prop("disabled",!1),jQuery(".wdi_more_token_template .wdi_more_access_token").attr("value",r))}),wdi_controller.instagram.addToken(r),wdi_controller.getUserInfo(r)},wdi_controller.getUserInfo=function(e){this.instagram.getSelfInfo({success:function(e){""===wdi_options.wdi_access_token?(jQuery("#wdi_user_name").attr("value",e.data.username),jQuery("#wdi_user_id").attr("value",e.data.id)):(jQuery(".wdi_more_token_template .wdi_more_user_name").prop("disabled",!1),jQuery(".wdi_more_token_template .wdi_more_user_id").prop("disabled",!1),jQuery(".wdi_more_token_template .wdi_more_user_name").attr("value",e.data.username),jQuery(".wdi_more_token_template .wdi_more_user_id").attr("value",e.data.id)),jQuery(document).trigger("wdi_settings_filled")}})},wdi_controller.oldDisplayType={},wdi_controller.displayTypeMemory={},wdi_controller.switchFeedTabs=function(e,t){jQuery("#wdi_refresh_tab").attr("value",e),jQuery(".wdi_tab").hide(),jQuery("#"+e+"_tab").show(),jQuery(".wdi_element_name_popup_enable_comment").hide(),"business"===jQuery("#WDI_user_name option:selected").data("type")&&jQuery(".wdi_element_name_popup_enable_comment").show(),jQuery(".display_type").css("display","none"),jQuery('.display_type[tab="'+e+'"]').css("display","block"),jQuery('.display_type[tab="'+e+'"]').length?jQuery(".display_type_content").show():jQuery(".display_type_content").hide(),jQuery(".wdi_feed_tabs").filter(".wdi_feed_tab_active").each(function(){jQuery(this).removeClass("wdi_feed_tab_active")}),jQuery("#wdi_"+e).addClass("wdi_feed_tab_active");var i=jQuery(),r=!1;null!=t&&""!=t&&(i=jQuery(".display_type #"+t).prop("checked",!0),jQuery("#wdi_feed_type").attr("value",t)),r||0!=(i=jQuery('.display_type[tab="'+e+'"] input[name="feed_type"]:checked')).length&&(r=!0),r||0!=(i=jQuery('.display_type[tab="'+e+'"] #thumbnails')).length&&(r=!0,i.prop("checked",!0),jQuery("#wdi_feed_type").attr("value","thumbnails")),r&&wdi_controller.displaySettingsSection(i),"conditional_filters"==e&&wdi_controller.updateConditionalFiltersUi()},wdi_controller.displaySettingsSection=function(e){var i=e.attr("id").toLowerCase().trim(),t=e.parent().parent().attr("tab"),e=jQuery("#wdi_refresh_section");wdi_controller.oldDisplayType={section:i,tab:t},wdi_controller.displayTypeMemory[t]=wdi_controller.oldDisplayType,null!=e&&e.attr("value",i);e=jQuery(".wdi_border_wrapper .form-table");jQuery("#wdi_feed_type").attr("value",i);var r=0,a=!1;e.find(".wdi_element").each(function(){0;var e=jQuery(this).find(".wdwt_param").children().children().children().attr("section");if(void 0!==e){a=!1;var t=e.toLowerCase().trim().split(",");for(r=0;r<t.length;r++)t[r]===i&&(jQuery(this).css("display","block"),a=!0);!1===a&&jQuery(this).css("display","none")}})},wdi_controller.switchThemeTabs=function(e,t){jQuery(".wdi_feed_tabs").filter(".wdi_feed_tab_active").each(function(){jQuery(this).removeClass("wdi_feed_tab_active")}),jQuery("#wdi_"+e).addClass("wdi_feed_tab_active"),jQuery("[tab]").each(function(){jQuery(this).attr("tab")!=e?jQuery(this).parent().parent().parent().parent().parent().filter("tr").css("display","none"):jQuery(this).parent().parent().parent().parent().parent().filter("tr").css("display","block")}),jQuery(".display_type").css("display","none"),jQuery('.display_type[tab="'+e+'"]').css("display","block"),jQuery("#wdi_refresh_tab").attr("value",e),null!=t&&""!=t&&jQuery("#wdi_refresh_section").attr("value",t),(null==t&&""!=t?null!=wdi_controller.displayTypeMemory[e]?jQuery(".display_type #"+wdi_controller.displayTypeMemory[e].section):jQuery('.display_type[tab="'+e+'"]').first().find("input"):jQuery(".display_type #"+t)).trigger("click")},wdi_controller.bindSaveFeedEvent=function(){var e=this;jQuery("#wdi_save_feed_submit").on("click",function(){e.save_feed("save_feed")}),jQuery("#wdi_save_feed_apply").on("click",function(){e.save_feed("apply_changes")}),jQuery("#wdi_cancel_changes").on("click",function(){e.save_feed("cancel")})},wdi_controller.save_feed=function(e){var t,i,r,a=[],s={};"cancel"==e&&(window.location=window.location.href),t=jQuery("#WDI_user_name option:selected").data("type"),n=jQuery("#WDI_user_name option:selected").val(),i=jQuery("#WDI_feed_name");var n=wdi_controller.getUserObj(n);if(""==i.val())return alert(wdi_messages.feed_title_field_required),i.focus().attr("style","border-color: #FF0000;"),!1;if(!n)return alert(wdi_messages.user_field_required),!1;if(r={id:n.user_id,username:n.user_name},wdi_controller.checkIfUserNotSaved(e),0==wdi_controller.waitingAjaxRequestEnd.button){if(s=jQuery("#WDI_feed_users").val(),this.isJsonString(s)){for(var d in s=JSON.parse(s))"business"==t&&"#"===s[d].username.charAt(0)&&a.push(s[d]);a.push(r)}else a.push(r);users=this.stringifyUserData(a),jQuery("#WDI_feed_users").val(users),jQuery("#wdi_feed_thumb").val(""),"business"==t&&jQuery("#wdi_feed_thumb").val(n.profile_picture_url),"apply_changes"!=e&&"save_feed"!=e||(n=jQuery("#wdi_add_or_edit").val(),jQuery("#wdi_current_id").val(n)),jQuery("#task").attr("value",e),submit_ajax()}};var comlete_redirect_url="";function submit_ajax(){var e=jQuery("#wdi_save_feed").serialize();e+="&action=wdi_apply_changes&page=wdi_feeds",jQuery("#wdi_save_loading").removeClass("wdi_hidden"),jQuery.ajax({url:wdi_ajax.ajax_url,type:"POST",dataType:"json",data:e,success:function(e){comlete_redirect_url=e.url;var t=e.feed_id;1==e.need_cache?(jQuery(".caching-process-message").removeClass("wdi_hidden"),setTimeout(function(){wdi_controller.instagram.set_cache_data(comlete_redirect_url,"",t,"",0,0,"","","","")},1e3)):(jQuery("#wdi_save_loading").addClass("wdi_hidden"),window.location=comlete_redirect_url)},error:function(e,t,i){window.location=comlete_redirect_url}})}function wdi_spider_select_value(e){e.focus(),e.select()}function wdi_spider_set_input_value(e,t){"add"===t&&""==jQuery("#wdi_access_token").attr("value")&&alert("Please get your access token"),document.getElementById(e)&&(document.getElementById(e).value=t)}function wdi_spider_form_submit(e,t){document.getElementById(t)&&document.getElementById(t).submit(),e.preventDefault?e.preventDefault():e.returnValue=!1}function wdi_bulk_actions(e){e=jQuery(e).val();return""!=e&&(!("delete_all"==e&&!confirm(wdi_messages.do_you_want_to_delete_selected_items))&&(wdi_spider_set_input_value("task",e),jQuery("#wdi_feed_form").submit(),!0))}function wdi_spider_check_all_items(){wdi_spider_check_all_items_checkbox(),jQuery("#check_all").trigger("click")}function wdi_spider_check_all_items_checkbox(){var e;jQuery("#check_all_items").prop("checked")?(jQuery("#check_all_items").prop("checked",!1),jQuery("#draganddrop").hide()):(e=parseInt(jQuery(".displaying-num").html())?parseInt(jQuery(".displaying-num").html()):0,e=(jQuery('input[id^="check_pr_"]').length?parseInt(jQuery('input[id^="check_pr_"]').length):0)+e,jQuery("#check_all_items").prop("checked",!0),e&&(jQuery("#draganddrop").html("<strong><p>Selected "+e+" item"+(1<e?"s":"")+".</p></strong>"),jQuery("#draganddrop").show()))}function wdi_spider_check_all(e){jQuery(e).prop("checked")||(jQuery("#check_all_items").prop("checked",!1),jQuery("#draganddrop").hide())}function wdi_spider_set_input_value(e,t){"add"===t&&""==jQuery("#wdi_access_token").attr("value")&&alert("Please get your access token"),document.getElementById(e)&&(document.getElementById(e).value=t)}function wdi_account_remove(e,t){jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{page:"wdi_settings",action:"wdi_account_disconnect",nonce:wdi_ajax.wdi_nonce,user_name:e,user_id:t},success:function(e){e.success&&(1==jQuery('[class*="wdi-account-list"]').length?((e=jQuery(".wdi-account-list-"+t).parent()).prev().remove(),e.remove(),jQuery("#toplevel_page_wdi_feeds ul").remove(),jQuery("#toplevel_page_wdi_feeds a").attr("href","admin.php?page=wdi_settings")):jQuery(".wdi-account-list-"+t).remove())}})}function wdi_popup_open(){jQuery(".wdi-popup").show()}function wdi_popup_close(){jQuery(".wdi-popup").hide()}wdi_controller.makeInstagramUserRequest=function(e,t){var i,r=this,a=this.getInputType(e),s="hashtag"===a,n=jQuery("#wdi_add_or_edit").val();if(""==e)return alert(wdi_messages.please_write_hashtag),!1;if(""!=e&&!s)return alert(wdi_messages.invalid_hashtag),!1;if(r.checkForDuplicateUser(e))return alert(e+" "+wdi_messages.already_added),!1;switch(i=jQuery("#WDI_user_name option:selected").val(),(s=wdi_controller.getUserObj(i))&&(this.instagram.user=s),a){case"user":break;case"hashtag":var d=(d=e.substr(1,e.length)).replace(" ",""),l=(jQuery("input[name='wdi_feed_settings[hashtag_top_recent]']:checked").val(),{tagname:d,action:"wdi_getHashtagId",wdi_nonce:wdi_ajax.wdi_nonce,user_name:i,feed_id:n});jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:l,success:function(e){jQuery("#wdi_add_user_ajax").removeAttr("disabled");var t=r.isValidResponse(e);t.valid?r.addHashtag(d,e):alert(t.msg)},error:function(e,t,i){}})}},wdi_controller.checkForDuplicateUser=function(e){var t=jQuery("#WDI_feed_users").val();if(this.isJsonString(t)){t=JSON.parse(t);for(var i=0;i<t.length;i++)if(e==t[i].username)return!0}return!1},wdi_controller.getInputType=function(e){switch(e[0]){case"#":return"hashtag";case"%":return"location";default:return"user"}},wdi_controller.stringifyUserData=function(e){for(var t=[],i=0;i<e.length;i++)t.push({id:e[i].id,username:e[i].username,tag_id:void 0!==e[i].tag_id?e[i].tag_id:""});return JSON.stringify(t)},wdi_controller.bindAddNewUserOrHashtagEvent=function(){jQuery("#wdi_add_user_ajax").on("click",function(){void 0!==jQuery(this).prop("disabled")||jQuery(this).prop("disabled",!0);var e=jQuery("#wdi_add_user_ajax_input").val().trim().toLowerCase();!1===wdi_controller.makeInstagramUserRequest(e)&&jQuery(this).removeAttr("disabled","disabled")}),jQuery("#wdi_add_user_ajax_input").on("keypress",function(e){if(13==e.keyCode){void 0!==jQuery("#wdi_add_user_ajax").prop("disabled")||jQuery("#wdi_add_user_ajax").prop("disabled",!0);e=jQuery("#wdi_add_user_ajax_input").val().trim().toLowerCase();return!1===wdi_controller.makeInstagramUserRequest(e)&&jQuery("#wdi_add_user_ajax").removeAttr("disabled","disabled"),!1}})},wdi_controller.removeFeedUser=function(e){var t,i=e.parent().find("a span").text();e.parent().find("a span").hasClass("wdi_hashtag")&&(i="#"+i),0!=this.feed_users.length||void 0!==(t=jQuery("#WDI_feed_users").val())&&this.isJsonString(t)&&(this.feed_users=JSON.parse(t));for(var r=0;r<this.feed_users.length;r++)if(this.feed_users[r].username==i){this.feed_users.splice(r,1);break}for(r=0;r<this.feed_users.length;r++)"#"!==this.feed_users[r].username.charAt(0)&&this.feed_users.splice(r,1);jQuery("#WDI_feed_users").val(this.stringifyUserData(this.feed_users)),e.parent().remove(),wdi_controller.changed_users()},wdi_controller.bindSaveThemeEvent=function(){jQuery("#wdi_save_theme_submit").on("click",function(){jQuery("#task").attr("value","save_feed"),jQuery("#wdi_save_feed").submit()}),jQuery("#wdi_save_theme_apply").on("click",function(){jQuery("#task").attr("value","apply_changes");var e=jQuery("#wdi_add_or_edit").attr("value");jQuery("#wdi_current_id").attr("value",e),jQuery("#wdi_save_feed").submit()}),jQuery("#wdi_save_theme_reset").on("click",function(){jQuery("#task").attr("value","reset_changes");var e=jQuery("#wdi_add_or_edit").attr("value");jQuery("#wdi_current_id").attr("value",e),jQuery("#wdi_save_feed").submit()})},wdi_controller.checkIfUserNotSaved=function(e){switch(e){case"save_feed":e="submit";break;case"apply_changes":e="apply";break;case"reset_changes":e="reset"}if(""==jQuery("#wdi_add_user_ajax_input").val().trim())return wdi_controller.waitingAjaxRequestEnd={button:0},0;var t=jQuery("#wdi_add_user_ajax_input").val().trim().toLowerCase();return wdi_controller.waitingAjaxRequestEnd={button:e},wdi_controller.makeInstagramUserRequest(t),1},wdi_controller.saveFeedAfterAjaxWait=function(e){var t;null!=wdi_controller.waitingAjaxRequestEnd&&(t=wdi_controller.waitingAjaxRequestEnd.button,e&&0!=t&&jQuery("#wdi_save_feed_"+t).trigger("click"),wdi_controller.waitingAjaxRequestEnd=void 0)},wdi_controller.getCookie=function(e){e=("; "+document.cookie).split("; "+e+"=");if(2==e.length)return e.pop().split(";").shift()},wdi_controller.isValidResponse=function(e){var t={};return void 0===e||void 0===e.meta.code||200!=e.meta.code?(t.valid=!1,void 0===e?t.msg=wdi_messages.instagram_server_error:200!==e.meta.code?t.msg=e.meta.message:t.msg=""):(t.valid=!0,t.msg="success"),t},wdi_controller.hasData=function(e){return void 0!==e&&void 0!==e.data&&0!=e.data.length},wdi_controller.thumbUser=function(e){return 0<this.feed_users.length&&this.feed_users[0].username===e},wdi_controller.findUser=function(e,t){var i=[];void 0!==t&&void 0!==t.data&&(i=t.data);for(var r=0;r<i.length;r++)if(i[r].username==e)return i[r];return!1},wdi_controller.addHashtag=function(e,t){if(null==e.match(/[~!@$%&*#^()<>?]/)){var i=jQuery('<div class="wdi_user"><a target="_blank" href="https://instagram.com/explore/tags/'+e+'"><img class="wdi_profile_pic" src="'+wdi_url.plugin_url+'images/hashtag.png"><span class="wdi_hashtag">'+e+'</span><i style="display:table-cell;width:25px;"></i></a><img class="wdi_remove_user" onclick="wdi_controller.removeFeedUser(jQuery(this))" src="'+wdi_url.plugin_url+'/images/delete_user.png"></div>');jQuery("#wdi_feed_users_ajax").append(i),jQuery("#wdi_add_user_ajax_input").val("");var r=jQuery("#WDI_feed_users").val();if(this.isJsonString(r)){r=JSON.parse(r);for(var a=0;a<r.length;a++)"#"!==r[a].username.charAt(0)&&r.splice(a,1)}else r=[];t={id:"#"+e,username:"#"+e,profile_picture:"",tag_id:t.tag_id};r.push(t),this.feed_users=r,jQuery("#WDI_feed_users").val(this.stringifyUserData(this.feed_users))}else alert(wdi_messages.invalid_hashtag);this.updateConditionalFiltersUi(),wdi_controller.saveFeedAfterAjaxWait(!0),wdi_controller.changed_users()},wdi_controller.changed_users=function(){for(var e=!1,t=0;t<this.feed_users.length;t++)if("#"===this.feed_users[t].username[0]){e=!0;break}e?(jQuery(".wdi_element_name_hashtag_top_recent").show(),jQuery(".wdi_element_name_show_username_on_thumb").hide()):(jQuery(".wdi_element_name_hashtag_top_recent").hide(),jQuery(".wdi_element_name_show_username_on_thumb").show())},wdi_controller.addUser=function(e){e.username=e.user_name,0==this.checkForDuplicateUser(e.username)?(newUser=jQuery('<div class="wdi_user"><a target="_blank" href="http://www.instagram.com/'+e.username+'"><span class="wdi_username">'+e.username+'</span><i style="display:table-cell;width:25px;"></i></a><img class="wdi_remove_user" onclick="wdi_controller.removeFeedUser(jQuery(this))" src="'+wdi_url.plugin_url+'images/delete_user.png"></div>'),jQuery("#wdi_feed_users_ajax").append(newUser),jQuery("#wdi_add_user_ajax_input").val(""),this.feed_users.push({id:e.id,username:e.username,profile_picture:""})):alert(e.username+" "+wdi_messages.already_added),this.updateConditionalFiltersUi(),wdi_controller.saveFeedAfterAjaxWait(!0)},wdi_controller.getUserProfilePic=function(e){for(var t=0;t<this.feed_users.length;t++)if(e==this.feed_users[t].username)return this.feed_users[t].profile_picture;return"false"},wdi_controller.conditionalFiltersTabInit=function(){this.setInitialFilters(),this.updateFiltersUi();var t=this;function e(){switch(jQuery("#WDI_wrap_conditional_filter_enable input:checked").val()){case"0":jQuery("#WDI_conditional_filters").parent().parent().addClass("wdi_hidden"),jQuery("#WDI_conditional_filter_type").parent().parent().parent().parent().parent().addClass("wdi_hidden"),jQuery("#wdi_final_condition").addClass("wdi_hidden"),jQuery("#WDI_filter_source").addClass("wdi_hidden");break;case"1":jQuery("#WDI_conditional_filters").parent().parent().removeClass("wdi_hidden"),jQuery("#WDI_conditional_filter_type").parent().parent().parent().parent().parent().removeClass("wdi_hidden"),jQuery("#wdi_final_condition").removeClass("wdi_hidden"),jQuery("#WDI_filter_source").removeClass("wdi_hidden")}}jQuery("#wdi_add_filter").on("click",function(){t.addConditionalFilter()&&jQuery("#wdi_filter_input").val("")}),jQuery(".wdi_filter_radio").on("click",function(){jQuery("#wdi_filter_input").trigger("focus")}),jQuery("#wdi_filter_input").on("keypress",function(e){if(13==e.keyCode)return t.addConditionalFilter()&&jQuery(this).val(""),!1}),e(),jQuery("#WDI_wrap_conditional_filter_enable input").on("change",function(){e()}),jQuery("#WDI_conditional_filter_type").on("change",function(){switch("none"==jQuery(this).val()||jQuery("#WDI_conditional_filters").css("display","block"),jQuery(this).parent().find("label").css({display:"inline-block"}),jQuery(this).val()){case"AND":jQuery("#WDI_conditional_filters").css("display","block"),jQuery(this).parent().find("label").html(wdi_messages.and_descr);break;case"OR":jQuery("#WDI_conditional_filters").css("display","block"),jQuery(this).parent().find("label").html(wdi_messages.or_descr);break;case"NOR":jQuery("#WDI_conditional_filters").css("display","block"),jQuery(this).parent().find("label").html(wdi_messages.nor_descr)}wdi_controller.updateFiltersUi()}),jQuery("#WDI_conditional_filter_type").trigger("change")},wdi_controller.addConditionalFilter=function(){var e=jQuery("#wdi_filter_input").val(),t=jQuery("#wdi_filter_type").val();if(filter={},""==e)return!1;switch(e=e.trim(),null==t&&("@"==e[0]?t="mention":"#"==e[0]?t="hashtag":"http"!=e.split("://")[0]&&"https"!=e.split("://")[0]||(t="url")),t){case"username":case"mention":"@"==e[0]&&(e=e.substr(1,e.length));break;case"hashtag":"#"==e[0]&&(e=e.substr(1,e.length));break;case"url":if(!/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(e))return alert(wdi_messages.invalid_url),!1}return filter={filter_type:t,filter_by:e,id:this.randomId()},null!=t?this.filterExists(filter)?(alert(e+" "+wdi_messages.already_added),!1):(this.conditionalFilters.push(filter),this.updateFiltersUi(),!0):(alert(wdi_messages.selectConditionType),!1)},wdi_controller.filterExists=function(e){for(var t=0;t<this.conditionalFilters.length;t++)if(this.conditionalFilters[t].filter_type==e.filter_type&&this.conditionalFilters[t].filter_by==e.filter_by)return!0;return!1},wdi_controller.updateFiltersUi=function(){for(var e,t=jQuery("#wdi_filters_ui").html(""),i=0;i<this.conditionalFilters.length;i++){if(0==i)if(1!=this.conditionalFilters.length)switch(jQuery("#WDI_conditional_filter_type").val()){case"AND":break;case"OR":t.append(jQuery('<span class="wdi_logic">'+wdi_messages.either+"</span>"));break;case"NOR":t.append(jQuery('<span class="wdi_logic">'+wdi_messages.neither+"</span>"))}else switch(jQuery("#WDI_conditional_filter_type").val()){case"AND":case"OR":break;case"NOR":t.append(jQuery('<span class="wdi_logic">'+wdi_messages.not+"</span>"))}switch(jQuery("#WDI_conditional_filter_type").val()){case"AND":e=wdi_messages.and;break;case"OR":e=wdi_messages.or;break;case"NOR":e=wdi_messages.nor}1<=i&&t.append(jQuery('<span class="wdi_logic">'+e+"</span>")),t.append(this.createUiElement(this.conditionalFilters[i]))}this.updateFilterTextarea()},wdi_controller.createUiElement=function(e){var t;switch(e.filter_type){case"mention":t="@";break;case"hashtag":t="#";break;case"location":t="%";break;default:t=""}return jQuery('<span data-id="'+e.id+'" class="wdi_filter_item wdi_filter_by_'+e.filter_type+'"></span>').html(t+e.filter_by+'<span onclick="wdi_controller.removeConditionalFilter(jQuery(this));" class="wdi_remove_filter">X</span>')},wdi_controller.randomId=function(){for(var e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=0;i<5;i++)e+=t.charAt(Math.floor(Math.random()*t.length));return e},wdi_controller.removeConditionalFilter=function(e){for(var t=e.parent().attr("data-id"),i=0;i<this.conditionalFilters.length;i++)this.conditionalFilters[i].id==t&&this.conditionalFilters.splice(i,1);this.updateFiltersUi()},wdi_controller.updateFilterTextarea=function(){var e=this.conditionalFilters,e=JSON.stringify(e);jQuery("#wdi_conditional_filters_textarea").val(e)},wdi_controller.setInitialFilters=function(){var e=[],t=jQuery("#wdi_conditional_filters_textarea").val();this.isJsonString(t)&&(e=JSON.parse(t)),this.conditionalFilters=e},wdi_controller.updateConditionalFiltersUi=function(){wdi_controller.updateFilterSource()},wdi_controller.updateFilterSource=function(){if("liked"!=jQuery('input[name="wdi_feed_settings[liked_feed]"]:checked').val()){var e,t,i=[];jQuery(".wdi_user").each(function(){e=(0!=jQuery(this).find(".wdi_username").length?jQuery(this).find(".wdi_username"):jQuery(this).find(".wdi_hashtag")).text(),t=jQuery(this).find("img").attr("src"),i.push({username:e,image:t})});for(var r=jQuery("#wdi_filter_source").html(""),a=0;a<i.length;a++){s="<div class='wdi_source_user'><span class='wdi_source_img'><img src='"+i[a].image+"'></span><span class='wdi_source_username'>"+i[a].username+"</span></div>";r.html(r.html()+s)}}else{var r,s="<div class='wdi_source_user'><span class='wdi_source_username'>Media I liked</span></div>";(r=jQuery("#wdi_filter_source").html("")).html(r.html()+s)}},wdi_controller.isJsonString=function(e){try{JSON.parse(e)}catch(e){return!1}return!0},wdi_controller.getUserObj=function(e){var t=JSON.parse(wdi_options.wdi_authenticated_users_list);if("object"==typeof t){if("object"==typeof t[e]&&""!=t[e])return t[e];console.log("Error: User not exist on Users object")}else console.log("Error: Wrong response when parsed on users (JSON.parse)");return!1};
js/wdi_frontend.js CHANGED
@@ -952,12 +952,15 @@ wdi_front.createObject = function (obj, currentFeed) {
952
  if ( obj.type === 'image' ) {
953
  var media_standard_h = obj['images']['standard_resolution']['height'];
954
  var media_standard_w = obj['images']['standard_resolution']['width'];
955
- } else if ( obj.type === 'video' ) {
 
956
  var media_standard_h = obj['videos']['standard_resolution']['height'] ;
957
  var media_standard_w = obj['videos']['standard_resolution']['width'] ;
958
- } else {
959
- var media_standard_h = obj['carousel_media'][0]['images'] ? obj['carousel_media'][0]['images']['standard_resolution']['height'] : obj['carousel_media'][0]['videos']['standard_resolution']['height'] ;
960
- var media_standard_w = obj['carousel_media'][0]['images'] ? obj['carousel_media'][0]['images']['standard_resolution']['width'] : obj['carousel_media'][0]['videos']['standard_resolution']['width'] ;
 
 
961
  }
962
  if(media_standard_h > media_standard_w){
963
  wdi_shape = 'portrait';
952
  if ( obj.type === 'image' ) {
953
  var media_standard_h = obj['images']['standard_resolution']['height'];
954
  var media_standard_w = obj['images']['standard_resolution']['width'];
955
+ }
956
+ else if ( obj.type === 'video' ) {
957
  var media_standard_h = obj['videos']['standard_resolution']['height'] ;
958
  var media_standard_w = obj['videos']['standard_resolution']['width'] ;
959
+ }
960
+ else {
961
+ var carousel_media_type = ( typeof obj['carousel_media'][0]['images'] !== 'undefined' ) ? 'images' : 'videos';
962
+ var media_standard_h = obj['carousel_media'][0][carousel_media_type]['standard_resolution']['height'];
963
+ var media_standard_w = obj['carousel_media'][0][carousel_media_type]['standard_resolution']['width'];
964
  }
965
  if(media_standard_h > media_standard_w){
966
  wdi_shape = 'portrait';
js/wdi_frontend.min.js CHANGED
@@ -1 +1 @@
1
- "undefined"==typeof wdi_front&&(wdi_front={type:"not_declared"});var wdi_error_show=!(wdi_front.detectEvent=function(){var e="click";return/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())&&(e="touchend"),e}),wdi_error_init=!1;function wdi_baseName(e){var i=e.substr(e.lastIndexOf("/"));return e.replace(i,"")}wdi_front.escape_tags=function(e){return void 0===e&&(e=""),e=e.toString().replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&#34;")},wdi_front.show_alert=function(e,i,d){var r,t;void 0!==(d=jQuery("#wdi_feed_"+d.feed_row.wdi_feed_counter))&&(wdi_error_show=!0,d.find(".wdi_spinner").remove(),r=d.find(".wdi_js_error"),t=d.find(".wdi_token_error"),0!=i&&(void 0!==i.meta&&1==i.meta.error&&"OAuthException"===i.meta.error_type||void 0!==i.error&&"OAuthException"===i.error.type)?(d.find(".wdi_single_user").remove(),t.removeClass("wdi_hidden"),"1"!=wdi_front_messages.wdi_token_error_flag&&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(e){}})):void 0!==i.error&&void 0!==i.error.message&&(r.html(i.error.message),d.find(".wdi_single_user").remove(),r.removeClass("wdi_js_error"),r.addClass("wdi_js_error_no_animate"),jQuery(".wdi_js_error_no_animate").show()),wdi_front_messages.show_alerts||console.log("%c"+e,"color:#cc0000;")),wdi_error_show=!0},wdi_front.globalInit=function(){var e=wdi_front.feed_counter,i=0;void 0!==wdi_ajax.ajax_response&&(i=wdi_feed_counter_init.wdi_feed_counter_init);for(var d,r=i;r<=e;r++)0!==jQuery("#wdi_feed_"+r).length&&((d=new WDIFeed(window["wdi_feed_"+r])).instagram=new WDIInstagram,d.instagram.filterArguments={feed:d},d.instagram.addToken(d.feed_row.access_token),wdi_front.access_token=d.feed_row.access_token,d.dataLoaded=0,d.dataStorageRaw=[],d.dataStorage=[],d.dataStorageList=[],d.allResponseLength=0,d.currentResponseLength=0,d.temproraryUsersData=[],d.removedUsers=0,d.nowLoadingImages=!0,d.imageIndex=0,d.resIndex=0,d.currentPage=1,d.currentPageLoadMore=0,d.userSortFlags=[],d.customFilterChanged=!1,d.maxConditionalFiltersRequestCount=10,d.instagramRequestCounter=0,d.mediaRequestsDone=!1,d.conditionalFilterBuffer=[],d.stopInfiniteScrollFlag=!1,"masonry"==d.feed_row.feed_type&&(d.displayedData=[]),"pagination"==d.feed_row.feed_display_view?(d.feed_row.resort_after_load_more=0,"image_browser"!=d.feed_row.feed_type?(d.feed_row.load_more_number=parseInt(d.feed_row.pagination_per_page_number),d.feed_row.number_of_photos=d.allResponseLength):(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):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),"masonry"==d.feed_row.feed_type&&jQuery(window).trigger("resize"),wdi_front.bindEvents(d),window["wdi_feed_"+r]=d,wdi_front.init(d))},wdi_front.init=function(e){if(jQuery(".wdi_js_error").hide(),e.photoCounter=e.feed_row.number_of_photos,"liked"==e.feed_row.liked_feed)e.feed_users=["self"];else{if(!wdi_front.isJsonString(e.feed_row.feed_users))return void wdi_front.show_alert(wdi_front_messages.invalid_users_format,!1,e);e.feed_users=JSON.parse(e.feed_row.feed_users)}var i=[],d=[],r=[];void 0!==window.wdi_all_tags&&(i=window.wdi_all_tags);for(var t=0;t<e.feed_users.length;t++)"#"===e.feed_users[t].username[0]&&void 0!==e.feed_users[t].tag_id?(i[e.feed_users[t].tag_id]=e.feed_users[t],r[t]=e.feed_users[t]):d[0]=e.feed_users[t];window.wdi_all_tags=i,e.feed_users=void 0===r||wdi_front.isEmpty(r)?d:r;var a=wdi_front.getFeedItemResolution(e);e.feedImageResolution=a.image,e.feedVideoResolution=a.video,e.dataCount=e.feed_users.length;for(var o=0;o<e.dataCount;o++)wdi_front.instagramRequest(o,e);0<e.feed_row.number_of_photos&&wdi_front.ajaxLoader(e),"1"===e.feed_row.display_header&&wdi_front.show("header",e),"1"===e.feed_row.show_usernames&&wdi_front.show("users",e)},wdi_front.getFeedItemResolution=function(e){var i={image:"standard_resolution",video:"standard_resolution"};if("thumbnail"===e.feed_row.feed_resolution)return{image:"thumbnail",video:"low_bandwidth"};if("low"===e.feed_row.feed_resolution)return{image:"low_resolution",video:"low_resolution"};if("standard"===e.feed_row.feed_resolution)return{image:"standard_resolution",video:"standard_resolution"};var d=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter).find(".wdi_feed_wrapper");d.append('<div class="wdi_feed_item" id="wdi_feed_item_example"></div>'),wdi_responsive.columnControl(e,1);e=d.attr("wdi-res").split("wdi_col_");if(d.find("#wdi_feed_item_example").remove(),2!==e.length)return i;e=parseInt(e[1]);if(e<=0)return i;e=d.width()/e-10;return e<=150?(i.image="thumbnail",i.video="low_bandwidth"):150<e&&e<=320?(i.image="low_resolution",i.video="low_resolution"):(i.image="standard_resolution",i.video="standard_resolution"),i},wdi_front.isJsonString=function(e){try{JSON.parse(e)}catch(e){return!1}return!0},wdi_front.instagramRequest=function(i,d){var r=this,e=d.feed_users;if("string"==typeof e[i]&&"self"===e[i])d.instagram.getRecentLikedMedia({success:function(e){void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,d),d.mediaRequestsDone=!0,0!=(e=r.checkMediaResponse(e,d))&&r.saveSelfUserData(e,d)}});else if("hashtag"==this.getInputType(e[i].username)){if(this.isJsonString(d.feed_row.feed_users))for(var t in json_feed_users=JSON.parse(d.feed_row.feed_users),json_feed_users)"#"!==json_feed_users[t].username.charAt(0)&&(user=json_feed_users[t]);d.instagram.getTagRecentMedia(this.stripHashtag(e[i].username),{feed_id:d.feed_row.id,user_id:user.id,user_name:user.username,success:function(e){if(void 0!==e.error&&"undefined"!=e.error.type||void 0!==e.meta&&1==e.meta.error)return d.dataLoaded=1,wdi_front.show_alert(!1,e,d),!1;d.mediaRequestsDone=!0,e=r.checkMediaResponse(e,d),d.dataLoaded=1,0!=e&&r.saveUserData(e,d.feed_users[i],d)}},null,d.feed_row.hashtag_top_recent,0)}else"user"==this.getInputType(e[i].username)&&d.instagram.getUserMedia({feed_id:d.feed_row.id,user_id:e[i].id,user_name:e[i].username,success:function(e){if(void 0!==e.meta&&1==typeof e.meta.error)return d.dataLoaded=1,wdi_front.show_alert(!1,e,d),!1;d.mediaRequestsDone=!0,d.dataLoaded=1,0!=(e=r.checkMediaResponse(e,d))?r.saveUserData(e,d.feed_users[i],d):wdi_front.allImagesLoaded(d)}},"",0)},wdi_front.isHashtag=function(e){return"#"===e[0]},wdi_front.saveUserData=function(e,i,d){e.user_id=i.id,e.username=i.username,"#"===e.user_id[0]&&(e.data=wdi_front.appendRequestHashtag(e.data,e.user_id)),d.usersData.push(e),d.currentResponseLength=wdi_front.getArrayContentLength(d.usersData,"data"),d.allResponseLength+=d.currentResponseLength,d.dataCount==d.usersData.length&&(d.currentResponseLength<d.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(d)?wdi_front.loadMore("initial-keep",d):(wdi_front.displayFeed(d),wdi_front.applyFilters(d),wdi_front.activeUsersCount(d)||"load_more_btn"==d.feed_row.feed_display_view&&((d=jQuery("#wdi_feed_"+d.feed_row.wdi_feed_counter)).find(".wdi_load_more").addClass("wdi_hidden"),d.find(".wdi_spinner").addClass("wdi_hidden"))))},wdi_front.saveSelfUserData=function(e,i){e.user_id="",e.username="",i.usersData.push(e),i.currentResponseLength=wdi_front.getArrayContentLength(i.usersData,"data"),i.allResponseLength+=i.currentResponseLength,i.dataCount==i.usersData.length&&(i.currentResponseLength<i.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(i)?wdi_front.loadMore("initial-keep",i):(wdi_front.displayFeed(i),wdi_front.applyFilters(i),wdi_front.activeUsersCount(i)||"load_more_btn"==i.feed_row.feed_display_view&&((i=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter)).find(".wdi_load_more").addClass("wdi_hidden"),i.find(".wdi_spinner").addClass("wdi_hidden"))))},wdi_front.userHasNoPhoto=function(e,i){var d=0,r=e.usersData;void 0!==i&&(r=i);for(var t=0;t<r.length;t++)void 0===r[t].pagination&&(r[t].pagination=[]),"liked"===e.feed_row.liked_feed?void 0===r[t].pagination.next_max_like_id&&d++:void 0===r[t].pagination.next_max_id&&d++;return d==r.length?1:0},wdi_front.appendRequestHashtag=function(e,i){for(var d=0;d<e.length;d++)e[d].wdi_hashtag=i;return e},wdi_front.displayFeed=function(e,i){void 0===i&&(i=1);for(var d=0;d<e.usersData.length;d++)e.dataStorageList=e.usersData[d].data,e.dataStorage[d]=e.usersData[d].data;var r=e.feed_row.number_of_photos,t=e.feed_row.load_more_number,a=0,o=r,r="";"pagination"==e.feed_row.feed_display_view?(1<e.allResponseLength&&jQuery(".wdi_pagination").removeClass("wdi_hidden"),e.feed_row.number_of_photos=e.allResponseLength,"image_browser"==e.feed_row.feed_type?e.paginator=parseInt(e.feed_row.number_of_photos):e.paginator=Math.ceil(parseInt(e.feed_row.number_of_photos)/parseInt(t)),r=(o=1===i?(a=0,"image_browser"==e.feed_row.feed_type?1:t):"image_browser"==e.feed_row.feed_type?(a=i-1)+1:(a=(i-1)*t)+t,e.dataStorageList.slice(a,o))):void 0!==e.already_loaded_count?(a=parseInt(e.already_loaded_count),o=e.already_loaded_count+parseInt(t),r=e.dataStorageList.slice(a,o),e.already_loaded_count+=r.length):(r=e.dataStorageList.slice(a,o),e.already_loaded_count=r.length),e.parsedData=wdi_front.parseLighboxData(e,!0),"masonry"==e.feed_row.feed_type&&wdi_front.masonryDisplayFeedItems(r,e),"thumbnails"!=e.feed_row.feed_type&&"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||wdi_front.displayFeedItems(r,e),"pagination"==e.feed_row.feed_display_view&&e.currentPage<e.paginator&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter).find("#wdi_last_page").removeClass("wdi_disabled"),wdi_front.updateUsersImages(e)},wdi_front.updateUsersImages=function(i){jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter).find(".wdi_single_user .wdi_user_img_wrap img").each(function(){if((jQuery(this).attr("src")==wdi_url.plugin_url+"images/missing.png"||""==jQuery(this).attr("src"))&&"liked"!=i.feed_row.liked_feed)for(var e=0;e<i.usersData.length;e++)i.usersData[e].username==jQuery(this).parent().parent().find("h3").text()&&0!=i.usersData[e].data.length&&jQuery(this).attr("src",i.usersData[e].data[0].images.thumbnail.url)})},wdi_front.checkLoaded=function(e){var i=e.feed_row.wdi_feed_counter,d=jQuery("#wdi_feed_"+i);e.dataStorageList.length>e.already_loaded_count?d.find(".wdi_load_more").removeClass("wdi_hidden"):d.find(".wdi_load_more").addClass("wdi_hidden"),d.find(".wdi_spinner").addClass("wdi_hidden"),setTimeout(function(){d.find(".wdi_ajax_loading").addClass("wdi_hidden"),d.find(".wdi_page_loading").addClass("wdi_hidden"),d.find(".wdi_front_overlay").addClass("wdi_hidden")},500)},wdi_front.masonryDisplayFeedItems=function(e,i){var d=[],r=[];if(0!=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length){jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_masonry_column").each(function(){1==i.feed_row.resort_after_load_more&&(jQuery(this).html(""),i.imageIndex=0),1==i.customFilterChanged&&(jQuery(this).html(""),i.imageIndex=0),"pagination"==i.feed_row.feed_display_view?d.push(0):d.push(jQuery(this).height()),r.push(jQuery(this))}),1==i.customFilterChanged&&(i.customFilterChanged=!1);for(var t,a,o,n=0;n<e.length;n++)"object"==typeof e[n].videos&&null==e[n].videos.standard_resolution||(i.displayedData.push(e[n]),t="",void 0!==e[n].wdi_hashtag&&(t=e[n].wdi_hashtag),a="image"==e[n].type?wdi_front.getPhotoTemplate(i,t):e[n].hasOwnProperty("videos")||"video"==e[n].type?wdi_front.getVideoTemplate(i,t):wdi_front.getSliderTemplate(i,t),o=e[n],t=a(wdi_front.createObject(o,i)),a=wdi_front.array_min(d),o=wdi_front.getImageResolution(e[n]),r[a.index].html(r[a.index].html()+t),d[a.index]+=r[a.index].width()*o,i.imageIndex++,"pagination"==i.feed_row.feed_display_view&&((n+1)%i.feed_row.pagination_per_page_number==0?i.resIndex+=i.freeSpaces+1:i.resIndex++));i.wdi_loadedImages=0;var s=!1;i.wdi_load_count=n;var _=i.feed_row.wdi_feed_counter;jQuery("#wdi_feed_"+_+" .wdi_img").on("load",function(){i.wdi_loadedImages++,!1===s&&(wdi_responsive.columnControl(i,1),s=!0)});wdi_front.checkLoaded(i),1==i.paginatorNextFlag&&wdi_front.updatePagination(i,"next"),i.infiniteScrollFlag=!1}},wdi_front.getImageResolution=function(e){var i;return e="image"===e.type?(i=e.images.standard_resolution.height,e.images.standard_resolution.width):"video"===e.type?(i=e.videos.standard_resolution.height,e.videos.standard_resolution.width):(i=(e.carousel_media[0].images||e.carousel_media[0].videos).standard_resolution.height,(e.carousel_media[0].images||e.carousel_media[0].videos).standard_resolution.width),i/e},wdi_front.getDataLength=function(e,i){var d=0;if(void 0===i)for(var r=0;r<e.dataStorage.length;r++)d+=e.dataStorage[r].length;else for(r=0;r<i.length;r++)d+=i[r].length;return d},wdi_front.getArrayContentLength=function(e,i){for(var d=0,r=0;r<e.length;r++)"finished"!=e[r].finished&&void 0===e[r].error&&(d+=e[r][i].length);return d},wdi_front.displayFeedItems=function(e,i){if(0!=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length){for(var d,r,t,a=i.feed_row.wdi_feed_counter,o=jQuery("#wdi_feed_"+a+" .wdi_feed_wrapper"),n=0;n<e.length;n++){if(void 0===e[n])return;"object"==typeof e[n].videos&&null==e[n].videos.standard_resolution||(t="",void 0!==e[n].wdi_hashtag&&(t=e[n].wdi_hashtag),d="image"==e[n].type?wdi_front.getPhotoTemplate(i,t):e[n].hasOwnProperty("videos")?wdi_front.getVideoTemplate(i,t):wdi_front.getSliderTemplate(i,t),r=e[n],t="",void 0!==(r=wdi_front.createObject(r,i))&&(t=d(r)),o.html(o.html()+t),i.imageIndex++,"pagination"==i.feed_row.feed_display_view&&((n+1)%i.feed_row.pagination_per_page_number==0?i.resIndex+=i.freeSpaces+1:i.resIndex++))}wdi_front.checkLoaded(i)}},wdi_front.checkFeedFinished=function(e){for(var i=0;i<e.usersData.length;i++)if(void 0===e.usersData[i].finished)return!1;return!0},wdi_front.createObject=function(e,i){var d=null!=e.caption?e.caption.text:"&nbsp";switch(e.type){case"image":var r=e.images[i.feedImageResolution].url,t=void 0,a=e.hasOwnProperty("thumbnail")?e.thumbnail:wdi_url.plugin_url+"images/missing.png";break;case"video":r=void 0,t=e.hasOwnProperty("videos")?e.videos[i.feedVideoResolution].url:wdi_url.plugin_url+"images/video_missing.png",a=e.hasOwnProperty("thumbnail")?e.thumbnail:wdi_url.plugin_url+"images/video_missing.png";break;case"carousel":if(0===e.carousel_media.length)r=wdi_url.plugin_url+"images/missing.png",t=void 0,a=wdi_url.plugin_url+"images/missing.png";else switch(e.carousel_media[0].type){case"image":r=e.carousel_media[0].images[i.feedImageResolution].url,t=void 0,a=e.hasOwnProperty("thumbnail")?e.thumbnail:wdi_url.plugin_url+"images/missing.png";break;case"video":r=void 0,t=e.carousel_media[0].videos[i.feedVideoResolution].url,a=e.hasOwnProperty("thumbnail")?e.thumbnail:wdi_url.plugin_url+"images/video_missing.png";break;default:r=wdi_url.plugin_url+"images/missing.png",t=void 0,a=wdi_url.plugin_url+"images/missing.png"}break;default:r=wdi_url.plugin_url+"images/missing.png",t=void 0,a=wdi_url.plugin_url+"images/missing.png"}var o,n=i.imageIndex,s="square";(_="image"===e.type?(o=e.images.standard_resolution.height,e.images.standard_resolution.width):"video"===e.type?(o=e.videos.standard_resolution.height,e.videos.standard_resolution.width):(o=(e.carousel_media[0].images||e.carousel_media[0].videos).standard_resolution.height,(e.carousel_media[0].images||e.carousel_media[0].videos).standard_resolution.width))<o?s="portrait":o<_&&(s="landscape");var _=e.user.username;return""===_&&(_="no_user"),{id:e.id,thumb_url:a,caption:wdi_front.escape_tags(d),image_url:r,likes:void 0!==e.likes.count?e.likes.count:e.likes,comments:void 0!==e.comments.count?e.comments.count:e.comments,wdi_index:n,wdi_res_index:i.resIndex,wdi_media_user:_,link:e.link,video_url:t,wdi_username:_,wdi_shape:s}},wdi_front.getPhotoTemplate=function(e,i){var d="",r="",t="",a="tenweb-i-arrows-out",o="";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(a=""),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(o='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(d+=" wdi_full_caption");var n="";switch("blog_style"!==e.feed_row.feed_type&&(n="masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":r="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":r="onclick=\"window.open ('<%= link%>','_blank')\"",t="wdi_hover_off",a="";break;case"custom_redirect":r="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",t="wdi_hover_off",a="";break;case"none":t="wdi_cursor_off wdi_hover_off",a=r=""}var s='<div class="wdi_feed_item '+d+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> wdi_type="image" id="wdi_'+e.feed_row.wdi_feed_counter+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img <%= wdi_shape == \'square\' ? \'wdi_shape_square\' : (wdi_shape == \'portrait\' ? \'wdi_shape_portrait\' : (wdi_shape == \'landscape\' ? \'wdi_shape_landscape\' : \'wdi_shape_square\') ) %>"><img class="wdi_img" src="<%=thumb_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+t+'" >'+o+'<div class="wdi_thumb_icon" '+r+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+a+'"></i></div></div></div></div></div></div>',w=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(s+='<div class="wdi_photo_meta">',void(o=d=0)!==e.dataStorageList[w]&&(void 0!==e.dataStorageList[w].likes&&(d=void 0!==e.dataStorageList[w].likes.count?e.dataStorageList[w].likes.count:e.dataStorageList[w].likes),void 0!==e.dataStorageList[w].comments&&(o=void 0!==e.dataStorageList[w].comments.count?e.dataStorageList[w].comments.count:e.dataStorageList[w].comments)),"1"===e.feed_row.show_likes&&0!==d&&(s+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"1"===e.feed_row.show_comments&&0!==o&&(s+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),s+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(s+='<div class="wdi_photo_title" onclick='+n+" ><%=caption%></div>"),s+="</div>"),s+="</div>",_.template(s)},wdi_front.getSliderTemplate=function(e,i){var d="",r="",t="",a="tenweb-i-clone",o="";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(a=""),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(o='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(d+=" wdi_full_caption");var n="";switch("blog_style"!==e.feed_row.feed_type&&(n="masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":r="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":r="onclick=\"window.open ('<%= link%>','_blank')\"",t="wdi_hover_off",a="tenweb-i-clone";break;case"custom_redirect":r="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",t="wdi_hover_off",a="";break;case"none":t="wdi_cursor_off wdi_hover_off",a=r=""}var s='<div class="wdi_feed_item '+d+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> wdi_type="slideshow" id="wdi_'+e.feed_row.wdi_feed_counter+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img <%= wdi_shape == \'square\' ? \'wdi_shape_square\' : (wdi_shape == \'portrait\' ? \'wdi_shape_portrait\' : (wdi_shape == \'landscape\' ? \'wdi_shape_landscape\' : \'wdi_shape_square\') ) %>"><img class="wdi_img" src="<%=thumb_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+t+'" >'+o+'<div class="wdi_thumb_icon" '+r+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+a+'"></i></div></div></div></div></div></div>',w=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(s+='<div class="wdi_photo_meta">',void(o=d=0)!==e.dataStorageList[w]&&(void 0!==e.dataStorageList[w].likes&&(d=void 0!==e.dataStorageList[w].likes.count?e.dataStorageList[w].likes.count:e.dataStorageList[w].likes),void 0!==e.dataStorageList[w].comments&&(o=void 0!==e.dataStorageList[w].comments.count?e.dataStorageList[w].comments.count:e.dataStorageList[w].comments)),"1"===e.feed_row.show_likes&&0!==d&&(s+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"1"===e.feed_row.show_comments&&0!==o&&(s+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),s+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(s+='<div class="wdi_photo_title" onclick='+n+" ><%=caption%></div>"),s+="</div>"),s+="</div>",_.template(s)},wdi_front.getVideoTemplate=function(e,i){var d="",r="tenweb-i-play",t="",a="",o="";"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(o='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(d+=" wdi_full_caption");var n="";switch("blog_style"!==e.feed_row.feed_type&&(n="masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":t="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":t="onclick=\"window.open ('<%= link%>','_blank')\"",a="wdi_hover_off",r="tenweb-i-play";break;case"custom_redirect":t="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",a="wdi_hover_off",r="";break;case"none":a="wdi_cursor_off wdi_hover_off",r="","blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(t="onclick=wdi_front.replaceToVideo('<%= video_url%>','<%= wdi_index%>',"+e.feed_row.wdi_feed_counter+")",a="",r="tenweb-i-play")}var s='<div class="wdi_feed_item '+d+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> wdi_type="image" id="wdi_'+e.feed_row.wdi_feed_counter+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img <%= wdi_shape == \'square\' ? \'wdi_shape_square\' : (wdi_shape == \'portrait\' ? \'wdi_shape_portrait\' : (wdi_shape == \'landscape\' ? \'wdi_shape_landscape\' : \'wdi_shape_square\') ) %>"><img class="wdi_img" src="<%=thumb_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+a+'" '+t+">"+o+'<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="tenweb-i '+r+'"></i></div></div></div></div></div></div>',w=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(s+='<div class="wdi_photo_meta">',void(o=d=0)!==e.dataStorageList[w]&&(void 0!==e.dataStorageList[w].likes&&(d=void 0!==e.dataStorageList[w].likes.count?e.dataStorageList[w].likes.count:e.dataStorageList[w].likes),void 0!==e.dataStorageList[w].comments&&(o=void 0!==e.dataStorageList[w].comments.count?e.dataStorageList[w].comments.count:e.dataStorageList[w].comments)),"1"===e.feed_row.show_likes&&0!==d&&(s+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"1"===e.feed_row.show_comments&&0!==o&&(s+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),s+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(s+='<div class="wdi_photo_title" onclick='+n+" ><%=caption%></div>"),s+="</div>"),s+="</div>",_.template(s)},wdi_front.replaceToVideo=function(e,i,d){overlayHtml="<video style='width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;' controls=''><source src='"+e+"' type='video/mp4'>Your browser does not support the video tag. </video>",jQuery("#wdi_feed_"+d+' [wdi_index="'+i+'"] .wdi_photo_wrap_inner').html(overlayHtml),jQuery("#wdi_feed_"+d+' [wdi_index="'+i+'"] .wdi_photo_wrap_inner video').get(0).play()},wdi_front.bindEvents=function(i){0!=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length&&("load_more_btn"==i.feed_row.feed_display_view&&jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_load_more_container").on(wdi_front.clickOrTouch,function(){jQuery(document).find("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_load_more").addClass("wdi_hidden"),jQuery(document).find("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_spinner").removeClass("wdi_hidden"),setTimeout(function(){wdi_front.loadMore(jQuery(this).find(".wdi_load_more_wrap"),i)},1e3)}),"pagination"==i.feed_row.feed_display_view&&(jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" #wdi_next").on(wdi_front.clickOrTouch,function(){var e=parseInt(jQuery(this).parents(".wdi_pagination_container").find("#wdi_current_page").text())+1;parseInt(e)>i.paginator||(i.currentPage=parseInt(e),wdi_front.changePage(jQuery(this),i))}),jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" #wdi_prev").on(wdi_front.clickOrTouch,function(){var e=parseInt(jQuery(this).parents(".wdi_pagination_container").find("#wdi_current_page").text())-1;parseInt(e)<=0||(i.currentPage=parseInt(e),wdi_front.changePage(jQuery(this),i))}),jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" #wdi_last_page").on(wdi_front.clickOrTouch,function(){i.currentPage=i.paginator,wdi_front.changePage(jQuery(this),i)}),jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" #wdi_first_page").on(wdi_front.clickOrTouch,function(){i.currentPage=1,wdi_front.changePage(jQuery(this),i)}),i.paginatorNextFlag=!1),"infinite_scroll"==i.feed_row.feed_display_view&&(jQuery(window).on("scroll",function(){wdi_front.infiniteScroll(i)}),i.infiniteScrollFlag=!1))},wdi_front.infiniteScroll=function(e){jQuery(window).scrollTop()+jQuery(window).height()-100>=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_infinite_scroll").offset().top&&(e.dataStorageList.length>e.already_loaded_count||void 0===e.already_loaded_count?(e.infiniteScrollFlag=!0,wdi_front.loadMore(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_infinite_scroll"),e)):wdi_front.allImagesLoaded(e))},wdi_front.changePage=function(e,i){new_page_number=i.currentPage,1<new_page_number?e.parents(".wdi_pagination").find("#wdi_first_page").removeClass("wdi_disabled"):1===new_page_number&&e.parents(".wdi_pagination").find("#wdi_first_page").addClass("wdi_disabled"),new_page_number==parseInt(i.paginator)?e.parents(".wdi_pagination").find("#wdi_last_page").addClass("wdi_disabled"):new_page_number<parseInt(i.paginator)&&e.parents(".wdi_pagination").find("#wdi_last_page").removeClass("wdi_disabled"),("masonry"==i.feed_row.feed_type?e.parent().parent().parent().find(".wdi_feed_wrapper .wdi_masonry_column"):e.parent().parent().parent().find(".wdi_feed_wrapper")).empty(),e.parent().find("#wdi_current_page").empty().text(new_page_number);e=e.closest(".wdi_feed_container");e.parents(".wdi_feed_main_container").find(".wdi_front_overlay").removeClass("wdi_hidden"),e.parents(".wdi_feed_main_container").find(".wdi_page_loading").removeClass("wdi_hidden"),wdi_front.displayFeed(i,new_page_number)},wdi_front.updatePagination=function(e,i,d){var r="#wdi_feed_"+e.feed_row.wdi_feed_counter;switch(jQuery(r+' [wdi_page="'+e.currentPage+'"]').each(function(){jQuery(this).removeClass("wdi_hidden")}),i){case"next":var d=e.currentPage-1;jQuery(r+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(r+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"prev":d=e.currentPage+1;jQuery(r+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(r+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"custom":(d=d)!=e.currentPage&&(jQuery(r+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(r+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")}))}e.paginatorNextFlag=!1,jQuery(r+" .wdi_feed_wrapper").css("height","auto"),jQuery(r+" #wdi_current_page").text(e.currentPage)},wdi_front.loadMore=function(e,i){var d;if(""!=e&&void 0!==e&&"initial"!=e&&"initial-keep"!=e&&(d=window[e.parent().parent().parent().parent().attr("id")]),void 0!==i&&(d=i),wdi_front.ajaxLoader(d),this.isJsonString(d.feed_row.feed_users))for(var r in json_feed_users=JSON.parse(d.feed_row.feed_users),json_feed_users)iuser=json_feed_users[r],"#"!==json_feed_users[r].username.charAt(0)&&(iuser=json_feed_users[r]);"masonry"===d.feed_row.feed_type&&"pagination"==d.feed_row.feed_display_view&&jQuery("#wdi_feed_"+wdi_front.feed_counter+" .wdi_full_caption").each(function(){jQuery(this).find(".wdi_photo_title").trigger(wdi_front.clickOrTouch)}),d.loadMoreDataCount=d.feed_users.length,wdi_front.displayFeed(d)},wdi_front.loadMoreRequest=function(e,i,d,r){d.mediaRequestsDone&&""!=i&&d.usersData},wdi_front.checkForLoadMoreDone=function(e,i){var d,r=e.feed_row.load_more_number,t=e.feed_row.number_of_photos;0==e.loadMoreDataCount&&(e.temproraryUsersData=wdi_front.mergeData(e.temproraryUsersData,e.usersData),d=wdi_front.getArrayContentLength(e.temproraryUsersData,"data"),"initial-keep"==i&&(i="initial"),"initial"==i?d<t&&!wdi_front.userHasNoPhoto(e,e.temproraryUsersData)&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount?wdi_front.loadMore("initial",e):(e.usersData=e.temproraryUsersData,wdi_front.displayFeed(e),wdi_front.applyFilters(e),e.temproraryUsersData=[]):d<r&&!wdi_front.userHasNoPhoto(e,e.temproraryUsersData)&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount?wdi_front.loadMore(void 0,e):(e.usersData=e.temproraryUsersData,wdi_front.activeUsersCount(e)&&(wdi_front.displayFeed(e,r),wdi_front.applyFilters(e),e.temproraryUsersData=[])))},wdi_front.allDataHasFinished=function(e){for(var i=0,d=0;d<e.dataStorageRaw.length;d++)""==e.usersData[d].pagination.next_url&&(i++,e.usersData[d].finished="finished");return i==e.dataStorageRaw.length&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_load_more").remove(),!0)},wdi_front.mergeData=function(e,i){for(var d=0;d<i.length;d++)void 0!==e[d]?"finished"!=i[d].finished&&(void 0===e[d].pagination.next_max_id&&void 0===e[d].pagination.next_max_like_id||(e[d].data=e[d].data.concat(i[d].data),e[d].pagination=i[d].pagination,e[d].user_id=i[d].user_id,e[d].username=i[d].username,e[d].meta=i[d].meta)):e.push(i[d]);return e},wdi_front.brokenImageHandler=function(e){return!0},wdi_front.ajaxLoader=function(e){var i,d=e.feed_row.wdi_feed_counter,d=jQuery(document).find("#wdi_feed_"+d);return"load_more_btn"==e.feed_row.feed_display_view&&(d.find(".wdi_load_more").addClass("wdi_hidden"),d.find(".wdi_spinner").removeClass("wdi_hidden")),"infinite_scroll"==e.feed_row.feed_display_view&&(0==d.find(".wdi_ajax_loading").length?(i=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>'),d.find(".wdi_feed_container").append(i)):i=d.find(".wdi_ajax_loading"),i.removeClass("wdi_hidden")),1},wdi_front.allImagesLoaded=function(e){wdi_front.getDataLength(e);e.mediaRequestsDone||jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").remove("wdi_nomedia"),0==e.allResponseLength&&1===e.dataLoaded&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").append("<p class='wdi_nomedia'>"+wdi_front_messages.feed_nomedia+"</p>");var i=e.feed_row.wdi_feed_counter,i=jQuery("#wdi_feed_"+i);"load_more_btn"==e.feed_row.feed_display_view&&(parseInt(e.allResponseLength)>parseInt(e.feed_row.number_of_photos)&&i.find(".wdi_load_more").removeClass("wdi_hidden"),i.find(".wdi_spinner").addClass("wdi_hidden")),"infinite_scroll"==e.feed_row.feed_display_view&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_ajax_loading").addClass("wdi_hidden")},wdi_front.show=function(e,i){var d,r,t=i.feed_row.wdi_feed_counter,a=jQuery("#wdi_feed_"+t+" .wdi_feed_container");"header"===e&&(d={feed_thumb:i.feed_row.feed_thumb,feed_name:i.feed_row.feed_name},r=wdi_front.getHeaderTemplate()(d),d=a.find(".wdi_feed_header").html(),a.find(".wdi_feed_header").html(d+r))},wdi_front.getUserTemplate=function(e,i){var d=e.dataCount,r="#"===i[0]?"//instagram.com/explore/tags/"+i.substr(1,i.length):"//instagram.com/"+i,t="onclick='"+('window.open("'+r+'","_blank")')+"'",r='<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%>">';return 1<d&&(r+='<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="tenweb-i tenweb-i-filter"></span></div></div>'),r+="</div>",r+="<h3 "+t+"><%= user_name%></h3>","#"!==i[0]?("1"==e.feed_row.follow_on_instagram_btn&&(r+='<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>"),r+='<div class="wdi_media_info"><p class="wdi_posts"><span class="tenweb-i tenweb-i-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span class="tenweb-i tenweb-i-user"></span><%= counts.followed_by%></p></div>'):r+='<div class="wdi_user_controls"></div><div class="wdi_media_info"><p class="wdi_posts"><span class="tenweb-i tenweb-i-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span></span></p></div>',r+='<div class="wdi_clear"></div>',1==d&&"#"!==i[0]&&"1"==e.feed_row.display_user_info&&(r+='<div class="wdi_bio"><%= bio%></div>',r+='<div class="wdi_website"><a target="_blank" href="<%= website_url%>" ><%= website%></a></div>'),r+="</div></div>",_.template(r)},wdi_front.getHeaderTemplate=function(){return _.template('<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>')},wdi_front.addFilter=function(e,i){var d=window["wdi_feed_"+i],i=d.dataCount;if(!(i<2)&&0==d.nowLoadingImages){i=jQuery("#wdi_feed_"+d.feed_row.wdi_feed_counter+'_users [user_index="'+e+'"]');i.find(".wdi_filter_overlay").toggleClass("wdi_filter_active_bg"),i.find(".wdi_header_user_text h3").toggleClass("wdi_filter_active_col"),i.find(".wdi_media_info").toggleClass("wdi_filter_active_col"),i.find(".wdi_follow_btn").toggleClass("wdi_filter_active_col"),d.customFilterChanged=!0,0==d.userSortFlags[e].flag?d.userSortFlags[e].flag=!0:d.userSortFlags[e].flag=!1;for(var r=0,t=0;t<d.userSortFlags.length;t++)1==d.userSortFlags[t].flag&&r++;"pagination"==d.feed_row.feed_display_view&&(d.resIndex=0),0!=r?wdi_front.filterData(d):d.customFilteredData=d.dataStorageList,wdi_front.displayFeed(d),"pagination"==d.feed_row.feed_display_view&&(d.paginator=Math.ceil(d.imageIndex/parseInt(d.feed_row.pagination_per_page_number)),d.currentPage=d.paginator,wdi_front.updatePagination(d,"custom",1),jQuery("#wdi_first_page").removeClass("wdi_disabled"),jQuery("#wdi_last_page").addClass("wdi_disabled"))}},wdi_front.filterData=function(e){var i=e.userSortFlags;e.customFilteredData=[];for(var d=0;d<e.dataStorageList.length;d++)for(var r=0;r<i.length;r++)(void 0!==e.dataStorageList[d].user.id&&e.dataStorageList[d].user.id==i[r].id||e.dataStorageList[d].wdi_hashtag==i[r].name)&&1==i[r].flag&&e.customFilteredData.push(e.dataStorageList[d])},wdi_front.applyFilters=function(e){for(var i=0;i<e.userSortFlags.length;i++)1==e.userSortFlags[i].flag&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+'[user_index="'+i+'"]'),wdi_front.addFilter(i,e.feed_row.wdi_feed_counter),wdi_front.addFilter(i,e.feed_row.wdi_feed_counter))},wdi_front.getImgCount=function(e){for(var i=e.dataStorage,d=0,r=0;r<i.length;r++)d+=i[r].length;return d},wdi_front.parseLighboxData=function(e,i){for(var d,r,t,a,o=e.dataStorage,n=[],s=[],_=0;_<o.length;_++)for(var w=0;w<o[_].length;w++)n.push(o[_][w]);for(_=0;_<n.length;_++)void 0!==n[_]&&(r=void 0!==n[_]&&void 0!==n[_].media_url?n[_].media_url:wdi_url.plugin_url+"images/video_missing.png",r=n[_].thumbnail,void 0!==n[_]&&void 0===n[_].media_url&&("carousel"!==n[_].type||(void 0!==(a=n[_].carousel_media[0])&&void 0!==a.images||void 0!==a&&void 0!==a.videos)&&(r=a.thumbnail)),a=void(t=0)!==n[_].comments.count?n[_].comments.count:n[_].comments,void 0!==n[_]&&void 0!==a&&(t=a),d={alt:"",avg_rating:"",comment_count:t,date:wdi_front.convertUnixDate(n[_].created_time),description:wdi_front.getDescription(void 0!==n[_].caption&&null!==n[_].caption?wdi_front.escape_tags(n[_].caption.text):""),filename:wdi_front.getFileName(n[_]),filetype:wdi_front.getFileType(n[_]),hit_count:"0",id:n[_].id,image_url:n[_].link,number:0,rate:"",rate_count:"0",username:void 0!==n[_].user?n[_].user.username:"",profile_picture:void 0!==n[_].user?n[_].user.profile_picture:"",thumb_url:r,comments_data:void 0!==n[_].comments?n[_].comments.data:"",images:n[_].images||n[_].videos,carousel_media:void 0!==n[_].carousel_media?n[_].carousel_media:null},s.push(d));return s},wdi_front.convertUnixDate=function(e){var i=new Date(e).getTime()/1e3,e=new Date(0);e.setUTCSeconds(i);i=e.getFullYear()+"-"+(e.getMonth()+1)+"-"+e.getDate();return i+=" "+e.getHours()+":"+e.getMinutes()},wdi_front.getDescription=function(e){return e=e.replace(/\r?\n|\r/g," ")},wdi_front.getFileName=function(e){if(void 0!==e){var i=e.link;if("video"===e.type&&e.hasOwnProperty("videos")&&null!=e.videos.standard_resolution)return e.videos.standard_resolution.url;if(void 0===i)return"";i=i.split("/");return i[i.length-2]}},wdi_front.getFileType=function(e){return"video"==e.type&&e.hasOwnProperty("videos")?"EMBED_OEMBED_INSTAGRAM_VIDEO":"carousel"==e.type&&e.hasOwnProperty("carousel_media")?"EMBED_OEMBED_INSTAGRAM_CAROUSEL":"EMBED_OEMBED_INSTAGRAM_IMAGE"},wdi_front.array_max=function(e){for(var i=e[0],d=0,r=1;r<e.length;r++)i<e[r]&&(i=e[r],d=r);return{value:i,index:d}},wdi_front.array_min=function(e){for(var i=e[0],d=0,r=1;r<e.length;r++)i>e[r]&&(i=e[r],d=r);return{value:i,index:d}},wdi_front.activeUsersCount=function(e){for(var i=0,d=0;d<e.usersData.length;d++)"finished"!=e.usersData[d].finished&&i++;return i},wdi_front.checkMediaResponse=function(e,i){return""==e||void 0===e||null==e||void 0!==e.error?(errorMessage=wdi_front_messages.connection_error,wdi_front.show_alert(errorMessage,e,i),!1):""!=e&&void 0!==e&&null!=e&&void 0!==e.meta&&200!=e.meta.code?(errorMessage=e.meta.error_message,wdi_front.show_alert(errorMessage,e,i),!1):e},wdi_front.stripHashtag=function(e){return"#"!==e[0]?e:e.substr(1,e.length)},wdi_front.getInputType=function(e){switch(e[0]){case"#":return"hashtag";case"%":return"location";default:return"user"}},wdi_front.regexpTestCaption=function(e,i){var d=!1,r=!1,t=i.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&"),i=new RegExp("(?:^|\\s)"+t+"(?:^|\\s)"),a=new RegExp("(?:^|\\s)"+t,"g");for(null!=i.exec(e)&&(d=!0);null!=(match=a.exec(e));)r=!0;return 1==d||1==r},wdi_front.replaceNewLines=function(e){var i,d="vUkCJvN2ps3t",r=[];for(e=e.replace(/\r?\n|\r/g,d),i=new RegExp(d,"g");null!=(match=i.exec(e));)r.push(match.index);for(var t=e.split(d),a=0,o=0;o<t.length;o++)""==t[o]?a++:a=0,0<a&&(t.splice(o,1),a--,o--);return e=t.join(" ")},wdi_front.isEmptyObject=function(e){for(var i in e)if(e.hasOwnProperty(i))return!1;return!0},wdi_front.isEmpty=function(e){return!e||0===e.length};var WDIFeed=function(e){this.data=e.data,this.dataCount=e.dataCount,this.feed_row=e.feed_row,this.usersData=e.usersData,(_this=this).set_images_loading_flag=function(e){window.addEventListener("load",function(){e.nowLoadingImages=!1})},this.set_images_loading_flag(_this)};function wdi_extractHostname(e){return void 0===e||""===e?"":e.replace(/(^\w+:|^)\/\//,"")}WDIFeed.prototype.mediaExists=function(e,i){for(var d=0;d<i.length;d++)if(e.id==i[d].id)return!0;return!1},WDIFeed.prototype.getIdFromUrl=function(e){for(var i=e.split("/"),d=!1,r=0;r<i.length;r++)if("p"==i[r]&&void 0!==i[r+1]){d=i[r+1];break}return d},WDIFeed.prototype.avoidDuplicateMedia=function(e){var i=e.data,d=[];void 0===i&&(i=[]);for(var r=0;r<i.length;r++)this.mediaExists(i[r],this.dataStorageList)||this.mediaExists(i[r],d)||this.mediaExists(i[r],this.conditionalFilterBuffer)||d.push(i[r]);return this.conditionalFilterBuffer=this.conditionalFilterBuffer.concat(d),{data:d,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.storeRawData=function(e,i){var r=this;if("object"==typeof this[i]&&"number"==typeof this[i].length)for(var d=0;d<e.length;d++){var t="";wdi_front.isHashtag(e[d].user_id)?void 0!==e[d].pagination.cursors&&(t=e[d].pagination.cursors.after):"liked"==r.feed_row.liked_feed?void 0===(t=e[d].pagination.next_max_like_id)&&(t=""):(null==e[d].pagination&&(e[d].pagination=[]),void 0===(t=e[d].pagination.next_max_id)&&(t="")),void 0===this[i][d]?this[i].push({data:e[d].data,index:0,locked:!1,hash_id:t,usersDataFinished:!1,userId:e[d].user_id,length:function(){return this.data.length-this.index},getData:function(e){var i=this.data.slice(this.index,this.index+e);if(this.index+=Math.min(e,this.length()),this.index==this.data.length&&1==this.locked&&0==this.usersDataFinished)for(var d=0;d<r.usersData.length;d++)if(r.usersData[d].user_id==this.userId){this.usersDataFinished=!0;break}return i}}):0==this[i][d].locked&&(t!=this[i][d].hash_id?(this[i][d].data=this[i][d].data.concat(e[d].data),this[i][d].hash_id=t):this[i][d].locked=!0)}},wdi_front.updateUsersIfNecessary=function(o){for(var n=o.feed_users,e=!1,i=0;i<n.length;i++)"#"!=n[i].username.substr(0,1)?""!=n[i].id&&"username"!=n[i].id||(e=!0,o.instagram.searchForUsersByName(n[i].username,{success:function(e){if(void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,o),200==e.meta.code&&0<e.data.length){for(var i=!1,d=0;d<e.data.length;d++)if(e.data[d].username==e.args.username){i=!0;break}if(i)for(var r=0;r<n.length;r++)e.data[d].username==n[r].username&&(n[r].id=e.data[d].id)}for(var t=!1,a=0;a<n.length;a++)if(""==n[a].id||"username"==n[a].id){t=!0;break}t||(o.feed_row.feed_users=JSON.stringify(n),wdi_front.init(o))},username:n[i].username})):n[i].id=n[i].username;return e},void 0!==wdi_ajax.ajax_response?jQuery(document).one("ajaxStop",function(){"not_declared"!=wdi_front.type&&(wdi_front.clickOrTouch=wdi_front.detectEvent(),wdi_front.globalInit())}):jQuery(document).ready(function(){"not_declared"!=wdi_front.type&&(wdi_front.clickOrTouch=wdi_front.detectEvent(),wdi_front.globalInit())}),jQuery(document).ready(function(){setTimeout(function(){"1"===wdi_front_messages.show_alerts&&"I"!==jQuery(".wdi_check_fontawesome .tenweb-i-instagram").prop("tagName")&&console.log("Font Awesome is not loaded properly. Please ask for support https://wordpress.org/support/plugin/wd-instagram-feed/")},2e3)});
1
+ "undefined"==typeof wdi_front&&(wdi_front={type:"not_declared"});var wdi_error_show=!(wdi_front.detectEvent=function(){var e="click";return/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())&&(e="touchend"),e}),wdi_error_init=!1;function wdi_baseName(e){var i=e.substr(e.lastIndexOf("/"));return e.replace(i,"")}wdi_front.escape_tags=function(e){return void 0===e&&(e=""),e=e.toString().replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&#34;")},wdi_front.show_alert=function(e,i,d){var r,t;void 0!==(d=jQuery("#wdi_feed_"+d.feed_row.wdi_feed_counter))&&(wdi_error_show=!0,d.find(".wdi_spinner").remove(),r=d.find(".wdi_js_error"),t=d.find(".wdi_token_error"),0!=i&&(void 0!==i.meta&&1==i.meta.error&&"OAuthException"===i.meta.error_type||void 0!==i.error&&"OAuthException"===i.error.type)?(d.find(".wdi_single_user").remove(),t.removeClass("wdi_hidden"),"1"!=wdi_front_messages.wdi_token_error_flag&&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(e){}})):void 0!==i.error&&void 0!==i.error.message&&(r.html(i.error.message),d.find(".wdi_single_user").remove(),r.removeClass("wdi_js_error"),r.addClass("wdi_js_error_no_animate"),jQuery(".wdi_js_error_no_animate").show()),wdi_front_messages.show_alerts||console.log("%c"+e,"color:#cc0000;")),wdi_error_show=!0},wdi_front.globalInit=function(){var e=wdi_front.feed_counter,i=0;void 0!==wdi_ajax.ajax_response&&(i=wdi_feed_counter_init.wdi_feed_counter_init);for(var d,r=i;r<=e;r++)0!==jQuery("#wdi_feed_"+r).length&&((d=new WDIFeed(window["wdi_feed_"+r])).instagram=new WDIInstagram,d.instagram.filterArguments={feed:d},d.instagram.addToken(d.feed_row.access_token),wdi_front.access_token=d.feed_row.access_token,d.dataLoaded=0,d.dataStorageRaw=[],d.dataStorage=[],d.dataStorageList=[],d.allResponseLength=0,d.currentResponseLength=0,d.temproraryUsersData=[],d.removedUsers=0,d.nowLoadingImages=!0,d.imageIndex=0,d.resIndex=0,d.currentPage=1,d.currentPageLoadMore=0,d.userSortFlags=[],d.customFilterChanged=!1,d.maxConditionalFiltersRequestCount=10,d.instagramRequestCounter=0,d.mediaRequestsDone=!1,d.conditionalFilterBuffer=[],d.stopInfiniteScrollFlag=!1,"masonry"==d.feed_row.feed_type&&(d.displayedData=[]),"pagination"==d.feed_row.feed_display_view?(d.feed_row.resort_after_load_more=0,"image_browser"!=d.feed_row.feed_type?(d.feed_row.load_more_number=parseInt(d.feed_row.pagination_per_page_number),d.feed_row.number_of_photos=d.allResponseLength):(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):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),"masonry"==d.feed_row.feed_type&&jQuery(window).trigger("resize"),wdi_front.bindEvents(d),window["wdi_feed_"+r]=d,wdi_front.init(d))},wdi_front.init=function(e){if(jQuery(".wdi_js_error").hide(),e.photoCounter=e.feed_row.number_of_photos,"liked"==e.feed_row.liked_feed)e.feed_users=["self"];else{if(!wdi_front.isJsonString(e.feed_row.feed_users))return void wdi_front.show_alert(wdi_front_messages.invalid_users_format,!1,e);e.feed_users=JSON.parse(e.feed_row.feed_users)}var i=[],d=[],r=[];void 0!==window.wdi_all_tags&&(i=window.wdi_all_tags);for(var t=0;t<e.feed_users.length;t++)"#"===e.feed_users[t].username[0]&&void 0!==e.feed_users[t].tag_id?(i[e.feed_users[t].tag_id]=e.feed_users[t],r[t]=e.feed_users[t]):d[0]=e.feed_users[t];window.wdi_all_tags=i,e.feed_users=void 0===r||wdi_front.isEmpty(r)?d:r;var a=wdi_front.getFeedItemResolution(e);e.feedImageResolution=a.image,e.feedVideoResolution=a.video,e.dataCount=e.feed_users.length;for(var o=0;o<e.dataCount;o++)wdi_front.instagramRequest(o,e);0<e.feed_row.number_of_photos&&wdi_front.ajaxLoader(e),"1"===e.feed_row.display_header&&wdi_front.show("header",e),"1"===e.feed_row.show_usernames&&wdi_front.show("users",e)},wdi_front.getFeedItemResolution=function(e){var i={image:"standard_resolution",video:"standard_resolution"};if("thumbnail"===e.feed_row.feed_resolution)return{image:"thumbnail",video:"low_bandwidth"};if("low"===e.feed_row.feed_resolution)return{image:"low_resolution",video:"low_resolution"};if("standard"===e.feed_row.feed_resolution)return{image:"standard_resolution",video:"standard_resolution"};var d=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter).find(".wdi_feed_wrapper");d.append('<div class="wdi_feed_item" id="wdi_feed_item_example"></div>'),wdi_responsive.columnControl(e,1);e=d.attr("wdi-res").split("wdi_col_");if(d.find("#wdi_feed_item_example").remove(),2!==e.length)return i;e=parseInt(e[1]);if(e<=0)return i;e=d.width()/e-10;return e<=150?(i.image="thumbnail",i.video="low_bandwidth"):150<e&&e<=320?(i.image="low_resolution",i.video="low_resolution"):(i.image="standard_resolution",i.video="standard_resolution"),i},wdi_front.isJsonString=function(e){try{JSON.parse(e)}catch(e){return!1}return!0},wdi_front.instagramRequest=function(i,d){var r=this,e=d.feed_users;if("string"==typeof e[i]&&"self"===e[i])d.instagram.getRecentLikedMedia({success:function(e){void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,d),d.mediaRequestsDone=!0,0!=(e=r.checkMediaResponse(e,d))&&r.saveSelfUserData(e,d)}});else if("hashtag"==this.getInputType(e[i].username)){if(this.isJsonString(d.feed_row.feed_users))for(var t in json_feed_users=JSON.parse(d.feed_row.feed_users),json_feed_users)"#"!==json_feed_users[t].username.charAt(0)&&(user=json_feed_users[t]);d.instagram.getTagRecentMedia(this.stripHashtag(e[i].username),{feed_id:d.feed_row.id,user_id:user.id,user_name:user.username,success:function(e){if(void 0!==e.error&&"undefined"!=e.error.type||void 0!==e.meta&&1==e.meta.error)return d.dataLoaded=1,wdi_front.show_alert(!1,e,d),!1;d.mediaRequestsDone=!0,e=r.checkMediaResponse(e,d),d.dataLoaded=1,0!=e&&r.saveUserData(e,d.feed_users[i],d)}},null,d.feed_row.hashtag_top_recent,0)}else"user"==this.getInputType(e[i].username)&&d.instagram.getUserMedia({feed_id:d.feed_row.id,user_id:e[i].id,user_name:e[i].username,success:function(e){if(void 0!==e.meta&&1==typeof e.meta.error)return d.dataLoaded=1,wdi_front.show_alert(!1,e,d),!1;d.mediaRequestsDone=!0,d.dataLoaded=1,0!=(e=r.checkMediaResponse(e,d))?r.saveUserData(e,d.feed_users[i],d):wdi_front.allImagesLoaded(d)}},"",0)},wdi_front.isHashtag=function(e){return"#"===e[0]},wdi_front.saveUserData=function(e,i,d){e.user_id=i.id,e.username=i.username,"#"===e.user_id[0]&&(e.data=wdi_front.appendRequestHashtag(e.data,e.user_id)),d.usersData.push(e),d.currentResponseLength=wdi_front.getArrayContentLength(d.usersData,"data"),d.allResponseLength+=d.currentResponseLength,d.dataCount==d.usersData.length&&(d.currentResponseLength<d.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(d)?wdi_front.loadMore("initial-keep",d):(wdi_front.displayFeed(d),wdi_front.applyFilters(d),wdi_front.activeUsersCount(d)||"load_more_btn"==d.feed_row.feed_display_view&&((d=jQuery("#wdi_feed_"+d.feed_row.wdi_feed_counter)).find(".wdi_load_more").addClass("wdi_hidden"),d.find(".wdi_spinner").addClass("wdi_hidden"))))},wdi_front.saveSelfUserData=function(e,i){e.user_id="",e.username="",i.usersData.push(e),i.currentResponseLength=wdi_front.getArrayContentLength(i.usersData,"data"),i.allResponseLength+=i.currentResponseLength,i.dataCount==i.usersData.length&&(i.currentResponseLength<i.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(i)?wdi_front.loadMore("initial-keep",i):(wdi_front.displayFeed(i),wdi_front.applyFilters(i),wdi_front.activeUsersCount(i)||"load_more_btn"==i.feed_row.feed_display_view&&((i=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter)).find(".wdi_load_more").addClass("wdi_hidden"),i.find(".wdi_spinner").addClass("wdi_hidden"))))},wdi_front.userHasNoPhoto=function(e,i){var d=0,r=e.usersData;void 0!==i&&(r=i);for(var t=0;t<r.length;t++)void 0===r[t].pagination&&(r[t].pagination=[]),"liked"===e.feed_row.liked_feed?void 0===r[t].pagination.next_max_like_id&&d++:void 0===r[t].pagination.next_max_id&&d++;return d==r.length?1:0},wdi_front.appendRequestHashtag=function(e,i){for(var d=0;d<e.length;d++)e[d].wdi_hashtag=i;return e},wdi_front.displayFeed=function(e,i){void 0===i&&(i=1);for(var d=0;d<e.usersData.length;d++)e.dataStorageList=e.usersData[d].data,e.dataStorage[d]=e.usersData[d].data;var r=e.feed_row.number_of_photos,t=e.feed_row.load_more_number,a=0,o=r,r="";"pagination"==e.feed_row.feed_display_view?(1<e.allResponseLength&&jQuery(".wdi_pagination").removeClass("wdi_hidden"),e.feed_row.number_of_photos=e.allResponseLength,"image_browser"==e.feed_row.feed_type?e.paginator=parseInt(e.feed_row.number_of_photos):e.paginator=Math.ceil(parseInt(e.feed_row.number_of_photos)/parseInt(t)),r=(o=1===i?(a=0,"image_browser"==e.feed_row.feed_type?1:t):"image_browser"==e.feed_row.feed_type?(a=i-1)+1:(a=(i-1)*t)+t,e.dataStorageList.slice(a,o))):void 0!==e.already_loaded_count?(a=parseInt(e.already_loaded_count),o=e.already_loaded_count+parseInt(t),r=e.dataStorageList.slice(a,o),e.already_loaded_count+=r.length):(r=e.dataStorageList.slice(a,o),e.already_loaded_count=r.length),e.parsedData=wdi_front.parseLighboxData(e,!0),"masonry"==e.feed_row.feed_type&&wdi_front.masonryDisplayFeedItems(r,e),"thumbnails"!=e.feed_row.feed_type&&"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||wdi_front.displayFeedItems(r,e),"pagination"==e.feed_row.feed_display_view&&e.currentPage<e.paginator&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter).find("#wdi_last_page").removeClass("wdi_disabled"),wdi_front.updateUsersImages(e)},wdi_front.updateUsersImages=function(i){jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter).find(".wdi_single_user .wdi_user_img_wrap img").each(function(){if((jQuery(this).attr("src")==wdi_url.plugin_url+"images/missing.png"||""==jQuery(this).attr("src"))&&"liked"!=i.feed_row.liked_feed)for(var e=0;e<i.usersData.length;e++)i.usersData[e].username==jQuery(this).parent().parent().find("h3").text()&&0!=i.usersData[e].data.length&&jQuery(this).attr("src",i.usersData[e].data[0].images.thumbnail.url)})},wdi_front.checkLoaded=function(e){var i=e.feed_row.wdi_feed_counter,d=jQuery("#wdi_feed_"+i);e.dataStorageList.length>e.already_loaded_count?d.find(".wdi_load_more").removeClass("wdi_hidden"):d.find(".wdi_load_more").addClass("wdi_hidden"),d.find(".wdi_spinner").addClass("wdi_hidden"),setTimeout(function(){d.find(".wdi_ajax_loading").addClass("wdi_hidden"),d.find(".wdi_page_loading").addClass("wdi_hidden"),d.find(".wdi_front_overlay").addClass("wdi_hidden")},500)},wdi_front.masonryDisplayFeedItems=function(e,i){var d=[],r=[];if(0!=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length){jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_masonry_column").each(function(){1==i.feed_row.resort_after_load_more&&(jQuery(this).html(""),i.imageIndex=0),1==i.customFilterChanged&&(jQuery(this).html(""),i.imageIndex=0),"pagination"==i.feed_row.feed_display_view?d.push(0):d.push(jQuery(this).height()),r.push(jQuery(this))}),1==i.customFilterChanged&&(i.customFilterChanged=!1);for(var t,a,o,n=0;n<e.length;n++)"object"==typeof e[n].videos&&null==e[n].videos.standard_resolution||(i.displayedData.push(e[n]),t="",void 0!==e[n].wdi_hashtag&&(t=e[n].wdi_hashtag),a="image"==e[n].type?wdi_front.getPhotoTemplate(i,t):e[n].hasOwnProperty("videos")||"video"==e[n].type?wdi_front.getVideoTemplate(i,t):wdi_front.getSliderTemplate(i,t),o=e[n],t=a(wdi_front.createObject(o,i)),a=wdi_front.array_min(d),o=wdi_front.getImageResolution(e[n]),r[a.index].html(r[a.index].html()+t),d[a.index]+=r[a.index].width()*o,i.imageIndex++,"pagination"==i.feed_row.feed_display_view&&((n+1)%i.feed_row.pagination_per_page_number==0?i.resIndex+=i.freeSpaces+1:i.resIndex++));i.wdi_loadedImages=0;var s=!1;i.wdi_load_count=n;var _=i.feed_row.wdi_feed_counter;jQuery("#wdi_feed_"+_+" .wdi_img").on("load",function(){i.wdi_loadedImages++,!1===s&&(wdi_responsive.columnControl(i,1),s=!0)});wdi_front.checkLoaded(i),1==i.paginatorNextFlag&&wdi_front.updatePagination(i,"next"),i.infiniteScrollFlag=!1}},wdi_front.getImageResolution=function(e){var i;return e="image"===e.type?(i=e.images.standard_resolution.height,e.images.standard_resolution.width):"video"===e.type?(i=e.videos.standard_resolution.height,e.videos.standard_resolution.width):(i=(e.carousel_media[0].images||e.carousel_media[0].videos).standard_resolution.height,(e.carousel_media[0].images||e.carousel_media[0].videos).standard_resolution.width),i/e},wdi_front.getDataLength=function(e,i){var d=0;if(void 0===i)for(var r=0;r<e.dataStorage.length;r++)d+=e.dataStorage[r].length;else for(r=0;r<i.length;r++)d+=i[r].length;return d},wdi_front.getArrayContentLength=function(e,i){for(var d=0,r=0;r<e.length;r++)"finished"!=e[r].finished&&void 0===e[r].error&&(d+=e[r][i].length);return d},wdi_front.displayFeedItems=function(e,i){if(0!=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length){for(var d,r,t,a=i.feed_row.wdi_feed_counter,o=jQuery("#wdi_feed_"+a+" .wdi_feed_wrapper"),n=0;n<e.length;n++){if(void 0===e[n])return;"object"==typeof e[n].videos&&null==e[n].videos.standard_resolution||(t="",void 0!==e[n].wdi_hashtag&&(t=e[n].wdi_hashtag),d="image"==e[n].type?wdi_front.getPhotoTemplate(i,t):e[n].hasOwnProperty("videos")?wdi_front.getVideoTemplate(i,t):wdi_front.getSliderTemplate(i,t),r=e[n],t="",void 0!==(r=wdi_front.createObject(r,i))&&(t=d(r)),o.html(o.html()+t),i.imageIndex++,"pagination"==i.feed_row.feed_display_view&&((n+1)%i.feed_row.pagination_per_page_number==0?i.resIndex+=i.freeSpaces+1:i.resIndex++))}wdi_front.checkLoaded(i)}},wdi_front.checkFeedFinished=function(e){for(var i=0;i<e.usersData.length;i++)if(void 0===e.usersData[i].finished)return!1;return!0},wdi_front.createObject=function(e,i){var d=null!=e.caption?e.caption.text:"&nbsp";switch(e.type){case"image":var r=e.images[i.feedImageResolution].url,t=void 0,a=e.hasOwnProperty("thumbnail")?e.thumbnail:wdi_url.plugin_url+"images/missing.png";break;case"video":r=void 0,t=e.hasOwnProperty("videos")?e.videos[i.feedVideoResolution].url:wdi_url.plugin_url+"images/video_missing.png",a=e.hasOwnProperty("thumbnail")?e.thumbnail:wdi_url.plugin_url+"images/video_missing.png";break;case"carousel":if(0===e.carousel_media.length)r=wdi_url.plugin_url+"images/missing.png",t=void 0,a=wdi_url.plugin_url+"images/missing.png";else switch(e.carousel_media[0].type){case"image":r=e.carousel_media[0].images[i.feedImageResolution].url,t=void 0,a=e.hasOwnProperty("thumbnail")?e.thumbnail:wdi_url.plugin_url+"images/missing.png";break;case"video":r=void 0,t=e.carousel_media[0].videos[i.feedVideoResolution].url,a=e.hasOwnProperty("thumbnail")?e.thumbnail:wdi_url.plugin_url+"images/video_missing.png";break;default:r=wdi_url.plugin_url+"images/missing.png",t=void 0,a=wdi_url.plugin_url+"images/missing.png"}break;default:r=wdi_url.plugin_url+"images/missing.png",t=void 0,a=wdi_url.plugin_url+"images/missing.png"}var o,n=i.imageIndex,s="square";(_="image"===e.type?(o=e.images.standard_resolution.height,e.images.standard_resolution.width):"video"===e.type?(o=e.videos.standard_resolution.height,e.videos.standard_resolution.width):(_=void 0!==e.carousel_media[0].images?"images":"videos",o=e.carousel_media[0][_].standard_resolution.height,e.carousel_media[0][_].standard_resolution.width))<o?s="portrait":o<_&&(s="landscape");var _=e.user.username;return""===_&&(_="no_user"),{id:e.id,thumb_url:a,caption:wdi_front.escape_tags(d),image_url:r,likes:void 0!==e.likes.count?e.likes.count:e.likes,comments:void 0!==e.comments.count?e.comments.count:e.comments,wdi_index:n,wdi_res_index:i.resIndex,wdi_media_user:_,link:e.link,video_url:t,wdi_username:_,wdi_shape:s}},wdi_front.getPhotoTemplate=function(e,i){var d="",r="",t="",a="tenweb-i-arrows-out",o="";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(a=""),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(o='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(d+=" wdi_full_caption");var n="";switch("blog_style"!==e.feed_row.feed_type&&(n="masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":r="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":r="onclick=\"window.open ('<%= link%>','_blank')\"",t="wdi_hover_off",a="";break;case"custom_redirect":r="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",t="wdi_hover_off",a="";break;case"none":t="wdi_cursor_off wdi_hover_off",a=r=""}var s='<div class="wdi_feed_item '+d+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> wdi_type="image" id="wdi_'+e.feed_row.wdi_feed_counter+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img <%= wdi_shape == \'square\' ? \'wdi_shape_square\' : (wdi_shape == \'portrait\' ? \'wdi_shape_portrait\' : (wdi_shape == \'landscape\' ? \'wdi_shape_landscape\' : \'wdi_shape_square\') ) %>"><img class="wdi_img" src="<%=thumb_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+t+'" >'+o+'<div class="wdi_thumb_icon" '+r+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+a+'"></i></div></div></div></div></div></div>',w=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(s+='<div class="wdi_photo_meta">',void(o=d=0)!==e.dataStorageList[w]&&(void 0!==e.dataStorageList[w].likes&&(d=void 0!==e.dataStorageList[w].likes.count?e.dataStorageList[w].likes.count:e.dataStorageList[w].likes),void 0!==e.dataStorageList[w].comments&&(o=void 0!==e.dataStorageList[w].comments.count?e.dataStorageList[w].comments.count:e.dataStorageList[w].comments)),"1"===e.feed_row.show_likes&&0!==d&&(s+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"1"===e.feed_row.show_comments&&0!==o&&(s+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),s+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(s+='<div class="wdi_photo_title" onclick='+n+" ><%=caption%></div>"),s+="</div>"),s+="</div>",_.template(s)},wdi_front.getSliderTemplate=function(e,i){var d="",r="",t="",a="tenweb-i-clone",o="";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(a=""),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(o='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(d+=" wdi_full_caption");var n="";switch("blog_style"!==e.feed_row.feed_type&&(n="masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":r="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":r="onclick=\"window.open ('<%= link%>','_blank')\"",t="wdi_hover_off",a="tenweb-i-clone";break;case"custom_redirect":r="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",t="wdi_hover_off",a="";break;case"none":t="wdi_cursor_off wdi_hover_off",a=r=""}var s='<div class="wdi_feed_item '+d+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> wdi_type="slideshow" id="wdi_'+e.feed_row.wdi_feed_counter+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img <%= wdi_shape == \'square\' ? \'wdi_shape_square\' : (wdi_shape == \'portrait\' ? \'wdi_shape_portrait\' : (wdi_shape == \'landscape\' ? \'wdi_shape_landscape\' : \'wdi_shape_square\') ) %>"><img class="wdi_img" src="<%=thumb_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+t+'" >'+o+'<div class="wdi_thumb_icon" '+r+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+a+'"></i></div></div></div></div></div></div>',w=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(s+='<div class="wdi_photo_meta">',void(o=d=0)!==e.dataStorageList[w]&&(void 0!==e.dataStorageList[w].likes&&(d=void 0!==e.dataStorageList[w].likes.count?e.dataStorageList[w].likes.count:e.dataStorageList[w].likes),void 0!==e.dataStorageList[w].comments&&(o=void 0!==e.dataStorageList[w].comments.count?e.dataStorageList[w].comments.count:e.dataStorageList[w].comments)),"1"===e.feed_row.show_likes&&0!==d&&(s+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"1"===e.feed_row.show_comments&&0!==o&&(s+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),s+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(s+='<div class="wdi_photo_title" onclick='+n+" ><%=caption%></div>"),s+="</div>"),s+="</div>",_.template(s)},wdi_front.getVideoTemplate=function(e,i){var d="",r="tenweb-i-play",t="",a="",o="";"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(o='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(d+=" wdi_full_caption");var n="";switch("blog_style"!==e.feed_row.feed_type&&(n="masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":t="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":t="onclick=\"window.open ('<%= link%>','_blank')\"",a="wdi_hover_off",r="tenweb-i-play";break;case"custom_redirect":t="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",a="wdi_hover_off",r="";break;case"none":a="wdi_cursor_off wdi_hover_off",r="","blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(t="onclick=wdi_front.replaceToVideo('<%= video_url%>','<%= wdi_index%>',"+e.feed_row.wdi_feed_counter+")",a="",r="tenweb-i-play")}var s='<div class="wdi_feed_item '+d+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> wdi_type="image" id="wdi_'+e.feed_row.wdi_feed_counter+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img <%= wdi_shape == \'square\' ? \'wdi_shape_square\' : (wdi_shape == \'portrait\' ? \'wdi_shape_portrait\' : (wdi_shape == \'landscape\' ? \'wdi_shape_landscape\' : \'wdi_shape_square\') ) %>"><img class="wdi_img" src="<%=thumb_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+a+'" '+t+">"+o+'<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="tenweb-i '+r+'"></i></div></div></div></div></div></div>',w=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(s+='<div class="wdi_photo_meta">',void(o=d=0)!==e.dataStorageList[w]&&(void 0!==e.dataStorageList[w].likes&&(d=void 0!==e.dataStorageList[w].likes.count?e.dataStorageList[w].likes.count:e.dataStorageList[w].likes),void 0!==e.dataStorageList[w].comments&&(o=void 0!==e.dataStorageList[w].comments.count?e.dataStorageList[w].comments.count:e.dataStorageList[w].comments)),"1"===e.feed_row.show_likes&&0!==d&&(s+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"1"===e.feed_row.show_comments&&0!==o&&(s+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),s+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(s+='<div class="wdi_photo_title" onclick='+n+" ><%=caption%></div>"),s+="</div>"),s+="</div>",_.template(s)},wdi_front.replaceToVideo=function(e,i,d){overlayHtml="<video style='width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;' controls=''><source src='"+e+"' type='video/mp4'>Your browser does not support the video tag. </video>",jQuery("#wdi_feed_"+d+' [wdi_index="'+i+'"] .wdi_photo_wrap_inner').html(overlayHtml),jQuery("#wdi_feed_"+d+' [wdi_index="'+i+'"] .wdi_photo_wrap_inner video').get(0).play()},wdi_front.bindEvents=function(i){0!=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length&&("load_more_btn"==i.feed_row.feed_display_view&&jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_load_more_container").on(wdi_front.clickOrTouch,function(){jQuery(document).find("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_load_more").addClass("wdi_hidden"),jQuery(document).find("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_spinner").removeClass("wdi_hidden"),setTimeout(function(){wdi_front.loadMore(jQuery(this).find(".wdi_load_more_wrap"),i)},1e3)}),"pagination"==i.feed_row.feed_display_view&&(jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" #wdi_next").on(wdi_front.clickOrTouch,function(){var e=parseInt(jQuery(this).parents(".wdi_pagination_container").find("#wdi_current_page").text())+1;parseInt(e)>i.paginator||(i.currentPage=parseInt(e),wdi_front.changePage(jQuery(this),i))}),jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" #wdi_prev").on(wdi_front.clickOrTouch,function(){var e=parseInt(jQuery(this).parents(".wdi_pagination_container").find("#wdi_current_page").text())-1;parseInt(e)<=0||(i.currentPage=parseInt(e),wdi_front.changePage(jQuery(this),i))}),jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" #wdi_last_page").on(wdi_front.clickOrTouch,function(){i.currentPage=i.paginator,wdi_front.changePage(jQuery(this),i)}),jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" #wdi_first_page").on(wdi_front.clickOrTouch,function(){i.currentPage=1,wdi_front.changePage(jQuery(this),i)}),i.paginatorNextFlag=!1),"infinite_scroll"==i.feed_row.feed_display_view&&(jQuery(window).on("scroll",function(){wdi_front.infiniteScroll(i)}),i.infiniteScrollFlag=!1))},wdi_front.infiniteScroll=function(e){jQuery(window).scrollTop()+jQuery(window).height()-100>=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_infinite_scroll").offset().top&&(e.dataStorageList.length>e.already_loaded_count||void 0===e.already_loaded_count?(e.infiniteScrollFlag=!0,wdi_front.loadMore(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_infinite_scroll"),e)):wdi_front.allImagesLoaded(e))},wdi_front.changePage=function(e,i){new_page_number=i.currentPage,1<new_page_number?e.parents(".wdi_pagination").find("#wdi_first_page").removeClass("wdi_disabled"):1===new_page_number&&e.parents(".wdi_pagination").find("#wdi_first_page").addClass("wdi_disabled"),new_page_number==parseInt(i.paginator)?e.parents(".wdi_pagination").find("#wdi_last_page").addClass("wdi_disabled"):new_page_number<parseInt(i.paginator)&&e.parents(".wdi_pagination").find("#wdi_last_page").removeClass("wdi_disabled"),("masonry"==i.feed_row.feed_type?e.parent().parent().parent().find(".wdi_feed_wrapper .wdi_masonry_column"):e.parent().parent().parent().find(".wdi_feed_wrapper")).empty(),e.parent().find("#wdi_current_page").empty().text(new_page_number);e=e.closest(".wdi_feed_container");e.parents(".wdi_feed_main_container").find(".wdi_front_overlay").removeClass("wdi_hidden"),e.parents(".wdi_feed_main_container").find(".wdi_page_loading").removeClass("wdi_hidden"),wdi_front.displayFeed(i,new_page_number)},wdi_front.updatePagination=function(e,i,d){var r="#wdi_feed_"+e.feed_row.wdi_feed_counter;switch(jQuery(r+' [wdi_page="'+e.currentPage+'"]').each(function(){jQuery(this).removeClass("wdi_hidden")}),i){case"next":var d=e.currentPage-1;jQuery(r+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(r+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"prev":d=e.currentPage+1;jQuery(r+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(r+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"custom":(d=d)!=e.currentPage&&(jQuery(r+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(r+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")}))}e.paginatorNextFlag=!1,jQuery(r+" .wdi_feed_wrapper").css("height","auto"),jQuery(r+" #wdi_current_page").text(e.currentPage)},wdi_front.loadMore=function(e,i){var d;if(""!=e&&void 0!==e&&"initial"!=e&&"initial-keep"!=e&&(d=window[e.parent().parent().parent().parent().attr("id")]),void 0!==i&&(d=i),wdi_front.ajaxLoader(d),this.isJsonString(d.feed_row.feed_users))for(var r in json_feed_users=JSON.parse(d.feed_row.feed_users),json_feed_users)iuser=json_feed_users[r],"#"!==json_feed_users[r].username.charAt(0)&&(iuser=json_feed_users[r]);"masonry"===d.feed_row.feed_type&&"pagination"==d.feed_row.feed_display_view&&jQuery("#wdi_feed_"+wdi_front.feed_counter+" .wdi_full_caption").each(function(){jQuery(this).find(".wdi_photo_title").trigger(wdi_front.clickOrTouch)}),d.loadMoreDataCount=d.feed_users.length,wdi_front.displayFeed(d)},wdi_front.loadMoreRequest=function(e,i,d,r){d.mediaRequestsDone&&""!=i&&d.usersData},wdi_front.checkForLoadMoreDone=function(e,i){var d,r=e.feed_row.load_more_number,t=e.feed_row.number_of_photos;0==e.loadMoreDataCount&&(e.temproraryUsersData=wdi_front.mergeData(e.temproraryUsersData,e.usersData),d=wdi_front.getArrayContentLength(e.temproraryUsersData,"data"),"initial-keep"==i&&(i="initial"),"initial"==i?d<t&&!wdi_front.userHasNoPhoto(e,e.temproraryUsersData)&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount?wdi_front.loadMore("initial",e):(e.usersData=e.temproraryUsersData,wdi_front.displayFeed(e),wdi_front.applyFilters(e),e.temproraryUsersData=[]):d<r&&!wdi_front.userHasNoPhoto(e,e.temproraryUsersData)&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount?wdi_front.loadMore(void 0,e):(e.usersData=e.temproraryUsersData,wdi_front.activeUsersCount(e)&&(wdi_front.displayFeed(e,r),wdi_front.applyFilters(e),e.temproraryUsersData=[])))},wdi_front.allDataHasFinished=function(e){for(var i=0,d=0;d<e.dataStorageRaw.length;d++)""==e.usersData[d].pagination.next_url&&(i++,e.usersData[d].finished="finished");return i==e.dataStorageRaw.length&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_load_more").remove(),!0)},wdi_front.mergeData=function(e,i){for(var d=0;d<i.length;d++)void 0!==e[d]?"finished"!=i[d].finished&&(void 0===e[d].pagination.next_max_id&&void 0===e[d].pagination.next_max_like_id||(e[d].data=e[d].data.concat(i[d].data),e[d].pagination=i[d].pagination,e[d].user_id=i[d].user_id,e[d].username=i[d].username,e[d].meta=i[d].meta)):e.push(i[d]);return e},wdi_front.brokenImageHandler=function(e){return!0},wdi_front.ajaxLoader=function(e){var i,d=e.feed_row.wdi_feed_counter,d=jQuery(document).find("#wdi_feed_"+d);return"load_more_btn"==e.feed_row.feed_display_view&&(d.find(".wdi_load_more").addClass("wdi_hidden"),d.find(".wdi_spinner").removeClass("wdi_hidden")),"infinite_scroll"==e.feed_row.feed_display_view&&(0==d.find(".wdi_ajax_loading").length?(i=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>'),d.find(".wdi_feed_container").append(i)):i=d.find(".wdi_ajax_loading"),i.removeClass("wdi_hidden")),1},wdi_front.allImagesLoaded=function(e){wdi_front.getDataLength(e);e.mediaRequestsDone||jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").remove("wdi_nomedia"),0==e.allResponseLength&&1===e.dataLoaded&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").append("<p class='wdi_nomedia'>"+wdi_front_messages.feed_nomedia+"</p>");var i=e.feed_row.wdi_feed_counter,i=jQuery("#wdi_feed_"+i);"load_more_btn"==e.feed_row.feed_display_view&&(parseInt(e.allResponseLength)>parseInt(e.feed_row.number_of_photos)&&i.find(".wdi_load_more").removeClass("wdi_hidden"),i.find(".wdi_spinner").addClass("wdi_hidden")),"infinite_scroll"==e.feed_row.feed_display_view&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_ajax_loading").addClass("wdi_hidden")},wdi_front.show=function(e,i){var d,r,t=i.feed_row.wdi_feed_counter,a=jQuery("#wdi_feed_"+t+" .wdi_feed_container");"header"===e&&(d={feed_thumb:i.feed_row.feed_thumb,feed_name:i.feed_row.feed_name},r=wdi_front.getHeaderTemplate()(d),d=a.find(".wdi_feed_header").html(),a.find(".wdi_feed_header").html(d+r))},wdi_front.getUserTemplate=function(e,i){var d=e.dataCount,r="#"===i[0]?"//instagram.com/explore/tags/"+i.substr(1,i.length):"//instagram.com/"+i,t="onclick='"+('window.open("'+r+'","_blank")')+"'",r='<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%>">';return 1<d&&(r+='<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="tenweb-i tenweb-i-filter"></span></div></div>'),r+="</div>",r+="<h3 "+t+"><%= user_name%></h3>","#"!==i[0]?("1"==e.feed_row.follow_on_instagram_btn&&(r+='<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>"),r+='<div class="wdi_media_info"><p class="wdi_posts"><span class="tenweb-i tenweb-i-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span class="tenweb-i tenweb-i-user"></span><%= counts.followed_by%></p></div>'):r+='<div class="wdi_user_controls"></div><div class="wdi_media_info"><p class="wdi_posts"><span class="tenweb-i tenweb-i-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span></span></p></div>',r+='<div class="wdi_clear"></div>',1==d&&"#"!==i[0]&&"1"==e.feed_row.display_user_info&&(r+='<div class="wdi_bio"><%= bio%></div>',r+='<div class="wdi_website"><a target="_blank" href="<%= website_url%>" ><%= website%></a></div>'),r+="</div></div>",_.template(r)},wdi_front.getHeaderTemplate=function(){return _.template('<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>')},wdi_front.addFilter=function(e,i){var d=window["wdi_feed_"+i],i=d.dataCount;if(!(i<2)&&0==d.nowLoadingImages){i=jQuery("#wdi_feed_"+d.feed_row.wdi_feed_counter+'_users [user_index="'+e+'"]');i.find(".wdi_filter_overlay").toggleClass("wdi_filter_active_bg"),i.find(".wdi_header_user_text h3").toggleClass("wdi_filter_active_col"),i.find(".wdi_media_info").toggleClass("wdi_filter_active_col"),i.find(".wdi_follow_btn").toggleClass("wdi_filter_active_col"),d.customFilterChanged=!0,0==d.userSortFlags[e].flag?d.userSortFlags[e].flag=!0:d.userSortFlags[e].flag=!1;for(var r=0,t=0;t<d.userSortFlags.length;t++)1==d.userSortFlags[t].flag&&r++;"pagination"==d.feed_row.feed_display_view&&(d.resIndex=0),0!=r?wdi_front.filterData(d):d.customFilteredData=d.dataStorageList,wdi_front.displayFeed(d),"pagination"==d.feed_row.feed_display_view&&(d.paginator=Math.ceil(d.imageIndex/parseInt(d.feed_row.pagination_per_page_number)),d.currentPage=d.paginator,wdi_front.updatePagination(d,"custom",1),jQuery("#wdi_first_page").removeClass("wdi_disabled"),jQuery("#wdi_last_page").addClass("wdi_disabled"))}},wdi_front.filterData=function(e){var i=e.userSortFlags;e.customFilteredData=[];for(var d=0;d<e.dataStorageList.length;d++)for(var r=0;r<i.length;r++)(void 0!==e.dataStorageList[d].user.id&&e.dataStorageList[d].user.id==i[r].id||e.dataStorageList[d].wdi_hashtag==i[r].name)&&1==i[r].flag&&e.customFilteredData.push(e.dataStorageList[d])},wdi_front.applyFilters=function(e){for(var i=0;i<e.userSortFlags.length;i++)1==e.userSortFlags[i].flag&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+'[user_index="'+i+'"]'),wdi_front.addFilter(i,e.feed_row.wdi_feed_counter),wdi_front.addFilter(i,e.feed_row.wdi_feed_counter))},wdi_front.getImgCount=function(e){for(var i=e.dataStorage,d=0,r=0;r<i.length;r++)d+=i[r].length;return d},wdi_front.parseLighboxData=function(e,i){for(var d,r,t,a,o=e.dataStorage,n=[],s=[],_=0;_<o.length;_++)for(var w=0;w<o[_].length;w++)n.push(o[_][w]);for(_=0;_<n.length;_++)void 0!==n[_]&&(r=void 0!==n[_]&&void 0!==n[_].media_url?n[_].media_url:wdi_url.plugin_url+"images/video_missing.png",r=n[_].thumbnail,void 0!==n[_]&&void 0===n[_].media_url&&("carousel"!==n[_].type||(void 0!==(a=n[_].carousel_media[0])&&void 0!==a.images||void 0!==a&&void 0!==a.videos)&&(r=a.thumbnail)),a=void(t=0)!==n[_].comments.count?n[_].comments.count:n[_].comments,void 0!==n[_]&&void 0!==a&&(t=a),d={alt:"",avg_rating:"",comment_count:t,date:wdi_front.convertUnixDate(n[_].created_time),description:wdi_front.getDescription(void 0!==n[_].caption&&null!==n[_].caption?wdi_front.escape_tags(n[_].caption.text):""),filename:wdi_front.getFileName(n[_]),filetype:wdi_front.getFileType(n[_]),hit_count:"0",id:n[_].id,image_url:n[_].link,number:0,rate:"",rate_count:"0",username:void 0!==n[_].user?n[_].user.username:"",profile_picture:void 0!==n[_].user?n[_].user.profile_picture:"",thumb_url:r,comments_data:void 0!==n[_].comments?n[_].comments.data:"",images:n[_].images||n[_].videos,carousel_media:void 0!==n[_].carousel_media?n[_].carousel_media:null},s.push(d));return s},wdi_front.convertUnixDate=function(e){var i=new Date(e).getTime()/1e3,e=new Date(0);e.setUTCSeconds(i);i=e.getFullYear()+"-"+(e.getMonth()+1)+"-"+e.getDate();return i+=" "+e.getHours()+":"+e.getMinutes()},wdi_front.getDescription=function(e){return e=e.replace(/\r?\n|\r/g," ")},wdi_front.getFileName=function(e){if(void 0!==e){var i=e.link;if("video"===e.type&&e.hasOwnProperty("videos")&&null!=e.videos.standard_resolution)return e.videos.standard_resolution.url;if(void 0===i)return"";i=i.split("/");return i[i.length-2]}},wdi_front.getFileType=function(e){return"video"==e.type&&e.hasOwnProperty("videos")?"EMBED_OEMBED_INSTAGRAM_VIDEO":"carousel"==e.type&&e.hasOwnProperty("carousel_media")?"EMBED_OEMBED_INSTAGRAM_CAROUSEL":"EMBED_OEMBED_INSTAGRAM_IMAGE"},wdi_front.array_max=function(e){for(var i=e[0],d=0,r=1;r<e.length;r++)i<e[r]&&(i=e[r],d=r);return{value:i,index:d}},wdi_front.array_min=function(e){for(var i=e[0],d=0,r=1;r<e.length;r++)i>e[r]&&(i=e[r],d=r);return{value:i,index:d}},wdi_front.activeUsersCount=function(e){for(var i=0,d=0;d<e.usersData.length;d++)"finished"!=e.usersData[d].finished&&i++;return i},wdi_front.checkMediaResponse=function(e,i){return""==e||void 0===e||null==e||void 0!==e.error?(errorMessage=wdi_front_messages.connection_error,wdi_front.show_alert(errorMessage,e,i),!1):""!=e&&void 0!==e&&null!=e&&void 0!==e.meta&&200!=e.meta.code?(errorMessage=e.meta.error_message,wdi_front.show_alert(errorMessage,e,i),!1):e},wdi_front.stripHashtag=function(e){return"#"!==e[0]?e:e.substr(1,e.length)},wdi_front.getInputType=function(e){switch(e[0]){case"#":return"hashtag";case"%":return"location";default:return"user"}},wdi_front.regexpTestCaption=function(e,i){var d=!1,r=!1,t=i.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&"),i=new RegExp("(?:^|\\s)"+t+"(?:^|\\s)"),a=new RegExp("(?:^|\\s)"+t,"g");for(null!=i.exec(e)&&(d=!0);null!=(match=a.exec(e));)r=!0;return 1==d||1==r},wdi_front.replaceNewLines=function(e){var i,d="vUkCJvN2ps3t",r=[];for(e=e.replace(/\r?\n|\r/g,d),i=new RegExp(d,"g");null!=(match=i.exec(e));)r.push(match.index);for(var t=e.split(d),a=0,o=0;o<t.length;o++)""==t[o]?a++:a=0,0<a&&(t.splice(o,1),a--,o--);return e=t.join(" ")},wdi_front.isEmptyObject=function(e){for(var i in e)if(e.hasOwnProperty(i))return!1;return!0},wdi_front.isEmpty=function(e){return!e||0===e.length};var WDIFeed=function(e){this.data=e.data,this.dataCount=e.dataCount,this.feed_row=e.feed_row,this.usersData=e.usersData,(_this=this).set_images_loading_flag=function(e){window.addEventListener("load",function(){e.nowLoadingImages=!1})},this.set_images_loading_flag(_this)};function wdi_extractHostname(e){return void 0===e||""===e?"":e.replace(/(^\w+:|^)\/\//,"")}WDIFeed.prototype.mediaExists=function(e,i){for(var d=0;d<i.length;d++)if(e.id==i[d].id)return!0;return!1},WDIFeed.prototype.getIdFromUrl=function(e){for(var i=e.split("/"),d=!1,r=0;r<i.length;r++)if("p"==i[r]&&void 0!==i[r+1]){d=i[r+1];break}return d},WDIFeed.prototype.avoidDuplicateMedia=function(e){var i=e.data,d=[];void 0===i&&(i=[]);for(var r=0;r<i.length;r++)this.mediaExists(i[r],this.dataStorageList)||this.mediaExists(i[r],d)||this.mediaExists(i[r],this.conditionalFilterBuffer)||d.push(i[r]);return this.conditionalFilterBuffer=this.conditionalFilterBuffer.concat(d),{data:d,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.storeRawData=function(e,i){var r=this;if("object"==typeof this[i]&&"number"==typeof this[i].length)for(var d=0;d<e.length;d++){var t="";wdi_front.isHashtag(e[d].user_id)?void 0!==e[d].pagination.cursors&&(t=e[d].pagination.cursors.after):"liked"==r.feed_row.liked_feed?void 0===(t=e[d].pagination.next_max_like_id)&&(t=""):(null==e[d].pagination&&(e[d].pagination=[]),void 0===(t=e[d].pagination.next_max_id)&&(t="")),void 0===this[i][d]?this[i].push({data:e[d].data,index:0,locked:!1,hash_id:t,usersDataFinished:!1,userId:e[d].user_id,length:function(){return this.data.length-this.index},getData:function(e){var i=this.data.slice(this.index,this.index+e);if(this.index+=Math.min(e,this.length()),this.index==this.data.length&&1==this.locked&&0==this.usersDataFinished)for(var d=0;d<r.usersData.length;d++)if(r.usersData[d].user_id==this.userId){this.usersDataFinished=!0;break}return i}}):0==this[i][d].locked&&(t!=this[i][d].hash_id?(this[i][d].data=this[i][d].data.concat(e[d].data),this[i][d].hash_id=t):this[i][d].locked=!0)}},wdi_front.updateUsersIfNecessary=function(o){for(var n=o.feed_users,e=!1,i=0;i<n.length;i++)"#"!=n[i].username.substr(0,1)?""!=n[i].id&&"username"!=n[i].id||(e=!0,o.instagram.searchForUsersByName(n[i].username,{success:function(e){if(void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,o),200==e.meta.code&&0<e.data.length){for(var i=!1,d=0;d<e.data.length;d++)if(e.data[d].username==e.args.username){i=!0;break}if(i)for(var r=0;r<n.length;r++)e.data[d].username==n[r].username&&(n[r].id=e.data[d].id)}for(var t=!1,a=0;a<n.length;a++)if(""==n[a].id||"username"==n[a].id){t=!0;break}t||(o.feed_row.feed_users=JSON.stringify(n),wdi_front.init(o))},username:n[i].username})):n[i].id=n[i].username;return e},void 0!==wdi_ajax.ajax_response?jQuery(document).one("ajaxStop",function(){"not_declared"!=wdi_front.type&&(wdi_front.clickOrTouch=wdi_front.detectEvent(),wdi_front.globalInit())}):jQuery(document).ready(function(){"not_declared"!=wdi_front.type&&(wdi_front.clickOrTouch=wdi_front.detectEvent(),wdi_front.globalInit())}),jQuery(document).ready(function(){setTimeout(function(){"1"===wdi_front_messages.show_alerts&&"I"!==jQuery(".wdi_check_fontawesome .tenweb-i-instagram").prop("tagName")&&console.log("Font Awesome is not loaded properly. Please ask for support https://wordpress.org/support/plugin/wd-instagram-feed/")},2e3)});
js/wdi_instagram.js CHANGED
@@ -1088,7 +1088,7 @@ function WDIInstagram(args) {
1088
  response['iter']++;
1089
  if( response['iter'] >= wdi_cache_request_count ) {
1090
  if( frontend === 1 ) {
1091
- if( tag_id === 'false' ) {
1092
  _this.getTagRecentMedia( tagname, args, next_url, endpoint, 1);
1093
  } else {
1094
  _this.getUserMedia(args, response['next_url'], 1);
1088
  response['iter']++;
1089
  if( response['iter'] >= wdi_cache_request_count ) {
1090
  if( frontend === 1 ) {
1091
+ if( tag_id !== 'false' ) {
1092
  _this.getTagRecentMedia( tagname, args, next_url, endpoint, 1);
1093
  } else {
1094
  _this.getUserMedia(args, response['next_url'], 1);
js/wdi_instagram.min.js CHANGED
@@ -1 +1 @@
1
- function WDIInstagram(e){this.user={},this.access_tokens=[],this.filters=[],void 0!==e&&(void 0!==e.access_tokens&&(this.access_tokens=e.access_tokens),void 0!==e.filters&&(this.filters=e.filters));var _=this;function g(){return void 0!==_.user&&void 0!==_.user.user_name?_.user.user_name:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user?wdi_object.user.user_name:""}function u(){return void 0!==_.user&&void 0!==_.user.access_token?_.user.access_token:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user&&void 0!==wdi_object.user.access_token?wdi_object.user.access_token:""}this.statusCode={429:function(){console.log(" 429: Too many requests. Try after one hour")}},this.getFilter=function(e){var s=_.filters;if(void 0===s)return!1;for(var t=0;t<s.length;t++)if(s[t].where==e)if("object"==typeof s[t].what&&2==s[t].what.length){if(void 0!==window[s[t].what[0]]&&"function"==typeof window[s[t].what[0]][s[t].what[1]])return window[s[t].what[0]][s[t].what[1]]}else{if("string"!=typeof s[t].what)return"function"==typeof s[t].what&&s[t].what;if("function"==typeof window[s[t].what])return window[s[t].what]}return!1},this.addToken=function(e){"string"==typeof e&&_.access_tokens.push(e)},this.resetTokens=function(){_.access_tokens=[]},this.getTagRecentMedia=function(n,i,e,c,a){var s=!1,t=this.statusCode,o=!1,u=(this.getFilter("getTagRecentMedia"),wdi_ajax.feed_id),d=g();c=0===parseInt(c)?"top_media":"recent_media",void 0===i||0===i.length||("success"in i&&(s=!0),"statusCode"in i&&(t=i.statusCode),"error"in i&&(o=!0),"args"in i||(i.args={}),"count"in i?(i.count=parseInt(i.count),(!Number.isInteger(i.count)||i.count<=0)&&(i.count=33)):i.count=33,"feed_id"in i&&(u=i.feed_id),"user_name"in i&&(d=i.user_name));var f=this.getTagId(n);function w(e){void 0===e.data&&(e.data=[]),s&&("object"==typeof i.success&&2==i.success.length?void 0!==window[i.success[0]]&&"function"==typeof window[i.success[0]][i.success[1]]&&window[i.success[0]][i.success[1]](e):"string"==typeof i.success?"function"==typeof window[i.success]&&window[i.success](e):"function"==typeof i.success&&i.success(e))}jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{action:"wdi_getTagRecentMedia",wdi_nonce:wdi_ajax.wdi_nonce,user_name:d,feed_id:u,next_url:e,tagname:n,wdiTagId:f,endpoint:c},success:function(e){var s,t,o=!1,r="";void 0!==e.error&&(o=!0,r=e.error.type),void 0===e.data||void 0!==e.data&&0===e.data.length&&0===a?_.set_cache_data("",d,u,"",0,1,n,f,c,i):(0===e.data.length?e.meta={code:400,error:o,error_type:r}:(!1===f&&(f=""),void 0!==e.tag_data&&(void 0!==(s=e.tag_data).tag_id&&(f=s.tag_id),t=[],void 0!==window.wdi_all_tags&&(t=window.wdi_all_tags),t[s.tag_id]=s,window.wdi_all_tags=t),e.meta={code:200,error:o,error_type:r}),e.tag_id=f,w(e))},error:function(e){o&&("object"==typeof i.error&&2==i.error.length?"function"==typeof window[i.error[0]][i.error[1]]&&window[i.error[0]][i.error[1]](e):"string"==typeof i.error?"function"==typeof window[i.error]&&window[i.error](e):"function"==typeof i.error&&i.error(e))},statusCode:t})},this.getTagId=function(e){var s,t,o=[];if("undefined"!=typeof wdi_controller){if(void 0===(o=wdi_controller.feed_users))return!1;0!==o.length||void 0!==(s=jQuery("#WDI_feed_users").val())&&""!==s&&(o=JSON.parse(s))}else void 0!==window.wdi_all_tags&&(o=window.wdi_all_tags);for(t in o)if(e===o[t].username||"#"+e===o[t].username)return void 0!==o[t].tag_id&&o[t].tag_id;return!1},this.searchForTagsByName=function(e,t){var o=this,r=!1,n=this.statusCode,i=!1;filter=this.getFilter("searchForTagsByName"),void 0===t||0===t.length||("success"in t&&(r=!0),"error"in t&&(i=!0),"statusCode"in t&&(n=t.statusCode));var c="https://api.instagram.com/v1/tags/search?q="+e+"&access_token="+u();_.getDataFromCache(function(e){function s(e){r&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(filter&&(e=filter(e,o.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(filter&&(e=filter(e,o.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(filter&&(e=filter(e,o.filterArguments)),t.success(e)))}!1===e?jQuery.ajax({type:"POST",url:c,dataType:"jsonp",success:function(e){_.setDataToCache(c,e),s(e)},error:function(e){i&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:n}):s(e)},c)},this.searchForUsersByName=function(e,s){var t=this,o=!1,r=(this.statusCode,!1),n=this.getFilter("searchForUsersByName");void 0===s||0===s.length||("success"in s&&(o=!0),"error"in s&&(r=!0),"statusCode"in s&&s.statusCode),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/search?q="+e+"&access_token="+u(),success:function(e){o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(n&&(e=n(e,t.filterArguments)),e.args=s,window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(n&&(e=n(e,t.filterArguments)),e.args=s,window[s.success](e)):"function"==typeof s.success&&(n&&(e=n(e,t.filterArguments)),(e.args=s).success(e)))},error:function(e){r&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:this.statusCode})},this.getRecentLikedMedia=function(s){var t=this,o=!1,e=this.statusCode,r=!1,n=this.getFilter("getRecentLikedMedia"),i="https://api.instagram.com/v1/users/self/media/liked?access_token="+u();void 0===s||0===s.length||("success"in s&&(o=!0),"error"in s&&(r=!0),"statusCode"in s&&(e=s.statusCode),"args"in s?argFlag=!0:s.args={},"count"in s?(s.count=parseInt(s.count),(!Number.isInteger(s.count)||s.count<=0)&&(s.count=20)):s.count=20,i+="&count="+s.count,"next_max_like_id"in s&&(i+="&next_max_like_id="+s.next_max_like_id)),jQuery.ajax({type:"POST",dataType:"jsonp",url:i,success:function(e){o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(n&&(e=n(e,t.filterArguments,s.args)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(n&&(e=n(e,t.filterArguments,s.args)),window[s.success](e)):"function"==typeof s.success&&(n&&(e=n(e,t.filterArguments,s.args)),s.success(e)))},error:function(e){r&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:e})},this.getUserRecentMedia=function(e,s){var t=this,o=!1,r=this.statusCode,n=!1,i=this.getFilter("getUserRecentMedia"),e="https://api.instagram.com/v1/users/"+e+"/media/recent/?access_token="+u();void 0===s||0===s.length||("success"in s&&(o=!0),"statusCode"in s&&(r=s.statusCode),"args"in s||(s.args={}),"error"in s&&(n=!0),"count"in s?(s.count=parseInt(s.count),(!Number.isInteger(s.count)||s.count<=0)&&(s.count=33)):s.count=33,e+="&count="+s.count,"min_id"in s&&(e+="&min_id="+s.min_id),"max_id"in s&&(e+="&max_id="+s.max_id)),jQuery.ajax({type:"POST",dataType:"jsonp",url:e,success:function(e){void 0===e.data&&(e.data=[]),o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(i&&(e=i(e,t.filterArguments,s.args)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(i&&(e=i(e,t.filterArguments,s.args)),window[s.success](e)):"function"==typeof s.success&&(i&&(e=i(e,t.filterArguments,s.args)),s.success(e)))},error:function(e){n&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:r})},this.getUserMedia=function(o,e,r){e=void 0===e?"":e;var n=this,i=!1,s=this.statusCode,t=!1,c=this.getFilter("getUserMedia"),a=g(),u=wdi_ajax.feed_id;void 0===o||0===o.length||("success"in o&&(i=!0),"error"in o&&(t=!0),"statusCode"in o&&(s=o.statusCode),"args"in o||(o.args={}),"count"in o?(o.count=parseInt(o.count),(!Number.isInteger(o.count)||o.count<=0)&&(o.count=20)):o.count=20,"feed_id"in o&&(u=o.feed_id),"user_name"in o&&(a=o.user_name)),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,action:"wdi_getUserMedia",user_name:a,feed_id:u,next_url:e},success:function(e){var s=!1,t="";void 0!==e.error&&(s=!0,t=e.error.type),void 0===e.data||void 0!==e.data&&0===e.data.length&&0===r?_.set_cache_data("",a,u,"",0,1,"","","",o):0!==e.data.length?(e.meta={code:200,error:s,error_type:t},i&&("object"==typeof o.success&&2==o.success.length?void 0!==window[o.success[0]]&&"function"==typeof window[o.success[0]][o.success[1]]&&(c&&(e=_.addTags(e),e=c(e,n.filterArguments,o)),window[o.success[0]][o.success[1]](e)):"string"==typeof o.success?"function"==typeof window[o.success]&&(c&&(e=_.addTags(e),e=c(e,n.filterArguments,o)),window[o.success](e)):"function"==typeof o.success&&o.success(e))):(e.meta={code:400,error:s,error_type:t},o.success(e))},error:function(e){t&&("object"==typeof o.error&&2==o.error.length?"function"==typeof window[o.error[0]][o.error[1]]&&window[o.error[0]][o.error[1]](e):"string"==typeof o.error?"function"==typeof window[o.error]&&window[o.error](e):"function"==typeof o.error&&o.error(e))},statusCode:s})},this.set_cache_data=function(s,t,o,r,e,n,i,c,a,u){var d;0===n?(""===t&&(t=jQuery("#WDI_user_name").val()),0===o&&(o=jQuery("#wdi_add_or_edit").val()),""===a&&0!==jQuery("#wdi_feed_users_ajax .wdi_user").length&&(a=jQuery("#WDI_wrap_hashtag_top_recent input[name='wdi_feed_settings[hashtag_top_recent]']:checked").val()),a="0"===a?"top_media":"recent_media",""===c&&"undefined"!=typeof users&&(d=JSON.parse(users),c=d[0].tag_id),""===c&&(c="false")):(c=this.getTagId(i),""===t&&(t=jQuery("#WDI_user_name").val()),0===o&&(o=wdi_ajax.feed_id));var f=10;void 0!==wdi_ajax.wdi_cache_request_count&&""!==wdi_ajax.wdi_cache_request_count&&(f=parseInt(wdi_ajax.wdi_cache_request_count)),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{action:"wdi_set_preload_cache_data",tag_id:c,tagname:i,user_name:t,feed_id:o,endpoint:a,wdi_nonce:wdi_ajax.wdi_nonce,next_url:r,iter:e},success:function(e){""!=e.next_url?(e.iter++,e.iter>=f?1===n?"false"===c?_.getTagRecentMedia(i,u,r,a,1):_.getUserMedia(u,e.next_url,1):(jQuery("#wdi_save_loading").addClass("wdi_hidden"),window.location=s):_.set_cache_data(s,t,o,e.next_url,e.iter,n,i,c,a,u)):1===n?"false"===c?_.getTagRecentMedia(i,u,r,a,1):_.getUserMedia(u,e.next_url,1):(jQuery("#wdi_save_loading").addClass("wdi_hidden"),jQuery("#wdi_save_loading .caching-process-message").addClass("wdi_hidden"),""!==s&&(window.location=s))},error:function(e,s,t){jQuery("#wdi_save_loading .caching-process-message").addClass("wdi_hidden"),jQuery("#wdi_save_loading").addClass("wdi_hidden")}})},this.getUserInfo=function(e,s){var t=this,o=!1,r=this.statusCode,n=!1,i=this.getFilter("getUserInfo");void 0===s||0===s.length||("success"in s&&(o=!0),"error"in s&&(n=!0),"statusCode"in s&&(r=s.statusCode)),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/"+e+"/?access_token="+u(),success:function(e){o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(i&&(e=i(e,t.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(i&&(e=i(e,t.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(i&&(e=i(e,t.filterArguments)),s.success(e)))},error:function(e){n&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:r})},this.getSelfInfo=function(t){var o=this,r=!1,n=this.statusCode,i=!1,c=this.getFilter("getSelfInfo");void 0===t||0===t.length||("success"in t&&(r=!0),"error"in t&&(i=!0),"statusCode"in t&&(n=t.statusCode));var a="https://graph.facebook.com/v3.2/"+(void 0!==_.user&&void 0!==_.user.user_id?_.user.user_id:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user?wdi_object.user.user_id:"")+"?fields=id,ig_id,username,name,biography,profile_picture_url,followers_count,follows_count,media_count,website&access_token="+u();_.getDataFromCache(function(e){var s;!1===e?jQuery.ajax({type:"POST",dataType:"jsonp",url:a,statusCode:n,success:function(e){_.setDataToCache(a,e),r&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(c&&(e.meta={code:200},e=c(e,o.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(c&&(e.meta={code:200},e=c(e,o.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(c&&(e.meta={code:200},e=c(e,o.filterArguments)),t.success(e)))},error:function(e){i&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))}}):(s=e,r&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(c&&(s=c(s,o.filterArguments)),window[t.success[0]][t.success[1]](s)):"string"==typeof t.success?"function"==typeof window[t.success]&&(c&&(s=c(s,o.filterArguments)),window[t.success](s)):"function"==typeof t.success&&(c&&(s=c(s,o.filterArguments)),t.success(s))))},a)},this.getRecentMediaComments=function(e,s,t){var o=this,r=!1,n=this.statusCode,i=!1,c=this.getFilter("getRecentMediaComments");void 0===s||0===s.length||("success"in s&&(r=!0),"error"in s&&(i=!0),"statusCode"in s&&(n=s.statusCode)),jQuery(".wdi_comment_container #ajax_loading #opacity_div").css("display","block"),jQuery(".wdi_comment_container #ajax_loading #loading_div").css("display","block"),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,action:"wdi_getRecentMediaComments",user_name:g(),media_id:e,next:t},success:function(e){e=e,r&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(c&&(e=c(e,o.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(c&&(e=c(e,o.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(c&&(e=c(e,o.filterArguments)),s.success(e)))},complete:function(){jQuery(".wdi_comment_container #ajax_loading #opacity_div").css("display","none"),jQuery(".wdi_comment_container #ajax_loading #loading_div").css("display","none")},error:function(e){i&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:n})},this.getRecentMediaLikes=function(e,s){var t=this,o=!1,r=this.statusCode,n=!1,i=this.getFilter("getRecentMediaLikes");void 0===s||0===s.length||("success"in s&&(o=!0),"error"in s&&(n=!0),"statusCode"in s&&(r=s.statusCode)),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/media/"+e+"/likes?access_token="+u(),success:function(e){o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(i&&(e=i(e,t.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(i&&(e=i(e,t.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(i&&(e=i(e,t.filterArguments)),s.success(e)))},error:function(e){n&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:r})},this.getDataFromCache=function(s,e,t){void 0===t&&(t=!0),jQuery.ajax({type:"POST",async:t,url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_cache_name:e,wdi_nonce:wdi_ajax.wdi_nonce,WDI_MINIFY:wdi_ajax.WDI_MINIFY,task:"get",action:"wdi_cache"},success:function(e){e.success&&void 0!==e.cache_data&&null!==e.cache_data?(e=JSON.parse(e.cache_data),s(e)):s(!1)}})},this.setDataToCache=function(e,s){jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_cache_name:e,wdi_cache_response:JSON.stringify(s),wdi_nonce:wdi_ajax.wdi_nonce,task:"set",action:"wdi_cache"},success:function(e){}})}}
1
+ function WDIInstagram(e){this.user={},this.access_tokens=[],this.filters=[],void 0!==e&&(void 0!==e.access_tokens&&(this.access_tokens=e.access_tokens),void 0!==e.filters&&(this.filters=e.filters));var _=this;function g(){return void 0!==_.user&&void 0!==_.user.user_name?_.user.user_name:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user?wdi_object.user.user_name:""}function u(){return void 0!==_.user&&void 0!==_.user.access_token?_.user.access_token:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user&&void 0!==wdi_object.user.access_token?wdi_object.user.access_token:""}this.statusCode={429:function(){console.log(" 429: Too many requests. Try after one hour")}},this.getFilter=function(e){var s=_.filters;if(void 0===s)return!1;for(var t=0;t<s.length;t++)if(s[t].where==e)if("object"==typeof s[t].what&&2==s[t].what.length){if(void 0!==window[s[t].what[0]]&&"function"==typeof window[s[t].what[0]][s[t].what[1]])return window[s[t].what[0]][s[t].what[1]]}else{if("string"!=typeof s[t].what)return"function"==typeof s[t].what&&s[t].what;if("function"==typeof window[s[t].what])return window[s[t].what]}return!1},this.addToken=function(e){"string"==typeof e&&_.access_tokens.push(e)},this.resetTokens=function(){_.access_tokens=[]},this.getTagRecentMedia=function(n,i,e,c,a){var s=!1,t=this.statusCode,o=!1,u=(this.getFilter("getTagRecentMedia"),wdi_ajax.feed_id),d=g();c=0===parseInt(c)?"top_media":"recent_media",void 0===i||0===i.length||("success"in i&&(s=!0),"statusCode"in i&&(t=i.statusCode),"error"in i&&(o=!0),"args"in i||(i.args={}),"count"in i?(i.count=parseInt(i.count),(!Number.isInteger(i.count)||i.count<=0)&&(i.count=33)):i.count=33,"feed_id"in i&&(u=i.feed_id),"user_name"in i&&(d=i.user_name));var f=this.getTagId(n);function w(e){void 0===e.data&&(e.data=[]),s&&("object"==typeof i.success&&2==i.success.length?void 0!==window[i.success[0]]&&"function"==typeof window[i.success[0]][i.success[1]]&&window[i.success[0]][i.success[1]](e):"string"==typeof i.success?"function"==typeof window[i.success]&&window[i.success](e):"function"==typeof i.success&&i.success(e))}jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{action:"wdi_getTagRecentMedia",wdi_nonce:wdi_ajax.wdi_nonce,user_name:d,feed_id:u,next_url:e,tagname:n,wdiTagId:f,endpoint:c},success:function(e){var s,t,o=!1,r="";void 0!==e.error&&(o=!0,r=e.error.type),void 0===e.data||void 0!==e.data&&0===e.data.length&&0===a?_.set_cache_data("",d,u,"",0,1,n,f,c,i):(0===e.data.length?e.meta={code:400,error:o,error_type:r}:(!1===f&&(f=""),void 0!==e.tag_data&&(void 0!==(s=e.tag_data).tag_id&&(f=s.tag_id),t=[],void 0!==window.wdi_all_tags&&(t=window.wdi_all_tags),t[s.tag_id]=s,window.wdi_all_tags=t),e.meta={code:200,error:o,error_type:r}),e.tag_id=f,w(e))},error:function(e){o&&("object"==typeof i.error&&2==i.error.length?"function"==typeof window[i.error[0]][i.error[1]]&&window[i.error[0]][i.error[1]](e):"string"==typeof i.error?"function"==typeof window[i.error]&&window[i.error](e):"function"==typeof i.error&&i.error(e))},statusCode:t})},this.getTagId=function(e){var s,t,o=[];if("undefined"!=typeof wdi_controller){if(void 0===(o=wdi_controller.feed_users))return!1;0!==o.length||void 0!==(s=jQuery("#WDI_feed_users").val())&&""!==s&&(o=JSON.parse(s))}else void 0!==window.wdi_all_tags&&(o=window.wdi_all_tags);for(t in o)if(e===o[t].username||"#"+e===o[t].username)return void 0!==o[t].tag_id&&o[t].tag_id;return!1},this.searchForTagsByName=function(e,t){var o=this,r=!1,n=this.statusCode,i=!1;filter=this.getFilter("searchForTagsByName"),void 0===t||0===t.length||("success"in t&&(r=!0),"error"in t&&(i=!0),"statusCode"in t&&(n=t.statusCode));var c="https://api.instagram.com/v1/tags/search?q="+e+"&access_token="+u();_.getDataFromCache(function(e){function s(e){r&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(filter&&(e=filter(e,o.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(filter&&(e=filter(e,o.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(filter&&(e=filter(e,o.filterArguments)),t.success(e)))}!1===e?jQuery.ajax({type:"POST",url:c,dataType:"jsonp",success:function(e){_.setDataToCache(c,e),s(e)},error:function(e){i&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:n}):s(e)},c)},this.searchForUsersByName=function(e,s){var t=this,o=!1,r=(this.statusCode,!1),n=this.getFilter("searchForUsersByName");void 0===s||0===s.length||("success"in s&&(o=!0),"error"in s&&(r=!0),"statusCode"in s&&s.statusCode),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/search?q="+e+"&access_token="+u(),success:function(e){o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(n&&(e=n(e,t.filterArguments)),e.args=s,window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(n&&(e=n(e,t.filterArguments)),e.args=s,window[s.success](e)):"function"==typeof s.success&&(n&&(e=n(e,t.filterArguments)),(e.args=s).success(e)))},error:function(e){r&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:this.statusCode})},this.getRecentLikedMedia=function(s){var t=this,o=!1,e=this.statusCode,r=!1,n=this.getFilter("getRecentLikedMedia"),i="https://api.instagram.com/v1/users/self/media/liked?access_token="+u();void 0===s||0===s.length||("success"in s&&(o=!0),"error"in s&&(r=!0),"statusCode"in s&&(e=s.statusCode),"args"in s?argFlag=!0:s.args={},"count"in s?(s.count=parseInt(s.count),(!Number.isInteger(s.count)||s.count<=0)&&(s.count=20)):s.count=20,i+="&count="+s.count,"next_max_like_id"in s&&(i+="&next_max_like_id="+s.next_max_like_id)),jQuery.ajax({type:"POST",dataType:"jsonp",url:i,success:function(e){o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(n&&(e=n(e,t.filterArguments,s.args)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(n&&(e=n(e,t.filterArguments,s.args)),window[s.success](e)):"function"==typeof s.success&&(n&&(e=n(e,t.filterArguments,s.args)),s.success(e)))},error:function(e){r&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:e})},this.getUserRecentMedia=function(e,s){var t=this,o=!1,r=this.statusCode,n=!1,i=this.getFilter("getUserRecentMedia"),e="https://api.instagram.com/v1/users/"+e+"/media/recent/?access_token="+u();void 0===s||0===s.length||("success"in s&&(o=!0),"statusCode"in s&&(r=s.statusCode),"args"in s||(s.args={}),"error"in s&&(n=!0),"count"in s?(s.count=parseInt(s.count),(!Number.isInteger(s.count)||s.count<=0)&&(s.count=33)):s.count=33,e+="&count="+s.count,"min_id"in s&&(e+="&min_id="+s.min_id),"max_id"in s&&(e+="&max_id="+s.max_id)),jQuery.ajax({type:"POST",dataType:"jsonp",url:e,success:function(e){void 0===e.data&&(e.data=[]),o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(i&&(e=i(e,t.filterArguments,s.args)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(i&&(e=i(e,t.filterArguments,s.args)),window[s.success](e)):"function"==typeof s.success&&(i&&(e=i(e,t.filterArguments,s.args)),s.success(e)))},error:function(e){n&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:r})},this.getUserMedia=function(o,e,r){e=void 0===e?"":e;var n=this,i=!1,s=this.statusCode,t=!1,c=this.getFilter("getUserMedia"),a=g(),u=wdi_ajax.feed_id;void 0===o||0===o.length||("success"in o&&(i=!0),"error"in o&&(t=!0),"statusCode"in o&&(s=o.statusCode),"args"in o||(o.args={}),"count"in o?(o.count=parseInt(o.count),(!Number.isInteger(o.count)||o.count<=0)&&(o.count=20)):o.count=20,"feed_id"in o&&(u=o.feed_id),"user_name"in o&&(a=o.user_name)),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,action:"wdi_getUserMedia",user_name:a,feed_id:u,next_url:e},success:function(e){var s=!1,t="";void 0!==e.error&&(s=!0,t=e.error.type),void 0===e.data||void 0!==e.data&&0===e.data.length&&0===r?_.set_cache_data("",a,u,"",0,1,"","","",o):0!==e.data.length?(e.meta={code:200,error:s,error_type:t},i&&("object"==typeof o.success&&2==o.success.length?void 0!==window[o.success[0]]&&"function"==typeof window[o.success[0]][o.success[1]]&&(c&&(e=_.addTags(e),e=c(e,n.filterArguments,o)),window[o.success[0]][o.success[1]](e)):"string"==typeof o.success?"function"==typeof window[o.success]&&(c&&(e=_.addTags(e),e=c(e,n.filterArguments,o)),window[o.success](e)):"function"==typeof o.success&&o.success(e))):(e.meta={code:400,error:s,error_type:t},o.success(e))},error:function(e){t&&("object"==typeof o.error&&2==o.error.length?"function"==typeof window[o.error[0]][o.error[1]]&&window[o.error[0]][o.error[1]](e):"string"==typeof o.error?"function"==typeof window[o.error]&&window[o.error](e):"function"==typeof o.error&&o.error(e))},statusCode:s})},this.set_cache_data=function(s,t,o,r,e,n,i,c,a,u){var d;0===n?(""===t&&(t=jQuery("#WDI_user_name").val()),0===o&&(o=jQuery("#wdi_add_or_edit").val()),""===a&&0!==jQuery("#wdi_feed_users_ajax .wdi_user").length&&(a=jQuery("#WDI_wrap_hashtag_top_recent input[name='wdi_feed_settings[hashtag_top_recent]']:checked").val()),a="0"===a?"top_media":"recent_media",""===c&&"undefined"!=typeof users&&(d=JSON.parse(users),c=d[0].tag_id),""===c&&(c="false")):(c=this.getTagId(i),""===t&&(t=jQuery("#WDI_user_name").val()),0===o&&(o=wdi_ajax.feed_id));var f=10;void 0!==wdi_ajax.wdi_cache_request_count&&""!==wdi_ajax.wdi_cache_request_count&&(f=parseInt(wdi_ajax.wdi_cache_request_count)),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{action:"wdi_set_preload_cache_data",tag_id:c,tagname:i,user_name:t,feed_id:o,endpoint:a,wdi_nonce:wdi_ajax.wdi_nonce,next_url:r,iter:e},success:function(e){""!=e.next_url?(e.iter++,e.iter>=f?1===n?"false"!==c?_.getTagRecentMedia(i,u,r,a,1):_.getUserMedia(u,e.next_url,1):(jQuery("#wdi_save_loading").addClass("wdi_hidden"),window.location=s):_.set_cache_data(s,t,o,e.next_url,e.iter,n,i,c,a,u)):1===n?"false"===c?_.getTagRecentMedia(i,u,r,a,1):_.getUserMedia(u,e.next_url,1):(jQuery("#wdi_save_loading").addClass("wdi_hidden"),jQuery("#wdi_save_loading .caching-process-message").addClass("wdi_hidden"),""!==s&&(window.location=s))},error:function(e,s,t){jQuery("#wdi_save_loading .caching-process-message").addClass("wdi_hidden"),jQuery("#wdi_save_loading").addClass("wdi_hidden")}})},this.getUserInfo=function(e,s){var t=this,o=!1,r=this.statusCode,n=!1,i=this.getFilter("getUserInfo");void 0===s||0===s.length||("success"in s&&(o=!0),"error"in s&&(n=!0),"statusCode"in s&&(r=s.statusCode)),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/"+e+"/?access_token="+u(),success:function(e){o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(i&&(e=i(e,t.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(i&&(e=i(e,t.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(i&&(e=i(e,t.filterArguments)),s.success(e)))},error:function(e){n&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:r})},this.getSelfInfo=function(t){var o=this,r=!1,n=this.statusCode,i=!1,c=this.getFilter("getSelfInfo");void 0===t||0===t.length||("success"in t&&(r=!0),"error"in t&&(i=!0),"statusCode"in t&&(n=t.statusCode));var a="https://graph.facebook.com/v3.2/"+(void 0!==_.user&&void 0!==_.user.user_id?_.user.user_id:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user?wdi_object.user.user_id:"")+"?fields=id,ig_id,username,name,biography,profile_picture_url,followers_count,follows_count,media_count,website&access_token="+u();_.getDataFromCache(function(e){var s;!1===e?jQuery.ajax({type:"POST",dataType:"jsonp",url:a,statusCode:n,success:function(e){_.setDataToCache(a,e),r&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(c&&(e.meta={code:200},e=c(e,o.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(c&&(e.meta={code:200},e=c(e,o.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(c&&(e.meta={code:200},e=c(e,o.filterArguments)),t.success(e)))},error:function(e){i&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))}}):(s=e,r&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(c&&(s=c(s,o.filterArguments)),window[t.success[0]][t.success[1]](s)):"string"==typeof t.success?"function"==typeof window[t.success]&&(c&&(s=c(s,o.filterArguments)),window[t.success](s)):"function"==typeof t.success&&(c&&(s=c(s,o.filterArguments)),t.success(s))))},a)},this.getRecentMediaComments=function(e,s,t){var o=this,r=!1,n=this.statusCode,i=!1,c=this.getFilter("getRecentMediaComments");void 0===s||0===s.length||("success"in s&&(r=!0),"error"in s&&(i=!0),"statusCode"in s&&(n=s.statusCode)),jQuery(".wdi_comment_container #ajax_loading #opacity_div").css("display","block"),jQuery(".wdi_comment_container #ajax_loading #loading_div").css("display","block"),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,action:"wdi_getRecentMediaComments",user_name:g(),media_id:e,next:t},success:function(e){e=e,r&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(c&&(e=c(e,o.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(c&&(e=c(e,o.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(c&&(e=c(e,o.filterArguments)),s.success(e)))},complete:function(){jQuery(".wdi_comment_container #ajax_loading #opacity_div").css("display","none"),jQuery(".wdi_comment_container #ajax_loading #loading_div").css("display","none")},error:function(e){i&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:n})},this.getRecentMediaLikes=function(e,s){var t=this,o=!1,r=this.statusCode,n=!1,i=this.getFilter("getRecentMediaLikes");void 0===s||0===s.length||("success"in s&&(o=!0),"error"in s&&(n=!0),"statusCode"in s&&(r=s.statusCode)),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/media/"+e+"/likes?access_token="+u(),success:function(e){o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(i&&(e=i(e,t.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(i&&(e=i(e,t.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(i&&(e=i(e,t.filterArguments)),s.success(e)))},error:function(e){n&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:r})},this.getDataFromCache=function(s,e,t){void 0===t&&(t=!0),jQuery.ajax({type:"POST",async:t,url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_cache_name:e,wdi_nonce:wdi_ajax.wdi_nonce,WDI_MINIFY:wdi_ajax.WDI_MINIFY,task:"get",action:"wdi_cache"},success:function(e){e.success&&void 0!==e.cache_data&&null!==e.cache_data?(e=JSON.parse(e.cache_data),s(e)):s(!1)}})},this.setDataToCache=function(e,s){jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_cache_name:e,wdi_cache_response:JSON.stringify(s),wdi_nonce:wdi_ajax.wdi_nonce,task:"set",action:"wdi_cache"},success:function(e){}})}}
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: 5.8
7
- Stable tag: 1.4.23
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -505,6 +505,11 @@ Please make sure you don't have any important information before you proceed.
505
  10Web Social Photo Feed for Instagram plugin uses Instagram API on website front end. You have to authorize the plugin via sign in to get data from Instagram on your behalf. The plugin does not send any user’s data to Instagram. All the data received from Instagram via API is cached in WordPress database for some short customizable period to provide front end optimization. You can delete or update cached data. Instagram saves some cookies in browsers of website visitors via API data. These cookies are mostly used for security purposes. They are regulated under terms of Instagram’s privacy policy https://instagram.com/legal/privacy. The plugin asks for your consent to collect site administrator’s email address and site URL to offer customer support, deals and discounts on premium products and more.
506
 
507
  == Changelog ==
 
 
 
 
 
508
  = 1.4.23 =
509
  Improved: Cache logic.
510
  Fixed: Share to Twitter.
4
  Requires at least: 3.9
5
  Requires PHP: 5.2
6
  Tested up to: 5.8
7
+ Stable tag: 1.4.24
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
505
  10Web Social Photo Feed for Instagram plugin uses Instagram API on website front end. You have to authorize the plugin via sign in to get data from Instagram on your behalf. The plugin does not send any user’s data to Instagram. All the data received from Instagram via API is cached in WordPress database for some short customizable period to provide front end optimization. You can delete or update cached data. Instagram saves some cookies in browsers of website visitors via API data. These cookies are mostly used for security purposes. They are regulated under terms of Instagram’s privacy policy https://instagram.com/legal/privacy. The plugin asks for your consent to collect site administrator’s email address and site URL to offer customer support, deals and discounts on premium products and more.
506
 
507
  == Changelog ==
508
+ = 1.4.24 =
509
+ Fixed: Recent Hashtags ordering.
510
+ Fixed: Large images height in the lightbox.
511
+ Fixed: Image in Pinterest share preview.
512
+
513
  = 1.4.23 =
514
  Improved: Cache logic.
515
  Fixed: Share to Twitter.
wd-instagram-feed.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: 10Web Social Photo Feed
4
  * Plugin URI: https://10web.io/plugins/wordpress-instagram-feed/?utm_source=instagram_feed&utm_medium=free_plugin
5
  * Description: 10Web Social Photo 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.4.23
7
  * Author: 10Web
8
  * Author URI: https://10Web.io/plugins/?utm_source=instagram_feed&utm_medium=free_plugin
9
  * License: GPLv2 or later
3
  * Plugin Name: 10Web Social Photo Feed
4
  * Plugin URI: https://10web.io/plugins/wordpress-instagram-feed/?utm_source=instagram_feed&utm_medium=free_plugin
5
  * Description: 10Web Social Photo 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.4.24
7
  * Author: 10Web
8
  * Author URI: https://10Web.io/plugins/?utm_source=instagram_feed&utm_medium=free_plugin
9
  * License: GPLv2 or later