WD Instagram Feed – Instagram Gallery - Version 1.4.11

Version Description

Fixed: Adding the Instagram Feed to the Elementor. Fixed: Feed preview. Fixed: Comments for feed.

Download this release

Release Info

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

Code changes from version 1.4.10 to 1.4.11

admin/controllers/feeds.php CHANGED
@@ -228,6 +228,7 @@ class Feeds_controller_wdi {
228
 
229
  $message_id = 23;
230
  if ( $action == '' ) {
 
231
  $wpdb->insert($wpdb->prefix . WDI_FEED_TABLE, $settings, $this->dataFormat);
232
  if ( $wpdb->insert_id == FALSE ) {
233
  $message_id = 24;
@@ -328,13 +329,16 @@ class Feeds_controller_wdi {
328
  }
329
 
330
  private function duplicate_tabels( $feed_id ) {
 
331
  global $wpdb;
 
332
  if ( $feed_id ) {
333
  $feed_row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . WDI_FEED_TABLE . ' where id="%d"', $feed_id));
334
  }
335
  if ( $feed_row ) {
336
  $duplicate_values = WDILibrary::objectToArray($feed_row);
337
  unset($duplicate_values['id']);
 
338
  $save = $wpdb->insert($wpdb->prefix . WDI_FEED_TABLE, $duplicate_values, $this->dataFormat);
339
  $new_slider_id = $wpdb->get_var('SELECT MAX(id) FROM ' . $wpdb->prefix . WDI_FEED_TABLE);
340
  }
228
 
229
  $message_id = 23;
230
  if ( $action == '' ) {
231
+ $settings["feed_name"] = $model->get_unique_title($settings["feed_name"]);
232
  $wpdb->insert($wpdb->prefix . WDI_FEED_TABLE, $settings, $this->dataFormat);
233
  if ( $wpdb->insert_id == FALSE ) {
234
  $message_id = 24;
329
  }
330
 
331
  private function duplicate_tabels( $feed_id ) {
332
+ require_once WDI_DIR . '/admin/models/feeds.php';
333
  global $wpdb;
334
+ $model = new Feeds_model_wdi();
335
  if ( $feed_id ) {
336
  $feed_row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . WDI_FEED_TABLE . ' where id="%d"', $feed_id));
337
  }
338
  if ( $feed_row ) {
339
  $duplicate_values = WDILibrary::objectToArray($feed_row);
340
  unset($duplicate_values['id']);
341
+ $duplicate_values["feed_name"] = $model->get_unique_title($duplicate_values["feed_name"]);
342
  $save = $wpdb->insert($wpdb->prefix . WDI_FEED_TABLE, $duplicate_values, $this->dataFormat);
343
  $new_slider_id = $wpdb->get_var('SELECT MAX(id) FROM ' . $wpdb->prefix . WDI_FEED_TABLE);
344
  }
admin/controllers/settings.php CHANGED
@@ -114,6 +114,8 @@ class Settings_controller_wdi {
114
  $wdi_options['wdi_access_token'] = $access_token;
115
  }
116
  update_option(WDI_OPT, $wdi_options);
 
 
117
  WDILibrary::redirect(add_query_arg(array(
118
  'page' => 'wdi_settings',
119
  'message' => 29,
114
  $wdi_options['wdi_access_token'] = $access_token;
115
  }
116
  update_option(WDI_OPT, $wdi_options);
117
+ delete_option('wdi_token_error_flag');
118
+
119
  WDILibrary::redirect(add_query_arg(array(
120
  'page' => 'wdi_settings',
121
  'message' => 29,
admin/controllers/uninstall.php CHANGED
@@ -64,6 +64,7 @@ class Uninstall_controller_wdi {
64
  foreach ( $rows as $row ) {
65
  wp_delete_post( $row->ID, true );
66
  }
 
67
  // remove all options.
68
  delete_option(WDI_OPT);
69
  delete_option('wdi_version');
@@ -75,6 +76,7 @@ class Uninstall_controller_wdi {
75
  delete_option('wdi_admin_notice');
76
  delete_option('wdi_subscribe_done');
77
  delete_option('wdi_redirect_to_settings');
 
78
  delete_option('widget_wdi_instagram_widget');
79
  $this->remove_theme_files();
80
 
64
  foreach ( $rows as $row ) {
65
  wp_delete_post( $row->ID, true );
66
  }
67
+
68
  // remove all options.
69
  delete_option(WDI_OPT);
70
  delete_option('wdi_version');
76
  delete_option('wdi_admin_notice');
77
  delete_option('wdi_subscribe_done');
78
  delete_option('wdi_redirect_to_settings');
79
+ delete_option('wdi_token_error_flag');
80
  delete_option('widget_wdi_instagram_widget');
81
  $this->remove_theme_files();
82
 
admin/models/feeds.php CHANGED
@@ -73,7 +73,7 @@ class Feeds_model_wdi {
73
  $default_theme = WDILibrary::objectToArray($wpdb->get_results($query));
74
  $settings = array(
75
  'thumb_user' => '',
76
- 'feed_name' => 'Sample Feed',
77
  'feed_thumb' => '',
78
  'published' => '1',
79
  'theme_id' => $default_theme[0]['id'],
@@ -233,6 +233,22 @@ class Feeds_model_wdi {
233
  return $feed_row;
234
  }
235
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  /**
237
  * Create Preview Instagram post.
238
  *
@@ -243,7 +259,7 @@ class Feeds_model_wdi {
243
  $post_type = 'wdi_instagram';
244
  $args = array(
245
  'post_type' => $post_type,
246
- 'post_status' => 'private'
247
  );
248
  $row = get_posts($args);
249
 
73
  $default_theme = WDILibrary::objectToArray($wpdb->get_results($query));
74
  $settings = array(
75
  'thumb_user' => '',
76
+ 'feed_name' => '',
77
  'feed_thumb' => '',
78
  'published' => '1',
79
  'theme_id' => $default_theme[0]['id'],
233
  return $feed_row;
234
  }
235
 
236
+ public function get_unique_title($feed_name){
237
+ global $wpdb;
238
+ $check_feed_title = $wpdb->get_var($wpdb->prepare("SELECT id FROM ". $wpdb->prefix.WDI_FEED_TABLE. " WHERE feed_name='%s' ", $feed_name));
239
+ if($check_feed_title){
240
+ $num = 1;
241
+ do {
242
+ $alt_name = $feed_name . "-$num";
243
+ $num++;
244
+ $slug_check = $wpdb->get_var($wpdb->prepare("SELECT id FROM ". $wpdb->prefix.WDI_FEED_TABLE. " WHERE feed_name='%s' ", $alt_name));
245
+ }
246
+ while ( $slug_check );
247
+ $feed_name = $alt_name;
248
+ }
249
+ return $feed_name;
250
+ }
251
+
252
  /**
253
  * Create Preview Instagram post.
254
  *
259
  $post_type = 'wdi_instagram';
260
  $args = array(
261
  'post_type' => $post_type,
262
+ 'post_status' => 'publish'
263
  );
264
  $row = get_posts($args);
265
 
admin/views/feeds.php CHANGED
@@ -544,14 +544,6 @@ class Feeds_view_wdi {
544
  'br' => 'true'
545
  );
546
 
547
- /* $tabs["feed_settings"]["advanced"]["elements"][0]["thumb_user"]["switched"]="off";
548
- $tabs["feed_settings"]["advanced"]["elements"][0]["thumb_user"]["label"] = array(
549
- 'place' => 'after',
550
- 'class' => 'wdi_pro_only',
551
- 'text' => __("Featured Image is available only in premium version", "wd-instagram-feed"),
552
- 'br' => 'true'
553
- );*/
554
-
555
  $tabs["feed_settings"]["layout"]["elements"][0]["feed_display_view"]["disabled_options"]=array('infinite_scroll');
556
  $tabs["feed_settings"]["layout"]["elements"][0]["feed_display_view"]["disabled"]=array(
557
  'text' => __("Infinite Scroll option is available only in premium version", "wd-instagram-feed")
@@ -761,8 +753,8 @@ class Feeds_view_wdi {
761
  }
762
 
763
  $formInfo = $this->getFormElements($current_id);
764
-
765
  $tabs = $formInfo['tabs'];
 
766
  $wdi_preview_link = $this->model->get_instagram_preview_post();
767
  // for edit
768
  $edit = FALSE;
@@ -804,7 +796,7 @@ class Feeds_view_wdi {
804
  <form method="post" action="admin.php?page=wdi_feeds" id='wdi_save_feed'>
805
  <div class="wdi-page-header">
806
  <h1 class="wp-heading-inline"><?php echo __('Feed Title', 'wd-instagram-feed')?></h1>
807
- <input id="WDI_feed_name" class="WDI_title_input" name="wdi_feed_settings[feed_name]" type="text" value="<?php echo ($edit == TRUE && isset($feed_row['feed_name'])) ? $feed_row['feed_name'] : "Sample Feed";?>">
808
  <div class="wdi_buttons">
809
  <div id="wdi_save_feed_apply" class="button button-primary"><?php echo $save_btn_name;?></div>
810
  <button class="button preview-button button-large"<?php if (!$wdi_preview_btn) echo ' disabled="disabled"' ?> <?php echo ($wdi_preview_btn) ? 'onclick="window.open(\''. add_query_arg( array('feed_id' => $feed_row_id), $wdi_preview_link ) .'\', \'_blank\'); return false;"' : ''; ?>><?php echo __('Preview', 'wd-instagram-feed');?></button>
544
  'br' => 'true'
545
  );
546
 
 
 
 
 
 
 
 
 
547
  $tabs["feed_settings"]["layout"]["elements"][0]["feed_display_view"]["disabled_options"]=array('infinite_scroll');
548
  $tabs["feed_settings"]["layout"]["elements"][0]["feed_display_view"]["disabled"]=array(
549
  'text' => __("Infinite Scroll option is available only in premium version", "wd-instagram-feed")
753
  }
754
 
755
  $formInfo = $this->getFormElements($current_id);
 
756
  $tabs = $formInfo['tabs'];
757
+
758
  $wdi_preview_link = $this->model->get_instagram_preview_post();
759
  // for edit
760
  $edit = FALSE;
796
  <form method="post" action="admin.php?page=wdi_feeds" id='wdi_save_feed'>
797
  <div class="wdi-page-header">
798
  <h1 class="wp-heading-inline"><?php echo __('Feed Title', 'wd-instagram-feed')?></h1>
799
+ <input id="WDI_feed_name" class="WDI_title_input" name="wdi_feed_settings[feed_name]" type="text" value="<?php echo ($edit == TRUE && isset($feed_row['feed_name'])) ? $feed_row['feed_name'] : "";?>">
800
  <div class="wdi_buttons">
801
  <div id="wdi_save_feed_apply" class="button button-primary"><?php echo $save_btn_name;?></div>
802
  <button class="button preview-button button-large"<?php if (!$wdi_preview_btn) echo ' disabled="disabled"' ?> <?php echo ($wdi_preview_btn) ? 'onclick="window.open(\''. add_query_arg( array('feed_id' => $feed_row_id), $wdi_preview_link ) .'\', \'_blank\'); return false;"' : ''; ?>><?php echo __('Preview', 'wd-instagram-feed');?></button>
admin/views/uninstall.php CHANGED
@@ -34,7 +34,8 @@ class Uninstall_view_wdi {
34
  <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">12) wdi_theme_keys</li>
35
  <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">13) wdi_admin_notice</li>
36
  <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">14) wdi_subscribe_done</li>
37
- <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">15) widget_wdi_instagram_widget</li>
 
38
  </ul>
39
  </div>
40
  <form action="admin.php?page=wdi_uninstall" id="wdi_uninstall_form" method="post">
34
  <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">12) wdi_theme_keys</li>
35
  <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">13) wdi_admin_notice</li>
36
  <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">14) wdi_subscribe_done</li>
37
+ <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">15) wdi_token_error_flag</li>
38
+ <li style="padding-bottom:5px;padding-left:5px;font-weight: bold;margin:0;">16) widget_wdi_instagram_widget</li>
39
  </ul>
40
  </div>
41
  <form action="admin.php?page=wdi_uninstall" id="wdi_uninstall_form" method="post">
css/wdi_frontend.css CHANGED
@@ -575,6 +575,7 @@ div[id^="wdi_container"] p {
575
  }
576
 
577
  .wdi_layout_th .wdi_feed_item {
 
578
  display: inline-block;
579
  vertical-align: top;
580
  overflow: hidden;
@@ -1369,4 +1370,13 @@ div[id^="wdi_container"] p {
1369
  width: 100%;
1370
  height: 100%;
1371
  background-color: rgba(0,0,0,0.2);
1372
- }
 
 
 
 
 
 
 
 
 
575
  }
576
 
577
  .wdi_layout_th .wdi_feed_item {
578
+ width: 100%;
579
  display: inline-block;
580
  vertical-align: top;
581
  overflow: hidden;
1370
  width: 100%;
1371
  height: 100%;
1372
  background-color: rgba(0,0,0,0.2);
1373
+ }
1374
+
1375
+ #wdi_added_comments {
1376
+ padding-top: 20px;
1377
+ }
1378
+
1379
+ .wdi_comment_container #ajax_loading {
1380
+ left: calc(50% - 25px);
1381
+ top: calc(50% - 25px);
1382
+ }
css/wdi_frontend.min.css CHANGED
@@ -1 +1 @@
1
- .wdi_clear{clear:both}.wdi_feed_main_container .table{display:table}.wdi_feed_main_container .table-cell{display:table-cell}.wdi_feed_main_container .table-row{display:table-row}.wdi_feed_main_container{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.wdi_follow_button:hover{cursor:pointer}.wdi_hidden{display:none!important}.wdi_hover_off:hover{background-color:transparent!important}.wdi_cursor_off:hover{cursor:auto!important}.wdi_filter_active span{color:#fff}.wdi_disabled{visibility:hidden}.wdi_ajax_loading{position:absolute;width:50px;height:50px;left:0;right:0;bottom:-60px;margin:auto;z-index:100}.wdi_feed_main_container{width:100%;position:relative}.wdi_feed_main_container .wdi_img{margin:0}.wdi_feed_main_container .wdi_follow_btn{display:inline-block;background:0 0;border-style:solid;border-width:1px;font-weight:500;outline:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;-webkit-appearance:none;vertical-align:text-bottom}.wdi_feed_main_container .wdi_follow_btn:hover{cursor:pointer}.wdi_feed_main_container .wdi_pagination{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.wdi_feed_main_container .wdi_pagination_ctrl{display:inline-block}.wdi_feed_main_container .wdi_pagination_ctrl:hover{cursor:pointer}.wdi_feed_main_container .wdi_filter_icon span{display:block;font-size:25px;color:#fff}.wdi_feed_main_container .wdi_filter_icon span::before{width:20px;height:20px;position:absolute;opacity:1;right:0;left:0;top:0;bottom:0;margin:auto}.wdi_photo_img{position:relative;overflow:hidden}.wdi_photo_overlay{width:100%;height:100%;position:absolute;top:0;left:0;background-color:transparent;transition:all .1s ease}.wdi_photo_overlay:hover .wdi_thumb_icon i{display:block}.wdi_feed_main_container .tenweb{font-family:tenweb!important;font-style:normal;width:auto;speak:none;display:inline-block;line-height:1;font-weight:400;font-variant:normal;text-transform:none;vertical-align:top;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.wdi_media_info .tenweb-i:before{margin-right:6px}.wdi_spider_popup_loading{background-image:url(../images/ajax_loader.png);background-color:rgba(0,0,0,0);background-repeat:no-repeat;background-position:0 0;background-size:50px 50px;border:none!important;display:none;height:50px;left:50%;margin-left:-20px;margin-top:-20px;overflow:hidden;position:fixed;top:50%;width:50px;z-index:10102;-moz-animation:spin 2.5s infinite linear;-o-animation:spin 2.5s infinite linear;-webkit-animation:spin 2.5s infinite linear;animation:spin 2.5s infinite linear}.wdi_spider_popup_overlay{cursor:pointer;background-color:rgba(0,0,0,.5);display:none;height:100%;left:0;position:fixed;top:0;width:100%;z-index:10100}div[id^=wdi_container] p{padding:0!important;margin:0!important}.footer-list-block .bwp_gallery .wdi_spider_popup_loading,.footer-list-block .bwp_gallery_tags .wdi_spider_popup_loading,.wdi_spider_popup_loading{background-image:url(../images/ajax_loader.png);background-color:rgba(0,0,0,0);background-repeat:no-repeat;background-position:0 0;background-size:50px 50px;border:none!important;display:none;height:50px;left:50%;margin-left:-20px;margin-top:-20px;overflow:hidden;position:fixed;top:50%;width:50px;z-index:10102;-moz-animation:spin 2.5s infinite linear;-o-animation:spin 2.5s infinite linear;-webkit-animation:spin 2.5s infinite linear;animation:spin 2.5s infinite linear}.wdi_spider_ajax_loading{border:none!important;-moz-animation:spin 2.5s infinite linear;-o-animation:spin 2.5s infinite linear;-webkit-animation:spin 2.5s infinite linear;animation:spin 2.5s infinite linear}.footer-list-block .bwp_gallery .wdi_spider_popup_overlay,.footer-list-block .bwp_gallery_tags .wdi_spider_popup_overlay,.wdi_spider_popup_overlay{cursor:pointer;display:none;height:100%;left:0;position:fixed;top:0;width:100%;z-index:10100}.wdi_spider_popup_close,.wdi_spider_popup_close_fullscreen{-moz-box-sizing:content-box!important;box-sizing:content-box!important;cursor:pointer;display:table;line-height:0;position:absolute;z-index:11100}#wdi_spider_popup_left{left:0}#wdi_spider_popup_right{right:0}#wdi_spider_popup_left:hover,#wdi_spider_popup_right:hover{visibility:visible}#wdi_spider_popup_left:hover span{left:20px}#wdi_spider_popup_right:hover span{left:auto;right:20px}#wdi_spider_popup_left,#wdi_spider_popup_right{background:transparent url(../images/blank.gif) repeat scroll 0 0;bottom:35%;cursor:pointer;display:inline;height:30%;outline:medium none;position:absolute;width:35%;z-index:10130}#wdi_spider_popup_left-ico,#wdi_spider_popup_right-ico{-moz-box-sizing:border-box;box-sizing:border-box;cursor:pointer;display:table;left:-9999px;line-height:0;margin-top:-15px;position:absolute;top:50%;z-index:10135}.wdi_image_info_container1{height:100%;margin:0 auto;position:absolute;width:100%}.wdi_image_info_container2{display:table;height:100%;margin:0 auto;position:absolute;width:100%}.wdi_image_info_spun{display:table-cell;height:100%;left:0;top:0;width:100%;overflow:hidden;position:relative}.wdi_image_info{display:inline-block;position:relative;text-decoration:none;word-wrap:break-word;z-index:11}.wdi_photo_wrap_inner{text-align:center}.wdi_feed_item[wdi_type=slideshow] .tenweb-i-clone{-webkit-transform:rotate(180deg);-moz-transform:rotate(180deg);-o-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.wdi_js_error_no_animate,.wdi_token_error{text-align:center;font-size:14px}.wdi_js_error{text-align:center;-webkit-animation-name:wdi_js_error;-moz-animation-name:wdi_js_error;-o-animation-name:wdi_js_error;animation-name:wdi_js_error;-webkit-animation-duration:.5s;-moz-animation-duration:.5s;-o-animation-duration:.5s;animation-duration:.5s;-webkit-animation-delay:20s;-moz-animation-delay:20s;-o-animation-delay:20s;animation-delay:20s;-webkit-animation-fill-mode:forwards;-moz-animation-fill-mode:forwards;-o-animation-fill-mode:forwards;animation-fill-mode:forwards;color:#c00;-webkit-transform:scale(0);-moz-transform:scale(0);-ms-transform:scale(0);-o-transform:scale(0);transform:scale(0);font-size:12px}@keyframes wdi_js_error{from{visibility:hidden;-webkit-transform:scale(0);-moz-transform:scale(0);-ms-transform:scale(0);-o-transform:scale(0);transform:scale(0)}to{visibility:visible;-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}}.wdi_layout_th .wdi_feed_container{min-width:160px;margin:0 auto}.wdi_layout_th .wdi_feed_wrapper{margin:0 auto}.wdi_layout_th .wdi_header_wrapper{display:inline-table}.wdi_layout_th .wdi_header_img_wrap{overflow:hidden}.wdi_layout_th .wdi_header_text{display:table-cell;vertical-align:middle}.wdi_layout_th .wdi_single_user{display:inline-block;float:left}.wdi_layout_th .wdi_user_img_wrap{display:inline-block;float:left;position:relative}.wdi_layout_th .wdi_header_user_text{display:inline-block;float:left;width:100%}.wdi_layout_th .wdi_followers,.wdi_layout_th .wdi_posts{display:inline-block}.wdi_layout_th .wdi_feed_container .wdi_feed_info .wdi_header_user_text h3{display:inline-block;text-transform:none}.wdi_layout_th .wdi_header_user_text h3:hover{cursor:pointer}.wdi_layout_th .wdi_user_img_wrap img{overflow:hidden;display:block;margin:0}.wdi_layout_th .wdi_feed_container .wdi_feed_info .wdi_header_user_text h3{margin-left:10px;margin-bottom:0;padding:0}.wdi_layout_th .wdi_feed_container .wdi_feed_info .wdi_media_info p{margin-top:0;margin-bottom:0}.wdi_layout_th .wdi_user_controls{margin-left:0;display:inline-block;vertical-align:middle}.wdi_layout_th .wdi_bio{float:left}.wdi_layout_th .wdi_feed_container .wdi_feed_info .wdi_header_user_text .wdi_followers{margin-left:10px}.wdi_layout_th .wdi_filter_overlay{position:absolute;z-index:2;top:0;left:0;opacity:0;transition:opacity .1s ease}.wdi_layout_th .wdi_filter_overlay:hover{opacity:.9;cursor:pointer}.wdi_layout_th .wdi_photo_wrap{position:relative;display:inline-block;overflow:hidden;box-sizing:content-box}.wdi_layout_th .wdi_photo_wrap:after{padding-top:100%;display:block;content:""}.wdi_layout_th .wdi_photo_wrap_inner{position:absolute;top:0;bottom:0;left:0;right:0}.wdi_layout_th .wdi_photo_img{width:100%;height:100%}.wdi_layout_th .wdi_img{display:block;position:absolute;top:50%;left:50%;max-width:none;-webkit-transform:translateX(-50%) translateY(-50%);-moz-transform:translateX(-50%) translateY(-50%);-ms-transform:translateX(-50%) translateY(-50%);-o-transform:translateX(-50%) translateY(-50%);transform:translateX(-50%) translateY(-50%)}.wdi_layout_th .wdi_shape_portrait .wdi_img,.wdi_layout_th .wdi_shape_square .wdi_img{width:100%;height:auto}.wdi_layout_th .wdi_shape_landscape .wdi_img{height:100%!important;width:auto}.wdi_layout_th .wdi_feed_item{display:inline-block;vertical-align:top;overflow:hidden}.wdi_layout_th .wdi_photo_meta{text-align:center;padding-bottom:10px;line-height:1.4}.wdi_layout_th .wdi_thumb_comments i,.wdi_layout_th .wdi_thumb_likes i{width:100%}.wdi_layout_th .wdi_photo_title{text-overflow:ellipsis;overflow:hidden;white-space:nowrap;width:90%;margin-left:5%;margin-right:5%;text-align:center}.wdi_layout_th .wdi_photo_title:hover{cursor:pointer}@-moz-keyframes wdi_rotate{from{transform:rotate(0)}to{transform:rotate(360deg)}}@-o-keyframes wdi_rotate{from{transform:rotate(0)}to{transform:rotate(360deg)}}@-ms-keyframes wdi_rotate{from{transform:rotate(0)}to{transform:rotate(360deg)}}@-webkit-keyframes wdi_rotate{from{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes wdi_rotate{from{transform:rotate(0)}to{transform:rotate(360deg)}}.wdi_layout_bs .wdi_load_more_spinner,.wdi_layout_ms .wdi_load_more_spinner,.wdi_layout_th .wdi_load_more_spinner{display:table-cell;vertical-align:middle;-webkit-animation:wdi_rotate 1.5s infinite;-moz-animation:wdi_rotate 1.5s infinite;-o-animation:wdi_rotate 1.5s infinite;animation:wdi_rotate 1.5s infinite}.wdi_layout_th .wdi_load_more,.wdi_layout_th .wdi_spinner{padding:10px;transition:all .2s ease}.wdi_layout_th .wdi_load_more_wrap,.wdi_layout_th .wdi_spinner_wrap{display:inline-table;box-sizing:border-box}.wdi_layout_th .wdi_load_more_wrap_inner,.wdi_layout_th .wdi_spinner_wrap_inner{display:table-row;text-align:center}.wdi_layout_th .wdi_load_more_text{display:table-cell;vertical-align:middle}.wdi_layout_th .wdi_load_more_text img{float:left}.wdi_layout_th .wdi_load_more_wrap:hover{cursor:pointer}.wdi_layout_th .wdi_photo_overlay{transition:all .5s ease}.wdi_layout_th .wdi_photo_overlay:hover{cursor:pointer}.wdi_layout_th .wdi_photo_overlay i{color:transparent;transition:all .5s ease}.wdi_layout_th .wdi_photo_img img{transition:all .5s ease}.wdi_layout_th .wdi_load_more_container{display:inline-block}.wdi_layout_th .wdi_media_user{position:absolute;bottom:0;right:0;font-size:16px;border-radius:100px 0 0 0;padding-left:10px;padding-right:5px;line-height:1.5}.wdi_layout_ms .wdi_feed_container{min-width:160px;margin:0 auto}.wdi_layout_ms .wdi_feed_wrapper{position:relative;margin:0 auto}.wdi_layout_ms .wdi_header_wrapper{display:inline-table}.wdi_layout_ms .wdi_header_img_wrap,.wdi_layout_ms .wdi_users_img_wrap{overflow:hidden}.wdi_layout_ms .wdi_header_text{display:table-cell;vertical-align:middle}.wdi_layout_ms .wdi_single_user{display:inline-block;float:left}.wdi_layout_ms .wdi_user_img_wrap{display:inline-block;float:left;position:relative}.wdi_layout_ms .wdi_header_user_text{display:inline-block;float:left;width:100%}.wdi_layout_ms .wdi_followers,.wdi_layout_ms .wdi_posts{display:inline-block}.wdi_layout_ms .wdi_header_user_text h3{display:inline-block;text-transform:none}.wdi_layout_ms .wdi_header_user_text h3:hover{cursor:pointer}.wdi_layout_ms .wdi_user_img_wrap img{overflow:hidden;display:block;margin:0}.wdi_layout_ms .wdi_feed_container .wdi_feed_info .wdi_header_user_text h3{margin-left:10px;margin-bottom:0}.wdi_layout_ms .wdi_feed_container .wdi_feed_info .wdi_media_info p{margin-top:0;margin-bottom:0}.wdi_layout_ms .wdi_user_controls{margin-left:0;display:inline-block;vertical-align:middle}.wdi_layout_ms .wdi_bio{float:left}.wdi_layout_ms .wdi_feed_container .wdi_feed_info .wdi_header_user_text .wdi_followers{margin-left:10px}.wdi_layout_ms .wdi_filter_overlay{position:absolute;z-index:2;top:0;left:0;opacity:0;transition:opacity .1s ease}.wdi_layout_ms .wdi_filter_overlay:hover{opacity:.9;cursor:pointer}.wdi_layout_ms .wdi_photo_wrap{overflow:hidden;box-sizing:content-box}.wdi_layout_ms .wdi_img{width:100%;display:block}.wdi_layout_ms .wdi_masonry_column{display:block;overflow:hidden;float:left}.wdi_layout_ms .wdi_photo_meta{text-align:center;padding-bottom:10px}.wdi_layout_ms .wdi_likes i,.wdi_layout_ms .wdi_thumb_comments i{width:100%}.wdi_layout_ms .wdi_photo_title{text-overflow:ellipsis;overflow:hidden;width:90%;margin-left:5%;margin-right:5%;text-align:center}.wdi_layout_ms .wdi_photo_title:hover{cursor:pointer}.wdi_layout_ms .wdi_load_more,.wdi_layout_ms .wdi_spinner{padding:10px;transition:all .2s ease}.wdi_layout_ms .wdi_load_more_wrap,.wdi_layout_ms .wdi_spinner_wrap{display:inline-table;box-sizing:border-box}.wdi_layout_ms .wdi_load_more_wrap_inner,.wdi_layout_ms .wdi_spinner_wrap_inner{display:table-row;text-align:center}.wdi_layout_ms .wdi_load_more_text{display:table-cell;vertical-align:middle}.wdi_layout_ms .wdi_load_more_text img{float:left}.wdi_layout_ms .wdi_load_more_wrap:hover{cursor:pointer}.wdi_layout_ms .wdi_photo_overlay{transition:all .5s ease}.wdi_layout_ms .wdi_photo_overlay:hover{cursor:pointer}.wdi_layout_ms .wdi_photo_overlay i{color:transparent;transition:all .5s ease}.wdi_layout_ms .wdi_photo_img img{transition:all .5s ease}.wdi_layout_ms .wdi_load_more_container{display:inline-block}.wdi_layout_ms .wdi_media_user{position:absolute;bottom:0;right:0;font-size:16px;border-radius:100px 0 0 0;padding-left:10px;padding-right:5px}.wdi_layout_ib .wdi_feed_container{min-width:160px;margin:0 auto}.wdi_layout_ib .wdi_feed_wrapper{margin:0 auto}.wdi_layout_ib .wdi_header_wrapper{display:inline-table}.wdi_layout_ib .wdi_header_img_wrap,.wdi_layout_ib .wdi_users_img_wrap{overflow:hidden}.wdi_layout_ib .wdi_header_text{display:table-cell;vertical-align:middle}.wdi_layout_ib .wdi_single_user{display:inline-block;float:left}.wdi_layout_ib .wdi_user_img_wrap{display:inline-block;float:left;position:relative}.wdi_layout_ib .wdi_header_user_text{display:inline-block;float:left;width:100%}.wdi_layout_ib .wdi_followers,.wdi_layout_ib .wdi_posts{display:inline-block}.wdi_layout_ib .wdi_feed_container .wdi_feed_info .wdi_header_user_text h3{display:inline-block;text-transform:none}.wdi_layout_ib .wdi_header_user_text h3:hover{cursor:pointer}.wdi_layout_ib .wdi_user_img_wrap img{overflow:hidden;display:block;margin:0}.wdi_layout_ib .wdi_feed_container .wdi_feed_info .wdi_header_user_text h3{margin-left:10px;margin-bottom:0;padding:0}.wdi_layout_ib .wdi_feed_container .wdi_feed_info .wdi_media_info p{margin-top:0;margin-bottom:0}.wdi_layout_ib .wdi_user_controls{margin-left:0;display:inline-block;vertical-align:middle}.wdi_layout_ib .wdi_bio{float:left}.wdi_layout_ib .wdi_feed_container .wdi_feed_info .wdi_header_user_text .wdi_followers{margin-left:10px}.wdi_layout_ib .wdi_filter_overlay{position:absolute;z-index:2;top:0;left:0;opacity:0;transition:opacity .1s ease}.wdi_layout_ib .wdi_filter_overlay:hover{opacity:.9;cursor:pointer}.wdi_layout_ib .wdi_photo_wrap{overflow:hidden;box-sizing:content-box}.wdi_layout_ib .wdi_img{width:100%;display:block}.wdi_layout_ib .wdi_feed_item{display:inline-block;overflow:hidden}.wdi_layout_ib .wdi_photo_meta{text-align:center;padding-bottom:10px}.wdi_layout_ib .wdi_thumb_comments i,.wdi_layout_ib .wdi_thumb_likes i{width:100%}.wdi_layout_ib .wdi_photo_title{text-overflow:ellipsis;overflow:hidden;white-space:nowrap;width:90%;margin-left:5%;margin-right:5%;text-align:center}.wdi_layout_ib .wdi_photo_title:hover{cursor:pointer}.wdi_layout_ib .wdi_load_more{padding:10px;transition:all .2s ease}.wdi_layout_ib .wdi_load_more_wrap{display:inline-table;box-sizing:border-box}.wdi_layout_ib .wdi_load_more_wrap_inner{display:table-row;text-align:center}.wdi_layout_ib .wdi_load_more_text{display:table-cell;vertical-align:middle}.wdi_layout_ib .wdi_load_more_text img{float:left}.wdi_layout_ib .wdi_load_more_wrap:hover{cursor:pointer}.wdi_layout_ib .wdi_photo_overlay:hover{cursor:pointer}.wdi_layout_ib .wdi_load_more_container{display:inline-block}.wdi_layout_bs .wdi_feed_container{min-width:160px;margin:0 auto}.wdi_layout_bs .wdi_feed_wrapper{margin:0 auto}.wdi_layout_bs .wdi_header_wrapper{display:inline-table}.wdi_layout_bs .wdi_header_img_wrap,.wdi_layout_bs .wdi_users_img_wrap{overflow:hidden}.wdi_layout_bs .wdi_header_text{display:table-cell;vertical-align:middle}.wdi_layout_bs .wdi_single_user{display:inline-block;float:left}.wdi_layout_bs .wdi_user_img_wrap{display:inline-block;float:left;position:relative}.wdi_layout_bs .wdi_header_user_text{display:inline-block;float:left;width:100%}.wdi_layout_bs .wdi_followers,.wdi_layout_bs .wdi_posts{display:inline-block}.wdi_layout_bs .wdi_header_user_text h3{display:inline-block;text-transform:none}.wdi_layout_bs .wdi_header_user_text h3:hover{cursor:pointer}.wdi_layout_bs .wdi_user_img_wrap img{overflow:hidden;display:block;margin:0}.wdi_layout_bs .wdi_feed_container .wdi_feed_info .wdi_header_user_text h3{margin-left:10px;margin-bottom:0}.wdi_feed_info .wdi_header_user_text h3{padding-top:0}.wdi_layout_bs .wdi_feed_container .wdi_feed_info .wdi_media_info p{margin-top:0;margin-bottom:0}.wdi_layout_bs .wdi_user_controls{margin-left:0;display:inline-block;vertical-align:middle}.wdi_layout_bs .wdi_bio{float:left}.wdi_layout_bs .wdi_feed_container .wdi_feed_info .wdi_header_user_text .wdi_followers{margin-left:10px}.wdi_layout_bs .wdi_filter_overlay{position:absolute;z-index:2;top:0;left:0;opacity:0;transition:opacity .1s ease}.wdi_layout_bs .wdi_filter_overlay:hover{opacity:.9;cursor:pointer}.wdi_layout_bs .wdi_photo_wrap{overflow:hidden;box-sizing:content-box}.wdi_layout_bs .wdi_img{width:100%;display:block}.wdi_layout_bs .wdi_feed_item{display:inline-block;overflow:hidden}.wdi_layout_bs .wdi_photo_meta{text-align:center;padding-bottom:10px}.wdi_layout_bs .wdi_thumb_comments i,.wdi_layout_bs .wdi_thumb_likes i{width:100%}.wdi_layout_bs .wdi_photo_title{text-overflow:ellipsis;overflow:hidden;white-space:normal;width:90%;margin-left:5%;margin-right:5%;text-align:center}.wdi_layout_bs .wdi_load_more,.wdi_layout_bs .wdi_spinner{padding:10px;transition:all .2s ease}.wdi_layout_bs .wdi_load_more_wrap,.wdi_layout_bs .wdi_spinner_wrap{display:inline-table;box-sizing:border-box}.wdi_layout_bs .wdi_load_more_wrap_inner,.wdi_layout_bs .wdi_spinner_wrap_inner{display:table-row;text-align:center}.wdi_layout_bs .wdi_load_more_text{display:table-cell;vertical-align:middle}.wdi_layout_bs .wdi_load_more_text img{float:left}.wdi_layout_bs .wdi_load_more_wrap:hover{cursor:pointer}.wdi_layout_bs .wdi_photo_overlay:hover{cursor:pointer}.wdi_layout_bs .wdi_load_more_container{display:inline-block}.wdi_embed_frame video{display:inline-block}.wdi_image_container img{display:inline}.wdi_carousel_btn_container{height:20px;position:absolute;width:100%;bottom:65px;z-index:10150;font-size:0}.wdi_carousel_btn_container span{background:rgba(255,255,255,.5);width:10px;height:10px;display:inline-block;border-radius:5px;cursor:pointer;margin-right:9px;position:relative;left:0;transition:left .3s;-webkit-transition:left .3s;-moz-transition:left .3s}.wdi_carousel_btn_container span:last-child{margin-right:0}.wdi_carousel_btn_container span.active{background:#fff}.wdi_carousel_btn_container span.small{width:7px;height:7px;margin-right:12px;top:-2px}.wdi_carousel_btn_content{display:inline-block;overflow:hidden;white-space:nowrap;position:relative;padding:8px 9px;background:rgba(0,0,0,.17);border-radius:21px}.wdi_image_container .carousel_media:not(.active){display:none}.wdi_website{width:100%;display:block;float:left}.wdi_website a{box-shadow:none!important;color:#003569;text-decoration:none}.elementor-editor-active .wdi_front_overlay{position:absolute;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.2)}
1
+ .wdi_clear{clear:both}.wdi_feed_main_container .table{display:table}.wdi_feed_main_container .table-cell{display:table-cell}.wdi_feed_main_container .table-row{display:table-row}.wdi_feed_main_container{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.wdi_follow_button:hover{cursor:pointer}.wdi_hidden{display:none!important}.wdi_hover_off:hover{background-color:transparent!important}.wdi_cursor_off:hover{cursor:auto!important}.wdi_filter_active span{color:#fff}.wdi_disabled{visibility:hidden}.wdi_ajax_loading{position:absolute;width:50px;height:50px;left:0;right:0;bottom:-60px;margin:auto;z-index:100}.wdi_feed_main_container{width:100%;position:relative}.wdi_feed_main_container .wdi_img{margin:0}.wdi_feed_main_container .wdi_follow_btn{display:inline-block;background:0 0;border-style:solid;border-width:1px;font-weight:500;outline:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;-webkit-appearance:none;vertical-align:text-bottom}.wdi_feed_main_container .wdi_follow_btn:hover{cursor:pointer}.wdi_feed_main_container .wdi_pagination{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.wdi_feed_main_container .wdi_pagination_ctrl{display:inline-block}.wdi_feed_main_container .wdi_pagination_ctrl:hover{cursor:pointer}.wdi_feed_main_container .wdi_filter_icon span{display:block;font-size:25px;color:#fff}.wdi_feed_main_container .wdi_filter_icon span::before{width:20px;height:20px;position:absolute;opacity:1;right:0;left:0;top:0;bottom:0;margin:auto}.wdi_photo_img{position:relative;overflow:hidden}.wdi_photo_overlay{width:100%;height:100%;position:absolute;top:0;left:0;background-color:transparent;transition:all .1s ease}.wdi_photo_overlay:hover .wdi_thumb_icon i{display:block}.wdi_feed_main_container .tenweb{font-family:tenweb!important;font-style:normal;width:auto;speak:none;display:inline-block;line-height:1;font-weight:400;font-variant:normal;text-transform:none;vertical-align:top;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.wdi_media_info .tenweb-i:before{margin-right:6px}.wdi_spider_popup_loading{background-image:url(../images/ajax_loader.png);background-color:rgba(0,0,0,0);background-repeat:no-repeat;background-position:0 0;background-size:50px 50px;border:none!important;display:none;height:50px;left:50%;margin-left:-20px;margin-top:-20px;overflow:hidden;position:fixed;top:50%;width:50px;z-index:10102;-moz-animation:spin 2.5s infinite linear;-o-animation:spin 2.5s infinite linear;-webkit-animation:spin 2.5s infinite linear;animation:spin 2.5s infinite linear}.wdi_spider_popup_overlay{cursor:pointer;background-color:rgba(0,0,0,.5);display:none;height:100%;left:0;position:fixed;top:0;width:100%;z-index:10100}div[id^=wdi_container] p{padding:0!important;margin:0!important}.footer-list-block .bwp_gallery .wdi_spider_popup_loading,.footer-list-block .bwp_gallery_tags .wdi_spider_popup_loading,.wdi_spider_popup_loading{background-image:url(../images/ajax_loader.png);background-color:rgba(0,0,0,0);background-repeat:no-repeat;background-position:0 0;background-size:50px 50px;border:none!important;display:none;height:50px;left:50%;margin-left:-20px;margin-top:-20px;overflow:hidden;position:fixed;top:50%;width:50px;z-index:10102;-moz-animation:spin 2.5s infinite linear;-o-animation:spin 2.5s infinite linear;-webkit-animation:spin 2.5s infinite linear;animation:spin 2.5s infinite linear}.wdi_spider_ajax_loading{border:none!important;-moz-animation:spin 2.5s infinite linear;-o-animation:spin 2.5s infinite linear;-webkit-animation:spin 2.5s infinite linear;animation:spin 2.5s infinite linear}.footer-list-block .bwp_gallery .wdi_spider_popup_overlay,.footer-list-block .bwp_gallery_tags .wdi_spider_popup_overlay,.wdi_spider_popup_overlay{cursor:pointer;display:none;height:100%;left:0;position:fixed;top:0;width:100%;z-index:10100}.wdi_spider_popup_close,.wdi_spider_popup_close_fullscreen{-moz-box-sizing:content-box!important;box-sizing:content-box!important;cursor:pointer;display:table;line-height:0;position:absolute;z-index:11100}#wdi_spider_popup_left{left:0}#wdi_spider_popup_right{right:0}#wdi_spider_popup_left:hover,#wdi_spider_popup_right:hover{visibility:visible}#wdi_spider_popup_left:hover span{left:20px}#wdi_spider_popup_right:hover span{left:auto;right:20px}#wdi_spider_popup_left,#wdi_spider_popup_right{background:transparent url(../images/blank.gif) repeat scroll 0 0;bottom:35%;cursor:pointer;display:inline;height:30%;outline:medium none;position:absolute;width:35%;z-index:10130}#wdi_spider_popup_left-ico,#wdi_spider_popup_right-ico{-moz-box-sizing:border-box;box-sizing:border-box;cursor:pointer;display:table;left:-9999px;line-height:0;margin-top:-15px;position:absolute;top:50%;z-index:10135}.wdi_image_info_container1{height:100%;margin:0 auto;position:absolute;width:100%}.wdi_image_info_container2{display:table;height:100%;margin:0 auto;position:absolute;width:100%}.wdi_image_info_spun{display:table-cell;height:100%;left:0;top:0;width:100%;overflow:hidden;position:relative}.wdi_image_info{display:inline-block;position:relative;text-decoration:none;word-wrap:break-word;z-index:11}.wdi_photo_wrap_inner{text-align:center}.wdi_feed_item[wdi_type=slideshow] .tenweb-i-clone{-webkit-transform:rotate(180deg);-moz-transform:rotate(180deg);-o-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.wdi_js_error_no_animate,.wdi_token_error{text-align:center;font-size:14px}.wdi_js_error{text-align:center;-webkit-animation-name:wdi_js_error;-moz-animation-name:wdi_js_error;-o-animation-name:wdi_js_error;animation-name:wdi_js_error;-webkit-animation-duration:.5s;-moz-animation-duration:.5s;-o-animation-duration:.5s;animation-duration:.5s;-webkit-animation-delay:20s;-moz-animation-delay:20s;-o-animation-delay:20s;animation-delay:20s;-webkit-animation-fill-mode:forwards;-moz-animation-fill-mode:forwards;-o-animation-fill-mode:forwards;animation-fill-mode:forwards;color:#c00;-webkit-transform:scale(0);-moz-transform:scale(0);-ms-transform:scale(0);-o-transform:scale(0);transform:scale(0);font-size:12px}@keyframes wdi_js_error{from{visibility:hidden;-webkit-transform:scale(0);-moz-transform:scale(0);-ms-transform:scale(0);-o-transform:scale(0);transform:scale(0)}to{visibility:visible;-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);transform:scale(1)}}.wdi_layout_th .wdi_feed_container{min-width:160px;margin:0 auto}.wdi_layout_th .wdi_feed_wrapper{margin:0 auto}.wdi_layout_th .wdi_header_wrapper{display:inline-table}.wdi_layout_th .wdi_header_img_wrap{overflow:hidden}.wdi_layout_th .wdi_header_text{display:table-cell;vertical-align:middle}.wdi_layout_th .wdi_single_user{display:inline-block;float:left}.wdi_layout_th .wdi_user_img_wrap{display:inline-block;float:left;position:relative}.wdi_layout_th .wdi_header_user_text{display:inline-block;float:left;width:100%}.wdi_layout_th .wdi_followers,.wdi_layout_th .wdi_posts{display:inline-block}.wdi_layout_th .wdi_feed_container .wdi_feed_info .wdi_header_user_text h3{display:inline-block;text-transform:none}.wdi_layout_th .wdi_header_user_text h3:hover{cursor:pointer}.wdi_layout_th .wdi_user_img_wrap img{overflow:hidden;display:block;margin:0}.wdi_layout_th .wdi_feed_container .wdi_feed_info .wdi_header_user_text h3{margin-left:10px;margin-bottom:0;padding:0}.wdi_layout_th .wdi_feed_container .wdi_feed_info .wdi_media_info p{margin-top:0;margin-bottom:0}.wdi_layout_th .wdi_user_controls{margin-left:0;display:inline-block;vertical-align:middle}.wdi_layout_th .wdi_bio{float:left}.wdi_layout_th .wdi_feed_container .wdi_feed_info .wdi_header_user_text .wdi_followers{margin-left:10px}.wdi_layout_th .wdi_filter_overlay{position:absolute;z-index:2;top:0;left:0;opacity:0;transition:opacity .1s ease}.wdi_layout_th .wdi_filter_overlay:hover{opacity:.9;cursor:pointer}.wdi_layout_th .wdi_photo_wrap{position:relative;display:inline-block;overflow:hidden;box-sizing:content-box}.wdi_layout_th .wdi_photo_wrap:after{padding-top:100%;display:block;content:""}.wdi_layout_th .wdi_photo_wrap_inner{position:absolute;top:0;bottom:0;left:0;right:0}.wdi_layout_th .wdi_photo_img{width:100%;height:100%}.wdi_layout_th .wdi_img{display:block;position:absolute;top:50%;left:50%;max-width:none;-webkit-transform:translateX(-50%) translateY(-50%);-moz-transform:translateX(-50%) translateY(-50%);-ms-transform:translateX(-50%) translateY(-50%);-o-transform:translateX(-50%) translateY(-50%);transform:translateX(-50%) translateY(-50%)}.wdi_layout_th .wdi_shape_portrait .wdi_img,.wdi_layout_th .wdi_shape_square .wdi_img{width:100%;height:auto}.wdi_layout_th .wdi_shape_landscape .wdi_img{height:100%!important;width:auto}.wdi_layout_th .wdi_feed_item{width:100%;display:inline-block;vertical-align:top;overflow:hidden}.wdi_layout_th .wdi_photo_meta{text-align:center;padding-bottom:10px;line-height:1.4}.wdi_layout_th .wdi_thumb_comments i,.wdi_layout_th .wdi_thumb_likes i{width:100%}.wdi_layout_th .wdi_photo_title{text-overflow:ellipsis;overflow:hidden;white-space:nowrap;width:90%;margin-left:5%;margin-right:5%;text-align:center}.wdi_layout_th .wdi_photo_title:hover{cursor:pointer}@-moz-keyframes wdi_rotate{from{transform:rotate(0)}to{transform:rotate(360deg)}}@-o-keyframes wdi_rotate{from{transform:rotate(0)}to{transform:rotate(360deg)}}@-ms-keyframes wdi_rotate{from{transform:rotate(0)}to{transform:rotate(360deg)}}@-webkit-keyframes wdi_rotate{from{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes wdi_rotate{from{transform:rotate(0)}to{transform:rotate(360deg)}}.wdi_layout_bs .wdi_load_more_spinner,.wdi_layout_ms .wdi_load_more_spinner,.wdi_layout_th .wdi_load_more_spinner{display:table-cell;vertical-align:middle;-webkit-animation:wdi_rotate 1.5s infinite;-moz-animation:wdi_rotate 1.5s infinite;-o-animation:wdi_rotate 1.5s infinite;animation:wdi_rotate 1.5s infinite}.wdi_layout_th .wdi_load_more,.wdi_layout_th .wdi_spinner{padding:10px;transition:all .2s ease}.wdi_layout_th .wdi_load_more_wrap,.wdi_layout_th .wdi_spinner_wrap{display:inline-table;box-sizing:border-box}.wdi_layout_th .wdi_load_more_wrap_inner,.wdi_layout_th .wdi_spinner_wrap_inner{display:table-row;text-align:center}.wdi_layout_th .wdi_load_more_text{display:table-cell;vertical-align:middle}.wdi_layout_th .wdi_load_more_text img{float:left}.wdi_layout_th .wdi_load_more_wrap:hover{cursor:pointer}.wdi_layout_th .wdi_photo_overlay{transition:all .5s ease}.wdi_layout_th .wdi_photo_overlay:hover{cursor:pointer}.wdi_layout_th .wdi_photo_overlay i{color:transparent;transition:all .5s ease}.wdi_layout_th .wdi_photo_img img{transition:all .5s ease}.wdi_layout_th .wdi_load_more_container{display:inline-block}.wdi_layout_th .wdi_media_user{position:absolute;bottom:0;right:0;font-size:16px;border-radius:100px 0 0 0;padding-left:10px;padding-right:5px;line-height:1.5}.wdi_layout_ms .wdi_feed_container{min-width:160px;margin:0 auto}.wdi_layout_ms .wdi_feed_wrapper{position:relative;margin:0 auto}.wdi_layout_ms .wdi_header_wrapper{display:inline-table}.wdi_layout_ms .wdi_header_img_wrap,.wdi_layout_ms .wdi_users_img_wrap{overflow:hidden}.wdi_layout_ms .wdi_header_text{display:table-cell;vertical-align:middle}.wdi_layout_ms .wdi_single_user{display:inline-block;float:left}.wdi_layout_ms .wdi_user_img_wrap{display:inline-block;float:left;position:relative}.wdi_layout_ms .wdi_header_user_text{display:inline-block;float:left;width:100%}.wdi_layout_ms .wdi_followers,.wdi_layout_ms .wdi_posts{display:inline-block}.wdi_layout_ms .wdi_header_user_text h3{display:inline-block;text-transform:none}.wdi_layout_ms .wdi_header_user_text h3:hover{cursor:pointer}.wdi_layout_ms .wdi_user_img_wrap img{overflow:hidden;display:block;margin:0}.wdi_layout_ms .wdi_feed_container .wdi_feed_info .wdi_header_user_text h3{margin-left:10px;margin-bottom:0}.wdi_layout_ms .wdi_feed_container .wdi_feed_info .wdi_media_info p{margin-top:0;margin-bottom:0}.wdi_layout_ms .wdi_user_controls{margin-left:0;display:inline-block;vertical-align:middle}.wdi_layout_ms .wdi_bio{float:left}.wdi_layout_ms .wdi_feed_container .wdi_feed_info .wdi_header_user_text .wdi_followers{margin-left:10px}.wdi_layout_ms .wdi_filter_overlay{position:absolute;z-index:2;top:0;left:0;opacity:0;transition:opacity .1s ease}.wdi_layout_ms .wdi_filter_overlay:hover{opacity:.9;cursor:pointer}.wdi_layout_ms .wdi_photo_wrap{overflow:hidden;box-sizing:content-box}.wdi_layout_ms .wdi_img{width:100%;display:block}.wdi_layout_ms .wdi_masonry_column{display:block;overflow:hidden;float:left}.wdi_layout_ms .wdi_photo_meta{text-align:center;padding-bottom:10px}.wdi_layout_ms .wdi_likes i,.wdi_layout_ms .wdi_thumb_comments i{width:100%}.wdi_layout_ms .wdi_photo_title{text-overflow:ellipsis;overflow:hidden;width:90%;margin-left:5%;margin-right:5%;text-align:center}.wdi_layout_ms .wdi_photo_title:hover{cursor:pointer}.wdi_layout_ms .wdi_load_more,.wdi_layout_ms .wdi_spinner{padding:10px;transition:all .2s ease}.wdi_layout_ms .wdi_load_more_wrap,.wdi_layout_ms .wdi_spinner_wrap{display:inline-table;box-sizing:border-box}.wdi_layout_ms .wdi_load_more_wrap_inner,.wdi_layout_ms .wdi_spinner_wrap_inner{display:table-row;text-align:center}.wdi_layout_ms .wdi_load_more_text{display:table-cell;vertical-align:middle}.wdi_layout_ms .wdi_load_more_text img{float:left}.wdi_layout_ms .wdi_load_more_wrap:hover{cursor:pointer}.wdi_layout_ms .wdi_photo_overlay{transition:all .5s ease}.wdi_layout_ms .wdi_photo_overlay:hover{cursor:pointer}.wdi_layout_ms .wdi_photo_overlay i{color:transparent;transition:all .5s ease}.wdi_layout_ms .wdi_photo_img img{transition:all .5s ease}.wdi_layout_ms .wdi_load_more_container{display:inline-block}.wdi_layout_ms .wdi_media_user{position:absolute;bottom:0;right:0;font-size:16px;border-radius:100px 0 0 0;padding-left:10px;padding-right:5px}.wdi_layout_ib .wdi_feed_container{min-width:160px;margin:0 auto}.wdi_layout_ib .wdi_feed_wrapper{margin:0 auto}.wdi_layout_ib .wdi_header_wrapper{display:inline-table}.wdi_layout_ib .wdi_header_img_wrap,.wdi_layout_ib .wdi_users_img_wrap{overflow:hidden}.wdi_layout_ib .wdi_header_text{display:table-cell;vertical-align:middle}.wdi_layout_ib .wdi_single_user{display:inline-block;float:left}.wdi_layout_ib .wdi_user_img_wrap{display:inline-block;float:left;position:relative}.wdi_layout_ib .wdi_header_user_text{display:inline-block;float:left;width:100%}.wdi_layout_ib .wdi_followers,.wdi_layout_ib .wdi_posts{display:inline-block}.wdi_layout_ib .wdi_feed_container .wdi_feed_info .wdi_header_user_text h3{display:inline-block;text-transform:none}.wdi_layout_ib .wdi_header_user_text h3:hover{cursor:pointer}.wdi_layout_ib .wdi_user_img_wrap img{overflow:hidden;display:block;margin:0}.wdi_layout_ib .wdi_feed_container .wdi_feed_info .wdi_header_user_text h3{margin-left:10px;margin-bottom:0;padding:0}.wdi_layout_ib .wdi_feed_container .wdi_feed_info .wdi_media_info p{margin-top:0;margin-bottom:0}.wdi_layout_ib .wdi_user_controls{margin-left:0;display:inline-block;vertical-align:middle}.wdi_layout_ib .wdi_bio{float:left}.wdi_layout_ib .wdi_feed_container .wdi_feed_info .wdi_header_user_text .wdi_followers{margin-left:10px}.wdi_layout_ib .wdi_filter_overlay{position:absolute;z-index:2;top:0;left:0;opacity:0;transition:opacity .1s ease}.wdi_layout_ib .wdi_filter_overlay:hover{opacity:.9;cursor:pointer}.wdi_layout_ib .wdi_photo_wrap{overflow:hidden;box-sizing:content-box}.wdi_layout_ib .wdi_img{width:100%;display:block}.wdi_layout_ib .wdi_feed_item{display:inline-block;overflow:hidden}.wdi_layout_ib .wdi_photo_meta{text-align:center;padding-bottom:10px}.wdi_layout_ib .wdi_thumb_comments i,.wdi_layout_ib .wdi_thumb_likes i{width:100%}.wdi_layout_ib .wdi_photo_title{text-overflow:ellipsis;overflow:hidden;white-space:nowrap;width:90%;margin-left:5%;margin-right:5%;text-align:center}.wdi_layout_ib .wdi_photo_title:hover{cursor:pointer}.wdi_layout_ib .wdi_load_more{padding:10px;transition:all .2s ease}.wdi_layout_ib .wdi_load_more_wrap{display:inline-table;box-sizing:border-box}.wdi_layout_ib .wdi_load_more_wrap_inner{display:table-row;text-align:center}.wdi_layout_ib .wdi_load_more_text{display:table-cell;vertical-align:middle}.wdi_layout_ib .wdi_load_more_text img{float:left}.wdi_layout_ib .wdi_load_more_wrap:hover{cursor:pointer}.wdi_layout_ib .wdi_photo_overlay:hover{cursor:pointer}.wdi_layout_ib .wdi_load_more_container{display:inline-block}.wdi_layout_bs .wdi_feed_container{min-width:160px;margin:0 auto}.wdi_layout_bs .wdi_feed_wrapper{margin:0 auto}.wdi_layout_bs .wdi_header_wrapper{display:inline-table}.wdi_layout_bs .wdi_header_img_wrap,.wdi_layout_bs .wdi_users_img_wrap{overflow:hidden}.wdi_layout_bs .wdi_header_text{display:table-cell;vertical-align:middle}.wdi_layout_bs .wdi_single_user{display:inline-block;float:left}.wdi_layout_bs .wdi_user_img_wrap{display:inline-block;float:left;position:relative}.wdi_layout_bs .wdi_header_user_text{display:inline-block;float:left;width:100%}.wdi_layout_bs .wdi_followers,.wdi_layout_bs .wdi_posts{display:inline-block}.wdi_layout_bs .wdi_header_user_text h3{display:inline-block;text-transform:none}.wdi_layout_bs .wdi_header_user_text h3:hover{cursor:pointer}.wdi_layout_bs .wdi_user_img_wrap img{overflow:hidden;display:block;margin:0}.wdi_layout_bs .wdi_feed_container .wdi_feed_info .wdi_header_user_text h3{margin-left:10px;margin-bottom:0}.wdi_feed_info .wdi_header_user_text h3{padding-top:0}.wdi_layout_bs .wdi_feed_container .wdi_feed_info .wdi_media_info p{margin-top:0;margin-bottom:0}.wdi_layout_bs .wdi_user_controls{margin-left:0;display:inline-block;vertical-align:middle}.wdi_layout_bs .wdi_bio{float:left}.wdi_layout_bs .wdi_feed_container .wdi_feed_info .wdi_header_user_text .wdi_followers{margin-left:10px}.wdi_layout_bs .wdi_filter_overlay{position:absolute;z-index:2;top:0;left:0;opacity:0;transition:opacity .1s ease}.wdi_layout_bs .wdi_filter_overlay:hover{opacity:.9;cursor:pointer}.wdi_layout_bs .wdi_photo_wrap{overflow:hidden;box-sizing:content-box}.wdi_layout_bs .wdi_img{width:100%;display:block}.wdi_layout_bs .wdi_feed_item{display:inline-block;overflow:hidden}.wdi_layout_bs .wdi_photo_meta{text-align:center;padding-bottom:10px}.wdi_layout_bs .wdi_thumb_comments i,.wdi_layout_bs .wdi_thumb_likes i{width:100%}.wdi_layout_bs .wdi_photo_title{text-overflow:ellipsis;overflow:hidden;white-space:normal;width:90%;margin-left:5%;margin-right:5%;text-align:center}.wdi_layout_bs .wdi_load_more,.wdi_layout_bs .wdi_spinner{padding:10px;transition:all .2s ease}.wdi_layout_bs .wdi_load_more_wrap,.wdi_layout_bs .wdi_spinner_wrap{display:inline-table;box-sizing:border-box}.wdi_layout_bs .wdi_load_more_wrap_inner,.wdi_layout_bs .wdi_spinner_wrap_inner{display:table-row;text-align:center}.wdi_layout_bs .wdi_load_more_text{display:table-cell;vertical-align:middle}.wdi_layout_bs .wdi_load_more_text img{float:left}.wdi_layout_bs .wdi_load_more_wrap:hover{cursor:pointer}.wdi_layout_bs .wdi_photo_overlay:hover{cursor:pointer}.wdi_layout_bs .wdi_load_more_container{display:inline-block}.wdi_embed_frame video{display:inline-block}.wdi_image_container img{display:inline}.wdi_carousel_btn_container{height:20px;position:absolute;width:100%;bottom:65px;z-index:10150;font-size:0}.wdi_carousel_btn_container span{background:rgba(255,255,255,.5);width:10px;height:10px;display:inline-block;border-radius:5px;cursor:pointer;margin-right:9px;position:relative;left:0;transition:left .3s;-webkit-transition:left .3s;-moz-transition:left .3s}.wdi_carousel_btn_container span:last-child{margin-right:0}.wdi_carousel_btn_container span.active{background:#fff}.wdi_carousel_btn_container span.small{width:7px;height:7px;margin-right:12px;top:-2px}.wdi_carousel_btn_content{display:inline-block;overflow:hidden;white-space:nowrap;position:relative;padding:8px 9px;background:rgba(0,0,0,.17);border-radius:21px}.wdi_image_container .carousel_media:not(.active){display:none}.wdi_website{width:100%;display:block;float:left}.wdi_website a{box-shadow:none!important;color:#003569;text-decoration:none}.elementor-editor-active .wdi_front_overlay{position:absolute;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.2)}#wdi_added_comments{padding-top:20px}.wdi_comment_container #ajax_loading{left:calc(50% - 25px);top:calc(50% - 25px)}
framework/WDIInstagram.php CHANGED
@@ -31,7 +31,7 @@ class WDIInstagram {
31
  * @return array current feed filter data
32
  */
33
  public function get_filters( $feed_id ) {
34
- return array();
35
  }
36
 
37
  /**
@@ -121,17 +121,24 @@ class WDIInstagram {
121
 
122
  $response = wp_remote_get($baseUrl, $args);
123
  if ( !isset($response->errors) && is_array($response) && isset($response["body"]) ) {
124
- $response_arr = json_decode( $response["body"], 1 );
125
  $return_data["response"] = $response_arr;
126
- if ( !empty($this->conditions) ) {
127
- $this->cache->set_cache_data($baseUrl."&iter=".$this->iter, base64_encode(json_encode($return_data)));
128
- $response_arr['data'] = $this->filterUserMedia( $response_arr, $this->conditions['conditional_filters'], $this->conditions['conditional_filter_type'] );
 
 
 
 
129
  $response_arr['iter'] = $this->iter;
130
  $return_data["response"] = $response_arr;
131
- } else {
 
132
  $this->cache->set_cache_data($baseUrl, base64_encode(json_encode($return_data)));
 
 
 
133
  }
134
- return json_encode($return_data);
135
  }
136
  $return_data = '{"error":{"message":"cURL error","type":"http_request_failed"}}';
137
  return $return_data;
@@ -231,12 +238,12 @@ class WDIInstagram {
231
  ),
232
  "user_has_liked" => ($like_count > 0),
233
  "likes" => array(
234
- "count" => 0, // media.like_count
235
  ),
236
  "tags" => array(),
237
  "filter" => "Normal",
238
  "comments" => array(
239
- "count" => 0, // media.comments_count
240
  ),
241
  "media_type" => $media["media_type"],
242
  "type" => $media_type,
@@ -250,17 +257,17 @@ class WDIInstagram {
250
  "standard_resolution" => array(
251
  "width" => 640,
252
  "height" => 800,
253
- "url" => $media["thumbnail_url"],
254
  ),
255
  "low_bandwidth" => array(
256
  "width" => 480,
257
  "height" => 600,
258
- "url" => $media["thumbnail_url"],
259
  ),
260
  "low_resolution" => array(
261
  "width" => 480,
262
  "height" => 600,
263
- "url" => $media["thumbnail_url"],
264
  ),
265
  );
266
  }
@@ -291,111 +298,80 @@ class WDIInstagram {
291
  *
292
  * @param media_id => Media id
293
  *
294
- * @return object of founded media only child media ids
295
  */
296
  private function getMediaChildren( $media_id ) {
 
297
  $carousel_media = array();
298
  $api_url = 'https://graph.instagram.com/v1.0/';
299
  if ( $this->account_data["type"] === "business" ) {
300
  $api_url = 'https://graph.facebook.com/v8.0/';
301
  }
302
  $api_url .= $media_id . '/children?access_token=' . $this->account_data["access_token"];
 
 
303
  $response = wp_remote_get($api_url, array());
304
  if ( is_array($response) && isset($response["body"]) && $this->isJson($response["body"]) ) {
305
- $media_ids = json_decode($response["body"], TRUE);
306
- if ( is_array($media_ids) && isset($media_ids["data"]) ) {
307
- foreach ( $media_ids["data"] as $id ) {
308
- if ( isset($id["id"]) ) {
309
- $media = $this->getChildMediaById($id["id"]);
310
- if(isset($media) && is_array($media)){
311
- array_push($carousel_media, $media);
312
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
313
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
314
  }
315
  }
316
  }
317
  return $carousel_media;
318
  }
319
 
320
- /**
321
- * Get media info by id.
322
- *
323
- * @param media_id => Media id
324
- * @param ind => index for object
325
- *
326
- *
327
- * @return object of founded media
328
- */
329
- private function getChildMediaById( $media_id ) {
330
- $api_url = 'https://graph.instagram.com/v1.0/';
331
- $fields = 'id,media_type,media_url,permalink,thumbnail_url,username,timestamp';
332
- if ( $this->account_data["type"] === "business" ) {
333
- $api_url = 'https://graph.facebook.com/v8.0/';
334
- $fields = 'id,ig_id,media_type,media_url,permalink,thumbnail_url,username,timestamp,shortcode';
335
- }
336
- $api_url = $api_url . $media_id . '/?fields=' . $fields . '&access_token=' . $this->account_data["access_token"];
337
- $response = wp_remote_get($api_url, array());
338
- if ( is_array($response) && isset($response["body"]) && $this->isJson($response["body"]) ) {
339
- $media_data = json_decode($response["body"], TRUE);
340
- if( isset($media_data['error']) ) {
341
- return FALSE;
342
- }
343
-
344
- if ( isset($media_data["media_type"]) && $media_data["media_type"] == "IMAGE" ) {
345
- $return_data = array(
346
- "images" => array(
347
- "thumbnail" => array(
348
- "width" => 150,
349
- "height" => 150,
350
- "url" => $media_data["media_url"],
351
- ),
352
- "low_resolution" => array(
353
- "width" => 320,
354
- "height" => 320,
355
- "url" => $media_data["media_url"],
356
- ),
357
- "standard_resolution" => array(
358
- "width" => 640,
359
- "height" => 640,
360
- "url" => $media_data["media_url"],
361
- ),
362
- ),
363
- "users_in_photo" => array(),
364
- "type" => "image",
365
- );
366
- }
367
- else {
368
- $return_data = array(
369
- "videos" => array(
370
- "standard_resolution" => array(
371
- "width" => 640,
372
- "height" => 800,
373
- "url" => esc_url_raw($media_data["media_url"]),
374
- "id" => $media_data["id"],
375
- ),
376
- "low_bandwidth" => array(
377
- "width" => 480,
378
- "height" => 600,
379
- "url" => esc_url_raw($media_data["media_url"]),
380
- "id" => $media_data["id"],
381
- ),
382
- "low_resolution" => array(
383
- "width" => 640,
384
- "height" => 800,
385
- "url" => esc_url_raw($media_data["media_url"]),
386
- "id" => $media_data["id"],
387
- ),
388
- ),
389
- "users_in_photo" => array(),
390
- "type" => "video",
391
- );
392
- }
393
- return $return_data;
394
- }
395
-
396
- return FALSE;
397
- }
398
-
399
  public function wdi_preload_cache($data=NULL) {
400
  if(isset($data)){
401
  $feed_list = $this->get_feed_list($data, FALSE);
31
  * @return array current feed filter data
32
  */
33
  public function get_filters( $feed_id ) {
34
+ return array();
35
  }
36
 
37
  /**
121
 
122
  $response = wp_remote_get($baseUrl, $args);
123
  if ( !isset($response->errors) && is_array($response) && isset($response["body"]) ) {
124
+ $response_arr = json_decode($response["body"], TRUE);
125
  $return_data["response"] = $response_arr;
126
+ if ( !empty($return_data['response']) && !empty($return_data['response']['error']) ) {
127
+ return $response['body'];
128
+ }
129
+ if ( !empty($return_data['response']) && !empty($return_data['response']['data']) ) {
130
+ if ( !empty($this->conditions) ) {
131
+ $this->cache->set_cache_data($baseUrl . "&iter=" . $this->iter, base64_encode(json_encode($return_data)));
132
+ $response_arr['data'] = $this->filterUserMedia($response_arr, $this->conditions['conditional_filters'], $this->conditions['conditional_filter_type']);
133
  $response_arr['iter'] = $this->iter;
134
  $return_data["response"] = $response_arr;
135
+ }
136
+ else {
137
  $this->cache->set_cache_data($baseUrl, base64_encode(json_encode($return_data)));
138
+ }
139
+
140
+ return json_encode($return_data);
141
  }
 
142
  }
143
  $return_data = '{"error":{"message":"cURL error","type":"http_request_failed"}}';
144
  return $return_data;
238
  ),
239
  "user_has_liked" => ($like_count > 0),
240
  "likes" => array(
241
+ "count" => isset($media["like_count"]) ? $media["like_count"] : 0, // media.like_count
242
  ),
243
  "tags" => array(),
244
  "filter" => "Normal",
245
  "comments" => array(
246
+ "count" => isset($media["comments_count"]) ? $media["comments_count"] : 0, // media.comments_count
247
  ),
248
  "media_type" => $media["media_type"],
249
  "type" => $media_type,
257
  "standard_resolution" => array(
258
  "width" => 640,
259
  "height" => 800,
260
+ "url" => (isset($media["media_url"]) ? $media["media_url"] : ""),
261
  ),
262
  "low_bandwidth" => array(
263
  "width" => 480,
264
  "height" => 600,
265
+ "url" => (isset($media["media_url"]) ? $media["media_url"] : ""),
266
  ),
267
  "low_resolution" => array(
268
  "width" => 480,
269
  "height" => 600,
270
+ "url" => (isset($media["media_url"]) ? $media["media_url"] : ""),
271
  ),
272
  );
273
  }
298
  *
299
  * @param media_id => Media id
300
  *
301
+ * @return array of founded child media data
302
  */
303
  private function getMediaChildren( $media_id ) {
304
+
305
  $carousel_media = array();
306
  $api_url = 'https://graph.instagram.com/v1.0/';
307
  if ( $this->account_data["type"] === "business" ) {
308
  $api_url = 'https://graph.facebook.com/v8.0/';
309
  }
310
  $api_url .= $media_id . '/children?access_token=' . $this->account_data["access_token"];
311
+ $fields = 'id,media_type,media_url,permalink,thumbnail_url,username,timestamp';
312
+ $api_url .= '&fields='.$fields;
313
  $response = wp_remote_get($api_url, array());
314
  if ( is_array($response) && isset($response["body"]) && $this->isJson($response["body"]) ) {
315
+ $medias = json_decode($response["body"], TRUE);
316
+ if ( is_array($medias) && isset($medias["data"]) ) {
317
+ foreach ( $medias["data"] as $media_data ) {
318
+ if ( isset($media_data["media_type"]) && $media_data["media_type"] == "IMAGE" ) {
319
+ $child_media = array(
320
+ "images" => array(
321
+ "thumbnail" => array(
322
+ "width" => 150,
323
+ "height" => 150,
324
+ "url" => $media_data["media_url"],
325
+ ),
326
+ "low_resolution" => array(
327
+ "width" => 320,
328
+ "height" => 320,
329
+ "url" => $media_data["media_url"],
330
+ ),
331
+ "standard_resolution" => array(
332
+ "width" => 640,
333
+ "height" => 640,
334
+ "url" => $media_data["media_url"],
335
+ ),
336
+ ),
337
+ "users_in_photo" => array(),
338
+ "type" => "image",
339
+ );
340
  }
341
+ else {
342
+ $child_media = array(
343
+ "videos" => array(
344
+ "standard_resolution" => array(
345
+ "width" => 640,
346
+ "height" => 800,
347
+ "url" => esc_url_raw($media_data["media_url"]),
348
+ "id" => $media_data["id"],
349
+ ),
350
+ "low_bandwidth" => array(
351
+ "width" => 480,
352
+ "height" => 600,
353
+ "url" => esc_url_raw($media_data["media_url"]),
354
+ "id" => $media_data["id"],
355
+ ),
356
+ "low_resolution" => array(
357
+ "width" => 640,
358
+ "height" => 800,
359
+ "url" => esc_url_raw($media_data["media_url"]),
360
+ "id" => $media_data["id"],
361
+ ),
362
+ ),
363
+ "users_in_photo" => array(),
364
+ "type" => "video",
365
+ );
366
+ }
367
+ array_push($carousel_media, $child_media);
368
+
369
  }
370
  }
371
  }
372
  return $carousel_media;
373
  }
374
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
375
  public function wdi_preload_cache($data=NULL) {
376
  if(isset($data)){
377
  $feed_list = $this->get_feed_list($data, FALSE);
framework/WDILibrary.php CHANGED
@@ -1422,6 +1422,7 @@ class WDILibrary {
1422
  $wdi_instagram_options["wdi_authenticated_users_list"] = json_encode($wdi_authenticated_users_list);
1423
  $updated = update_option("wdi_instagram_options" , $wdi_instagram_options);
1424
  if($updated){
 
1425
  $return_data["success"] = TRUE;
1426
  $return_data["user"] = $user_name;
1427
  $return_data["token"] = $wdi_user_token;
1422
  $wdi_instagram_options["wdi_authenticated_users_list"] = json_encode($wdi_authenticated_users_list);
1423
  $updated = update_option("wdi_instagram_options" , $wdi_instagram_options);
1424
  if($updated){
1425
+ delete_option('wdi_token_error_flag');
1426
  $return_data["success"] = TRUE;
1427
  $return_data["user"] = $user_name;
1428
  $return_data["token"] = $wdi_user_token;
framework/WDILibraryEmbed.php CHANGED
@@ -29,10 +29,10 @@ class WDILibraryEmbed {
29
  }
30
  }
31
  $oembed_instagram_html .= " >";
32
- if( $url != '' ) {
33
- $oembed_instagram_html .= '<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls>'.
34
- '<source src="'. $url .
35
- '" type="video/mp4"> Your browser does not support the video tag. </video>';
36
 
37
  }
38
  $oembed_instagram_html .= "</div>";
@@ -48,19 +48,28 @@ class WDILibraryEmbed {
48
  }
49
  }
50
  $oembed_instagram_html .= " >";
51
- if ( !is_null($carousel_media) && count($carousel_media) ) {
52
- foreach ( $carousel_media as $key => $media ) {
53
- if ( $media["type"] == "image" ) {
54
- $oembed_instagram_html .= '<img src="' . $media["images"]["standard_resolution"]["url"] . '"' . ' style="' . 'max-width:' . '100%' . " !important" . '; max-height:' . '100%' . " !important" . '; width:' . 'auto !important' . '; height:' . 'auto !important' . ';" data-id="' . $key . '" class="carousel_media ' . ($key == 0 ? "active" : "") . '">';
55
- }
56
- elseif ( $media["type"] == "video" ) {
57
- $oembed_instagram_html .= '<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls data-id="' . $key . '" class="carousel_media ' . ($key == 0 ? "active" : "") . '">' . '<source src="' . $media["videos"]["standard_resolution"]["url"] . '" type="video/mp4"> Your browser does not support the video tag. </video>';
 
 
 
 
 
58
  }
59
  }
60
  }
61
- else {
62
- if ( $url != '' ) {
63
- $oembed_instagram_html .= '<img src="' . $url . '"' . ' style="' . 'max-width:' . '100%' . " !important" . '; max-height:' . '100%' . " !important" . '; width:' . 'auto !important' . '; height:' . 'auto !important' . ';">';
 
 
 
 
64
  }
65
  }
66
  $oembed_instagram_html .= "</div>";
29
  }
30
  }
31
  $oembed_instagram_html .= " >";
32
+ if ( $url != '' ) {
33
+ $oembed_instagram_html .= '<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls>'.
34
+ '<source src="'. $url .
35
+ '" type="video/mp4"> Your browser does not support the video tag. </video>';
36
 
37
  }
38
  $oembed_instagram_html .= "</div>";
48
  }
49
  }
50
  $oembed_instagram_html .= " >";
51
+ if ( $url != '' ) {
52
+ $oembed_instagram_html .= '<img src="' . $url . '"' . ' style="' . 'max-width:' . '100%' . " !important" . '; max-height:' . '100%' . " !important" . '; width:' . 'auto !important' . '; height:' . 'auto !important' . ';">';
53
+ }
54
+ $oembed_instagram_html .= "</div>";
55
+ $html_to_insert .= $oembed_instagram_html;
56
+ break;
57
+ case 'EMBED_OEMBED_INSTAGRAM_CAROUSEL':
58
+ $oembed_instagram_html = '<div ';
59
+ foreach ( $attrs as $attr => $value ) {
60
+ if ( preg_match('/src/i', $attr) === 0 ) {
61
+ if ( $attr != '' && $value != '' ) {
62
+ $oembed_instagram_html .= ' ' . $attr . '="' . $value . '"';
63
  }
64
  }
65
  }
66
+ $oembed_instagram_html .= " >";
67
+ foreach ( $carousel_media as $key => $media ) {
68
+ if ( $media["type"] == "image" ) {
69
+ $oembed_instagram_html .= '<img src="' . $media["images"]["standard_resolution"]["url"] . '"' . ' style="' . 'max-width:' . '100%' . " !important" . '; max-height:' . '100%' . " !important" . '; width:' . 'auto !important' . '; height:' . 'auto !important' . ';" data-id="' . $key . '" class="carousel_media ' . ($key == 0 ? "active" : "") . '">';
70
+ }
71
+ elseif ( $media["type"] == "video" ) {
72
+ $oembed_instagram_html .= '<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls data-id="' . $key . '" class="carousel_media ' . ($key == 0 ? "active" : "") . '">' . '<source src="' . $media["videos"]["standard_resolution"]["url"] . '" type="video/mp4"> Your browser does not support the video tag. </video>';
73
  }
74
  }
75
  $oembed_instagram_html .= "</div>";
frontend/shortcode.php CHANGED
@@ -392,50 +392,39 @@ function wdi_load_frontend_scripts_ajax($additional_scripts = array(), $addition
392
  echo sprintf($style_tag, $handle, $wp_styles->registered[$handle]->src, $wp_styles->registered[$handle]->ver);
393
  }
394
  }
395
-
396
  }
397
 
398
-
399
  add_action('wp_ajax_wdi_token_flag', 'wdi_token_flag');
400
  add_action('wp_ajax_nopriv_wdi_token_flag', 'wdi_token_flag');
401
  function wdi_token_flag() {
402
- if (check_ajax_referer('', 'wdi_token_flag_nonce', false)){
403
- add_option("wdi_token_error_flag", 1);
404
- }
405
- }
406
- add_action('wp_ajax_wdi_delete_token_flag', 'wdi_delete_token_flag');
407
- add_action('wp_ajax_nopriv_wdi_delete_token_flag', 'wdi_delete_token_flag');
408
- function wdi_delete_token_flag() {
409
- if (check_ajax_referer('', 'wdi_token_flag_nonce', false)){
410
- delete_option("wdi_token_error_flag");
411
  }
 
 
412
  }
413
 
414
- function wdi_feed_frontend_messages(){
415
  $manage_options_user = current_user_can('manage_options');
416
- //$class = $manage_options_user ? '' : 'wdi_hidden';
417
- $js_error_message = __("Something is wrong.", "wd-instagram-feed");
418
-
419
- $token_error_message = __("Instagram token error.");
420
- $error_style = "";
421
- $private_feed_error_1 = "";
422
- $private_feed_error_2 = "";
423
- $private_feed_error_3 = "";
424
- if($manage_options_user){
425
- $js_error_message = __("Something is wrong. Response takes too long or there is JS error. Press Ctrl+Shift+J or Cmd+Shift+J on a Mac to see error in console or ask for <a class='wdi_error_link' href='https://wordpress.org/support/plugin/wd-instagram-feed' target='_blank'>free support</a>.", "wd-instagram-feed");
426
- $token_error_message = __("Instagram token is invalid or expired. Please <a href='".site_url()."/wp-admin/admin.php?page=wdi_settings' target='_blank'>reset token</a> and sign-in again to get new one.");
427
  $error_style = 'style="color: #cc0000; text-align: center;"';
428
- $private_feed_error_1 = __("Admin warning: there is one or more private user in this feed") ;
429
-
430
- $private_feed_error_2 = __("Their media won't be displayed.") ;
431
- $private_feed_error_3 = '(<span class="wdi_private_feed_names"></span>). ' ;
432
  }
433
-
434
  $ajax_error_message = (defined('DOING_AJAX') && DOING_AJAX) ? __("Warning: Instagram Feed is loaded using AJAX request. It might not display properly.", "wd-instagram-feed") : '';
435
-
436
- echo '<div '.$error_style.' class="wdi_js_error">'.
437
- $js_error_message ."<br/>". $ajax_error_message .'</div>';
438
- echo '<div '.$error_style.' class="wdi_token_error wdi_hidden">'. $token_error_message .'</div>';
439
- echo '<div '.$error_style.' class="wdi_private_feed_error wdi_hidden"><span>'. $private_feed_error_1 . $private_feed_error_3 .$private_feed_error_2.'</span></div>';
440
  echo '<div class="wdi_check_fontawesome wdi_hidden"><i class="tenweb-i tenweb-i-instagram""></i></div>';
441
  }
392
  echo sprintf($style_tag, $handle, $wp_styles->registered[$handle]->src, $wp_styles->registered[$handle]->ver);
393
  }
394
  }
 
395
  }
396
 
 
397
  add_action('wp_ajax_wdi_token_flag', 'wdi_token_flag');
398
  add_action('wp_ajax_nopriv_wdi_token_flag', 'wdi_token_flag');
399
  function wdi_token_flag() {
400
+ $json = array( 'success' => 0 );
401
+ if ( check_ajax_referer('', 'wdi_token_flag_nonce', FALSE) ) {
402
+ $add = add_option('wdi_token_error_flag', 1);
403
+ $json = array( 'success' => $add );
 
 
 
 
 
404
  }
405
+ echo json_encode($json);
406
+ exit;
407
  }
408
 
409
+ function wdi_feed_frontend_messages() {
410
  $manage_options_user = current_user_can('manage_options');
411
+ $js_error_message = __('Something is wrong.', 'wd-instagram-feed');
412
+ $token_error_message = __('Instagram token error.', 'wd-instagram-feed');
413
+ $error_style = '';
414
+ $private_feed_error_1 = '';
415
+ $private_feed_error_2 = '';
416
+ $private_feed_error_3 = '';
417
+ if ( $manage_options_user ) {
418
+ $js_error_message = __("Something is wrong. Response takes too long or there is JS error. Press Ctrl+Shift+J or Cmd+Shift+J on a Mac to see error in console or ask for <a class='wdi_error_link' href='https://wordpress.org/support/plugin/wd-instagram-feed' target='_blank'>free support</a>.", 'wd-instagram-feed');
419
+ $token_error_message = __("Instagram token is invalid or expired. Please <a href='" . site_url() . "/wp-admin/admin.php?page=wdi_settings' target='_blank'>reset token</a> and sign-in again to get new one.");
 
 
420
  $error_style = 'style="color: #cc0000; text-align: center;"';
421
+ $private_feed_error_1 = __('Admin warning: there is one or more private user in this feed', 'wd-instagram-feed');
422
+ $private_feed_error_2 = __('Their media won\'t be displayed.', 'wd-instagram-feed');
423
+ $private_feed_error_3 = '(<span class="wdi_private_feed_names"></span>). ';
 
424
  }
 
425
  $ajax_error_message = (defined('DOING_AJAX') && DOING_AJAX) ? __("Warning: Instagram Feed is loaded using AJAX request. It might not display properly.", "wd-instagram-feed") : '';
426
+ echo '<div ' . $error_style . ' class="wdi_js_error">' . $js_error_message . '<br/>' . $ajax_error_message . '</div>';
427
+ echo '<div ' . $error_style . ' class="wdi_token_error wdi_hidden">' . $token_error_message . '</div>';
428
+ echo '<div ' . $error_style . ' class="wdi_private_feed_error wdi_hidden"><span>' . $private_feed_error_1 . $private_feed_error_3 . $private_feed_error_2 . '</span></div>';
 
 
429
  echo '<div class="wdi_check_fontawesome wdi_hidden"><i class="tenweb-i tenweb-i-instagram""></i></div>';
430
  }
frontend/views/WDIViewGalleryBox.php CHANGED
@@ -17,10 +17,12 @@ class WDIViewGalleryBox {
17
  $feed_id = WDILibrary::get('feed_id', 0, 'intval', 'POST');
18
  $current_feed = $this->model->get_feed_row_data( $feed_id );
19
  $is_hashtag = false;
20
- if(isset($current_feed["thumb_user"]) && !empty($current_feed["thumb_user"])){
21
- $first_char = mb_substr($current_feed["thumb_user"], 0, 1);
22
- if($first_char === "#"){
23
- $is_hashtag = true;
 
 
24
  }
25
  }
26
  $theme_row = WDILibrary::arrayToObject($this->model->get_theme_row_data($current_feed['theme_id']));
@@ -528,7 +530,7 @@ class WDIViewGalleryBox {
528
  else { ?>
529
  <span class="wdi_popup_embed wdi_popup_watermark" style="display:table; table-layout:fixed;">
530
  <?php
531
- $url = isset($image_row->images->standard_resolution->url) ? $image_row->images->standard_resolution->url : '';
532
  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 );
533
  ?>
534
  </span>
@@ -838,15 +840,19 @@ class WDIViewGalleryBox {
838
  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);
839
  /* Load comments.*/
840
  if (jQuery(".wdi_comment_container").hasClass("wdi_open")) {
841
- if (wdi_data[key]["comment_count"] == 0) {
842
- jQuery("#wdi_added_comments").html('<p class="wdi_no_comment"><?php _e('There are no comments to show','wd-instagram-feed');?></p>');
843
- }
844
- else {
845
  jQuery("#wdi_added_comments").show();
846
  wdi_spider_set_input_value('ajax_task', 'display');
847
  wdi_spider_set_input_value('image_id', jQuery('#wdi_popup_image').attr('image_id'));
848
  var cur_image_key = parseInt(jQuery("#wdi_current_image_key").val());
849
- wdi_spider_ajax_save('wdi_comment_form',cur_image_key);
 
 
 
 
 
 
 
850
  }
851
  }
852
  /* Update custom scroll.*/
@@ -1154,14 +1160,16 @@ class WDIViewGalleryBox {
1154
  /* Load comments.*/
1155
 
1156
  var cur_image_key = parseInt(jQuery("#wdi_current_image_key").val());
1157
- if (wdi_data[cur_image_key]["comment_count"] != 0) {
1158
- jQuery("#wdi_added_comments").show();/*deprecated*/
1159
- wdi_spider_set_input_value('ajax_task', 'display');/*deprecated*/
1160
- wdi_spider_set_input_value('image_id', jQuery('#wdi_popup_image').attr('image_id'));/*deprecated*/
1161
- wdi_spider_ajax_save('wdi_comment_form',cur_image_key);/*deprecated*/
1162
- }else{
1163
- jQuery("#wdi_added_comments").html('<p class="wdi_no_comment"><?php _e('There are no comments to show','wd-instagram-feed');?></p>');
1164
- }
 
 
1165
  }
1166
  }
1167
 
@@ -1323,7 +1331,7 @@ class WDIViewGalleryBox {
1323
 
1324
  jQuery(".wdi_filmstrip_left").on(wdi_click, function () {
1325
  jQuery( ".wdi_filmstrip_thumbnails" ).stop(true, false);
1326
- if (jQuery(".wdi_filmstrip_thumbnails").position().<?php echo $left_or_top; ?> < 0) {
1327
  jQuery(".wdi_filmstrip_right").css({opacity: 1, filter: "Alpha(opacity=100)"});
1328
  if (jQuery(".wdi_filmstrip_thumbnails").position().<?php echo $left_or_top; ?> > - <?php echo $filmstrip_thumb_margin_hor + $image_filmstrip_width; ?>) {
1329
  jQuery(".wdi_filmstrip_thumbnails").animate({<?php echo $left_or_top; ?>: 0}, 500, 'linear');
17
  $feed_id = WDILibrary::get('feed_id', 0, 'intval', 'POST');
18
  $current_feed = $this->model->get_feed_row_data( $feed_id );
19
  $is_hashtag = false;
20
+ if(isset($current_feed["feed_users"]) && !empty($current_feed["feed_users"])){
21
+ foreach (json_decode($current_feed['feed_users']) as $user) {
22
+ $first_char = mb_substr($user->id, 0, 1);
23
+ if($first_char === "#"){
24
+ $is_hashtag = true;
25
+ }
26
  }
27
  }
28
  $theme_row = WDILibrary::arrayToObject($this->model->get_theme_row_data($current_feed['theme_id']));
530
  else { ?>
531
  <span class="wdi_popup_embed wdi_popup_watermark" style="display:table; table-layout:fixed;">
532
  <?php
533
+ $url = isset($image_row->images->standard_resolution->url) ? $image_row->images->standard_resolution->url : $image_row->thumb_url;
534
  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 );
535
  ?>
536
  </span>
840
  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);
841
  /* Load comments.*/
842
  if (jQuery(".wdi_comment_container").hasClass("wdi_open")) {
843
+ if (wdi_data[key]["comment_count"] !== 0 && typeof wdi_data[key]["comments_data"]['data'] !== 'undefined') {
 
 
 
844
  jQuery("#wdi_added_comments").show();
845
  wdi_spider_set_input_value('ajax_task', 'display');
846
  wdi_spider_set_input_value('image_id', jQuery('#wdi_popup_image').attr('image_id'));
847
  var cur_image_key = parseInt(jQuery("#wdi_current_image_key").val());
848
+ //wdi_spider_ajax_save('wdi_comment_form',cur_image_key);
849
+ wdi_comments_manager.clear_comments();
850
+ wdi_comments_manager.showComments(wdi_data[cur_image_key]['comments_data']['data'], wdi_comments_manager.load_more_count);
851
+ wdi_comments_manager.createLoadMoreAndBindEvent(cur_image_key);
852
+ }
853
+ else {
854
+ var cur_image_key = parseInt(jQuery("#wdi_current_image_key").val());
855
+ wdi_comments_manager.init(cur_image_key);
856
  }
857
  }
858
  /* Update custom scroll.*/
1160
  /* Load comments.*/
1161
 
1162
  var cur_image_key = parseInt(jQuery("#wdi_current_image_key").val());
1163
+ jQuery("#wdi_added_comments").show();
1164
+ wdi_spider_set_input_value('ajax_task', 'display');
1165
+ wdi_spider_set_input_value('image_id', jQuery('#wdi_popup_image').attr('image_id'));
1166
+ if(typeof wdi_data[cur_image_key]['comments_data']['data'] !== 'undefined') {
1167
+ wdi_comments_manager.clear_comments();
1168
+ wdi_comments_manager.showComments(wdi_data[cur_image_key]['comments_data']['data'], wdi_comments_manager.load_more_count);
1169
+ wdi_comments_manager.createLoadMoreAndBindEvent(cur_image_key);
1170
+ } else {
1171
+ wdi_spider_ajax_save('wdi_comment_form', cur_image_key);
1172
+ }
1173
  }
1174
  }
1175
 
1331
 
1332
  jQuery(".wdi_filmstrip_left").on(wdi_click, function () {
1333
  jQuery( ".wdi_filmstrip_thumbnails" ).stop(true, false);
1334
+ if ((jQuery(".wdi_filmstrip_thumbnails").position().<?php echo $left_or_top; ?>) < 0) {
1335
  jQuery(".wdi_filmstrip_right").css({opacity: 1, filter: "Alpha(opacity=100)"});
1336
  if (jQuery(".wdi_filmstrip_thumbnails").position().<?php echo $left_or_top; ?> > - <?php echo $filmstrip_thumb_margin_hor + $image_filmstrip_width; ?>) {
1337
  jQuery(".wdi_filmstrip_thumbnails").animate({<?php echo $left_or_top; ?>: 0}, 500, 'linear');
frontend/views/imagebrowser.php CHANGED
@@ -21,7 +21,7 @@ class WDI_ImageBrowser_view {
21
  ?>
22
  <div id="wdi_feed_<?php echo $wdi_feed_counter ?>"
23
  class="wdi_feed_main_container wdi_layout_ib <?php echo $container_class; ?>" <?php echo $wdi_data_ajax; ?> >
24
- <?php // wdi_feed_frontend_messages();?>
25
  <div id="wdi_spider_popup_loading_<?php echo $wdi_feed_counter ?>" class="wdi_spider_popup_loading"></div>
26
  <div id="wdi_spider_popup_overlay_<?php echo $wdi_feed_counter ?>" class="wdi_spider_popup_overlay"
27
  onclick="wdi_spider_destroypopup(1000)"></div>
21
  ?>
22
  <div id="wdi_feed_<?php echo $wdi_feed_counter ?>"
23
  class="wdi_feed_main_container wdi_layout_ib <?php echo $container_class; ?>" <?php echo $wdi_data_ajax; ?> >
24
+ <?php wdi_feed_frontend_messages();?>
25
  <div id="wdi_spider_popup_loading_<?php echo $wdi_feed_counter ?>" class="wdi_spider_popup_loading"></div>
26
  <div id="wdi_spider_popup_overlay_<?php echo $wdi_feed_counter ?>" class="wdi_spider_popup_overlay"
27
  onclick="wdi_spider_destroypopup(1000)"></div>
js/gallerybox/wdi_gallery_box.js CHANGED
@@ -135,18 +135,35 @@ var wdi_construct_popup = function (popup, currentFeed, image_rows, current_imag
135
  'height:'+image_thumb_height+'px;' +
136
  'margin-left:'+thumb_left+'px;' +
137
  'margin-top:'+thumb_top+'px;';
138
- if( image_row.filetype == "EMBED_OEMBED_INSTAGRAM_VIDEO") {
139
- var src = (typeof image_row.filename !== 'undefined') ? image_row.filename : image_row.thumb_url;
140
- } else {
141
- var src = (typeof image_row.images[currentFeed.feedImageResolution] !== 'undefined' && typeof image_row.images[currentFeed.feedImageResolution]['url'] !== "undefined") ? image_row.images[currentFeed.feedImageResolution]['url'] : image_row.thumb_url;
142
- }
143
- if( src.indexOf('https://video.cdninstagram.com/') == 0 ) {
144
- src = wdi_url.plugin_url + "images/video_missing.png";
145
- }
146
  var onclick = 'wdi_change_image(parseInt(jQuery(\'#wdi_current_image_key\').val()), \'' + i + '\', wdi_data)';
147
  var ontouchend = 'wdi_change_image(parseInt(jQuery(\'#wdi_current_image_key\').val()), \'' + i + '\', wdi_data)';
148
 
149
- var img_html = '<img style="' + img_style + '" class="wdi_filmstrip_thumbnail_img" src="' + src + '" onclick="' + onclick + '" ontouchend="' + ontouchend + '" image_id="' + image_row.id + '" image_key="' + i + '" alt="' + image_row.alt + '" />';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  thumbnails_html += '<div id="wdi_filmstrip_thumbnail_' + i + '" class="' + class_name + '">' + img_html + '</div>';
151
 
152
 
@@ -285,49 +302,9 @@ Object.size = function (obj)
285
  function wdi_spider_ajax_save(form_id, image_id)
286
  {
287
  wdi_comments_manager.init(image_id);
288
- // var post_data = {};
289
- // post_wdi_data["wdi_name"] = jQuery("#wdi_name").val();
290
- // post_wdi_data["wdi_comment"] = jQuery("#wdi_comment").val();
291
- // post_wdi_data["wdi_email"] = jQuery("#wdi_email").val();
292
- // post_wdi_data["wdi_captcha_input"] = jQuery("#wdi_captcha_input").val();
293
- // post_wdi_data["ajax_task"] = jQuery("#ajax_task").val();
294
- // post_wdi_data["image_id"] = jQuery("#image_id").val();
295
- // post_wdi_data["comment_id"] = jQuery("#comment_id").val();
296
- // // Loading.
297
- // jQuery("#ajax_loading").css('height', jQuery(".wdi_comments").css('height'));
298
- // jQuery("#opacity_div").css('width', jQuery(".wdi_comments").css('width'));
299
- // jQuery("#opacity_div").css('height', jQuery(".wdi_comments").css('height'));
300
- // jQuery("#loading_div").css('width', jQuery(".wdi_comments").css('width'));
301
- // jQuery("#loading_div").css('height', jQuery(".wdi_comments").css('height'));
302
- // document.getElementById("opacity_div").style.display = '';
303
- // document.getElementById("loading_div").style.display = 'table-cell';
304
- // jQuery.post(
305
- // jQuery('#' + form_id).attr('action'),
306
- // post_data,
307
-
308
- // function (data) {
309
- // var str = jQuery(data).find('.wdi_comments').html();
310
- // jQuery('.wdi_comments').html(str);
311
- // }
312
- // ).success(function(jqXHR, textStatus, errorThrown) {
313
- // document.getElementById("opacity_div").style.display = 'none';
314
- // document.getElementById("loading_div").style.display = 'none';
315
- // // Update scrollbar.
316
- // jQuery(".wdi_comments").mCustomScrollbar({scrollInertia: 150});
317
- // // Bind comment container close function to close button.
318
- // jQuery(".wdi_comments_close_btn").click(wdi_comment);
319
- // });
320
-
321
- // if (event.preventDefault) {
322
- // event.preventDefault();
323
- // }
324
- // else {
325
- // event.returnValue = false;
326
- // }
327
  return false;
328
  }
329
 
330
-
331
  wdi_comments_manager = {
332
  media_id: '',
333
  mediaComments: [],
@@ -339,8 +316,6 @@ wdi_comments_manager = {
339
  /*iamge id*/
340
  init: function (image_id)
341
  {
342
-
343
-
344
  /*initializing instagram object which will handle all instagram api requests*/
345
  this.instagram = new WDIInstagram();
346
  this.instagram.addToken(wdi_front.access_token);
@@ -369,6 +344,13 @@ wdi_comments_manager = {
369
  //this.showComments(currentImage['comments_data']);
370
 
371
 
 
 
 
 
 
 
 
372
  },
373
  popup_destroyed: function ()
374
  {
@@ -384,7 +366,6 @@ wdi_comments_manager = {
384
  //function for dispaying comments
385
  showComments: function (comments, count)
386
  {
387
-
388
  if (Object.size(comments) - this.commentCounter - count < 0 || count === undefined) {
389
  count = Object.size(comments) - this.commentCounter;
390
  }
@@ -394,14 +375,16 @@ wdi_comments_manager = {
394
  var commentText = (comments[i]['text']);
395
  commentText = wdi_front.escape_tags(commentText);
396
  commentText = this.filterCommentText(commentText);
397
- var username = (comments[i]['from']['username']);
398
- var profile_picture = (comments[i]['from']['profile_picture']);
399
  var singleComment = jQuery('<div class="wdi_single_comment"></div>');
400
- singleComment.append(jQuery('<p class="wdi_comment_header_p"><span class="wdi_comment_header"><a target="_blank" href="//instagram.com/' + username + '">' + username + '</a></span><span class="wdi_comment_date">' + wdi_front.convertUnixDate(comments[i]['created_time']) + '</span></p>'));
401
  singleComment.append(jQuery('<div class="wdi_comment_body_p"><span class="wdi_comment_body"><p>' + commentText + '</p></span></div>'));
402
  jQuery('#wdi_added_comments').prepend(singleComment);
403
  }
404
-
 
 
405
  this.updateScrollbar();
406
  },
407
 
@@ -441,49 +424,70 @@ wdi_comments_manager = {
441
 
442
  },
443
  //get recent media comments
444
- getAjaxComments: function ()
445
- {
446
-
 
 
 
447
  this.instagram.getRecentMediaComments(this.media_id, {
448
  success: function (response)
449
  {
450
- if (response == '' || response == undefined || response == null) {
451
  errorMessage = 'Network Error, please try again later :(';
452
  console.log('%c' + errorMessage, "color:#cc0000;");
 
 
453
  return;
454
  }
455
  if (response['meta']['code'] != 200) {
456
  errorMessage = response['meta']['error_message'];
457
  console.log('%c' + errorMessage, "color:#cc0000;");
 
458
  return;
459
  }
460
 
461
- wdi_comments_manager.mediaComments = response['data'];
 
 
 
 
 
 
 
462
 
 
 
463
 
464
  //ttt
465
  var currentImage = wdi_data[wdi_comments_manager.currentKey];
466
- currentImage['comments_data'] = response['data'];
467
 
468
- wdi_comments_manager.showComments(currentImage['comments_data'], wdi_comments_manager.load_more_count);
469
  wdi_comments_manager.ajax_comments_ready(response['data']);
470
  }
471
- });
472
  },
473
  ajax_comments_ready: function (response)
474
  {
475
-
476
- this.createLoadMoreAndBindEvent();
477
  },
478
- createLoadMoreAndBindEvent: function ()
479
  {
480
- jQuery('#wdi_added_comments').prepend(jQuery('<p id="wdi_load_more_comments" class="wdi_load_more_comments">load more comments</p>'));
 
 
 
 
 
481
  jQuery('.wdi_comment_container #wdi_load_more_comments').on('click', function ()
482
  {
 
 
 
483
  jQuery(this).remove();
484
-
485
- wdi_comments_manager.showComments(wdi_comments_manager.mediaComments, wdi_comments_manager.load_more_count);
486
- wdi_comments_manager.createLoadMoreAndBindEvent();
487
  });
488
  },
489
  /*
@@ -676,36 +680,45 @@ function wdi_spider_display_embed( embed_type, embed_id, src, attrs, carousel_me
676
  }
677
  }
678
  oembed_instagram_html += " >";
679
- if ( carousel_media != null && carousel_media.length ) {
680
- for ( var i = 0; i < carousel_media.length; i++ ) {
681
- if ( carousel_media[i]["type"] == "image" ) {
682
- oembed_instagram_html += '<img src="' + carousel_media[i]["images"]["standard_resolution"]["url"] + '"' +
683
- ' style="' +
684
- 'max-width:' + '100%' + " !important" +
685
- '; max-height:' + '100%' + " !important" +
686
- '; width:' + 'auto !important' +
687
- '; height:' + 'auto !important' +
688
- ';" data-id="' + i + '" class="carousel_media ' + (i == 0 ? "active" : "") + '">';
689
- }
690
- else if ( carousel_media[i]["type"] == "video" ) {
691
- if(typeof carousel_media[i]["videos"] !== "undefined" && typeof carousel_media[i]["videos"]["standard_resolution"] !== "undefined" && typeof carousel_media[i]["videos"]["standard_resolution"]["url"] !== "undefined"){
692
- src = carousel_media[i]["videos"]["standard_resolution"]["url"];
693
- }
694
- oembed_instagram_html += '<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls data-id="' + i + '" class="carousel_media ' + (i == 0 ? "active" : "") + '">' +
695
- '<source src="' + src +
696
- '" type="video/mp4"> Your browser does not support the video tag. </video>';
697
  }
698
  }
699
  }
700
- else {
701
- if ( embed_id != '' ) {
702
- oembed_instagram_html += '<img src="' + src + '"' +
703
- ' style=" ' +
 
704
  'max-width:' + '100%' + " !important" +
705
  '; max-height:' + '100%' + " !important" +
706
- '; width:' + 'auto' +
707
- '; height:' + 'auto' +
708
- ';">';
 
 
 
 
 
 
 
 
709
  }
710
  }
711
  oembed_instagram_html += "</div>";
135
  'height:'+image_thumb_height+'px;' +
136
  'margin-left:'+thumb_left+'px;' +
137
  'margin-top:'+thumb_top+'px;';
138
+
 
 
 
 
 
 
 
139
  var onclick = 'wdi_change_image(parseInt(jQuery(\'#wdi_current_image_key\').val()), \'' + i + '\', wdi_data)';
140
  var ontouchend = 'wdi_change_image(parseInt(jQuery(\'#wdi_current_image_key\').val()), \'' + i + '\', wdi_data)';
141
 
142
+ switch (image_row.filetype) {
143
+ case 'EMBED_OEMBED_INSTAGRAM_IMAGE':
144
+ var src = (typeof image_row.images[currentFeed.feedImageResolution] !== 'undefined' && typeof image_row.images[currentFeed.feedImageResolution]['url'] !== "undefined") ? image_row.images[currentFeed.feedImageResolution]['url'] : image_row.thumb_url;
145
+ var img_html = '<img style="' + img_style + '" class="wdi_filmstrip_thumbnail_img" src="' + src + '" onclick="' + onclick + '" ontouchend="' + ontouchend + '" image_id="' + image_row.id + '" image_key="' + i + '" alt="' + image_row.alt + '" />';
146
+ break;
147
+ case 'EMBED_OEMBED_INSTAGRAM_VIDEO':
148
+ var src = (typeof image_row.filename !== 'undefined') ? image_row.filename : image_row.thumb_url;
149
+ var img_html = '<video style="' + img_style + '" class="wdi_filmstrip_thumbnail_img" src="' + src + '" onclick="' + onclick + '" ontouchend="' + ontouchend + '" image_id="' + image_row.id + '" image_key="' + i + '" alt="' + image_row.alt + '" /></video>';
150
+ break;
151
+ case 'EMBED_OEMBED_INSTAGRAM_CAROUSEL':
152
+ switch (image_row.carousel_media[0].type) {
153
+ case 'image':
154
+ src = image_row.carousel_media[0].images.thumbnail.url;
155
+ var img_html = '<img style="' + img_style + '" class="wdi_filmstrip_thumbnail_img" src="' + src + '" onclick="' + onclick + '" ontouchend="' + ontouchend + '" image_id="' + image_row.id + '" image_key="' + i + '" alt="' + image_row.alt + '" />';
156
+ break;
157
+ case 'video':
158
+ src = image_row.carousel_media[0].videos.low_resolution.url;
159
+ var img_html = '<video style="' + img_style + '" class="wdi_filmstrip_thumbnail_img" src="' + src + '" onclick="' + onclick + '" ontouchend="' + ontouchend + '" image_id="' + image_row.id + '" image_key="' + i + '" alt="' + image_row.alt + '" /></video>';
160
+ break;
161
+ default:
162
+ src = wdi_url.plugin_url + "images/missing.png";
163
+ var img_html = '<img style="' + img_style + '" class="wdi_filmstrip_thumbnail_img" src="' + src + '" onclick="' + onclick + '" ontouchend="' + ontouchend + '" image_id="' + image_row.id + '" image_key="' + i + '" alt="' + image_row.alt + '" />';
164
+ break;
165
+ }
166
+ }
167
  thumbnails_html += '<div id="wdi_filmstrip_thumbnail_' + i + '" class="' + class_name + '">' + img_html + '</div>';
168
 
169
 
302
  function wdi_spider_ajax_save(form_id, image_id)
303
  {
304
  wdi_comments_manager.init(image_id);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
305
  return false;
306
  }
307
 
 
308
  wdi_comments_manager = {
309
  media_id: '',
310
  mediaComments: [],
316
  /*iamge id*/
317
  init: function (image_id)
318
  {
 
 
319
  /*initializing instagram object which will handle all instagram api requests*/
320
  this.instagram = new WDIInstagram();
321
  this.instagram.addToken(wdi_front.access_token);
344
  //this.showComments(currentImage['comments_data']);
345
 
346
 
347
+ },
348
+ clear_comments: function ()
349
+ {
350
+ jQuery('#wdi_load_more_comments').remove();
351
+ jQuery('#wdi_added_comments').html('');
352
+ //currentImage = wdi_data[this.currentKey];
353
+ this.commentCounter = 0;
354
  },
355
  popup_destroyed: function ()
356
  {
366
  //function for dispaying comments
367
  showComments: function (comments, count)
368
  {
 
369
  if (Object.size(comments) - this.commentCounter - count < 0 || count === undefined) {
370
  count = Object.size(comments) - this.commentCounter;
371
  }
375
  var commentText = (comments[i]['text']);
376
  commentText = wdi_front.escape_tags(commentText);
377
  commentText = this.filterCommentText(commentText);
378
+ var username = (comments[i]['username']);
379
+ //var profile_picture = (comments[i]['profile_picture']);
380
  var singleComment = jQuery('<div class="wdi_single_comment"></div>');
381
+ singleComment.append(jQuery('<p class="wdi_comment_header_p"><span class="wdi_comment_header"><a target="_blank" href="//instagram.com/' + username + '">' + username + '</a></span><span class="wdi_comment_date">' + wdi_front.convertUnixDate(comments[i]['timestamp']) + '</span></p>'));
382
  singleComment.append(jQuery('<div class="wdi_comment_body_p"><span class="wdi_comment_body"><p>' + commentText + '</p></span></div>'));
383
  jQuery('#wdi_added_comments').prepend(singleComment);
384
  }
385
+ if (jQuery(".wdi_single_comment").length == 0){
386
+ jQuery("#wdi_added_comments").html('<p class="wdi_no_comment">There are no comments to show</p>');
387
+ }
388
  this.updateScrollbar();
389
  },
390
 
424
 
425
  },
426
  //get recent media comments
427
+ getAjaxComments: function () {
428
+ /* Next page url for comments */
429
+ var next = '';
430
+ if (typeof wdi_data[wdi_comments_manager.currentKey]['comments_data']['next'] !== 'undefined') {
431
+ next =wdi_data[wdi_comments_manager.currentKey]['comments_data']['next'];
432
+ }
433
  this.instagram.getRecentMediaComments(this.media_id, {
434
  success: function (response)
435
  {
436
+ if (response == '' || response == undefined || response == null || typeof response['error'] !== 'undefined') {
437
  errorMessage = 'Network Error, please try again later :(';
438
  console.log('%c' + errorMessage, "color:#cc0000;");
439
+ jQuery("#wdi_added_comments").html('<p class="wdi_no_comment">Comments are currently unavailable</p>');
440
+
441
  return;
442
  }
443
  if (response['meta']['code'] != 200) {
444
  errorMessage = response['meta']['error_message'];
445
  console.log('%c' + errorMessage, "color:#cc0000;");
446
+ jQuery("#wdi_added_comments").html('<p class="wdi_no_comment">Comments are currently unavailable</p>');
447
  return;
448
  }
449
 
450
+ if ( typeof wdi_data[wdi_comments_manager.currentKey]['comments_data']['data'] != 'undefined') {
451
+ wdi_data[wdi_comments_manager.currentKey]['comments_data']['data'] = response['data'].concat(wdi_data[wdi_comments_manager.currentKey]['comments_data']['data']);
452
+ wdi_data[wdi_comments_manager.currentKey]['comment_count'] += wdi_data[wdi_comments_manager.currentKey]['comments_data']['data'].length;
453
+ } else {
454
+ wdi_data[wdi_comments_manager.currentKey]['comments_data'] = response;
455
+ wdi_data[wdi_comments_manager.currentKey]['comment_count'] = wdi_data[wdi_comments_manager.currentKey]['comments_data']['data'].length;
456
+ }
457
+ wdi_data[wdi_comments_manager.currentKey]['comments_data']['next'] = ( typeof response['paging'] !== 'undefined') ? response['paging']['next'] : '';
458
 
459
+ //wdi_data[wdi_comments_manager.currentKey]['comments_data']['next'] = ( typeof response['paging'] !== 'undefined') ? response['paging']['next'] : '';
460
+ wdi_comments_manager.mediaComments = response['data'];
461
 
462
  //ttt
463
  var currentImage = wdi_data[wdi_comments_manager.currentKey];
464
+ //currentImage['comments_data'] = response['data'];
465
 
466
+ wdi_comments_manager.showComments(currentImage['comments_data']['data'], wdi_comments_manager.load_more_count);
467
  wdi_comments_manager.ajax_comments_ready(response['data']);
468
  }
469
+ },next);
470
  },
471
  ajax_comments_ready: function (response)
472
  {
473
+ this.createLoadMoreAndBindEvent(wdi_comments_manager.currentKey);
 
474
  },
475
+ createLoadMoreAndBindEvent: function (cur_image_key)
476
  {
477
+ if(cur_image_key == '') {
478
+ cur_image_key = wdi_comments_manager.currentKey;
479
+ }
480
+ if(wdi_data[cur_image_key]['comments_data']['next'] !== '' || (wdi_data[cur_image_key]['comments_data']['data'].length > wdi_comments_manager.load_more_count && jQuery(".wdi_single_comment").length < wdi_data[cur_image_key]['comments_data']['data'].length) && jQuery("#wdi_load_more_comments").length == 0) {
481
+ jQuery('#wdi_added_comments').prepend(jQuery('<p id="wdi_load_more_comments" class="wdi_load_more_comments">load more comments</p>'));
482
+ }
483
  jQuery('.wdi_comment_container #wdi_load_more_comments').on('click', function ()
484
  {
485
+ if( (wdi_comments_manager.commentCounter + wdi_comments_manager.load_more_count) > wdi_data[cur_image_key]['comments_data']['data'].length && wdi_data[cur_image_key]['comments_data']['next'] != '' ) {
486
+ wdi_comments_manager.getAjaxComments(this.currentKey);
487
+ }
488
  jQuery(this).remove();
489
+ wdi_comments_manager.showComments(wdi_data[cur_image_key]['comments_data']['data'], wdi_comments_manager.load_more_count);
490
+ wdi_comments_manager.createLoadMoreAndBindEvent(wdi_comments_manager.currentKey);
 
491
  });
492
  },
493
  /*
680
  }
681
  }
682
  oembed_instagram_html += " >";
683
+ if ( embed_id != '' ) {
684
+ oembed_instagram_html += '<img src="' + src + '"' +
685
+ ' style=" ' +
686
+ 'max-width:' + '100%' + " !important" +
687
+ '; max-height:' + '100%' + " !important" +
688
+ '; width:' + 'auto' +
689
+ '; height:' + 'auto' +
690
+ ';">';
691
+ }
692
+ oembed_instagram_html += "</div>";
693
+ html_to_insert += oembed_instagram_html;
694
+ break;
695
+ case 'EMBED_OEMBED_INSTAGRAM_CAROUSEL':
696
+ var oembed_instagram_html = '<div ';
697
+ for ( attr in attrs ) {
698
+ if ( !(/src/i).test(attr) ) {
699
+ if ( attr != '' && attrs[attr] != '' ) {
700
+ oembed_instagram_html += ' ' + attr + '="' + attrs[attr] + '"';
701
  }
702
  }
703
  }
704
+ oembed_instagram_html += " >";
705
+ for ( var i = 0; i < carousel_media.length; i++ ) {
706
+ if ( carousel_media[i]["type"] == "image" ) {
707
+ oembed_instagram_html += '<img src="' + carousel_media[i]["images"]["standard_resolution"]["url"] + '"' +
708
+ ' style="' +
709
  'max-width:' + '100%' + " !important" +
710
  '; max-height:' + '100%' + " !important" +
711
+ '; width:' + 'auto !important' +
712
+ '; height:' + 'auto !important' +
713
+ ';" data-id="' + i + '" class="carousel_media ' + (i == 0 ? "active" : "") + '">';
714
+ }
715
+ else if ( carousel_media[i]["type"] == "video" ) {
716
+ if(typeof carousel_media[i]["videos"] !== "undefined" && typeof carousel_media[i]["videos"]["standard_resolution"] !== "undefined" && typeof carousel_media[i]["videos"]["standard_resolution"]["url"] !== "undefined"){
717
+ src = carousel_media[i]["videos"]["standard_resolution"]["url"];
718
+ }
719
+ oembed_instagram_html += '<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls data-id="' + i + '" class="carousel_media ' + (i == 0 ? "active" : "") + '">' +
720
+ '<source src="' + src +
721
+ '" type="video/mp4"> Your browser does not support the video tag. </video>';
722
  }
723
  }
724
  oembed_instagram_html += "</div>";
js/gallerybox/wdi_gallery_box.min.js CHANGED
@@ -1 +1 @@
1
- var isPopUpOpened=!1,wdi_data=[];function wdi_spider_createpopup(e,t,i,a,r,n,d,o,s){if(e=e.replace(/&#038;/g,"&"),!isPopUpOpened&&(isPopUpOpened=!0,!wdi_spider_hasalreadyreceivedpopup(n)&&!wdi_spider_isunsupporteduseragent())){jQuery("html").attr("style","overflow:hidden !important;"),jQuery("#wdi_spider_popup_loading_"+t).css({display:"block"}),jQuery("#wdi_spider_popup_overlay_"+t).css({display:"block"});for(var _,c=0,u=0;u<o.parsedData.length;u++)if(o.parsedData[u].id===s){c=u,_=[o.parsedData[u]];break}jQuery.ajax({type:"POST",url:e,dataType:"text",data:{action:"WDIGalleryBox",image_rows:JSON.stringify(_),feed_id:o.feed_row.id,feed_counter:o.feed_row.wdi_feed_counter,current_image_index:c,image_rows_count:o.parsedData.length,carousel_media_row:JSON.stringify(_[0].carousel_media)},success:function(e){e=jQuery('<div id="wdi_spider_popup_wrap" class="wdi_spider_popup_wrap wdi_lightbox_theme_'+o.feed_row.theme_id+'" style="width:'+i+"px;height:"+a+"px;margin-top:-"+a/2+"px;margin-left: -"+i/2+'px; ">'+e+"</div>");new wdi_construct_popup(e,o,o.parsedData,s).construct(),e.hide().appendTo("body"),wdi_spider_showpopup(n,d,e,r),jQuery("#wdi_spider_popup_loading_"+t).css({display:"none !important;"})}})}}var wdi_construct_popup=function(p,w,h,f){this.theme_row={},this.construct=function(){this.theme_row=window["wdi_theme_"+w.feed_row.theme_id],w.feed_row.popup_enable_filmstrip&&"1"===w.feed_row.popup_enable_filmstrip&&this.add_filmstrip(),this.set_wdi_data()},this.add_filmstrip=function(){var e="horizontal";"right"!==this.theme_row.lightbox_filmstrip_pos&&"left"!==this.theme_row.lightbox_filmstrip_pos||(e="vertical");for(var t="horizontal"===e?"tenweb-i-angle-left":"tenweb-i-angle-up",i="horizontal"===e?"tenweb-i-angle-right":"tenweb-i-angle-down",a="",r=n="horizontal"===e?void 0!==w.feed_row.popup_filmstrip_height?w.feed_row.popup_filmstrip_height:"20":void 0!==w.feed_row.popup_filmstrip_height?w.feed_row.popup_filmstrip_height:"50",n=r=parseInt(r),d=0;d<h.length;d++){var o,s,_,c=h[d];_=c.resolution&&""!==c.resolution?(c.resolution.split(" "),m=intval($resolution_arr[0]),l=intval($resolution_arr[2]),0!==m&&0!==l?(o=m*(s=Math.max(r/m,n/l)),l*s):(o=r,n)):(o=r,n);var u=(r-(o*=s=Math.max(r/o,n/_)))/2,m=(n-(_*=s))/2,l="wdi_filmstrip_thumbnail "+(parseInt(c.id)===parseInt(f)?"wdi_thumb_active":"wdi_thumb_deactive"),u="width:"+o+"px;height:"+_+"px;margin-left:"+u+"px;margin-top:"+m+"px;";0==(m="EMBED_OEMBED_INSTAGRAM_VIDEO"==c.filetype?void 0!==c.filename?c.filename:c.thumb_url:void 0!==c.images[w.feedImageResolution]&&void 0!==c.images[w.feedImageResolution].url?c.images[w.feedImageResolution].url:c.thumb_url).indexOf("https://video.cdninstagram.com/")&&(m=wdi_url.plugin_url+"images/video_missing.png"),a+='<div id="wdi_filmstrip_thumbnail_'+d+'" class="'+l+'">'+('<img style="'+u+'" class="wdi_filmstrip_thumbnail_img" src="'+m+'" onclick="'+("wdi_change_image(parseInt(jQuery('#wdi_current_image_key').val()), '"+d+"', wdi_data)")+'" ontouchend="'+("wdi_change_image(parseInt(jQuery('#wdi_current_image_key').val()), '"+d+"', wdi_data)")+'" image_id="'+c.id+'" image_key="'+d+'" alt="'+c.alt+'" />')+"</div>"}i='<div class="wdi_filmstrip_left"><i class="tenweb-i '+t+'"></i></div><div class="wdi_filmstrip"><div class="wdi_filmstrip_thumbnails">'+a+'</div></div><div class="wdi_filmstrip_right"><i class="tenweb-i '+i+'"></i></div>';p.find(".wdi_filmstrip_container").append(i)},this.set_wdi_data=function(){wdi_data=[];for(var e=0;e<h.length;e++)wdi_data[e]=[],wdi_data[e].number=e+1,wdi_data[e].id=h[e].id,wdi_data[e].alt=h[e].alt,wdi_data[e].description=wdi_front.escape_tags(h[e].description),wdi_data[e].username=h[e].username,wdi_data[e].profile_picture=h[e].profile_picture,wdi_data[e].image_url=h[e].image_url,wdi_data[e].thumb_url=h[e].thumb_url,wdi_data[e].src=h[e].images.standard_resolution.url,wdi_data[e].date=h[e].date,wdi_data[e].comment_count=h[e].comment_count,wdi_data[e].filetype=h[e].filetype,wdi_data[e].filename=h[e].filename,wdi_data[e].avg_rating=h[e].avg_rating,wdi_data[e].rate=h[e].rate,wdi_data[e].rate_count=h[e].rate_count,wdi_data[e].hit_count=h[e].hit_count,wdi_data[e].comments_data=void 0!==h[e].comments_data?h[e].comments_data:"null",wdi_data[e].carousel_media=void 0!==h[e].carousel_media?h[e].carousel_media:null}};function wdi_spider_showpopup(e,t,i,a){isPopUpOpened=!0,i.show(),wdi_spider_receivedpopup(e,t)}function wdi_spider_hasalreadyreceivedpopup(e){return-1<document.cookie.indexOf(e)&&delete document.cookie[document.cookie.indexOf(e)],!1}function wdi_spider_receivedpopup(e,t){var i=new Date;i.setDate(i.getDate()+t),document.cookie=e+"=true;expires="+i.toUTCString()+";path=/",jQuery(".wdi_image_info").mCustomScrollbar({autoHideScrollbar:!1,scrollInertia:150,advanced:{updateOnContentResize:!0}})}function wdi_spider_isunsupporteduseragent(){return!window.XMLHttpRequest}function wdi_spider_destroypopup(e){null!=document.getElementById("wdi_spider_popup_wrap")&&(wdi_comments_manager.popup_destroyed(),void 0!==jQuery().fullscreen&&jQuery.isFunction(jQuery().fullscreen)&&jQuery.fullscreen.isFullScreen()&&jQuery.fullscreen.exit(),setTimeout(function(){jQuery(".wdi_spider_popup_wrap").remove(),jQuery(".wdi_spider_popup_loading").css({display:"none"}),jQuery(".wdi_spider_popup_overlay").css({display:"none"}),jQuery(document).off("keydown"),jQuery("html").attr("style","")},20)),isPopUpOpened=!1;var t=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()),i=document.querySelector('meta[name="viewport"]');t&&i&&(i.content="width=device-width, initial-scale=1");i=jQuery(document).scrollTop();window.location.hash="",jQuery(document).scrollTop(i),"undefined"!=typeof wdi_playInterval&&clearInterval(wdi_playInterval)}function wdi_spider_ajax_save(e,t){return wdi_comments_manager.init(t),!1}function wdi_spider_set_input_value(e,t){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_spider_check_required(e,t){return""==jQuery("#"+e).val()&&(wdi_front.show_alert(t+"* "+wdi_objectL10n.wdi_field_required),jQuery("#"+e).attr("style","border-color: #FF0000;"),jQuery("#"+e).focus(),!0)}function wdi_spider_check_email(e){if(""!=jQuery("#"+e).val())return-1==jQuery("#"+e).val().replace(/^\s+|\s+$/g,"").search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)&&(wdi_front.show_alert(wdi_objectL10n.wdi_mail_validation),!0)}function wdi_captcha_refresh(e){document.getElementById(e+"_img")&&document.getElementById(e+"_input")&&(srcArr=document.getElementById(e+"_img").src.split("&r="),document.getElementById(e+"_img").src=srcArr[0]+"&r="+Math.floor(100*Math.random()),document.getElementById(e+"_img").style.display="inline-block",document.getElementById(e+"_input").value="")}function wdi_play_pause(e){var t=-1<navigator.userAgent.indexOf("Chrome"),i=-1<navigator.userAgent.indexOf("Safari");t&&i&&(i=!1),i||(i=e.get(0),e=!1,navigator.userAgent.match(/firefox/i)&&(e=!0),e||(i.paused?i.play():i.pause()))}function wdi_spider_display_embed(e,t,i,a,r){var n="";switch(e){case"EMBED_OEMBED_INSTAGRAM_VIDEO":var d="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(d+=" "+attr+'="'+a[attr]+'"');d+=" >",""!=t&&(d+='<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls><source src="'+i+'" type="video/mp4"> Your browser does not support the video tag. </video>'),n+=d+="</div>";break;case"EMBED_OEMBED_INSTAGRAM_IMAGE":d="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(d+=" "+attr+'="'+a[attr]+'"');if(d+=" >",null!=r&&r.length)for(var o=0;o<r.length;o++)"image"==r[o].type?d+='<img src="'+r[o].images.standard_resolution.url+'" style="max-width:100% !important; max-height:100% !important; width:auto !important; height:auto !important;" data-id="'+o+'" class="carousel_media '+(0==o?"active":"")+'">':"video"==r[o].type&&(void 0!==r[o].videos&&void 0!==r[o].videos.standard_resolution&&void 0!==r[o].videos.standard_resolution.url&&(i=r[o].videos.standard_resolution.url),d+='<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls data-id="'+o+'" class="carousel_media '+(0==o?"active":"")+'"><source src="'+i+'" type="video/mp4"> Your browser does not support the video tag. </video>');else""!=t&&(d+='<img src="'+i+'" style=" max-width:100% !important; max-height:100% !important; width:auto; height:auto;">');n+=d+="</div>"}return n}function wdi_testBrowser_cssTransitions(){return wdi_testDom("Transition")}function wdi_testBrowser_cssTransforms3d(){return wdi_testDom("Perspective")}function wdi_testDom(e){for(var t=["","Webkit","Moz","ms","O","Khtml"],i=t.length;i--;)if(void 0!==document.body.style[t[i]+e])return!0;return!1}function wdi_cube(e,t,i,a,r,n,d,o,s,_){return wdi_testBrowser_cssTransitions()?wdi_testBrowser_cssTransforms3d()?(wdi_trans_in_progress=!0,jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive"),jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active"),jQuery(".wdi_slide_bg").css("perspective",1e3),jQuery(o).css({transform:"translateZ("+e+"px)",backfaceVisibility:"hidden"}),jQuery(s).css({opacity:1,filter:"Alpha(opacity=100)",backfaceVisibility:"hidden",transform:"translateY("+i+"px) translateX("+t+"px) rotateY("+r+"deg) rotateX("+a+"deg)"}),jQuery(".wdi_slider").css({transform:"translateZ(-"+e+"px)",transformStyle:"preserve-3d"}),setTimeout(function(){jQuery(".wdi_slider").css({transition:"all "+wdi_transition_duration+"ms ease-in-out",transform:"translateZ(-"+e+"px) rotateX("+n+"deg) rotateY("+d+"deg)"})},20),void jQuery(".wdi_slider").one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(function(){jQuery(o).removeAttr("style"),jQuery(s).removeAttr("style"),jQuery(".wdi_slider").removeAttr("style"),jQuery(o).css({opacity:0,filter:"Alpha(opacity=0)","z-index":1}),jQuery(s).css({opacity:1,filter:"Alpha(opacity=100)","z-index":2}),wdi_trans_in_progress=!1,jQuery(o).html(""),"undefined"==typeof event_stack||0<event_stack.length&&(key=event_stack[0].split("-"),event_stack.shift(),wdi_change_image(key[0],key[1],wdi_data,!0));wdi_change_watermark_container()}))):wdi_fallback3d(o,s,_):wdi_fallback(o,s,_)}function wdi_cubeH(e,t,i){var a=jQuery(e).width()/2;"right"==i?wdi_cube(a,a,0,0,90,0,-90,e,t,i):"left"==i&&wdi_cube(a,-a,0,0,-90,0,90,e,t,i)}function wdi_cubeV(e,t,i){var a=jQuery(e).height()/2;"right"==i?wdi_cube(a,0,-a,90,0,-90,0,e,t,i):"left"==i&&wdi_cube(a,0,a,-90,0,90,0,e,t,i)}function wdi_fallback(e,t,i){wdi_fade(e,t,i)}function wdi_fallback3d(e,t,i){wdi_sliceV(e,t,i)}function wdi_none(e,t,i){jQuery(e).css({opacity:0,"z-index":1}),jQuery(t).css({opacity:1,"z-index":2}),jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive"),jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active"),wdi_trans_in_progress=!1,jQuery(e).html(""),wdi_change_watermark_container()}function wdi_fade(e,t,i){jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive"),jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active"),wdi_testBrowser_cssTransitions()?(jQuery(t).css("transition","opacity "+wdi_transition_duration+"ms linear"),jQuery(e).css({opacity:0,"z-index":1}),jQuery(t).css({opacity:1,"z-index":2}),wdi_change_watermark_container()):(jQuery(e).animate({opacity:0,"z-index":1},wdi_transition_duration),jQuery(t).animate({opacity:1,"z-index":2},{duration:wdi_transition_duration,complete:function(){wdi_trans_in_progress=!1,jQuery(e).html(""),wdi_change_watermark_container()}}),jQuery(e).fadeTo(wdi_transition_duration,0),jQuery(t).fadeTo(wdi_transition_duration,1))}function wdi_grid(e,t,i,a,r,n,d,o,s,_){if(!wdi_testBrowser_cssTransitions())return wdi_fallback(o,s,_);wdi_trans_in_progress=!0,jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive"),jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");var c=wdi_transition_duration/(e+t);var u=jQuery(o).find("img"),m=jQuery('<span style="display: block;" />').addClass("wdi_grid");jQuery(o).prepend(m);var l=jQuery(".wdi_slide_bg"),p=u.width(),w=u.height(),_=l.width(),l=l.height(),h=Math.floor(_/e),f=Math.floor(l/t),g=_-e*h,y=Math.ceil(g/e),v=l-t*f,b=Math.ceil(v/t),j=0,Q=Math.ceil((jQuery(".wdi_slide_bg").width()-u.width())/2),k=void 0===u.attr("src")?"":u.attr("src");a="min-auto"===(a="auto"===a?_:a)?-_:a,r="min-auto"===(r="auto"===r?l:r)?-l:r;for(var x,C,I,E,M,A,O,T,B,z,D=0;D<e;D++){var S,V=0,R=Math.floor((jQuery(".wdi_slide_bg").height()-u.height())/2),H=h;0<g&&(H+=S=y<=g?y:g,g-=S);for(var P=0;P<t;P++){var K=f,L=v;0<L&&(K+=S=b<=L?b:v,0),m.append((x=H,C=K,I=V,E=R,M=j,A=Q,O=k,T=p,B=w,z=(D+(z=P))*c,jQuery('<span class="wdi_gridlet" />').css({display:"block",width:x,height:C,top:I,left:M,backgroundImage:'url("'+O+'")',backgroundColor:jQuery(".wdi_spider_popup_wrap").css("background-color"),backgroundRepeat:"no-repeat",backgroundPosition:A+"px "+E+"px",backgroundSize:T+"px "+B+"px",transition:"all "+wdi_transition_duration+"ms ease-in-out "+z+"ms",transform:"none"}))),V+=K,R-=K}Q-=H,j+=H}l=m.children().last();m.show(),u.css("opacity",0),m.children().first().addClass("rs-top-left"),m.children().last().addClass("rs-bottom-right"),m.children().eq(t-1).addClass("rs-bottom-left"),m.children().eq(-t).addClass("rs-top-right"),setTimeout(function(){m.children().css({opacity:d,transform:"rotate("+i+"deg) translateX("+a+"px) translateY("+r+"px) scale("+n+")"})},1),jQuery(s).css("opacity",1),jQuery(l).one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(function(){jQuery(o).css({opacity:0,"z-index":1}),jQuery(s).css({opacity:1,"z-index":2}),u.css("opacity",1),m.remove(),wdi_trans_in_progress=!1,jQuery(o).html(""),"undefined"==typeof event_stack||0<event_stack.length&&(key=event_stack[0].split("-"),event_stack.shift(),wdi_change_image(key[0],key[1],wdi_data,!0));wdi_change_watermark_container()}))}function wdi_sliceH(e,t,i){var a;"right"==i?a="min-auto":"left"==i&&(a="auto"),wdi_grid(1,8,0,a,0,1,0,e,t,i)}function wdi_sliceV(e,t,i){var a;"right"==i?a="min-auto":"left"==i&&(a="auto"),wdi_grid(10,1,0,0,a,1,0,e,t,i)}function wdi_slideV(e,t,i){var a;"right"==i?a="auto":"left"==i&&(a="min-auto"),wdi_grid(1,1,0,0,a,1,1,e,t,i)}function wdi_slideH(e,t,i){var a;"right"==i?a="min-auto":"left"==i&&(a="auto"),wdi_grid(1,1,0,a,0,1,1,e,t,i)}function wdi_scaleOut(e,t,i){wdi_grid(1,1,0,0,0,1.5,0,e,t,i)}function wdi_scaleIn(e,t,i){wdi_grid(1,1,0,0,0,.5,0,e,t,i)}function wdi_blockScale(e,t,i){wdi_grid(8,6,0,0,0,.6,0,e,t,i)}function wdi_kaleidoscope(e,t,i){wdi_grid(10,8,0,0,0,1,0,e,t,i)}function wdi_fan(e,t,i){var a,r;"right"==i?(a=45,r=100):"left"==i&&(a=-45,r=-100),wdi_grid(1,10,a,r,0,1,0,e,t,i)}function wdi_blindV(e,t,i){wdi_grid(1,8,0,0,0,.7,0,e,t)}function wdi_blindH(e,t,i){wdi_grid(10,1,0,0,0,.7,0,e,t)}function wdi_random(e,t,i){var a=["sliceH","sliceV","slideH","slideV","scaleOut","scaleIn","blockScale","kaleidoscope","fan","blindH","blindV"];this["wdi_"+a[Math.floor(Math.random()*a.length)]](e,t,i)}function wdi_pause_stream(e){jQuery(e).find("video").each(function(){jQuery(this).get(0).pause()})}function wdi_reset_zoom(){var e=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()),t=document.querySelector('meta[name="viewport"]');e&&t&&(t.content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0")}Object.size=function(e){var t,i=0;for(t in e)e.hasOwnProperty(t)&&i++;return i},wdi_comments_manager={media_id:"",mediaComments:[],load_more_count:10,commentCounter:0,currentKey:-1,init:function(e){this.instagram=new WDIInstagram,this.instagram.addToken(wdi_front.access_token),this.currentKey!=e&&(this.currentKey=e,this.reset_comments())},reset_comments:function(){jQuery("#wdi_load_more_comments").remove(),jQuery("#wdi_added_comments").html(""),this.commentCounter=0,this.media_id=wdi_data[this.currentKey].id,this.getAjaxComments(this.currentKey)},popup_destroyed:function(){this.media_id="",this.mediaComments=[],this.commentCounter=0,this.currentKey=-1},showComments:function(e,t){(Object.size(e)-this.commentCounter-t<0||void 0===t)&&(t=Object.size(e)-this.commentCounter);var a=this.commentCounter;for(i=Object.size(e)-a-1;i>=Object.size(e)-a-t;i--){this.commentCounter++;var r=e[i].text,r=wdi_front.escape_tags(r);r=this.filterCommentText(r);var n=e[i].from.username,d=(e[i].from.profile_picture,jQuery('<div class="wdi_single_comment"></div>'));d.append(jQuery('<p class="wdi_comment_header_p"><span class="wdi_comment_header"><a target="_blank" href="//instagram.com/'+n+'">'+n+'</a></span><span class="wdi_comment_date">'+wdi_front.convertUnixDate(e[i].created_time)+"</span></p>")),d.append(jQuery('<div class="wdi_comment_body_p"><span class="wdi_comment_body"><p>'+r+"</p></span></div>")),jQuery("#wdi_added_comments").prepend(d)}this.updateScrollbar()},updateScrollbar:function(){var e=jQuery("#wdi_comments"),t=jQuery("#wdi_added_comments");jQuery(".wdi_comments").attr("class","wdi_comments"),jQuery(".wdi_comments").html(""),jQuery(".wdi_comments").append(e),jQuery(".wdi_comments").append(t),void 0!==jQuery().mCustomScrollbar&&jQuery.isFunction(jQuery().mCustomScrollbar)&&jQuery(".wdi_comments").mCustomScrollbar({scrollInertia:250}),jQuery(".wdi_comments_close_btn").on("click",wdi_comment)},getAjaxComments:function(){this.instagram.getRecentMediaComments(this.media_id,{success:function(e){if(""==e||null==e||null==e)return errorMessage="Network Error, please try again later :(",void console.log("%c"+errorMessage,"color:#cc0000;");if(200!=e.meta.code)return errorMessage=e.meta.error_message,void console.log("%c"+errorMessage,"color:#cc0000;");wdi_comments_manager.mediaComments=e.data;var t=wdi_data[wdi_comments_manager.currentKey];t.comments_data=e.data,wdi_comments_manager.showComments(t.comments_data,wdi_comments_manager.load_more_count),wdi_comments_manager.ajax_comments_ready(e.data)}})},ajax_comments_ready:function(e){this.createLoadMoreAndBindEvent()},createLoadMoreAndBindEvent:function(){jQuery("#wdi_added_comments").prepend(jQuery('<p id="wdi_load_more_comments" class="wdi_load_more_comments">load more comments</p>')),jQuery(".wdi_comment_container #wdi_load_more_comments").on("click",function(){jQuery(this).remove(),wdi_comments_manager.showComments(wdi_comments_manager.mediaComments,wdi_comments_manager.load_more_count),wdi_comments_manager.createLoadMoreAndBindEvent()})},filterCommentText:function(e){for(var t=e.split(" "),i="",a=0;a<t.length;a++)switch(t[a][0]){case"@":i+='<a target="blank" class="wdi_comm_text_link" href="//instagram.com/'+t[a].substring(1,t[a].length)+'">'+t[a]+"</a> ";break;case"#":i+='<a target="blank" class="wdi_comm_text_link" href="//instagram.com/explore/tags/'+t[a].substring(1,t[a].length)+'">'+t[a]+"</a> ";break;default:i+=t[a]+" "}return i=i.substring(0,i.length-1)}};
1
+ var isPopUpOpened=!1,wdi_data=[];function wdi_spider_createpopup(e,t,i,a,r,n,d,o,s){if(e=e.replace(/&#038;/g,"&"),!isPopUpOpened&&(isPopUpOpened=!0,!wdi_spider_hasalreadyreceivedpopup(n)&&!wdi_spider_isunsupporteduseragent())){jQuery("html").attr("style","overflow:hidden !important;"),jQuery("#wdi_spider_popup_loading_"+t).css({display:"block"}),jQuery("#wdi_spider_popup_overlay_"+t).css({display:"block"});for(var _,m=0,c=0;c<o.parsedData.length;c++)if(o.parsedData[c].id===s){m=c,_=[o.parsedData[c]];break}jQuery.ajax({type:"POST",url:e,dataType:"text",data:{action:"WDIGalleryBox",image_rows:JSON.stringify(_),feed_id:o.feed_row.id,feed_counter:o.feed_row.wdi_feed_counter,current_image_index:m,image_rows_count:o.parsedData.length,carousel_media_row:JSON.stringify(_[0].carousel_media)},success:function(e){e=jQuery('<div id="wdi_spider_popup_wrap" class="wdi_spider_popup_wrap wdi_lightbox_theme_'+o.feed_row.theme_id+'" style="width:'+i+"px;height:"+a+"px;margin-top:-"+a/2+"px;margin-left: -"+i/2+'px; ">'+e+"</div>");new wdi_construct_popup(e,o,o.parsedData,s).construct(),e.hide().appendTo("body"),wdi_spider_showpopup(n,d,e,r),jQuery("#wdi_spider_popup_loading_"+t).css({display:"none !important;"})}})}}var wdi_construct_popup=function(y,f,v,b){this.theme_row={},this.construct=function(){this.theme_row=window["wdi_theme_"+f.feed_row.theme_id],f.feed_row.popup_enable_filmstrip&&"1"===f.feed_row.popup_enable_filmstrip&&this.add_filmstrip(),this.set_wdi_data()},this.add_filmstrip=function(){var e="horizontal";"right"!==this.theme_row.lightbox_filmstrip_pos&&"left"!==this.theme_row.lightbox_filmstrip_pos||(e="vertical");for(var t="horizontal"===e?"tenweb-i-angle-left":"tenweb-i-angle-up",i="horizontal"===e?"tenweb-i-angle-right":"tenweb-i-angle-down",a="",r=n="horizontal"===e?void 0!==f.feed_row.popup_filmstrip_height?f.feed_row.popup_filmstrip_height:"20":void 0!==f.feed_row.popup_filmstrip_height?f.feed_row.popup_filmstrip_height:"50",n=r=parseInt(r),d=0;d<v.length;d++){var o,s,_,m=v[d];_=m.resolution&&""!==m.resolution?(m.resolution.split(" "),u=intval($resolution_arr[0]),l=intval($resolution_arr[2]),0!==u&&0!==l?(o=u*(s=Math.max(r/u,n/l)),l*s):(o=r,n)):(o=r,n);var c=(r-(o*=s=Math.max(r/o,n/_)))/2,u=(n-(_*=s))/2,l="wdi_filmstrip_thumbnail "+(parseInt(m.id)===parseInt(b)?"wdi_thumb_active":"wdi_thumb_deactive"),w="width:"+o+"px;height:"+_+"px;margin-left:"+c+"px;margin-top:"+u+"px;",p="wdi_change_image(parseInt(jQuery('#wdi_current_image_key').val()), '"+d+"', wdi_data)",h="wdi_change_image(parseInt(jQuery('#wdi_current_image_key').val()), '"+d+"', wdi_data)";switch(m.filetype){case"EMBED_OEMBED_INSTAGRAM_IMAGE":var g='<img style="'+w+'" class="wdi_filmstrip_thumbnail_img" src="'+(void 0!==m.images[f.feedImageResolution]&&void 0!==m.images[f.feedImageResolution].url?m.images[f.feedImageResolution].url:m.thumb_url)+'" onclick="'+p+'" ontouchend="'+h+'" image_id="'+m.id+'" image_key="'+d+'" alt="'+m.alt+'" />';break;case"EMBED_OEMBED_INSTAGRAM_VIDEO":g='<video style="'+w+'" class="wdi_filmstrip_thumbnail_img" src="'+(void 0!==m.filename?m.filename:m.thumb_url)+'" onclick="'+p+'" ontouchend="'+h+'" image_id="'+m.id+'" image_key="'+d+'" alt="'+m.alt+'" /></video>';break;case"EMBED_OEMBED_INSTAGRAM_CAROUSEL":switch(m.carousel_media[0].type){case"image":g='<img style="'+w+'" class="wdi_filmstrip_thumbnail_img" src="'+m.carousel_media[0].images.thumbnail.url+'" onclick="'+p+'" ontouchend="'+h+'" image_id="'+m.id+'" image_key="'+d+'" alt="'+m.alt+'" />';break;case"video":g='<video style="'+w+'" class="wdi_filmstrip_thumbnail_img" src="'+m.carousel_media[0].videos.low_resolution.url+'" onclick="'+p+'" ontouchend="'+h+'" image_id="'+m.id+'" image_key="'+d+'" alt="'+m.alt+'" /></video>';break;default:g='<img style="'+w+'" class="wdi_filmstrip_thumbnail_img" src="'+(wdi_url.plugin_url+"images/missing.png")+'" onclick="'+p+'" ontouchend="'+h+'" image_id="'+m.id+'" image_key="'+d+'" alt="'+m.alt+'" />'}}a+='<div id="wdi_filmstrip_thumbnail_'+d+'" class="'+l+'">'+g+"</div>"}i='<div class="wdi_filmstrip_left"><i class="tenweb-i '+t+'"></i></div><div class="wdi_filmstrip"><div class="wdi_filmstrip_thumbnails">'+a+'</div></div><div class="wdi_filmstrip_right"><i class="tenweb-i '+i+'"></i></div>';y.find(".wdi_filmstrip_container").append(i)},this.set_wdi_data=function(){wdi_data=[];for(var e=0;e<v.length;e++)wdi_data[e]=[],wdi_data[e].number=e+1,wdi_data[e].id=v[e].id,wdi_data[e].alt=v[e].alt,wdi_data[e].description=wdi_front.escape_tags(v[e].description),wdi_data[e].username=v[e].username,wdi_data[e].profile_picture=v[e].profile_picture,wdi_data[e].image_url=v[e].image_url,wdi_data[e].thumb_url=v[e].thumb_url,wdi_data[e].src=v[e].images.standard_resolution.url,wdi_data[e].date=v[e].date,wdi_data[e].comment_count=v[e].comment_count,wdi_data[e].filetype=v[e].filetype,wdi_data[e].filename=v[e].filename,wdi_data[e].avg_rating=v[e].avg_rating,wdi_data[e].rate=v[e].rate,wdi_data[e].rate_count=v[e].rate_count,wdi_data[e].hit_count=v[e].hit_count,wdi_data[e].comments_data=void 0!==v[e].comments_data?v[e].comments_data:"null",wdi_data[e].carousel_media=void 0!==v[e].carousel_media?v[e].carousel_media:null}};function wdi_spider_showpopup(e,t,i,a){isPopUpOpened=!0,i.show(),wdi_spider_receivedpopup(e,t)}function wdi_spider_hasalreadyreceivedpopup(e){return-1<document.cookie.indexOf(e)&&delete document.cookie[document.cookie.indexOf(e)],!1}function wdi_spider_receivedpopup(e,t){var i=new Date;i.setDate(i.getDate()+t),document.cookie=e+"=true;expires="+i.toUTCString()+";path=/",jQuery(".wdi_image_info").mCustomScrollbar({autoHideScrollbar:!1,scrollInertia:150,advanced:{updateOnContentResize:!0}})}function wdi_spider_isunsupporteduseragent(){return!window.XMLHttpRequest}function wdi_spider_destroypopup(e){null!=document.getElementById("wdi_spider_popup_wrap")&&(wdi_comments_manager.popup_destroyed(),void 0!==jQuery().fullscreen&&jQuery.isFunction(jQuery().fullscreen)&&jQuery.fullscreen.isFullScreen()&&jQuery.fullscreen.exit(),setTimeout(function(){jQuery(".wdi_spider_popup_wrap").remove(),jQuery(".wdi_spider_popup_loading").css({display:"none"}),jQuery(".wdi_spider_popup_overlay").css({display:"none"}),jQuery(document).off("keydown"),jQuery("html").attr("style","")},20)),isPopUpOpened=!1;var t=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()),i=document.querySelector('meta[name="viewport"]');t&&i&&(i.content="width=device-width, initial-scale=1");i=jQuery(document).scrollTop();window.location.hash="",jQuery(document).scrollTop(i),"undefined"!=typeof wdi_playInterval&&clearInterval(wdi_playInterval)}function wdi_spider_ajax_save(e,t){return wdi_comments_manager.init(t),!1}function wdi_spider_set_input_value(e,t){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_spider_check_required(e,t){return""==jQuery("#"+e).val()&&(wdi_front.show_alert(t+"* "+wdi_objectL10n.wdi_field_required),jQuery("#"+e).attr("style","border-color: #FF0000;"),jQuery("#"+e).focus(),!0)}function wdi_spider_check_email(e){if(""!=jQuery("#"+e).val())return-1==jQuery("#"+e).val().replace(/^\s+|\s+$/g,"").search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)&&(wdi_front.show_alert(wdi_objectL10n.wdi_mail_validation),!0)}function wdi_captcha_refresh(e){document.getElementById(e+"_img")&&document.getElementById(e+"_input")&&(srcArr=document.getElementById(e+"_img").src.split("&r="),document.getElementById(e+"_img").src=srcArr[0]+"&r="+Math.floor(100*Math.random()),document.getElementById(e+"_img").style.display="inline-block",document.getElementById(e+"_input").value="")}function wdi_play_pause(e){var t=-1<navigator.userAgent.indexOf("Chrome"),i=-1<navigator.userAgent.indexOf("Safari");t&&i&&(i=!1),i||(i=e.get(0),e=!1,navigator.userAgent.match(/firefox/i)&&(e=!0),e||(i.paused?i.play():i.pause()))}function wdi_spider_display_embed(e,t,i,a,r){var n="";switch(e){case"EMBED_OEMBED_INSTAGRAM_VIDEO":var d="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(d+=" "+attr+'="'+a[attr]+'"');d+=" >",""!=t&&(d+='<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls><source src="'+i+'" type="video/mp4"> Your browser does not support the video tag. </video>'),n+=d+="</div>";break;case"EMBED_OEMBED_INSTAGRAM_IMAGE":d="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(d+=" "+attr+'="'+a[attr]+'"');d+=" >",""!=t&&(d+='<img src="'+i+'" style=" max-width:100% !important; max-height:100% !important; width:auto; height:auto;">'),n+=d+="</div>";break;case"EMBED_OEMBED_INSTAGRAM_CAROUSEL":d="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(d+=" "+attr+'="'+a[attr]+'"');d+=" >";for(var o=0;o<r.length;o++)"image"==r[o].type?d+='<img src="'+r[o].images.standard_resolution.url+'" style="max-width:100% !important; max-height:100% !important; width:auto !important; height:auto !important;" data-id="'+o+'" class="carousel_media '+(0==o?"active":"")+'">':"video"==r[o].type&&(void 0!==r[o].videos&&void 0!==r[o].videos.standard_resolution&&void 0!==r[o].videos.standard_resolution.url&&(i=r[o].videos.standard_resolution.url),d+='<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls data-id="'+o+'" class="carousel_media '+(0==o?"active":"")+'"><source src="'+i+'" type="video/mp4"> Your browser does not support the video tag. </video>');n+=d+="</div>"}return n}function wdi_testBrowser_cssTransitions(){return wdi_testDom("Transition")}function wdi_testBrowser_cssTransforms3d(){return wdi_testDom("Perspective")}function wdi_testDom(e){for(var t=["","Webkit","Moz","ms","O","Khtml"],i=t.length;i--;)if(void 0!==document.body.style[t[i]+e])return!0;return!1}function wdi_cube(e,t,i,a,r,n,d,o,s,_){return wdi_testBrowser_cssTransitions()?wdi_testBrowser_cssTransforms3d()?(wdi_trans_in_progress=!0,jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive"),jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active"),jQuery(".wdi_slide_bg").css("perspective",1e3),jQuery(o).css({transform:"translateZ("+e+"px)",backfaceVisibility:"hidden"}),jQuery(s).css({opacity:1,filter:"Alpha(opacity=100)",backfaceVisibility:"hidden",transform:"translateY("+i+"px) translateX("+t+"px) rotateY("+r+"deg) rotateX("+a+"deg)"}),jQuery(".wdi_slider").css({transform:"translateZ(-"+e+"px)",transformStyle:"preserve-3d"}),setTimeout(function(){jQuery(".wdi_slider").css({transition:"all "+wdi_transition_duration+"ms ease-in-out",transform:"translateZ(-"+e+"px) rotateX("+n+"deg) rotateY("+d+"deg)"})},20),void jQuery(".wdi_slider").one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(function(){jQuery(o).removeAttr("style"),jQuery(s).removeAttr("style"),jQuery(".wdi_slider").removeAttr("style"),jQuery(o).css({opacity:0,filter:"Alpha(opacity=0)","z-index":1}),jQuery(s).css({opacity:1,filter:"Alpha(opacity=100)","z-index":2}),wdi_trans_in_progress=!1,jQuery(o).html(""),"undefined"==typeof event_stack||0<event_stack.length&&(key=event_stack[0].split("-"),event_stack.shift(),wdi_change_image(key[0],key[1],wdi_data,!0));wdi_change_watermark_container()}))):wdi_fallback3d(o,s,_):wdi_fallback(o,s,_)}function wdi_cubeH(e,t,i){var a=jQuery(e).width()/2;"right"==i?wdi_cube(a,a,0,0,90,0,-90,e,t,i):"left"==i&&wdi_cube(a,-a,0,0,-90,0,90,e,t,i)}function wdi_cubeV(e,t,i){var a=jQuery(e).height()/2;"right"==i?wdi_cube(a,0,-a,90,0,-90,0,e,t,i):"left"==i&&wdi_cube(a,0,a,-90,0,90,0,e,t,i)}function wdi_fallback(e,t,i){wdi_fade(e,t,i)}function wdi_fallback3d(e,t,i){wdi_sliceV(e,t,i)}function wdi_none(e,t,i){jQuery(e).css({opacity:0,"z-index":1}),jQuery(t).css({opacity:1,"z-index":2}),jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive"),jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active"),wdi_trans_in_progress=!1,jQuery(e).html(""),wdi_change_watermark_container()}function wdi_fade(e,t,i){jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive"),jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active"),wdi_testBrowser_cssTransitions()?(jQuery(t).css("transition","opacity "+wdi_transition_duration+"ms linear"),jQuery(e).css({opacity:0,"z-index":1}),jQuery(t).css({opacity:1,"z-index":2}),wdi_change_watermark_container()):(jQuery(e).animate({opacity:0,"z-index":1},wdi_transition_duration),jQuery(t).animate({opacity:1,"z-index":2},{duration:wdi_transition_duration,complete:function(){wdi_trans_in_progress=!1,jQuery(e).html(""),wdi_change_watermark_container()}}),jQuery(e).fadeTo(wdi_transition_duration,0),jQuery(t).fadeTo(wdi_transition_duration,1))}function wdi_grid(e,t,i,a,r,n,d,o,s,_){if(!wdi_testBrowser_cssTransitions())return wdi_fallback(o,s,_);wdi_trans_in_progress=!0,jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive"),jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");var m=wdi_transition_duration/(e+t);var c=jQuery(o).find("img"),u=jQuery('<span style="display: block;" />').addClass("wdi_grid");jQuery(o).prepend(u);var l=jQuery(".wdi_slide_bg"),w=c.width(),p=c.height(),_=l.width(),l=l.height(),h=Math.floor(_/e),g=Math.floor(l/t),y=_-e*h,f=Math.ceil(y/e),v=l-t*g,b=Math.ceil(v/t),j=0,Q=Math.ceil((jQuery(".wdi_slide_bg").width()-c.width())/2),k=void 0===c.attr("src")?"":c.attr("src");a="min-auto"===(a="auto"===a?_:a)?-_:a,r="min-auto"===(r="auto"===r?l:r)?-l:r;for(var x,C,E,M,I,A,B,O,T,D,S=0;S<e;S++){var z,K=0,R=Math.floor((jQuery(".wdi_slide_bg").height()-c.height())/2),V=h;0<y&&(V+=z=f<=y?f:y,y-=z);for(var L=0;L<t;L++){var G=g,H=v;0<H&&(G+=z=b<=H?b:v,0),u.append((x=V,C=G,E=K,M=R,I=j,A=Q,B=k,O=w,T=p,D=(S+(D=L))*m,jQuery('<span class="wdi_gridlet" />').css({display:"block",width:x,height:C,top:E,left:I,backgroundImage:'url("'+B+'")',backgroundColor:jQuery(".wdi_spider_popup_wrap").css("background-color"),backgroundRepeat:"no-repeat",backgroundPosition:A+"px "+M+"px",backgroundSize:O+"px "+T+"px",transition:"all "+wdi_transition_duration+"ms ease-in-out "+D+"ms",transform:"none"}))),K+=G,R-=G}Q-=V,j+=V}l=u.children().last();u.show(),c.css("opacity",0),u.children().first().addClass("rs-top-left"),u.children().last().addClass("rs-bottom-right"),u.children().eq(t-1).addClass("rs-bottom-left"),u.children().eq(-t).addClass("rs-top-right"),setTimeout(function(){u.children().css({opacity:d,transform:"rotate("+i+"deg) translateX("+a+"px) translateY("+r+"px) scale("+n+")"})},1),jQuery(s).css("opacity",1),jQuery(l).one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(function(){jQuery(o).css({opacity:0,"z-index":1}),jQuery(s).css({opacity:1,"z-index":2}),c.css("opacity",1),u.remove(),wdi_trans_in_progress=!1,jQuery(o).html(""),"undefined"==typeof event_stack||0<event_stack.length&&(key=event_stack[0].split("-"),event_stack.shift(),wdi_change_image(key[0],key[1],wdi_data,!0));wdi_change_watermark_container()}))}function wdi_sliceH(e,t,i){var a;"right"==i?a="min-auto":"left"==i&&(a="auto"),wdi_grid(1,8,0,a,0,1,0,e,t,i)}function wdi_sliceV(e,t,i){var a;"right"==i?a="min-auto":"left"==i&&(a="auto"),wdi_grid(10,1,0,0,a,1,0,e,t,i)}function wdi_slideV(e,t,i){var a;"right"==i?a="auto":"left"==i&&(a="min-auto"),wdi_grid(1,1,0,0,a,1,1,e,t,i)}function wdi_slideH(e,t,i){var a;"right"==i?a="min-auto":"left"==i&&(a="auto"),wdi_grid(1,1,0,a,0,1,1,e,t,i)}function wdi_scaleOut(e,t,i){wdi_grid(1,1,0,0,0,1.5,0,e,t,i)}function wdi_scaleIn(e,t,i){wdi_grid(1,1,0,0,0,.5,0,e,t,i)}function wdi_blockScale(e,t,i){wdi_grid(8,6,0,0,0,.6,0,e,t,i)}function wdi_kaleidoscope(e,t,i){wdi_grid(10,8,0,0,0,1,0,e,t,i)}function wdi_fan(e,t,i){var a,r;"right"==i?(a=45,r=100):"left"==i&&(a=-45,r=-100),wdi_grid(1,10,a,r,0,1,0,e,t,i)}function wdi_blindV(e,t,i){wdi_grid(1,8,0,0,0,.7,0,e,t)}function wdi_blindH(e,t,i){wdi_grid(10,1,0,0,0,.7,0,e,t)}function wdi_random(e,t,i){var a=["sliceH","sliceV","slideH","slideV","scaleOut","scaleIn","blockScale","kaleidoscope","fan","blindH","blindV"];this["wdi_"+a[Math.floor(Math.random()*a.length)]](e,t,i)}function wdi_pause_stream(e){jQuery(e).find("video").each(function(){jQuery(this).get(0).pause()})}function wdi_reset_zoom(){var e=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()),t=document.querySelector('meta[name="viewport"]');e&&t&&(t.content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0")}Object.size=function(e){var t,i=0;for(t in e)e.hasOwnProperty(t)&&i++;return i},wdi_comments_manager={media_id:"",mediaComments:[],load_more_count:10,commentCounter:0,currentKey:-1,init:function(e){this.instagram=new WDIInstagram,this.instagram.addToken(wdi_front.access_token),this.currentKey!=e&&(this.currentKey=e,this.reset_comments())},reset_comments:function(){jQuery("#wdi_load_more_comments").remove(),jQuery("#wdi_added_comments").html(""),this.commentCounter=0,this.media_id=wdi_data[this.currentKey].id,this.getAjaxComments(this.currentKey)},clear_comments:function(){jQuery("#wdi_load_more_comments").remove(),jQuery("#wdi_added_comments").html(""),this.commentCounter=0},popup_destroyed:function(){this.media_id="",this.mediaComments=[],this.commentCounter=0,this.currentKey=-1},showComments:function(e,t){(Object.size(e)-this.commentCounter-t<0||void 0===t)&&(t=Object.size(e)-this.commentCounter);var a=this.commentCounter;for(i=Object.size(e)-a-1;i>=Object.size(e)-a-t;i--){this.commentCounter++;var r=e[i].text,r=wdi_front.escape_tags(r);r=this.filterCommentText(r);var n=e[i].username,d=jQuery('<div class="wdi_single_comment"></div>');d.append(jQuery('<p class="wdi_comment_header_p"><span class="wdi_comment_header"><a target="_blank" href="//instagram.com/'+n+'">'+n+'</a></span><span class="wdi_comment_date">'+wdi_front.convertUnixDate(e[i].timestamp)+"</span></p>")),d.append(jQuery('<div class="wdi_comment_body_p"><span class="wdi_comment_body"><p>'+r+"</p></span></div>")),jQuery("#wdi_added_comments").prepend(d)}0==jQuery(".wdi_single_comment").length&&jQuery("#wdi_added_comments").html('<p class="wdi_no_comment">There are no comments to show</p>'),this.updateScrollbar()},updateScrollbar:function(){var e=jQuery("#wdi_comments"),t=jQuery("#wdi_added_comments");jQuery(".wdi_comments").attr("class","wdi_comments"),jQuery(".wdi_comments").html(""),jQuery(".wdi_comments").append(e),jQuery(".wdi_comments").append(t),void 0!==jQuery().mCustomScrollbar&&jQuery.isFunction(jQuery().mCustomScrollbar)&&jQuery(".wdi_comments").mCustomScrollbar({scrollInertia:250}),jQuery(".wdi_comments_close_btn").on("click",wdi_comment)},getAjaxComments:function(){var e="";void 0!==wdi_data[wdi_comments_manager.currentKey].comments_data.next&&(e=wdi_data[wdi_comments_manager.currentKey].comments_data.next),this.instagram.getRecentMediaComments(this.media_id,{success:function(e){if(""==e||null==e||null==e||void 0!==e.error)return errorMessage="Network Error, please try again later :(",console.log("%c"+errorMessage,"color:#cc0000;"),void jQuery("#wdi_added_comments").html('<p class="wdi_no_comment">Comments are currently unavailable</p>');if(200!=e.meta.code)return errorMessage=e.meta.error_message,console.log("%c"+errorMessage,"color:#cc0000;"),void jQuery("#wdi_added_comments").html('<p class="wdi_no_comment">Comments are currently unavailable</p>');void 0!==wdi_data[wdi_comments_manager.currentKey].comments_data.data?(wdi_data[wdi_comments_manager.currentKey].comments_data.data=e.data.concat(wdi_data[wdi_comments_manager.currentKey].comments_data.data),wdi_data[wdi_comments_manager.currentKey].comment_count+=wdi_data[wdi_comments_manager.currentKey].comments_data.data.length):(wdi_data[wdi_comments_manager.currentKey].comments_data=e,wdi_data[wdi_comments_manager.currentKey].comment_count=wdi_data[wdi_comments_manager.currentKey].comments_data.data.length),wdi_data[wdi_comments_manager.currentKey].comments_data.next=void 0!==e.paging?e.paging.next:"",wdi_comments_manager.mediaComments=e.data;var t=wdi_data[wdi_comments_manager.currentKey];wdi_comments_manager.showComments(t.comments_data.data,wdi_comments_manager.load_more_count),wdi_comments_manager.ajax_comments_ready(e.data)}},e)},ajax_comments_ready:function(e){this.createLoadMoreAndBindEvent(wdi_comments_manager.currentKey)},createLoadMoreAndBindEvent:function(e){""==e&&(e=wdi_comments_manager.currentKey),(""!==wdi_data[e].comments_data.next||wdi_data[e].comments_data.data.length>wdi_comments_manager.load_more_count&&jQuery(".wdi_single_comment").length<wdi_data[e].comments_data.data.length&&0==jQuery("#wdi_load_more_comments").length)&&jQuery("#wdi_added_comments").prepend(jQuery('<p id="wdi_load_more_comments" class="wdi_load_more_comments">load more comments</p>')),jQuery(".wdi_comment_container #wdi_load_more_comments").on("click",function(){wdi_comments_manager.commentCounter+wdi_comments_manager.load_more_count>wdi_data[e].comments_data.data.length&&""!=wdi_data[e].comments_data.next&&wdi_comments_manager.getAjaxComments(this.currentKey),jQuery(this).remove(),wdi_comments_manager.showComments(wdi_data[e].comments_data.data,wdi_comments_manager.load_more_count),wdi_comments_manager.createLoadMoreAndBindEvent(wdi_comments_manager.currentKey)})},filterCommentText:function(e){for(var t=e.split(" "),i="",a=0;a<t.length;a++)switch(t[a][0]){case"@":i+='<a target="blank" class="wdi_comm_text_link" href="//instagram.com/'+t[a].substring(1,t[a].length)+'">'+t[a]+"</a> ";break;case"#":i+='<a target="blank" class="wdi_comm_text_link" href="//instagram.com/explore/tags/'+t[a].substring(1,t[a].length)+'">'+t[a]+"</a> ";break;default:i+=t[a]+" "}return i=i.substring(0,i.length-1)}};
js/wdi_admin.js CHANGED
@@ -167,6 +167,10 @@ jQuery(document).ready(function() {
167
  }
168
  return false;
169
  });
 
 
 
 
170
  });
171
 
172
  function wdi_multiple_accounts_option_controller() {
@@ -468,6 +472,7 @@ wdi_controller.save_feed = function ( task ) {
468
  id,
469
  type,
470
  username,
 
471
  default_user = {},
472
  json_feed_users = {};
473
  if ( 'cancel' == task ) {
@@ -475,7 +480,13 @@ wdi_controller.save_feed = function ( task ) {
475
  }
476
  type = jQuery('#WDI_user_name option:selected').data('type');
477
  username = jQuery('#WDI_user_name option:selected').val();
 
478
  var userObj = wdi_controller.getUserObj(username);
 
 
 
 
 
479
  if ( !userObj ) {
480
  alert(wdi_messages.user_field_required);
481
  return false;
167
  }
168
  return false;
169
  });
170
+
171
+ jQuery( '#WDI_feed_name' ).on( "keypress", function () {
172
+ jQuery( this ).removeAttr( "style" );
173
+ } );
174
  });
175
 
176
  function wdi_multiple_accounts_option_controller() {
472
  id,
473
  type,
474
  username,
475
+ feed_title,
476
  default_user = {},
477
  json_feed_users = {};
478
  if ( 'cancel' == task ) {
480
  }
481
  type = jQuery('#WDI_user_name option:selected').data('type');
482
  username = jQuery('#WDI_user_name option:selected').val();
483
+ feed_title = jQuery('#WDI_feed_name');
484
  var userObj = wdi_controller.getUserObj(username);
485
+ if (feed_title.val() == "") {
486
+ alert(wdi_messages.feed_title_field_required);
487
+ feed_title.focus().attr( 'style', 'border-color: #FF0000;' );
488
+ return false;
489
+ }
490
  if ( !userObj ) {
491
  alert(wdi_messages.user_field_required);
492
  return false;
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(){}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()}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(),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>"):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})}),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(".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={};"cancel"==e&&(window.location=window.location.href),t=jQuery("#WDI_user_name option:selected").data("type"),s=jQuery("#WDI_user_name option:selected").val();var s=wdi_controller.getUserObj(s);if(!s)return alert(wdi_messages.user_field_required),!1;if(i={id:s.user_id,username:s.user_name},wdi_controller.checkIfUserNotSaved(e),0==wdi_controller.waitingAjaxRequestEnd.button){if(a=jQuery("#WDI_feed_users").val(),this.isJsonString(a)){for(var n in a=JSON.parse(a))"#"===a[n].username.charAt(0)&&r.push(a[n]);r.push(i)}else r.push(i);jQuery("#WDI_feed_users").val(this.stringifyUserData(r)),jQuery("#wdi_feed_thumb").val(""),"business"==t&&jQuery("#wdi_feed_thumb").val(s.profile_picture_url),"apply_changes"!=e&&"save_feed"!=e||(s=jQuery("#wdi_add_or_edit").val(),jQuery("#wdi_current_id").val(s)),jQuery("#task").attr("value",e),jQuery("#wdi_save_feed").submit()}},wdi_controller.makeInstagramUserRequest=function(e,i){var r=this,t=this.getInputType(e),a="hashtag"===t;if(""==e)return alert(wdi_messages.please_write_hashtag),!1;if(""!=e&&!a)return alert(wdi_messages.invalid_hashtag),!1;if(r.checkForDuplicateUser(e))return alert(e+" "+wdi_messages.already_added),!1;switch(a=jQuery("#WDI_user_name option:selected").val(),(a=wdi_controller.getUserObj(a))&&(this.instagram.user=a),t){case"user":break;case"hashtag":var s=(s=e.substr(1,e.length)).replace(" ",""),n=jQuery("input[name='wdi_feed_settings[hashtag_top_recent]']:checked").val();this.instagram.getTagRecentMedia(s,{success:function(e){jQuery("#wdi_add_user_ajax").removeAttr("disabled");var t=r.isValidResponse(e);t.valid&&r.hasData(e)?r.addHashtag(s,e):r.hasData(e)||"success"!=t.msg?alert(t.msg):1!=i?(confirm(wdi_messages.hashtag_no_data),jQuery("#wdi_add_user_ajax_input").val("")):r.addHashtag(s,e)}},null,n)}},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.error_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(""),i=void 0!==t&&0!=t.data.length&&void 0!==t.data[0].images.thumbnail?t.data[0].images.thumbnail.url:"";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:i,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(){}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()}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(),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>"):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(".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))"#"===s[d].username.charAt(0)&&a.push(s[d]);a.push(r)}else a.push(r);jQuery("#WDI_feed_users").val(this.stringifyUserData(a)),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),jQuery("#wdi_save_feed").submit()}},wdi_controller.makeInstagramUserRequest=function(e,i){var r=this,t=this.getInputType(e),a="hashtag"===t;if(""==e)return alert(wdi_messages.please_write_hashtag),!1;if(""!=e&&!a)return alert(wdi_messages.invalid_hashtag),!1;if(r.checkForDuplicateUser(e))return alert(e+" "+wdi_messages.already_added),!1;switch(a=jQuery("#WDI_user_name option:selected").val(),(a=wdi_controller.getUserObj(a))&&(this.instagram.user=a),t){case"user":break;case"hashtag":var s=(s=e.substr(1,e.length)).replace(" ",""),n=jQuery("input[name='wdi_feed_settings[hashtag_top_recent]']:checked").val();this.instagram.getTagRecentMedia(s,{success:function(e){jQuery("#wdi_add_user_ajax").removeAttr("disabled");var t=r.isValidResponse(e);t.valid&&r.hasData(e)?r.addHashtag(s,e):r.hasData(e)||"success"!=t.msg?alert(t.msg):1!=i?(confirm(wdi_messages.hashtag_no_data),jQuery("#wdi_add_user_ajax_input").val("")):r.addHashtag(s,e)}},null,n)}},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.error_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(""),i=void 0!==t&&0!=t.data.length&&void 0!==t.data[0].images.thumbnail?t.data[0].images.thumbnail.url:"";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:i,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
@@ -4,21 +4,19 @@ if (typeof wdi_front == 'undefined') {
4
  };
5
  }
6
 
7
- wdi_front.detectEvent = function ()
8
- {
9
  var isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
10
- if (isMobile) {
11
- return "touchend";
12
- } else {
13
- return 'click';
14
  }
 
15
  }
16
 
17
  var wdi_error_show = false;
18
  var wdi_error_init = false;
19
 
20
- wdi_front.escape_tags = function (text)
21
- {
22
  var lt = /</g,
23
  gt = />/g,
24
  ap = /'/g,
@@ -31,72 +29,46 @@ wdi_front.escape_tags = function (text)
31
  return text;
32
  }
33
 
34
- wdi_front.show_alert = function (message, response, wdi_current_feed)
35
- {
36
  wdi_current_feed = jQuery('#wdi_feed_' + wdi_current_feed.feed_row.wdi_feed_counter);
37
- if(response["meta"]["code"] === 400 && response["meta"]["error_type"] === "APINotAllowedError"){
38
- if(typeof response.wdi_current_feed_name != "undefined"){
39
- var wdi_private_user_name = response.wdi_current_feed_name;
40
- var wdi_private_feed_names = wdi_current_feed.find(".wdi_private_feed_names");
41
-
42
- if(typeof wdi_private_feed_names.attr("wdi_first_private_user") == "undefined"){
43
- wdi_private_feed_names.attr("wdi_first_private_user",1);
44
- }else{
45
- wdi_private_user_name = ", " + wdi_private_user_name;
46
- }
47
-
48
- wdi_private_feed_names.append(wdi_private_user_name);
49
- wdi_current_feed.find(".wdi_private_feed_error").removeClass("wdi_hidden");
50
- }
51
- wdi_current_feed.find(".wdi_spinner").remove();
52
-
53
- }
54
-
55
-
56
- if(typeof wdi_current_feed != "undefined" && response["meta"]["error_type"] != "APINotAllowedError"){
57
- wdi_current_feed.find(".wdi_spinner").remove();
58
- /* if(wdi_error_show){
59
- return;
60
- }*/
61
  wdi_error_show = true;
62
-
63
- var wdi_js_error = wdi_current_feed.find(".wdi_js_error");
64
- var wdi_token_error = wdi_current_feed.find(".wdi_token_error");
65
-
66
- if(response!=false && typeof response.meta!= undefined && response.meta.error_type === "OAuthAccessTokenException"){
67
- wdi_token_error.removeClass("wdi_hidden");
68
- if(wdi_front_messages.wdi_token_error_flag != "1"){
69
  jQuery.ajax({
70
  type: "POST",
71
  url: wdi_url.ajax_url,
72
  dataType: 'json',
73
  data: {
74
- action: "wdi_token_flag",
75
  wdi_token_flag_nonce: wdi_front_messages.wdi_token_flag_nonce,
76
  },
77
- success: function(data){
78
-
79
  }
80
  });
81
  }
82
- }else{
83
- wdi_js_error.removeClass("wdi_js_error");
84
- wdi_js_error.addClass("wdi_js_error_no_animate");
 
 
85
  jQuery('.wdi_js_error_no_animate').show();
86
  }
87
-
88
- if (wdi_front_messages.show_alerts) {
89
- //alert(message);
90
  }
91
  else {
92
  console.log('%c' + message, "color:#cc0000;");
93
  }
94
  }
95
-
96
  wdi_error_show = true;
97
  }
98
 
99
-
100
  wdi_front.globalInit = function () {
101
 
102
  var num = wdi_front['feed_counter'];
@@ -336,8 +308,7 @@ wdi_front.getFeedItemResolution = function (currentFeed) {
336
  * @param {String} str [string to check]
337
  * @return {Boolean} [true or false]
338
  */
339
- wdi_front.isJsonString = function (str)
340
- {
341
  try {
342
  JSON.parse(str);
343
  } catch (e) {
@@ -346,7 +317,6 @@ wdi_front.isJsonString = function (str)
346
  return true;
347
  }
348
 
349
-
350
  /**
351
  * Makes an ajax request for given user from feed_users array
352
  * if response is ok then calls saveUserData function
@@ -376,11 +346,11 @@ wdi_front.instagramRequest = function (id, currentFeed) {
376
  if ( this.getInputType(feed_users[id]['username']) == 'hashtag' ) {
377
  currentFeed.instagram.getTagRecentMedia(this.stripHashtag(feed_users[id]['username']), {
378
  success: function (response) {
379
- if(typeof response.meta!= "undefined" && typeof response.meta.error_type != "undefined"){
380
  wdi_front.show_alert(false, response, currentFeed);
 
381
  }
382
  currentFeed.mediaRequestsDone = true;
383
-
384
  response = _this.checkMediaResponse(response, currentFeed);
385
  if ( response != false ) {
386
  _this.saveUserData(response, currentFeed.feed_users[id], currentFeed);
@@ -393,9 +363,9 @@ wdi_front.instagramRequest = function (id, currentFeed) {
393
  currentFeed.instagram.getUserMedia({
394
  user_id: feed_users[id].id,
395
  success: function (response) {
396
- if(typeof response.meta != "undefined" && typeof response.meta.error_type != "undefined"){
397
- response.wdi_current_feed_name = feed_users[id].username;
398
  wdi_front.show_alert(false, response, currentFeed);
 
399
  }
400
  currentFeed.mediaRequestsDone = true;
401
  response = _this.checkMediaResponse(response, currentFeed);
@@ -419,7 +389,6 @@ wdi_front.isHashtag = function (str)
419
  return (str[0] === '#');
420
  }
421
 
422
-
423
  /*
424
  * Saves each user data on seperate index in currentFeed.usersData array
425
  * And also checks if all data form all users is already avialable if yes it displays feed
@@ -464,13 +433,11 @@ wdi_front.saveUserData = function (data, user, currentFeed) {
464
  }
465
  }
466
 
467
-
468
  /*
469
  * Saves self user data on separate index in currentFeed.usersData array
470
  * And also checks if all data form all users is already avialable if yes it displays feed
471
  */
472
- wdi_front.saveSelfUserData = function (data, currentFeed)
473
- {
474
 
475
  //keep empty for self feed
476
  data['user_id'] = '';
@@ -509,8 +476,7 @@ wdi_front.saveSelfUserData = function (data, currentFeed)
509
  /**
510
  * checks weather all feed users have any photos after first time request
511
  */
512
- wdi_front.userHasNoPhoto = function (currentFeed, cstData)
513
- {
514
  var counter = 0;
515
  var data = currentFeed.usersData;
516
  if (typeof cstData != 'undefined') {
@@ -543,33 +509,28 @@ wdi_front.userHasNoPhoto = function (currentFeed, cstData)
543
  /*
544
  *gives each instagram object custom hashtag parameter, which is used for searching image/video
545
  */
546
- wdi_front.appendRequestHashtag = function (data, hashtag)
547
- {
548
  for (var i = 0; i < data.length; i++) {
549
  data[i]['wdi_hashtag'] = hashtag;
550
  }
551
  return data;
552
  }
553
 
554
-
555
  /*
556
  * sorts data based on user choice and displays feed
557
  * also checks if one request is not enough for displaying all images user wanted
558
  * it recursively calls wdi_front.loadMore() until the desired number of photos is reached
559
  */
560
  wdi_front.displayFeed = function (currentFeed, load_more_number) {
561
-
562
  if (currentFeed.customFilterChanged == false) {
563
- //sorting data...
564
  var data = wdi_front.feedSort(currentFeed, load_more_number);
565
  }
566
 
567
-
568
  //becomes true when user clicks in frontend filter
569
  //if isset to true then loadmore recursion would not start
570
  var frontendCustomFilterClicked = currentFeed.customFilterChanged;
571
 
572
-
573
  // if custom filter changed then display custom data
574
  if (currentFeed.customFilterChanged == true) {
575
  var data = currentFeed.customFilteredData;
@@ -578,7 +539,6 @@ wdi_front.displayFeed = function (currentFeed, load_more_number) {
578
  currentFeed.parsedData = wdi_front.parseLighboxData(currentFeed, true);
579
  }
580
 
581
-
582
  //storing all sorted data in array for later use in user based filters
583
  if (currentFeed.feed_row.resort_after_load_more != '1') {
584
  // filter changes when user clicks to usernames in header
@@ -650,7 +610,6 @@ wdi_front.displayFeed = function (currentFeed, load_more_number) {
650
  //if there are any missing images in header then replace them with new ones if possible
651
  wdi_front.updateUsersImages(currentFeed);
652
 
653
-
654
  // /**
655
  // * Enable image lazy laoding if pagination is not enabeled because pagination has option for preloading images
656
  // * which is the opposide of lazy load
@@ -662,9 +621,7 @@ wdi_front.displayFeed = function (currentFeed, load_more_number) {
662
  // threshold : 400
663
  // });
664
  // });
665
-
666
  // }
667
-
668
  }
669
 
670
  /**
@@ -672,8 +629,7 @@ wdi_front.displayFeed = function (currentFeed, load_more_number) {
672
  * then update source
673
  * @param {Object} currentFeed [description]
674
  */
675
- wdi_front.updateUsersImages = function (currentFeed)
676
- {
677
  var elements = jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter).find('.wdi_single_user .wdi_user_img_wrap img');
678
  elements.each(function ()
679
  {
@@ -694,14 +650,12 @@ wdi_front.updateUsersImages = function (currentFeed)
694
  });
695
  }
696
 
697
-
698
  /**
699
  * Displays data in masonry layout
700
  * @param {Object} data data to be displayed
701
  * @param {Object} currentFeed
702
  */
703
- wdi_front.masonryDisplayFeedItems = function (data, currentFeed)
704
- {
705
  var masonryColEnds = [];
706
  var masonryColumns = [];
707
  if (jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter + " .wdi_feed_wrapper").length == 0) {
@@ -739,7 +693,6 @@ wdi_front.masonryDisplayFeedItems = function (data, currentFeed)
739
  currentFeed.customFilterChanged = false;
740
  }
741
 
742
-
743
  //loop for displaying items
744
  for (var i = 0; i < data.length; i++) {
745
 
@@ -791,8 +744,7 @@ wdi_front.masonryDisplayFeedItems = function (data, currentFeed)
791
  var columnFlag = false;
792
  currentFeed.wdi_load_count = i;
793
  var wdi_feed_counter = currentFeed.feed_row['wdi_feed_counter'];
794
- var feed_wrapper = jQuery('#wdi_feed_' + wdi_feed_counter + ' img.wdi_img').on('load', function ()
795
- {
796
  currentFeed.wdi_loadedImages++;
797
  checkLoaded();
798
 
@@ -827,8 +779,7 @@ wdi_front.masonryDisplayFeedItems = function (data, currentFeed)
827
 
828
 
829
  //checks if all iamges have been succesfully loaded then it updates variables for next time use
830
- function checkLoaded()
831
- {
832
 
833
  if (currentFeed.wdi_load_count === currentFeed.wdi_loadedImages && currentFeed.wdi_loadedImages != 0) {
834
  currentFeed.loadedImages = 0;
@@ -845,16 +796,12 @@ wdi_front.masonryDisplayFeedItems = function (data, currentFeed)
845
 
846
  //check if load more done successfully then set infinite scroll flag to false
847
  currentFeed.infiniteScrollFlag = false;
848
-
849
-
850
  }
851
 
852
-
853
  /*
854
  * Calcuates image resolution
855
  */
856
- wdi_front.getImageResolution = function (data)
857
- {
858
 
859
  var originalWidth = data['images']['standard_resolution']['width'];
860
  var originalHeight = data['images']['standard_resolution']['height'];
@@ -866,8 +813,7 @@ wdi_front.getImageResolution = function (data)
866
  * Calculates data count on global Storage and if custom storage provied
867
  * it adds custom storage data count to golbals data count and returns length of all storages
868
  */
869
- wdi_front.getDataLength = function (currentFeed, customStorage)
870
- {
871
 
872
  var length = 0;
873
  if (typeof customStorage === 'undefined') {
@@ -883,8 +829,7 @@ wdi_front.getDataLength = function (currentFeed, customStorage)
883
  return length;
884
  }
885
 
886
- wdi_front.getArrayContentLength = function (array, data)
887
- {
888
  var sum = 0;
889
  for (var i = 0; i < array.length; i++) {
890
  if (array[i]['finished'] == 'finished' || (typeof array[i]['error'] !== 'undefined')) {
@@ -895,7 +840,6 @@ wdi_front.getArrayContentLength = function (array, data)
895
  return sum;
896
  }
897
 
898
-
899
  /**
900
  * Displays data in thumbnail layout
901
  * @param {Object} data data to be displayed
@@ -1052,8 +996,7 @@ wdi_front.displayFeedItems = function (data, currentFeed) {
1052
 
1053
  }
1054
 
1055
- wdi_front.checkFeedFinished = function (currentFeed)
1056
- {
1057
  for (var i = 0; i < currentFeed.usersData.length; i++) {
1058
  if (typeof currentFeed.usersData[i]['finished'] == 'undefined') {
1059
  return false;
@@ -1062,8 +1005,7 @@ wdi_front.checkFeedFinished = function (currentFeed)
1062
  return true;
1063
  }
1064
 
1065
- wdi_front.sortingOperator = function (sortImagesBy, sortOrder)
1066
- {
1067
  var operator;
1068
  switch (sortImagesBy) {
1069
  case 'date':
@@ -1148,8 +1090,7 @@ wdi_front.sortingOperator = function (sortImagesBy, sortOrder)
1148
  /*
1149
  * Calls smart picker method and then after receiving data it sorts data based on user choice
1150
  */
1151
- wdi_front.feedSort = function (currentFeed, load_more_number)
1152
- {
1153
 
1154
  var sortImagesBy = currentFeed.feed_row['sort_images_by'];
1155
  var sortOrder = currentFeed.feed_row['display_order'];
@@ -1164,15 +1105,13 @@ wdi_front.feedSort = function (currentFeed, load_more_number)
1164
  var operator = wdi_front.sortingOperator(sortImagesBy, sortOrder);
1165
  currentFeed['data'].sort(operator);
1166
  return currentFeed['data'];
1167
-
1168
  }
1169
 
1170
  /*
1171
  * Filters all requested data and takes some amount of data for each user
1172
  * and stops picking when it reaches number_of_photos limit
1173
  */
1174
- wdi_front.smartPicker = function (currentFeed, load_more_number)
1175
- {
1176
 
1177
  var dataStorage = [];
1178
  var dataLength = 0;
@@ -1328,25 +1267,39 @@ wdi_front.smartPicker = function (currentFeed, load_more_number)
1328
  */
1329
  wdi_front.createObject = function (obj, currentFeed) {
1330
  var caption = (obj['caption'] != null) ? obj['caption']['text'] : '&nbsp';
1331
- var videoUrl = wdi_url.plugin_url + "images/video_missing.png";
1332
- if ( obj['type'] == 'video' && obj['videos'][currentFeed.feedVideoResolution] && obj['videos'][currentFeed.feedVideoResolution]['url'] != null ) {
1333
- videoUrl = obj.hasOwnProperty('videos') ? obj['videos'][currentFeed.feedVideoResolution]['url'] : '';
1334
- }
1335
- if ( typeof obj.images[currentFeed.feedImageResolution] == "undefined" ) {
1336
- var image_url = wdi_url.plugin_url + "images/missing.png";
1337
- }
1338
- else {
1339
- if ( obj.type == "carousel" && typeof obj.images[currentFeed.feedImageResolution].url === 'undefined' ) {
1340
- if ( typeof obj.carousel_media[0].images !== 'undefined' ) {
1341
- var image_url = obj.carousel_media[0].images[currentFeed.feedImageResolution].url;
1342
- }
1343
- else if ( typeof obj.carousel_media[0].videos !== 'undefined' ) {
1344
- var image_url = wdi_url.plugin_url + 'images/video_missing.png'; //obj.carousel_media[0].videos['standard_resolution'].url;
1345
- }
1346
- }
1347
- else {
1348
  var image_url = obj.images[currentFeed.feedImageResolution].url;
1349
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1350
  }
1351
 
1352
  var imageIndex = currentFeed.imageIndex;
@@ -1366,6 +1319,7 @@ wdi_front.createObject = function (obj, currentFeed) {
1366
  }
1367
  var photoObject = {
1368
  'id': obj['id'],
 
1369
  'caption': wdi_front.escape_tags(caption),
1370
  'image_url': image_url,
1371
  'likes': obj['likes']['count'],
@@ -1384,8 +1338,7 @@ wdi_front.createObject = function (obj, currentFeed) {
1384
  /*
1385
  * If pagination is on sets the proper page number
1386
  */
1387
- wdi_front.setPage = function (currentFeed)
1388
- {
1389
  var display_type = currentFeed.feed_row.feed_display_view;
1390
  var feed_type = currentFeed.feed_row.feed_type;
1391
  if (display_type != 'pagination') {
@@ -1407,8 +1360,7 @@ wdi_front.setPage = function (currentFeed)
1407
  /*
1408
  * Template for all feed items which have type=image
1409
  */
1410
- wdi_front.getPhotoTemplate = function (currentFeed , type)
1411
- {
1412
  var page = wdi_front.setPage(currentFeed);
1413
  var customClass = '';
1414
  var pagination = '';
@@ -1519,12 +1471,10 @@ wdi_front.getPhotoTemplate = function (currentFeed , type)
1519
  return template;
1520
  }
1521
 
1522
-
1523
  /*
1524
  * Template for all feed items which have type=image
1525
  */
1526
- wdi_front.getSliderTemplate = function (currentFeed, type)
1527
- {
1528
  var page = wdi_front.setPage(currentFeed);
1529
  var customClass = '';
1530
  var pagination = '';
@@ -1603,7 +1553,11 @@ wdi_front.getSliderTemplate = function (currentFeed, type)
1603
  '<div class="wdi_photo_wrap">' +
1604
  '<div class="wdi_photo_wrap_inner">' +
1605
  '<div class="wdi_photo_img ' + wdi_shape_class + '">' +
1606
- '<img class="wdi_img" ' + sourceAttr + '="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);">' +
 
 
 
 
1607
  '<div class="wdi_photo_overlay ' + overlayCustomClass + '" >' + showUsernameOnThumb +
1608
  '<div class="wdi_thumb_icon" ' + onclick + ' style="display:table;width:100%;height:100%;">' +
1609
  '<div style="display:table-cell;vertical-align:middle;text-align:center;color:white;">' +
@@ -1637,8 +1591,7 @@ wdi_front.getSliderTemplate = function (currentFeed, type)
1637
  return template;
1638
  }
1639
 
1640
- wdi_front.replaceToVideo = function (url, index, feed_counter)
1641
- {
1642
 
1643
  overlayHtml = "<video style='width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;' controls=''>" +
1644
  "<source src='" + url + "' type='video/mp4'>" +
@@ -1651,8 +1604,7 @@ wdi_front.replaceToVideo = function (url, index, feed_counter)
1651
  /*
1652
  * Template for all feed items which have type=video
1653
  */
1654
- wdi_front.getVideoTemplate = function (currentFeed, type)
1655
- {
1656
  var page = wdi_front.setPage(currentFeed);
1657
  var customClass = '';
1658
  var pagination = '';
@@ -1731,7 +1683,7 @@ wdi_front.getVideoTemplate = function (currentFeed, type)
1731
  '<div class="wdi_photo_wrap">' +
1732
  '<div class="wdi_photo_wrap_inner">' +
1733
  '<div class="wdi_photo_img ' +wdi_shape_class + '">' +
1734
- '<img class="wdi_img" ' + sourceAttr + '="<%=video_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);">' +
1735
  '<div class="wdi_photo_overlay ' + overlayCustomClass + '" ' + onclick + '>' + showUsernameOnThumb +
1736
  '<div class="wdi_thumb_icon" style="display:table;width:100%;height:100%;">' +
1737
  '<div style="display:table-cell;vertical-align:middle;text-align:center;color:white;">' +
@@ -1764,8 +1716,7 @@ wdi_front.getVideoTemplate = function (currentFeed, type)
1764
  return template;
1765
  }
1766
 
1767
- wdi_front.bindEvents = function (currentFeed)
1768
- {
1769
 
1770
  if (jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter + " .wdi_feed_wrapper").length == 0) {
1771
  //no feed in DOM, ignore
@@ -1825,8 +1776,7 @@ wdi_front.infiniteScroll = function (currentFeed) {
1825
  }
1826
  }
1827
 
1828
- wdi_front.paginationFirstPage = function (btn, currentFeed)
1829
- {
1830
  if (currentFeed.paginator == 1 || currentFeed.currentPage == 1) {
1831
  btn.addClass('wdi_disabled');
1832
  return;
@@ -1841,11 +1791,9 @@ wdi_front.paginationFirstPage = function (btn, currentFeed)
1841
 
1842
  //disabling first page button
1843
  btn.addClass('wdi_disabled');
1844
-
1845
  }
1846
 
1847
- wdi_front.paginationLastPage = function (btn, currentFeed)
1848
- {
1849
  if (currentFeed.paginator == 1 || currentFeed.currentPage == currentFeed.paginator) {
1850
  return;
1851
  }
@@ -1861,8 +1809,7 @@ wdi_front.paginationLastPage = function (btn, currentFeed)
1861
  first_page_btn.removeClass('wdi_disabled');
1862
  }
1863
 
1864
- wdi_front.paginatorNext = function (btn, currentFeed)
1865
- {
1866
  var last_page_btn = btn.parent().find('#wdi_last_page');
1867
  var first_page_btn = btn.parent().find('#wdi_first_page');
1868
  currentFeed.paginatorNextFlag = true;
@@ -1883,10 +1830,8 @@ wdi_front.paginatorNext = function (btn, currentFeed)
1883
  last_page_btn.addClass('wdi_disabled');
1884
  }
1885
  }
1886
-
1887
  //enable first page button
1888
  first_page_btn.removeClass('wdi_disabled');
1889
-
1890
  }
1891
 
1892
  wdi_front.paginatorPrev = function (btn, currentFeed)
@@ -2119,9 +2064,7 @@ wdi_front.loadMoreRequest = function (user, next_url, currentFeed, button) {
2119
  }
2120
  }
2121
 
2122
-
2123
- wdi_front.checkForLoadMoreDone = function (currentFeed, button)
2124
- {
2125
  var load_more_number = currentFeed.feed_row['load_more_number'];
2126
  var number_of_photos = currentFeed.feed_row['number_of_photos'];
2127
 
@@ -2182,8 +2125,7 @@ wdi_front.checkForLoadMoreDone = function (currentFeed, button)
2182
  }
2183
  }
2184
 
2185
- wdi_front.allDataHasFinished = function (currentFeed)
2186
- {
2187
  var c = 0;
2188
  for (var j = 0; j < currentFeed.dataStorageRaw.length; j++) {
2189
  if (currentFeed.usersData[j].pagination.next_url == '') {
@@ -2198,7 +2140,6 @@ wdi_front.allDataHasFinished = function (currentFeed)
2198
  return false;
2199
  }
2200
 
2201
-
2202
  wdi_front.mergeData = function (array1, array2) {
2203
  for (var i = 0; i < array2.length; i++) {
2204
  if (typeof array1[i] != 'undefined') {
@@ -2225,8 +2166,7 @@ wdi_front.mergeData = function (array1, array2) {
2225
  }
2226
 
2227
  //broken image handling
2228
- wdi_front.brokenImageHandler = function (source)
2229
- {
2230
  /* @ToDo. remove this function
2231
  var url_params = source.src.split("/p/");
2232
  if(typeof url_params[0] !== "undefined" && typeof url_params[1] !== "undefined" && url_params[0] !== "https://www.instagram.com"){
@@ -2240,8 +2180,8 @@ wdi_front.brokenImageHandler = function (source)
2240
  */
2241
  return true;
2242
  }
2243
- function wdi_baseName(str)
2244
- {
2245
  var base = str.substr(str.lastIndexOf('/'));
2246
  return str.replace(base, "");
2247
  }
@@ -2322,7 +2262,7 @@ wdi_front.show = function (name, currentFeed) {
2322
  containerHtml = feed_container.find('.wdi_feed_header').html();
2323
  feed_container.find('.wdi_feed_header').html(containerHtml + html);
2324
  }
2325
-
2326
  function show_users(currentFeed) {
2327
  feed_container.find('.wdi_feed_users').html('');
2328
  var users = currentFeed['feed_users'];
@@ -2331,20 +2271,17 @@ wdi_front.show = function (name, currentFeed) {
2331
  currentFeed.headerUserinfo = [];
2332
  getThumb();
2333
  //recursively calls itself until all user data is ready then displyes it with escapeRequest
2334
- function getThumb()
2335
- {
2336
  if (currentFeed.headerUserinfo.length == users.length) {
2337
  escapeRequest(currentFeed.headerUserinfo, currentFeed);
2338
  return;
2339
  }
2340
  var _user = users[currentFeed.headerUserinfo.length];
2341
-
2342
  if (typeof _user === 'string' && _user === 'self') {
 
2343
  currentFeed.instagram.getSelfInfo({
2344
- success: function (response)
2345
- {
2346
-
2347
- if(typeof response.meta!= "undefined" && typeof response.meta.error_type != "undefined"){
2348
  wdi_front.show_alert(false, response, currentFeed);
2349
  }
2350
  response = _this.checkMediaResponse(response, currentFeed);
@@ -2369,13 +2306,10 @@ wdi_front.show = function (name, currentFeed) {
2369
  }
2370
  });
2371
  }
2372
- else
2373
- if (false && _this.getInputType(_user.username) == 'hashtag') {
2374
  currentFeed.instagram.searchForTagsByName(_this.stripHashtag(_user.username), {
2375
- /*currentFeed.instagram.getTagRecentMedia(_this.stripHashtag(_user.username), {*/
2376
- success: function (response)
2377
- {
2378
- if(typeof response.meta!= "undefined" && typeof response.meta.error_type != "undefined"){
2379
  wdi_front.show_alert(false, response, currentFeed);
2380
  }
2381
  response = _this.checkMediaResponse(response, currentFeed);
@@ -2404,15 +2338,12 @@ wdi_front.show = function (name, currentFeed) {
2404
  }
2405
  });
2406
  }
2407
- else
2408
- if (_this.getInputType(_user.username) == 'user') {
2409
-
2410
  currentFeed.instagram.getSelfInfo({
2411
  ///deprecated API
2412
  ///currentFeed.instagram.getUserInfo(_user.id, {
2413
- success: function (response)
2414
- {
2415
- if(typeof response.meta!= "undefined" && typeof response.meta.error_type != "undefined"){
2416
  wdi_front.show_alert(false, response, currentFeed);
2417
  }
2418
  response = _this.checkMediaResponse(response, currentFeed);
@@ -2444,12 +2375,10 @@ wdi_front.show = function (name, currentFeed) {
2444
  }
2445
  });
2446
  }
2447
-
2448
  }
2449
 
2450
  //when all user data is ready break recursion and create user elements
2451
- function escapeRequest(info, currentFeed)
2452
- {
2453
  feed_container.find('.wdi_feed_users').html('');
2454
  for (var k = 0; k < info.length; k++) {
2455
  //setting all user filters to false
@@ -2462,7 +2391,6 @@ wdi_front.show = function (name, currentFeed) {
2462
  'name': info[k]['name']
2463
  };
2464
 
2465
-
2466
  //user inforamtion
2467
  var hashtagClass = (info[k]['name'][0] == '#') ? 'wdi_header_hashtag' : '';
2468
  var website_host_name = wdi_extractHostname(info[k]['website']);
@@ -2477,7 +2405,6 @@ wdi_front.show = function (name, currentFeed) {
2477
  'website_url': info[k]['website'],
2478
  'usersCount': currentFeed.feed_row.feed_users.length,
2479
  'hashtagClass': hashtagClass
2480
-
2481
  };
2482
 
2483
  var userTemplate = wdi_front.getUserTemplate(currentFeed, info[k]['name']),
@@ -2486,7 +2413,6 @@ wdi_front.show = function (name, currentFeed) {
2486
 
2487
  feed_container.find('.wdi_feed_users').html(containerHtml + html);
2488
 
2489
-
2490
  currentFeed.userSortFlags.push(userFilter);
2491
 
2492
  var clearFloat = jQuery('<div class="wdi_clear"></div>');
@@ -2496,6 +2422,7 @@ wdi_front.show = function (name, currentFeed) {
2496
  wdi_front.updateUsersImages(currentFeed);
2497
  };
2498
  }
 
2499
  }
2500
 
2501
  wdi_front.getUserTemplate = function (currentFeed, username) {
@@ -2557,7 +2484,6 @@ wdi_front.getUserTemplate = function (currentFeed, username) {
2557
  source += '<div class="wdi_website"><a target="_blank" href="<%= website_url%>" ><%= website%></a></div>';
2558
  }
2559
 
2560
-
2561
  source += '</div>' +
2562
  '</div>';
2563
 
@@ -2565,8 +2491,7 @@ wdi_front.getUserTemplate = function (currentFeed, username) {
2565
  return template;
2566
  }
2567
 
2568
- wdi_front.getHeaderTemplate = function ()
2569
- {
2570
  var source = '<div class="wdi_header_wrapper">' +
2571
  '<div class="wdi_header_img_wrap">' +
2572
  '<img src="<%=feed_thumb%>">' +
@@ -2579,8 +2504,7 @@ wdi_front.getHeaderTemplate = function ()
2579
  }
2580
 
2581
  //sets user filter to true and applys filter to feed
2582
- wdi_front.addFilter = function (index, feed_counter)
2583
- {
2584
  var currentFeed = window['wdi_feed_' + feed_counter];
2585
  var usersCount = currentFeed.dataCount;
2586
  if (usersCount < 2) {
@@ -2612,7 +2536,6 @@ wdi_front.addFilter = function (index, feed_counter)
2612
  }
2613
  }
2614
 
2615
-
2616
  if (currentFeed.feed_row.feed_display_view == 'pagination') {
2617
  //reset responsive indexes because number of feed images may change after using filter
2618
  currentFeed.resIndex = 0;
@@ -2627,7 +2550,6 @@ wdi_front.addFilter = function (index, feed_counter)
2627
  wdi_front.displayFeed(currentFeed);
2628
  }
2629
 
2630
-
2631
  if (currentFeed.feed_row.feed_display_view == 'pagination') {
2632
  //reset paginator because while filtering images become more or less so pages also become more or less
2633
  currentFeed.paginator = Math.ceil((currentFeed.imageIndex) / parseInt(currentFeed.feed_row.pagination_per_page_number));
@@ -2643,9 +2565,7 @@ wdi_front.addFilter = function (index, feed_counter)
2643
  }
2644
  }
2645
 
2646
- wdi_front.filterData = function (currentFeed)
2647
- {
2648
-
2649
  var users = currentFeed.userSortFlags;
2650
  currentFeed.customFilteredData = [];
2651
  for (var i = 0; i < currentFeed.dataStorageList.length; i++) {
@@ -2659,8 +2579,7 @@ wdi_front.filterData = function (currentFeed)
2659
 
2660
  }
2661
 
2662
- wdi_front.applyFilters = function (currentFeed)
2663
- {
2664
  for (var i = 0; i < currentFeed.userSortFlags.length; i++) {
2665
  if (currentFeed.userSortFlags[i]['flag'] == true) {
2666
  var userDiv = jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter + '[user_index="' + i + '"]');
@@ -2671,8 +2590,7 @@ wdi_front.applyFilters = function (currentFeed)
2671
  }
2672
 
2673
  //gets data Count from global storage
2674
- wdi_front.getImgCount = function (currentFeed)
2675
- {
2676
  var dataStorage = currentFeed.dataStorage;
2677
  var count = 0;
2678
  for (var i = 0; i < dataStorage.length; i++) {
@@ -2750,8 +2668,7 @@ wdi_front.parseLighboxData = function (currentFeed, filterFlag) {
2750
  return popupData;
2751
  }
2752
 
2753
- wdi_front.convertUnixDate = function (date)
2754
- {
2755
  var utcSeconds = new Date(date).getTime() / 1000;
2756
  var newDate = new Date(0);
2757
  newDate.setUTCSeconds(utcSeconds);
@@ -2760,15 +2677,13 @@ wdi_front.convertUnixDate = function (date)
2760
  return str;
2761
  }
2762
 
2763
- wdi_front.getDescription = function (desc)
2764
- {
2765
  desc = desc.replace(/\r?\n|\r/g, ' ');
2766
 
2767
 
2768
  return desc;
2769
  }
2770
 
2771
-
2772
  /**
2773
  * use this data for lightbox
2774
  * **/
@@ -2796,8 +2711,9 @@ wdi_front.getFileType = function (data) {
2796
  //@ToDo old if (data['type'] == 'video' && data.hasOwnProperty('videos')) {
2797
  if (data['type'] == 'video' && data.hasOwnProperty('videos')) {
2798
  return "EMBED_OEMBED_INSTAGRAM_VIDEO";
2799
- }
2800
- else {
 
2801
  return "EMBED_OEMBED_INSTAGRAM_IMAGE";
2802
  }
2803
  }
@@ -2817,8 +2733,7 @@ wdi_front.array_max = function (array) {
2817
  };
2818
  }
2819
 
2820
- wdi_front.array_min = function (array)
2821
- {
2822
  var min = array[0];
2823
  var minIndex = 0;
2824
  for (var i = 1; i < array.length; i++) {
@@ -2836,8 +2751,7 @@ wdi_front.array_min = function (array)
2836
  /*
2837
  * Returns users count whose feed is not finished
2838
  */
2839
- wdi_front.activeUsersCount = function (currentFeed)
2840
- {
2841
  var counter = 0;
2842
  for (var i = 0; i < currentFeed.usersData.length; i++) {
2843
  if (currentFeed.usersData[i].finished != 'finished') {
@@ -2847,14 +2761,13 @@ wdi_front.activeUsersCount = function (currentFeed)
2847
  return counter;
2848
  }
2849
 
2850
-
2851
  /**
2852
  * Return response if it is valid else returns boolean false
2853
  * @param {Object} response [instagram API response]
2854
  * @return {Object or Boolean} [false: if invalid response, object: if valid]
2855
  */
2856
  wdi_front.checkMediaResponse = function (response, currentFeed) {
2857
- if (response == '' || typeof response == 'undefined' || response == null) {
2858
  errorMessage = wdi_front_messages.connection_error;
2859
  wdi_front.show_alert(errorMessage, response, currentFeed);
2860
  return false;
@@ -2868,14 +2781,12 @@ wdi_front.checkMediaResponse = function (response, currentFeed) {
2868
  return response;
2869
  }
2870
 
2871
-
2872
  /**
2873
  * Removes # from string if it is first char
2874
  * @param {String} hashtag
2875
  * @return {String}
2876
  */
2877
- wdi_front.stripHashtag = function (hashtag)
2878
- {
2879
  switch (hashtag[0]) {
2880
  case '#':
2881
  {
@@ -2922,8 +2833,7 @@ wdi_front.getInputType = function (input) {
2922
  * @param {String} searchkey [word or phrazee to search]
2923
  * @return {Boolean}
2924
  */
2925
- wdi_front.regexpTestCaption = function (captionText, searchkey)
2926
- {
2927
  var flag1 = false,
2928
  flag2 = false,
2929
  matchIndexes = [],
@@ -2948,15 +2858,13 @@ wdi_front.regexpTestCaption = function (captionText, searchkey)
2948
 
2949
  }
2950
 
2951
-
2952
  /**
2953
  * replaces single new-lines with space
2954
  * if multiple new lines are following each other then replaces all newlines with single space
2955
  * @param {String} string [input string]
2956
  * @return {String} [output string]
2957
  */
2958
- wdi_front.replaceNewLines = function (string)
2959
- {
2960
  var delimeter = "vUkCJvN2ps3t",
2961
  matchIndexes = [],
2962
  regexp;
@@ -2989,7 +2897,6 @@ wdi_front.replaceNewLines = function (string)
2989
  return string;
2990
  }
2991
 
2992
-
2993
  wdi_front.isEmptyObject = function (obj) {
2994
  for (var prop in obj) {
2995
  if (obj.hasOwnProperty(prop))
@@ -3002,9 +2909,7 @@ wdi_front.isEmpty = function (str) {
3002
  return (!str || 0 === str.length);
3003
  }
3004
 
3005
-
3006
- var WDIFeed = function (obj)
3007
- {
3008
  this['data'] = obj['data'];
3009
  this['dataCount'] = obj['dataCount'];
3010
  this['feed_row'] = obj['feed_row'];
@@ -3022,9 +2927,7 @@ var WDIFeed = function (obj)
3022
  this.set_images_loading_flag(_this);
3023
  };
3024
 
3025
-
3026
- WDIFeed.prototype.mediaExists = function (media, array)
3027
- {
3028
 
3029
  for (var i = 0; i < array.length; i++) {
3030
  if (media['id'] == array[i]['id']) {
@@ -3034,14 +2937,12 @@ WDIFeed.prototype.mediaExists = function (media, array)
3034
  return false;
3035
  }
3036
 
3037
-
3038
  /**
3039
  * gets id of media from url, this id is not the one which comes with api request
3040
  * @param {String} url [media url]
3041
  * @return {String}
3042
  */
3043
- WDIFeed.prototype.getIdFromUrl = function (url)
3044
- {
3045
  var url_parts = url.split('/'),
3046
  id = false;
3047
  for (var i = 0; i < url_parts.length; i++) {
@@ -3056,14 +2957,12 @@ WDIFeed.prototype.getIdFromUrl = function (url)
3056
  return id;
3057
  }
3058
 
3059
-
3060
  /**
3061
  * Iterates throught response data and remove duplicate media
3062
  * @param {Object} response [Instagram API request]
3063
  * @return {Object} [response]
3064
  */
3065
- WDIFeed.prototype.avoidDuplicateMedia = function (response)
3066
- {
3067
  var data = response['data'],
3068
  uniqueData = [],
3069
  returnObject = {};
@@ -3089,10 +2988,8 @@ WDIFeed.prototype.avoidDuplicateMedia = function (response)
3089
 
3090
  }
3091
 
3092
-
3093
  /* stores data from objects array into global variable */
3094
- WDIFeed.prototype.storeRawData = function (objects, variable)
3095
- {
3096
  var _this = this;
3097
  if (typeof this[variable] == "object" && typeof this[variable].length == "number") {
3098
  //checks if in golbal storage user already exisit then it adds new data to user old data
@@ -3175,9 +3072,7 @@ WDIFeed.prototype.storeRawData = function (objects, variable)
3175
 
3176
  }
3177
 
3178
-
3179
- wdi_front.updateUsersIfNecessary = function (currentFeed)
3180
- {
3181
  var users = currentFeed.feed_users;
3182
  var ifUpdateNecessary = false;
3183
 
@@ -3255,9 +3150,7 @@ if (typeof wdi_ajax.ajax_response != "undefined") {
3255
 
3256
  }
3257
  else {
3258
- jQuery(document).ready(function ()
3259
- {
3260
-
3261
  if (wdi_front['type'] != 'not_declared') {
3262
  wdi_front.clickOrTouch = wdi_front.detectEvent();
3263
  //initializing all feeds in the page
@@ -3265,11 +3158,9 @@ else {
3265
  } else {
3266
  return;
3267
  }
3268
-
3269
  });
3270
  }
3271
 
3272
-
3273
  jQuery(document).ready(function () {
3274
  setTimeout(function(){
3275
  if(wdi_front_messages.show_alerts === '1' && jQuery('.wdi_check_fontawesome .tenweb-i-instagram').prop("tagName") !== 'I'){
@@ -3284,6 +3175,5 @@ function wdi_extractHostname(url) {
3284
  }
3285
  var result = url.replace(/(^\w+:|^)\/\//, '');
3286
 
3287
-
3288
  return result;
3289
  }
4
  };
5
  }
6
 
7
+ wdi_front.detectEvent = function () {
8
+ var e = 'click';
9
  var isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
10
+ if ( isMobile ) {
11
+ e = 'touchend';
 
 
12
  }
13
+ return e;
14
  }
15
 
16
  var wdi_error_show = false;
17
  var wdi_error_init = false;
18
 
19
+ wdi_front.escape_tags = function (text) {
 
20
  var lt = /</g,
21
  gt = />/g,
22
  ap = /'/g,
29
  return text;
30
  }
31
 
32
+ wdi_front.show_alert = function ( message, response, wdi_current_feed ) {
 
33
  wdi_current_feed = jQuery('#wdi_feed_' + wdi_current_feed.feed_row.wdi_feed_counter);
34
+ if ( typeof wdi_current_feed != 'undefined' ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  wdi_error_show = true;
36
+ wdi_current_feed.find('.wdi_spinner').remove();
37
+ var wdi_js_error = wdi_current_feed.find('.wdi_js_error');
38
+ var wdi_token_error = wdi_current_feed.find('.wdi_token_error');
39
+ if ( response != false && ( (typeof response.meta !== 'undefined' && response.meta.error == true && response.meta.error_type === 'OAuthException' ) || (typeof response.error !== 'undefined' && response.error.type === 'OAuthException') ) ) {
40
+ wdi_current_feed.find('.wdi_single_user').remove();
41
+ wdi_token_error.removeClass('wdi_hidden');
42
+ if ( wdi_front_messages.wdi_token_error_flag != '1' ) {
43
  jQuery.ajax({
44
  type: "POST",
45
  url: wdi_url.ajax_url,
46
  dataType: 'json',
47
  data: {
48
+ action: 'wdi_token_flag',
49
  wdi_token_flag_nonce: wdi_front_messages.wdi_token_flag_nonce,
50
  },
51
+ success: function ( data ) {
 
52
  }
53
  });
54
  }
55
+ }
56
+ else {
57
+ wdi_current_feed.find('.wdi_single_user').remove();
58
+ wdi_js_error.removeClass('wdi_js_error');
59
+ wdi_js_error.addClass('wdi_js_error_no_animate');
60
  jQuery('.wdi_js_error_no_animate').show();
61
  }
62
+ if ( wdi_front_messages.show_alerts ) {
63
+ // alert(message);
 
64
  }
65
  else {
66
  console.log('%c' + message, "color:#cc0000;");
67
  }
68
  }
 
69
  wdi_error_show = true;
70
  }
71
 
 
72
  wdi_front.globalInit = function () {
73
 
74
  var num = wdi_front['feed_counter'];
308
  * @param {String} str [string to check]
309
  * @return {Boolean} [true or false]
310
  */
311
+ wdi_front.isJsonString = function (str) {
 
312
  try {
313
  JSON.parse(str);
314
  } catch (e) {
317
  return true;
318
  }
319
 
 
320
  /**
321
  * Makes an ajax request for given user from feed_users array
322
  * if response is ok then calls saveUserData function
346
  if ( this.getInputType(feed_users[id]['username']) == 'hashtag' ) {
347
  currentFeed.instagram.getTagRecentMedia(this.stripHashtag(feed_users[id]['username']), {
348
  success: function (response) {
349
+ if ( typeof response.meta != 'undefined' && response.meta.error == true ) {
350
  wdi_front.show_alert(false, response, currentFeed);
351
+ return false;
352
  }
353
  currentFeed.mediaRequestsDone = true;
 
354
  response = _this.checkMediaResponse(response, currentFeed);
355
  if ( response != false ) {
356
  _this.saveUserData(response, currentFeed.feed_users[id], currentFeed);
363
  currentFeed.instagram.getUserMedia({
364
  user_id: feed_users[id].id,
365
  success: function (response) {
366
+ if ( typeof response.meta != 'undefined' && typeof response.meta.error == true ) {
 
367
  wdi_front.show_alert(false, response, currentFeed);
368
+ return false;
369
  }
370
  currentFeed.mediaRequestsDone = true;
371
  response = _this.checkMediaResponse(response, currentFeed);
389
  return (str[0] === '#');
390
  }
391
 
 
392
  /*
393
  * Saves each user data on seperate index in currentFeed.usersData array
394
  * And also checks if all data form all users is already avialable if yes it displays feed
433
  }
434
  }
435
 
 
436
  /*
437
  * Saves self user data on separate index in currentFeed.usersData array
438
  * And also checks if all data form all users is already avialable if yes it displays feed
439
  */
440
+ wdi_front.saveSelfUserData = function (data, currentFeed) {
 
441
 
442
  //keep empty for self feed
443
  data['user_id'] = '';
476
  /**
477
  * checks weather all feed users have any photos after first time request
478
  */
479
+ wdi_front.userHasNoPhoto = function (currentFeed, cstData) {
 
480
  var counter = 0;
481
  var data = currentFeed.usersData;
482
  if (typeof cstData != 'undefined') {
509
  /*
510
  *gives each instagram object custom hashtag parameter, which is used for searching image/video
511
  */
512
+ wdi_front.appendRequestHashtag = function (data, hashtag) {
 
513
  for (var i = 0; i < data.length; i++) {
514
  data[i]['wdi_hashtag'] = hashtag;
515
  }
516
  return data;
517
  }
518
 
 
519
  /*
520
  * sorts data based on user choice and displays feed
521
  * also checks if one request is not enough for displaying all images user wanted
522
  * it recursively calls wdi_front.loadMore() until the desired number of photos is reached
523
  */
524
  wdi_front.displayFeed = function (currentFeed, load_more_number) {
 
525
  if (currentFeed.customFilterChanged == false) {
526
+ // sorting data...
527
  var data = wdi_front.feedSort(currentFeed, load_more_number);
528
  }
529
 
 
530
  //becomes true when user clicks in frontend filter
531
  //if isset to true then loadmore recursion would not start
532
  var frontendCustomFilterClicked = currentFeed.customFilterChanged;
533
 
 
534
  // if custom filter changed then display custom data
535
  if (currentFeed.customFilterChanged == true) {
536
  var data = currentFeed.customFilteredData;
539
  currentFeed.parsedData = wdi_front.parseLighboxData(currentFeed, true);
540
  }
541
 
 
542
  //storing all sorted data in array for later use in user based filters
543
  if (currentFeed.feed_row.resort_after_load_more != '1') {
544
  // filter changes when user clicks to usernames in header
610
  //if there are any missing images in header then replace them with new ones if possible
611
  wdi_front.updateUsersImages(currentFeed);
612
 
 
613
  // /**
614
  // * Enable image lazy laoding if pagination is not enabeled because pagination has option for preloading images
615
  // * which is the opposide of lazy load
621
  // threshold : 400
622
  // });
623
  // });
 
624
  // }
 
625
  }
626
 
627
  /**
629
  * then update source
630
  * @param {Object} currentFeed [description]
631
  */
632
+ wdi_front.updateUsersImages = function (currentFeed) {
 
633
  var elements = jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter).find('.wdi_single_user .wdi_user_img_wrap img');
634
  elements.each(function ()
635
  {
650
  });
651
  }
652
 
 
653
  /**
654
  * Displays data in masonry layout
655
  * @param {Object} data data to be displayed
656
  * @param {Object} currentFeed
657
  */
658
+ wdi_front.masonryDisplayFeedItems = function (data, currentFeed) {
 
659
  var masonryColEnds = [];
660
  var masonryColumns = [];
661
  if (jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter + " .wdi_feed_wrapper").length == 0) {
693
  currentFeed.customFilterChanged = false;
694
  }
695
 
 
696
  //loop for displaying items
697
  for (var i = 0; i < data.length; i++) {
698
 
744
  var columnFlag = false;
745
  currentFeed.wdi_load_count = i;
746
  var wdi_feed_counter = currentFeed.feed_row['wdi_feed_counter'];
747
+ var feed_wrapper = jQuery('#wdi_feed_' + wdi_feed_counter + ' img.wdi_img').on('load', function () {
 
748
  currentFeed.wdi_loadedImages++;
749
  checkLoaded();
750
 
779
 
780
 
781
  //checks if all iamges have been succesfully loaded then it updates variables for next time use
782
+ function checkLoaded() {
 
783
 
784
  if (currentFeed.wdi_load_count === currentFeed.wdi_loadedImages && currentFeed.wdi_loadedImages != 0) {
785
  currentFeed.loadedImages = 0;
796
 
797
  //check if load more done successfully then set infinite scroll flag to false
798
  currentFeed.infiniteScrollFlag = false;
 
 
799
  }
800
 
 
801
  /*
802
  * Calcuates image resolution
803
  */
804
+ wdi_front.getImageResolution = function (data) {
 
805
 
806
  var originalWidth = data['images']['standard_resolution']['width'];
807
  var originalHeight = data['images']['standard_resolution']['height'];
813
  * Calculates data count on global Storage and if custom storage provied
814
  * it adds custom storage data count to golbals data count and returns length of all storages
815
  */
816
+ wdi_front.getDataLength = function (currentFeed, customStorage) {
 
817
 
818
  var length = 0;
819
  if (typeof customStorage === 'undefined') {
829
  return length;
830
  }
831
 
832
+ wdi_front.getArrayContentLength = function (array, data) {
 
833
  var sum = 0;
834
  for (var i = 0; i < array.length; i++) {
835
  if (array[i]['finished'] == 'finished' || (typeof array[i]['error'] !== 'undefined')) {
840
  return sum;
841
  }
842
 
 
843
  /**
844
  * Displays data in thumbnail layout
845
  * @param {Object} data data to be displayed
996
 
997
  }
998
 
999
+ wdi_front.checkFeedFinished = function (currentFeed) {
 
1000
  for (var i = 0; i < currentFeed.usersData.length; i++) {
1001
  if (typeof currentFeed.usersData[i]['finished'] == 'undefined') {
1002
  return false;
1005
  return true;
1006
  }
1007
 
1008
+ wdi_front.sortingOperator = function (sortImagesBy, sortOrder) {
 
1009
  var operator;
1010
  switch (sortImagesBy) {
1011
  case 'date':
1090
  /*
1091
  * Calls smart picker method and then after receiving data it sorts data based on user choice
1092
  */
1093
+ wdi_front.feedSort = function (currentFeed, load_more_number) {
 
1094
 
1095
  var sortImagesBy = currentFeed.feed_row['sort_images_by'];
1096
  var sortOrder = currentFeed.feed_row['display_order'];
1105
  var operator = wdi_front.sortingOperator(sortImagesBy, sortOrder);
1106
  currentFeed['data'].sort(operator);
1107
  return currentFeed['data'];
 
1108
  }
1109
 
1110
  /*
1111
  * Filters all requested data and takes some amount of data for each user
1112
  * and stops picking when it reaches number_of_photos limit
1113
  */
1114
+ wdi_front.smartPicker = function (currentFeed, load_more_number) {
 
1115
 
1116
  var dataStorage = [];
1117
  var dataLength = 0;
1267
  */
1268
  wdi_front.createObject = function (obj, currentFeed) {
1269
  var caption = (obj['caption'] != null) ? obj['caption']['text'] : '&nbsp';
1270
+ switch (obj['type']) {
1271
+ case 'image':
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1272
  var image_url = obj.images[currentFeed.feedImageResolution].url;
1273
+ var videoUrl = undefined;
1274
+ var thumbType = 'image';
1275
+ break;
1276
+ case 'video':
1277
+ var image_url = undefined;
1278
+ var videoUrl = obj.hasOwnProperty('videos') ? obj['videos'][currentFeed.feedVideoResolution]['url'] : wdi_url.plugin_url + "images/video_missing.png";
1279
+ var thumbType = 'video';
1280
+ break;
1281
+ case 'carousel':
1282
+ switch (obj.carousel_media[0].type) {
1283
+ case 'image':
1284
+ var image_url = obj.carousel_media[0].images[currentFeed.feedImageResolution].url
1285
+ var videoUrl = undefined;
1286
+ var thumbType = 'image';
1287
+ break;
1288
+ case 'video':
1289
+ var image_url = undefined;
1290
+ var videoUrl = obj.carousel_media[0].videos[currentFeed.feedVideoResolution].url;
1291
+ var thumbType = 'video';
1292
+ break;
1293
+ default:
1294
+ var image_url = wdi_url.plugin_url + "images/missing.png";
1295
+ var videoUrl = wdi_url.plugin_url + "images/video_missing.png";
1296
+ var thumbType = 'image';
1297
+ }
1298
+ break
1299
+ default:
1300
+ var image_url = wdi_url.plugin_url + "images/missing.png";
1301
+ var videoUrl = wdi_url.plugin_url + "images/video_missing.png";
1302
+ var thumbType = 'image'
1303
  }
1304
 
1305
  var imageIndex = currentFeed.imageIndex;
1319
  }
1320
  var photoObject = {
1321
  'id': obj['id'],
1322
+ 'thumbType': thumbType,
1323
  'caption': wdi_front.escape_tags(caption),
1324
  'image_url': image_url,
1325
  'likes': obj['likes']['count'],
1338
  /*
1339
  * If pagination is on sets the proper page number
1340
  */
1341
+ wdi_front.setPage = function (currentFeed) {
 
1342
  var display_type = currentFeed.feed_row.feed_display_view;
1343
  var feed_type = currentFeed.feed_row.feed_type;
1344
  if (display_type != 'pagination') {
1360
  /*
1361
  * Template for all feed items which have type=image
1362
  */
1363
+ wdi_front.getPhotoTemplate = function (currentFeed , type) {
 
1364
  var page = wdi_front.setPage(currentFeed);
1365
  var customClass = '';
1366
  var pagination = '';
1471
  return template;
1472
  }
1473
 
 
1474
  /*
1475
  * Template for all feed items which have type=image
1476
  */
1477
+ wdi_front.getSliderTemplate = function (currentFeed, type) {
 
1478
  var page = wdi_front.setPage(currentFeed);
1479
  var customClass = '';
1480
  var pagination = '';
1553
  '<div class="wdi_photo_wrap">' +
1554
  '<div class="wdi_photo_wrap_inner">' +
1555
  '<div class="wdi_photo_img ' + wdi_shape_class + '">' +
1556
+ "<% if (thumbType === 'video') { %>"+
1557
+ '<video class="wdi_img" ' + sourceAttr + '="<%=video_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"></video>'+
1558
+ "<% } else {%>"+
1559
+ '<img class="wdi_img" ' + sourceAttr + '="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);">' +
1560
+ "<% }%>"+
1561
  '<div class="wdi_photo_overlay ' + overlayCustomClass + '" >' + showUsernameOnThumb +
1562
  '<div class="wdi_thumb_icon" ' + onclick + ' style="display:table;width:100%;height:100%;">' +
1563
  '<div style="display:table-cell;vertical-align:middle;text-align:center;color:white;">' +
1591
  return template;
1592
  }
1593
 
1594
+ wdi_front.replaceToVideo = function (url, index, feed_counter) {
 
1595
 
1596
  overlayHtml = "<video style='width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;' controls=''>" +
1597
  "<source src='" + url + "' type='video/mp4'>" +
1604
  /*
1605
  * Template for all feed items which have type=video
1606
  */
1607
+ wdi_front.getVideoTemplate = function (currentFeed, type) {
 
1608
  var page = wdi_front.setPage(currentFeed);
1609
  var customClass = '';
1610
  var pagination = '';
1683
  '<div class="wdi_photo_wrap">' +
1684
  '<div class="wdi_photo_wrap_inner">' +
1685
  '<div class="wdi_photo_img ' +wdi_shape_class + '">' +
1686
+ '<video class="wdi_img" ' + sourceAttr + '="<%=video_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"></video>' +
1687
  '<div class="wdi_photo_overlay ' + overlayCustomClass + '" ' + onclick + '>' + showUsernameOnThumb +
1688
  '<div class="wdi_thumb_icon" style="display:table;width:100%;height:100%;">' +
1689
  '<div style="display:table-cell;vertical-align:middle;text-align:center;color:white;">' +
1716
  return template;
1717
  }
1718
 
1719
+ wdi_front.bindEvents = function (currentFeed) {
 
1720
 
1721
  if (jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter + " .wdi_feed_wrapper").length == 0) {
1722
  //no feed in DOM, ignore
1776
  }
1777
  }
1778
 
1779
+ wdi_front.paginationFirstPage = function (btn, currentFeed) {
 
1780
  if (currentFeed.paginator == 1 || currentFeed.currentPage == 1) {
1781
  btn.addClass('wdi_disabled');
1782
  return;
1791
 
1792
  //disabling first page button
1793
  btn.addClass('wdi_disabled');
 
1794
  }
1795
 
1796
+ wdi_front.paginationLastPage = function (btn, currentFeed) {
 
1797
  if (currentFeed.paginator == 1 || currentFeed.currentPage == currentFeed.paginator) {
1798
  return;
1799
  }
1809
  first_page_btn.removeClass('wdi_disabled');
1810
  }
1811
 
1812
+ wdi_front.paginatorNext = function (btn, currentFeed) {
 
1813
  var last_page_btn = btn.parent().find('#wdi_last_page');
1814
  var first_page_btn = btn.parent().find('#wdi_first_page');
1815
  currentFeed.paginatorNextFlag = true;
1830
  last_page_btn.addClass('wdi_disabled');
1831
  }
1832
  }
 
1833
  //enable first page button
1834
  first_page_btn.removeClass('wdi_disabled');
 
1835
  }
1836
 
1837
  wdi_front.paginatorPrev = function (btn, currentFeed)
2064
  }
2065
  }
2066
 
2067
+ wdi_front.checkForLoadMoreDone = function (currentFeed, button) {
 
 
2068
  var load_more_number = currentFeed.feed_row['load_more_number'];
2069
  var number_of_photos = currentFeed.feed_row['number_of_photos'];
2070
 
2125
  }
2126
  }
2127
 
2128
+ wdi_front.allDataHasFinished = function (currentFeed) {
 
2129
  var c = 0;
2130
  for (var j = 0; j < currentFeed.dataStorageRaw.length; j++) {
2131
  if (currentFeed.usersData[j].pagination.next_url == '') {
2140
  return false;
2141
  }
2142
 
 
2143
  wdi_front.mergeData = function (array1, array2) {
2144
  for (var i = 0; i < array2.length; i++) {
2145
  if (typeof array1[i] != 'undefined') {
2166
  }
2167
 
2168
  //broken image handling
2169
+ wdi_front.brokenImageHandler = function (source) {
 
2170
  /* @ToDo. remove this function
2171
  var url_params = source.src.split("/p/");
2172
  if(typeof url_params[0] !== "undefined" && typeof url_params[1] !== "undefined" && url_params[0] !== "https://www.instagram.com"){
2180
  */
2181
  return true;
2182
  }
2183
+
2184
+ function wdi_baseName(str) {
2185
  var base = str.substr(str.lastIndexOf('/'));
2186
  return str.replace(base, "");
2187
  }
2262
  containerHtml = feed_container.find('.wdi_feed_header').html();
2263
  feed_container.find('.wdi_feed_header').html(containerHtml + html);
2264
  }
2265
+ /* @ToDo This function is not used. It must be removed.
2266
  function show_users(currentFeed) {
2267
  feed_container.find('.wdi_feed_users').html('');
2268
  var users = currentFeed['feed_users'];
2271
  currentFeed.headerUserinfo = [];
2272
  getThumb();
2273
  //recursively calls itself until all user data is ready then displyes it with escapeRequest
2274
+ function getThumb() {
 
2275
  if (currentFeed.headerUserinfo.length == users.length) {
2276
  escapeRequest(currentFeed.headerUserinfo, currentFeed);
2277
  return;
2278
  }
2279
  var _user = users[currentFeed.headerUserinfo.length];
 
2280
  if (typeof _user === 'string' && _user === 'self') {
2281
+ alert(2333);
2282
  currentFeed.instagram.getSelfInfo({
2283
+ success: function (response) {
2284
+ if(typeof response.meta!= 'undefined' && typeof response.meta.error_type != 'undefined'){
 
 
2285
  wdi_front.show_alert(false, response, currentFeed);
2286
  }
2287
  response = _this.checkMediaResponse(response, currentFeed);
2306
  }
2307
  });
2308
  }
2309
+ else if (false && _this.getInputType(_user.username) == 'hashtag') {
 
2310
  currentFeed.instagram.searchForTagsByName(_this.stripHashtag(_user.username), {
2311
+ success: function (response) {
2312
+ if(typeof response.meta != "undefined" && typeof response.meta.error_type != "undefined"){
 
 
2313
  wdi_front.show_alert(false, response, currentFeed);
2314
  }
2315
  response = _this.checkMediaResponse(response, currentFeed);
2338
  }
2339
  });
2340
  }
2341
+ else if (_this.getInputType(_user.username) == 'user') {
 
 
2342
  currentFeed.instagram.getSelfInfo({
2343
  ///deprecated API
2344
  ///currentFeed.instagram.getUserInfo(_user.id, {
2345
+ success: function (response) {
2346
+ if(typeof response.meta!= 'undefined' && typeof response.meta.error_type != 'undefined'){
 
2347
  wdi_front.show_alert(false, response, currentFeed);
2348
  }
2349
  response = _this.checkMediaResponse(response, currentFeed);
2375
  }
2376
  });
2377
  }
 
2378
  }
2379
 
2380
  //when all user data is ready break recursion and create user elements
2381
+ function escapeRequest(info, currentFeed) {
 
2382
  feed_container.find('.wdi_feed_users').html('');
2383
  for (var k = 0; k < info.length; k++) {
2384
  //setting all user filters to false
2391
  'name': info[k]['name']
2392
  };
2393
 
 
2394
  //user inforamtion
2395
  var hashtagClass = (info[k]['name'][0] == '#') ? 'wdi_header_hashtag' : '';
2396
  var website_host_name = wdi_extractHostname(info[k]['website']);
2405
  'website_url': info[k]['website'],
2406
  'usersCount': currentFeed.feed_row.feed_users.length,
2407
  'hashtagClass': hashtagClass
 
2408
  };
2409
 
2410
  var userTemplate = wdi_front.getUserTemplate(currentFeed, info[k]['name']),
2413
 
2414
  feed_container.find('.wdi_feed_users').html(containerHtml + html);
2415
 
 
2416
  currentFeed.userSortFlags.push(userFilter);
2417
 
2418
  var clearFloat = jQuery('<div class="wdi_clear"></div>');
2422
  wdi_front.updateUsersImages(currentFeed);
2423
  };
2424
  }
2425
+ */
2426
  }
2427
 
2428
  wdi_front.getUserTemplate = function (currentFeed, username) {
2484
  source += '<div class="wdi_website"><a target="_blank" href="<%= website_url%>" ><%= website%></a></div>';
2485
  }
2486
 
 
2487
  source += '</div>' +
2488
  '</div>';
2489
 
2491
  return template;
2492
  }
2493
 
2494
+ wdi_front.getHeaderTemplate = function () {
 
2495
  var source = '<div class="wdi_header_wrapper">' +
2496
  '<div class="wdi_header_img_wrap">' +
2497
  '<img src="<%=feed_thumb%>">' +
2504
  }
2505
 
2506
  //sets user filter to true and applys filter to feed
2507
+ wdi_front.addFilter = function (index, feed_counter) {
 
2508
  var currentFeed = window['wdi_feed_' + feed_counter];
2509
  var usersCount = currentFeed.dataCount;
2510
  if (usersCount < 2) {
2536
  }
2537
  }
2538
 
 
2539
  if (currentFeed.feed_row.feed_display_view == 'pagination') {
2540
  //reset responsive indexes because number of feed images may change after using filter
2541
  currentFeed.resIndex = 0;
2550
  wdi_front.displayFeed(currentFeed);
2551
  }
2552
 
 
2553
  if (currentFeed.feed_row.feed_display_view == 'pagination') {
2554
  //reset paginator because while filtering images become more or less so pages also become more or less
2555
  currentFeed.paginator = Math.ceil((currentFeed.imageIndex) / parseInt(currentFeed.feed_row.pagination_per_page_number));
2565
  }
2566
  }
2567
 
2568
+ wdi_front.filterData = function (currentFeed) {
 
 
2569
  var users = currentFeed.userSortFlags;
2570
  currentFeed.customFilteredData = [];
2571
  for (var i = 0; i < currentFeed.dataStorageList.length; i++) {
2579
 
2580
  }
2581
 
2582
+ wdi_front.applyFilters = function (currentFeed) {
 
2583
  for (var i = 0; i < currentFeed.userSortFlags.length; i++) {
2584
  if (currentFeed.userSortFlags[i]['flag'] == true) {
2585
  var userDiv = jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter + '[user_index="' + i + '"]');
2590
  }
2591
 
2592
  //gets data Count from global storage
2593
+ wdi_front.getImgCount = function (currentFeed) {
 
2594
  var dataStorage = currentFeed.dataStorage;
2595
  var count = 0;
2596
  for (var i = 0; i < dataStorage.length; i++) {
2668
  return popupData;
2669
  }
2670
 
2671
+ wdi_front.convertUnixDate = function (date) {
 
2672
  var utcSeconds = new Date(date).getTime() / 1000;
2673
  var newDate = new Date(0);
2674
  newDate.setUTCSeconds(utcSeconds);
2677
  return str;
2678
  }
2679
 
2680
+ wdi_front.getDescription = function (desc) {
 
2681
  desc = desc.replace(/\r?\n|\r/g, ' ');
2682
 
2683
 
2684
  return desc;
2685
  }
2686
 
 
2687
  /**
2688
  * use this data for lightbox
2689
  * **/
2711
  //@ToDo old if (data['type'] == 'video' && data.hasOwnProperty('videos')) {
2712
  if (data['type'] == 'video' && data.hasOwnProperty('videos')) {
2713
  return "EMBED_OEMBED_INSTAGRAM_VIDEO";
2714
+ } else if(data['type'] == 'carousel' && data.hasOwnProperty('carousel_media')) {
2715
+ return "EMBED_OEMBED_INSTAGRAM_CAROUSEL";
2716
+ } else {
2717
  return "EMBED_OEMBED_INSTAGRAM_IMAGE";
2718
  }
2719
  }
2733
  };
2734
  }
2735
 
2736
+ wdi_front.array_min = function (array) {
 
2737
  var min = array[0];
2738
  var minIndex = 0;
2739
  for (var i = 1; i < array.length; i++) {
2751
  /*
2752
  * Returns users count whose feed is not finished
2753
  */
2754
+ wdi_front.activeUsersCount = function (currentFeed) {
 
2755
  var counter = 0;
2756
  for (var i = 0; i < currentFeed.usersData.length; i++) {
2757
  if (currentFeed.usersData[i].finished != 'finished') {
2761
  return counter;
2762
  }
2763
 
 
2764
  /**
2765
  * Return response if it is valid else returns boolean false
2766
  * @param {Object} response [instagram API response]
2767
  * @return {Object or Boolean} [false: if invalid response, object: if valid]
2768
  */
2769
  wdi_front.checkMediaResponse = function (response, currentFeed) {
2770
+ if (response == '' || typeof response == 'undefined' || response == null || typeof response.error !== 'undefined') {
2771
  errorMessage = wdi_front_messages.connection_error;
2772
  wdi_front.show_alert(errorMessage, response, currentFeed);
2773
  return false;
2781
  return response;
2782
  }
2783
 
 
2784
  /**
2785
  * Removes # from string if it is first char
2786
  * @param {String} hashtag
2787
  * @return {String}
2788
  */
2789
+ wdi_front.stripHashtag = function (hashtag) {
 
2790
  switch (hashtag[0]) {
2791
  case '#':
2792
  {
2833
  * @param {String} searchkey [word or phrazee to search]
2834
  * @return {Boolean}
2835
  */
2836
+ wdi_front.regexpTestCaption = function (captionText, searchkey) {
 
2837
  var flag1 = false,
2838
  flag2 = false,
2839
  matchIndexes = [],
2858
 
2859
  }
2860
 
 
2861
  /**
2862
  * replaces single new-lines with space
2863
  * if multiple new lines are following each other then replaces all newlines with single space
2864
  * @param {String} string [input string]
2865
  * @return {String} [output string]
2866
  */
2867
+ wdi_front.replaceNewLines = function (string) {
 
2868
  var delimeter = "vUkCJvN2ps3t",
2869
  matchIndexes = [],
2870
  regexp;
2897
  return string;
2898
  }
2899
 
 
2900
  wdi_front.isEmptyObject = function (obj) {
2901
  for (var prop in obj) {
2902
  if (obj.hasOwnProperty(prop))
2909
  return (!str || 0 === str.length);
2910
  }
2911
 
2912
+ var WDIFeed = function (obj) {
 
 
2913
  this['data'] = obj['data'];
2914
  this['dataCount'] = obj['dataCount'];
2915
  this['feed_row'] = obj['feed_row'];
2927
  this.set_images_loading_flag(_this);
2928
  };
2929
 
2930
+ WDIFeed.prototype.mediaExists = function (media, array) {
 
 
2931
 
2932
  for (var i = 0; i < array.length; i++) {
2933
  if (media['id'] == array[i]['id']) {
2937
  return false;
2938
  }
2939
 
 
2940
  /**
2941
  * gets id of media from url, this id is not the one which comes with api request
2942
  * @param {String} url [media url]
2943
  * @return {String}
2944
  */
2945
+ WDIFeed.prototype.getIdFromUrl = function (url) {
 
2946
  var url_parts = url.split('/'),
2947
  id = false;
2948
  for (var i = 0; i < url_parts.length; i++) {
2957
  return id;
2958
  }
2959
 
 
2960
  /**
2961
  * Iterates throught response data and remove duplicate media
2962
  * @param {Object} response [Instagram API request]
2963
  * @return {Object} [response]
2964
  */
2965
+ WDIFeed.prototype.avoidDuplicateMedia = function (response) {
 
2966
  var data = response['data'],
2967
  uniqueData = [],
2968
  returnObject = {};
2988
 
2989
  }
2990
 
 
2991
  /* stores data from objects array into global variable */
2992
+ WDIFeed.prototype.storeRawData = function (objects, variable) {
 
2993
  var _this = this;
2994
  if (typeof this[variable] == "object" && typeof this[variable].length == "number") {
2995
  //checks if in golbal storage user already exisit then it adds new data to user old data
3072
 
3073
  }
3074
 
3075
+ wdi_front.updateUsersIfNecessary = function (currentFeed) {
 
 
3076
  var users = currentFeed.feed_users;
3077
  var ifUpdateNecessary = false;
3078
 
3150
 
3151
  }
3152
  else {
3153
+ jQuery(document).ready(function () {
 
 
3154
  if (wdi_front['type'] != 'not_declared') {
3155
  wdi_front.clickOrTouch = wdi_front.detectEvent();
3156
  //initializing all feeds in the page
3158
  } else {
3159
  return;
3160
  }
 
3161
  });
3162
  }
3163
 
 
3164
  jQuery(document).ready(function () {
3165
  setTimeout(function(){
3166
  if(wdi_front_messages.show_alerts === '1' && jQuery('.wdi_check_fontawesome .tenweb-i-instagram').prop("tagName") !== 'I'){
3175
  }
3176
  var result = url.replace(/(^\w+:|^)\/\//, '');
3177
 
 
3178
  return result;
3179
  }
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(){return/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())?"touchend":"click"}),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,r){var t,d;r=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter),400===i.meta.code&&"APINotAllowedError"===i.meta.error_type&&(void 0!==i.wdi_current_feed_name&&(d=i.wdi_current_feed_name,void 0===(t=r.find(".wdi_private_feed_names")).attr("wdi_first_private_user")?t.attr("wdi_first_private_user",1):d=", "+d,t.append(d),r.find(".wdi_private_feed_error").removeClass("wdi_hidden")),r.find(".wdi_spinner").remove()),void 0!==r&&"APINotAllowedError"!=i.meta.error_type&&(r.find(".wdi_spinner").remove(),wdi_error_show=!0,d=r.find(".wdi_js_error"),r=r.find(".wdi_token_error"),0!=i&&null!=typeof i.meta&&"OAuthAccessTokenException"===i.meta.error_type?(r.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){}})):(d.removeClass("wdi_js_error"),d.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 r,t=i;t<=e;t++)0!==jQuery("#wdi_feed_"+t).length&&((r=new WDIFeed(window["wdi_feed_"+t])).instagram=new WDIInstagram,r.instagram.filterArguments={feed:r},r.instagram.addToken(r.feed_row.access_token),wdi_front.access_token=r.feed_row.access_token,r.dataStorageRaw=[],r.dataStorage=[],r.dataStorageList=[],r.allResponseLength=0,r.currentResponseLength=0,r.temproraryUsersData=[],r.removedUsers=0,r.nowLoadingImages=!0,r.imageIndex=0,r.resIndex=0,r.currentPage=1,r.currentPageLoadMore=0,r.userSortFlags=[],r.customFilterChanged=!1,r.maxConditionalFiltersRequestCount=10,r.instagramRequestCounter=0,r.mediaRequestsDone=!1,r.conditionalFilterBuffer=[],r.stopInfiniteScrollFlag=!1,"masonry"==r.feed_row.feed_type&&(r.displayedData=[]),"pagination"==r.feed_row.feed_display_view?(r.feed_row.resort_after_load_more=0,"image_browser"!=r.feed_row.feed_type?(r.feed_row.load_more_number=parseInt(r.feed_row.pagination_per_page_number),r.feed_row.number_of_photos=(1+parseInt(r.feed_row.pagination_preload_number))*r.feed_row.load_more_number):(r.feed_row.number_of_photos=1+parseInt(r.feed_row.image_browser_preload_number),r.feed_row.load_more_number=parseInt(r.feed_row.image_browser_load_number)),r.freeSpaces=(Math.floor(r.feed_row.pagination_per_page_number/r.feed_row.number_of_columns)+1)*r.feed_row.number_of_columns-r.feed_row.pagination_per_page_number):r.freeSpaces=0,r.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(r),"masonry"==r.feed_row.feed_type&&jQuery(window).trigger("resize"),wdi_front.bindEvents(r),window["wdi_feed_"+t]=r,wdi_front.init(r))},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=[],r=[],t=[];void 0!==window.wdi_all_tags&&(i=window.wdi_all_tags);for(var d=0;d<e.feed_users.length;d++)"#"===e.feed_users[d].username[0]&&void 0!==e.feed_users[d].tag_id?(i[e.feed_users[d].tag_id]=e.feed_users[d],t[d]=e.feed_users[d]):r[0]=e.feed_users[d];window.wdi_all_tags=i,e.feed_users=void 0===t||wdi_front.isEmpty(t)?r:t;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 r=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter).find(".wdi_feed_wrapper");r.append('<div class="wdi_feed_item" id="wdi_feed_item_example"></div>'),wdi_responsive.columnControl(e,1);e=r.attr("wdi-res").split("wdi_col_");if(r.find("#wdi_feed_item_example").remove(),2!==e.length)return i;e=parseInt(e[1]);if(e<=0)return i;e=r.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,r){var t=this,d=r.feed_users;"string"==typeof d[i]&&"self"===d[i]?r.instagram.getRecentLikedMedia({success:function(e){void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,r),r.mediaRequestsDone=!0,0!=(e=t.checkMediaResponse(e,r))&&t.saveSelfUserData(e,r)}}):"hashtag"==this.getInputType(d[i].username)?r.instagram.getTagRecentMedia(this.stripHashtag(d[i].username),{success:function(e){void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,r),r.mediaRequestsDone=!0,0!=(e=t.checkMediaResponse(e,r))&&t.saveUserData(e,r.feed_users[i],r)}},null,r.feed_row.hashtag_top_recent):"user"==this.getInputType(d[i].username)&&r.instagram.getUserMedia({user_id:d[i].id,success:function(e){void 0!==e.meta&&void 0!==e.meta.error_type&&(e.wdi_current_feed_name=d[i].username,wdi_front.show_alert(!1,e,r)),r.mediaRequestsDone=!0,0!=(e=t.checkMediaResponse(e,r))&&t.saveUserData(e,r.feed_users[i],r)}})},wdi_front.isHashtag=function(e){return"#"===e[0]},wdi_front.saveUserData=function(e,i,r){e.user_id=i.id,e.username=i.username,"#"===e.user_id[0]&&(e.data=wdi_front.appendRequestHashtag(e.data,e.user_id)),r.usersData.push(e),r.currentResponseLength=wdi_front.getArrayContentLength(r.usersData,"data"),r.allResponseLength+=r.currentResponseLength,r.dataCount==r.usersData.length&&(r.currentResponseLength<r.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(r)?wdi_front.loadMore("initial-keep",r):(wdi_front.displayFeed(r),wdi_front.applyFilters(r),wdi_front.activeUsersCount(r)||"load_more_btn"==r.feed_row.feed_display_view&&((r=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter)).find(".wdi_load_more").addClass("wdi_hidden"),r.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 r=0,t=e.usersData;void 0!==i&&(t=i);for(var d=0;d<t.length;d++)void 0===t[d].pagination&&(t[d].pagination=[]),"liked"===e.feed_row.liked_feed?void 0===t[d].pagination.next_max_like_id&&r++:void 0===t[d].pagination.next_max_id&&r++;return r==t.length?1:0},wdi_front.appendRequestHashtag=function(e,i){for(var r=0;r<e.length;r++)e[r].wdi_hashtag=i;return e},wdi_front.displayFeed=function(e,i){0==e.customFilterChanged&&(r=wdi_front.feedSort(e,i));var r,i=e.customFilterChanged;1==e.customFilterChanged&&(r=e.customFilteredData,e.parsedData=wdi_front.parseLighboxData(e,!0)),"1"!=e.feed_row.resort_after_load_more?0==e.customFilterChanged&&(e.dataStorageList=e.dataStorageList.concat(r)):0==e.customFilterChanged&&(e.dataStorageList=r),"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),wdi_front.getDataLength(e)<parseInt(e.feed_row.number_of_photos)+parseInt(e.feed_row.load_more_number*e.currentPageLoadMore)&&!i&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount&&!wdi_front.allDataHasFinished(e)?wdi_front.loadMore("",e):(e.currentPageLoadMore++,wdi_front.allImagesLoaded(e)),e.instagramRequestCounter>e.maxConditionalFiltersRequestCount&&(wdi_front.allImagesLoaded(e),0==r.length&&(e.stopInfiniteScrollFlag=!0)),"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"),e.instagramRequestCounter=0,e.conditionalFilterBuffer=[],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.masonryDisplayFeedItems=function(e,i){var r=[],t=[];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?r.push(0):r.push(jQuery(this).height()),t.push(jQuery(this))}),1==i.customFilterChanged&&(i.customFilterChanged=!1);for(var d,a,o,n=0;n<e.length;n++)"object"==typeof e[n].videos&&null==e[n].videos.standard_resolution||(i.displayedData.push(e[n]),d="",void 0!==e[n].wdi_hashtag&&(d=e[n].wdi_hashtag),a="image"==e[n].type?wdi_front.getPhotoTemplate(i,d):e[n].hasOwnProperty("videos")||"video"==e[n].type?wdi_front.getVideoTemplate(i,d):wdi_front.getSliderTemplate(i,d),o=e[n],d=a(wdi_front.createObject(o,i)),a=wdi_front.array_min(r),o=wdi_front.getImageResolution(e[n]),t[a.index].html(t[a.index].html()+d),r[a.index]+=t[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_"+_+" img.wdi_img").on("load",function(){i.wdi_loadedImages++,w(),!1===s&&(wdi_responsive.columnControl(i,1),s=!0)});w(),1==i.paginatorNextFlag&&wdi_front.updatePagination(i,"next"),i.infiniteScrollFlag=!1}function w(){i.wdi_load_count===i.wdi_loadedImages&&0!=i.wdi_loadedImages&&(i.loadedImages=0,i.wdi_load_count=0,wdi_front.allImagesLoaded(i))}},wdi_front.getImageResolution=function(e){var i=e.images.standard_resolution.width;return e.images.standard_resolution.height/i},wdi_front.getDataLength=function(e,i){var r=0;if(void 0===i)for(var t=0;t<e.dataStorage.length;t++)r+=e.dataStorage[t].length;else for(t=0;t<i.length;t++)r+=i[t].length;return r},wdi_front.getArrayContentLength=function(e,i){for(var r=0,t=0;t<e.length;t++)"finished"!=e[t].finished&&void 0===e[t].error&&(r+=e[t][i].length);return r},wdi_front.displayFeedItems=function(e,i){if(0!=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length){var r=i.feed_row.wdi_feed_counter,t=jQuery("#wdi_feed_"+r+" .wdi_feed_wrapper");"1"===i.feed_row.resort_after_load_more&&(t.html(""),i.imageIndex=0),1==i.customFilterChanged&&(t.html(""),i.imageIndex=0,i.customFilterChanged=!1);var d;wdi_front.getImgCount(i),e.length;"pagination"==i.feed_row.feed_display_view&&(d=i.feed_row.load_more_number,"image_browser"==i.feed_row.feed_type&&(d=1),(jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+' [wdi_page="'+(i.currentPage-1)+'"]').length<d||0==e.length)&&(i.currentPage=--i.currentPage<=1?1:i.currentPage));for(var a,o,n=0;n<e.length;n++){if(void 0===e[n])return;"object"==typeof e[n].videos&&null==e[n].videos.standard_resolution||(o="",void 0!==e[n].wdi_hashtag&&(o=e[n].wdi_hashtag),a="image"==e[n].type?wdi_front.getPhotoTemplate(i,o):e[n].hasOwnProperty("videos")?wdi_front.getVideoTemplate(i,o):wdi_front.getSliderTemplate(i,o),o=e[n],o=a(wdi_front.createObject(o,i)),t.html(t.html()+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;r=i.feed_row.wdi_feed_counter,t=jQuery("#wdi_feed_"+r+" img.wdi_img").on("load",function(){i.wdi_loadedImages++,i.wdi_load_count===i.wdi_loadedImages&&0!=i.wdi_loadedImages&&(i.loadedImages=0,i.wdi_load_count=0,wdi_front.allImagesLoaded(i)),!1===s&&(wdi_responsive.columnControl(i,1),s=!0)});1==i.paginatorNextFlag&&wdi_front.updatePagination(i,"next"),i.infiniteScrollFlag=!1}},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.sortingOperator=function(e,i){var r;switch(e){case"date":switch(i){case"asc":r=function(e,i){return e.created_time>i.created_time?1:-1};break;case"desc":r=function(e,i){return e.created_time>i.created_time?-1:1}}break;case"likes":switch(i){case"asc":r=function(e,i){return e.likes.count<i.likes.count?-1:1};break;case"desc":r=function(e,i){return e.likes.count<i.likes.count?1:-1}}break;case"comments":switch(i){case"asc":r=function(e,i){return e.comments.count<i.comments.count?-1:1};break;case"desc":r=function(e,i){return e.comments.count<i.comments.count?1:-1}}break;case"random":r=function(e,i){return.5<Math.random()?1:-1}}return r},wdi_front.feedSort=function(e,i){var r=e.feed_row.sort_images_by,t=e.feed_row.display_order;"1"===e.feed_row.resort_after_load_more?e.data=e.data.concat(wdi_front.smartPicker(e,i)):e.data=wdi_front.smartPicker(e,i);t=wdi_front.sortingOperator(r,t);return e.data.sort(t),e.data},wdi_front.smartPicker=function(e,i){var r=[],t=0,d=[],a=Math.ceil(e.feed_row.number_of_photos/e.usersData.length),o=parseInt(e.feed_row.number_of_photos),n=0;""!=i&&void 0!==i&&null!=i&&(o=parseInt(i),a=Math.ceil(o/wdi_front.activeUsersCount(e)));e.storeRawData(e.usersData,"dataStorageRaw");for(var s,_=e.dataStorageRaw.sort(function(e,i){return e.length()>i.length()?1:-1}),w=e.usersData.sort(function(e,i){return e.data.length>i.data.length?1:-1}),l=0;l<w.length;l++)n+=a,_[l].length()<=n?(n-=_[l].length(),r.push(_[l].getData(_[l].length())),t+=r[r.length-1].length):(o<t+n&&(n=o-t),(!(s=[])===e.auto_trigger||s.length+wdi_front.getDataLength(e)+wdi_front.getDataLength(e,r)<e.feed_row.number_of_photos)&&(s=s.concat(_[l].getData(n))),n=0,t+=s.length,r.push(s));for(l=0;l<r.length;l++)void 0===e.dataStorage[l]?e.dataStorage.push(r[l]):e.dataStorage[l]=e.dataStorage[l].concat(r[l]);for(e.parsedData=wdi_front.parseLighboxData(e),l=0;l<r.length;l++)d=d.concat(r[l]);return d},wdi_front.createObject=function(e,i){var r,t=null!=e.caption?e.caption.text:"&nbsp",d=wdi_url.plugin_url+"images/video_missing.png";"video"==e.type&&e.videos[i.feedVideoResolution]&&null!=e.videos[i.feedVideoResolution].url&&(d=e.hasOwnProperty("videos")?e.videos[i.feedVideoResolution].url:""),void 0===e.images[i.feedImageResolution]?r=wdi_url.plugin_url+"images/missing.png":"carousel"==e.type&&void 0===e.images[i.feedImageResolution].url?void 0!==e.carousel_media[0].images?r=e.carousel_media[0].images[i.feedImageResolution].url:void 0!==e.carousel_media[0].videos&&(r=wdi_url.plugin_url+"images/video_missing.png"):r=e.images[i.feedImageResolution].url;var a=i.imageIndex,o="square",n=e.images.standard_resolution.height,s=e.images.standard_resolution.width;s<n?o="portrait":n<s&&(o="landscape");s=e.user.username;return""===s&&(s="no_user"),{id:e.id,caption:wdi_front.escape_tags(t),image_url:r,likes:e.likes.count,comments:e.comments.count,wdi_index:a,wdi_res_index:i.resIndex,wdi_media_user:s,link:e.link,video_url:d,wdi_username:s,wdi_shape:o}},wdi_front.setPage=function(e){var i=e.feed_row.feed_display_view,r=e.feed_row.feed_type;if("pagination"!=i)return"";i=e.imageIndex;return r="image_browser"==r?1:Math.abs(e.feed_row.pagination_per_page_number),e.paginator=Math.ceil((i+1)/r),e.paginator},wdi_front.getPhotoTemplate=function(e,i){var r=wdi_front.setPage(e),t="",d="",a="",o="",n="tenweb-i-arrows-out",s="";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(n=""),sourceAttr=(""!=r&&(d='wdi_page="'+r+'"'),"src"),""!=r&&1!=r&&(t="wdi_hidden"),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(s='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(t+=" wdi_full_caption");r="";switch("blog_style"!==e.feed_row.feed_type&&(r="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":a="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":a="onclick=\"window.open ('<%= link%>','_blank')\"",o="wdi_hover_off",n="";break;case"custom_redirect":a="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",o="wdi_hover_off",n="";break;case"none":o="wdi_cursor_off wdi_hover_off",n=a=""}d='<div class="wdi_feed_item '+t+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+d+' 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\" "+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+o+'" >'+s+'<div class="wdi_thumb_icon" '+a+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+n+'"></i></div></div></div></div></div></div>',s=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(d+='<div class="wdi_photo_meta">',"1"===e.feed_row.show_likes&&0!=e.dataStorageList[s].likes.count&&(d+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"1"===e.feed_row.show_comments&&0!=e.dataStorageList[s].comments.count&&(d+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),d+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(d+='<div class="wdi_photo_title" onclick='+r+" ><%=caption%></div>"),d+="</div>"),d+="</div>",_.template(d)},wdi_front.getSliderTemplate=function(e,i){var r=wdi_front.setPage(e),t="",d="",a="",o="",n="tenweb-i-clone",s="";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(n=""),sourceAttr=(""!=r&&(d='wdi_page="'+r+'"'),"src"),""!=r&&1!=r&&(t="wdi_hidden"),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(s='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(t+=" wdi_full_caption");r="";switch("blog_style"!==e.feed_row.feed_type&&(r="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":a="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":a="onclick=\"window.open ('<%= link%>','_blank')\"",o="wdi_hover_off",n="tenweb-i-clone";break;case"custom_redirect":a="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",o="wdi_hover_off",n="";break;case"none":o="wdi_cursor_off wdi_hover_off",n=a=""}d='<div class="wdi_feed_item '+t+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+d+' 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\" "+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+o+'" >'+s+'<div class="wdi_thumb_icon" '+a+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+n+'"></i></div></div></div></div></div></div>',s=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(d+='<div class="wdi_photo_meta">',"1"===e.feed_row.show_likes&&0!=e.dataStorageList[s].likes.count&&(d+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"1"===e.feed_row.show_comments&&0!=e.dataStorageList[s].comments.count&&(d+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),d+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(d+='<div class="wdi_photo_title" onclick='+r+" ><%=caption%></div>"),d+="</div>"),d+="</div>",_.template(d)},wdi_front.replaceToVideo=function(e,i,r){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_"+r+' [wdi_index="'+i+'"] .wdi_photo_wrap_inner').html(overlayHtml),jQuery("#wdi_feed_"+r+' [wdi_index="'+i+'"] .wdi_photo_wrap_inner video').get(0).play()},wdi_front.getVideoTemplate=function(e,i){var r=wdi_front.setPage(e),t="",d="",a="tenweb-i-play",o="",n="",s="",w=(""!=r&&(d='wdi_page="'+r+'"'),"src");""!=r&&1!=r&&(t="wdi_hidden"),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(s='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(t+=" wdi_full_caption");r="";switch("blog_style"!==e.feed_row.feed_type&&(r="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":o="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":o="onclick=\"window.open ('<%= link%>','_blank')\"",n="wdi_hover_off",a="tenweb-i-play";break;case"custom_redirect":o="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",n="wdi_hover_off",a="";break;case"none":n="wdi_cursor_off wdi_hover_off",a="","blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(o="onclick=wdi_front.replaceToVideo('<%= video_url%>','<%= wdi_index%>',"+e.feed_row.wdi_feed_counter+")",n="",a="tenweb-i-play")}w='<div class="wdi_feed_item '+t+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+d+' 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\" "+w+'="<%=video_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+n+'" '+o+">"+s+'<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 '+a+'"></i></div></div></div></div></div></div>',s=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(w+='<div class="wdi_photo_meta">',"1"===e.feed_row.show_likes&&0!=e.dataStorageList[s].likes.count&&(w+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"1"===e.feed_row.show_comments&&0!=e.dataStorageList[s].comments.count&&(w+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),w+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(w+='<div class="wdi_photo_title" onclick='+r+" ><%=caption%></div>"),w+="</div>"),w+="</div>",_.template(w)},wdi_front.bindEvents=function(e){0!=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length&&("load_more_btn"==e.feed_row.feed_display_view&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_load_more_container").on(wdi_front.clickOrTouch,function(){wdi_front.loadMore(jQuery(this).find(".wdi_load_more_wrap"))}),"pagination"==e.feed_row.feed_display_view&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_next").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorNext(jQuery(this),e)}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_prev").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorPrev(jQuery(this),e)}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_last_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationLastPage(jQuery(this),e)}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_first_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationFirstPage(jQuery(this),e)}),e.paginatorNextFlag=!1),"infinite_scroll"==e.feed_row.feed_display_view&&(jQuery(window).on("scroll",function(){wdi_front.infiniteScroll(e)}),e.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&&(!1===e.infiniteScrollFlag&&0==e.stopInfiniteScrollFlag?(e.infiniteScrollFlag=!0,wdi_front.loadMore(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_infinite_scroll"),e)):e.stopInfiniteScrollFlag&&wdi_front.allImagesLoaded(e))},wdi_front.paginationFirstPage=function(e,i){var r;1!=i.paginator&&1!=i.currentPage&&(r=i.currentPage,i.currentPage=1,wdi_front.updatePagination(i,"custom",r),e.parent().find("#wdi_last_page").removeClass("wdi_disabled")),e.addClass("wdi_disabled")},wdi_front.paginationLastPage=function(e,i){var r;1!=i.paginator&&i.currentPage!=i.paginator&&(r=i.currentPage,i.currentPage=i.paginator,wdi_front.updatePagination(i,"custom",r),e.addClass("wdi_disabled"),e.parent().find("#wdi_first_page").removeClass("wdi_disabled"))},wdi_front.paginatorNext=function(e,i){var r,t=e.parent().find("#wdi_last_page"),d=e.parent().find("#wdi_first_page");i.paginatorNextFlag=!0,i.paginator!=i.currentPage||wdi_front.checkFeedFinished(i)?i.paginator>i.currentPage&&(i.currentPage++,wdi_front.updatePagination(i,"next"),i.paginator>i.currentPage?t.removeClass("wdi_disabled"):t.addClass("wdi_disabled")):(i.currentPage++,r=i.feed_row.number_of_photos,wdi_front.loadMore(e,i,r),t.addClass("wdi_disabled")),d.removeClass("wdi_disabled")},wdi_front.paginatorPrev=function(e,i){var r=e.parent().find("#wdi_last_page"),e=e.parent().find("#wdi_first_page");1!=i.currentPage?(i.currentPage--,wdi_front.updatePagination(i,"prev"),r.removeClass("wdi_disabled"),1==i.currentPage&&e.addClass("wdi_disabled")):e.addClass("wdi_disabled")},wdi_front.updatePagination=function(e,i,r){var t="#wdi_feed_"+e.feed_row.wdi_feed_counter;switch(jQuery(t+' [wdi_page="'+e.currentPage+'"]').each(function(){jQuery(this).removeClass("wdi_hidden")}),i){case"next":var r=e.currentPage-1;jQuery(t+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(t+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"prev":r=e.currentPage+1;jQuery(t+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(t+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"custom":(r=r)!=e.currentPage&&(jQuery(t+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(t+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")}))}e.paginatorNextFlag=!1,jQuery(t+" .wdi_feed_wrapper").css("height","auto"),jQuery(t+" #wdi_current_page").text(e.currentPage)},wdi_front.loadMore=function(e,i){var r,t=0;""!=e&&void 0!==e&&"initial"!=e&&"initial-keep"!=e&&(r=window[e.parent().parent().parent().parent().attr("id")]),void 0!==i&&(r=i);for(var d=0,a=0,o=0;o<r.userSortFlags.length;o++)if(!0===r.userSortFlags[o].flag){d++;for(var n=0;n<r.usersData.length;n++)r.userSortFlags[o].id===r.usersData[n].user_id&&"finished"===r.usersData[n].finished&&a++}if(d!==a||0==d){r.auto_trigger=""===e,wdi_front.ajaxLoader(r),"masonry"===r.feed_row.feed_type&&"pagination"==r.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)});for(o=0;o<r.usersData.length;o++)"finished"===r.usersData[o].finished&&t++;t===r.usersData.length&&(wdi_front.allImagesLoaded(r),jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter+" .wdi_load_more").remove());var s=r.usersData;r.loadMoreDataCount=r.feed_users.length;for(o=0;o<s.length;o++){var _=s[o].pagination,w={user_id:s[o].user_id,username:s[o].username};""!=_.next_url&&null!=_.next_url&&void 0!==_.next_url?(_=_.next_url,wdi_front.loadMoreRequest(w,_,r,e)):("initial-keep"==e&&(r.temproraryUsersData[o]=r.usersData[o]),r.loadMoreDataCount--,wdi_front.checkForLoadMoreDone(r,e))}}},wdi_front.loadMoreRequest=function(r,e,t,d){var a,i;t.mediaRequestsDone&&(t.usersData,a="",i=function(e){if(""===e||void 0===e||null==e)return a=wdi_front_messages.network_error,t.loadMoreDataCount--,void wdi_front.show_alert(a,e,t);if(void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,t),void 0!==e.meta&&void 0!==e.meta.code&&200!=e.meta.code)return a=e.meta.error_message,t.loadMoreDataCount--,void wdi_front.show_alert(a,e,t);e.user_id=r.user_id,e.username=r.username;for(var i=0;i<t.usersData.length;i++)e.user_id===t.usersData[i].user_id&&("#"===e.user_id[0]&&(e.data=wdi_front.appendRequestHashtag(e.data,e.user_id)),"initial-keep"==d&&(t.temproraryUsersData[i]=t.usersData[i]),t.usersData[i]=e,void 0===t.dataStorageRaw[i]?t.dataStorageRaw[i]={data:e.data}:t.dataStorageRaw[i].data=t.dataStorageRaw[i].data.concat(e.data),t.loadMoreDataCount--);wdi_front.checkForLoadMoreDone(t,d)},"#"!==r.username[0]?t.instagram.getUserMedia({user_id:r.username[0].id,success:i},e):t.instagram.getTagRecentMedia(r.username,{success:i},e,t.feed_row.hashtag_top_recent))},wdi_front.checkForLoadMoreDone=function(e,i){var r,t=e.feed_row.load_more_number,d=e.feed_row.number_of_photos;0==e.loadMoreDataCount&&(e.temproraryUsersData=wdi_front.mergeData(e.temproraryUsersData,e.usersData),r=wdi_front.getArrayContentLength(e.temproraryUsersData,"data"),"initial-keep"==i&&(i="initial"),"initial"==i?r<d&&!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=[]):r<t&&!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,t),wdi_front.applyFilters(e),e.temproraryUsersData=[])))},wdi_front.allDataHasFinished=function(e){for(var i=0,r=0;r<e.dataStorageRaw.length;r++)""==e.usersData[r].pagination.next_url&&(i++,e.usersData[r].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 r=0;r<i.length;r++)void 0!==e[r]?"finished"!=i[r].finished&&(void 0===e[r].pagination.next_max_id&&void 0===e[r].pagination.next_max_like_id||(e[r].data=e[r].data.concat(i[r].data),e[r].pagination=i[r].pagination,e[r].user_id=i[r].user_id,e[r].username=i[r].username,e[r].meta=i[r].meta)):e.push(i[r]);return e},wdi_front.brokenImageHandler=function(e){return!0},wdi_front.ajaxLoader=function(e){var i,r=e.feed_row.wdi_feed_counter,r=jQuery("#wdi_feed_"+r);"load_more_btn"==e.feed_row.feed_display_view&&(r.find(".wdi_load_more").addClass("wdi_hidden"),r.find(".wdi_spinner").removeClass("wdi_hidden")),"infinite_scroll"==e.feed_row.feed_display_view&&(0==r.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>'),r.append(i)):i=r.find(".wdi_ajax_loading"),i.removeClass("wdi_hidden"))},wdi_front.allImagesLoaded=function(e){var i=wdi_front.getDataLength(e);e.mediaRequestsDone||jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").remove("wdi_nomedia"),0!=i||!e.mediaRequestsDone||0!=e.feed_row.conditional_filters.length&&0!=e.feed_row.conditional_filter_enable||jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").append("<p class='wdi_nomedia'>"+wdi_front_messages.feed_nomedia+"</p>");i=e.feed_row.wdi_feed_counter,i=jQuery("#wdi_feed_"+i);"load_more_btn"==e.feed_row.feed_display_view&&(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 r,t,d=i.feed_row.wdi_feed_counter,a=jQuery("#wdi_feed_"+d+" .wdi_feed_container");"header"===e&&(r={feed_thumb:i.feed_row.feed_thumb,feed_name:i.feed_row.feed_name},t=wdi_front.getHeaderTemplate()(r),r=a.find(".wdi_feed_header").html(),a.find(".wdi_feed_header").html(r+t))},wdi_front.getUserTemplate=function(e,i){var r=e.dataCount,t="#"===i[0]?"//instagram.com/explore/tags/"+i.substr(1,i.length):"//instagram.com/"+i,d="onclick='"+('window.open("'+t+'","_blank")')+"'",t='<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<r&&(t+='<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>'),t+="</div>",t+="<h3 "+d+"><%= user_name%></h3>","#"!==i[0]?("1"==e.feed_row.follow_on_instagram_btn&&(t+='<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>"),t+='<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>'):t+='<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>',t+='<div class="wdi_clear"></div>',1==r&&"#"!==i[0]&&"1"==e.feed_row.display_user_info&&(t+='<div class="wdi_bio"><%= bio%></div>',t+='<div class="wdi_website"><a target="_blank" href="<%= website_url%>" ><%= website%></a></div>'),t+="</div></div>",_.template(t)},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 r=window["wdi_feed_"+i],i=r.dataCount;if(!(i<2)&&0==r.nowLoadingImages){i=jQuery("#wdi_feed_"+r.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"),r.customFilterChanged=!0,0==r.userSortFlags[e].flag?r.userSortFlags[e].flag=!0:r.userSortFlags[e].flag=!1;for(var t=0,d=0;d<r.userSortFlags.length;d++)1==r.userSortFlags[d].flag&&t++;"pagination"==r.feed_row.feed_display_view&&(r.resIndex=0),0!=t?wdi_front.filterData(r):r.customFilteredData=r.dataStorageList,wdi_front.displayFeed(r),"pagination"==r.feed_row.feed_display_view&&(r.paginator=Math.ceil(r.imageIndex/parseInt(r.feed_row.pagination_per_page_number)),r.currentPage=r.paginator,wdi_front.updatePagination(r,"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 r=0;r<e.dataStorageList.length;r++)for(var t=0;t<i.length;t++)(void 0!==e.dataStorageList[r].user.id&&e.dataStorageList[r].user.id==i[t].id||e.dataStorageList[r].wdi_hashtag==i[t].name)&&1==i[t].flag&&e.customFilteredData.push(e.dataStorageList[r])},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,r=0,t=0;t<i.length;t++)r+=i[t].length;return r},wdi_front.parseLighboxData=function(e,i){var r,t,d,a=e.dataStorage,o=e.feed_row.sort_images_by,n=e.feed_row.display_order,n=wdi_front.sortingOperator(o,n),s=[],_=[];if(1==i)s=e.customFilteredData;else{for(var w=0;w<a.length;w++)for(var l=0;l<a[w].length;l++)s.push(a[w][l]);s.sort(n)}for(w=0;w<s.length;w++)void 0!==s[w]&&(t=void 0!==s[w]&&void 0!==s[w].media_url?s[w].media_url:wdi_url.plugin_url+"images/video_missing.png",void 0!==s[w]&&void 0===s[w].media_url&&"carousel"===s[w].type&&(void 0!==(d=s[w].carousel_media[0])&&void 0!==d.images?t=d.images.standard_resolution.url:void 0!==d&&void 0!==d.videos&&(t=d.videos.standard_resolution.url)),void(d=0)!==s[w]&&void 0!==s[w].comments&&(d=s[w].comments.count),r={alt:"",avg_rating:"",comment_count:d,date:wdi_front.convertUnixDate(s[w].created_time),description:wdi_front.getDescription(void 0!==s[w].caption&&null!==s[w].caption?wdi_front.escape_tags(s[w].caption.text):""),filename:wdi_front.getFileName(s[w]),filetype:wdi_front.getFileType(s[w]),hit_count:"0",id:s[w].id,image_url:s[w].link,number:0,rate:"",rate_count:"0",username:void 0!==s[w].user?s[w].user.username:"",profile_picture:void 0!==s[w].user?s[w].user.profile_picture:"",thumb_url:t,comments_data:void 0!==s[w].comments?s[w].comments.data:"",images:s[w].images,carousel_media:void 0!==s[w].carousel_media?s[w].carousel_media:null},_.push(r));return _},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":"EMBED_OEMBED_INSTAGRAM_IMAGE"},wdi_front.array_max=function(e){for(var i=e[0],r=0,t=1;t<e.length;t++)i<e[t]&&(i=e[t],r=t);return{value:i,index:r}},wdi_front.array_min=function(e){for(var i=e[0],r=0,t=1;t<e.length;t++)i>e[t]&&(i=e[t],r=t);return{value:i,index:r}},wdi_front.activeUsersCount=function(e){for(var i=0,r=0;r<e.usersData.length;r++)"finished"!=e.usersData[r].finished&&i++;return i},wdi_front.checkMediaResponse=function(e,i){return""==e||void 0===e||null==e?(errorMessage=wdi_front_messages.connection_error,wdi_front.show_alert(errorMessage,e,i),!1):""!=e&&void 0!==e&&null!=e&&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 r=!1,t=!1,d=i.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&"),i=new RegExp("(?:^|\\s)"+d+"(?:^|\\s)"),a=new RegExp("(?:^|\\s)"+d,"g");for(null!=i.exec(e)&&(r=!0);null!=(match=a.exec(e));)t=!0;return 1==r||1==t},wdi_front.replaceNewLines=function(e){var i,r="vUkCJvN2ps3t",t=[];for(e=e.replace(/\r?\n|\r/g,r),i=new RegExp(r,"g");null!=(match=i.exec(e));)t.push(match.index);for(var d=e.split(r),a=0,o=0;o<d.length;o++)""==d[o]?a++:a=0,0<a&&(d.splice(o,1),a--,o--);return e=d.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 r=0;r<i.length;r++)if(e.id==i[r].id)return!0;return!1},WDIFeed.prototype.getIdFromUrl=function(e){for(var i=e.split("/"),r=!1,t=0;t<i.length;t++)if("p"==i[t]&&void 0!==i[t+1]){r=i[t+1];break}return r},WDIFeed.prototype.avoidDuplicateMedia=function(e){var i=e.data,r=[];void 0===i&&(i=[]);for(var t=0;t<i.length;t++)this.mediaExists(i[t],this.dataStorageList)||this.mediaExists(i[t],r)||this.mediaExists(i[t],this.conditionalFilterBuffer)||r.push(i[t]);return this.conditionalFilterBuffer=this.conditionalFilterBuffer.concat(r),{data:r,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.storeRawData=function(e,i){var t=this;if("object"==typeof this[i]&&"number"==typeof this[i].length)for(var r=0;r<e.length;r++){var d="";wdi_front.isHashtag(e[r].user_id)?void 0!==e[r].pagination.cursors&&(d=e[r].pagination.cursors.after):"liked"==t.feed_row.liked_feed?void 0===(d=e[r].pagination.next_max_like_id)&&(d=""):(null==e[r].pagination&&(e[r].pagination=[]),void 0===(d=e[r].pagination.next_max_id)&&(d="")),void 0===this[i][r]?this[i].push({data:e[r].data,index:0,locked:!1,hash_id:d,usersDataFinished:!1,userId:e[r].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 r=0;r<t.usersData.length;r++)if(t.usersData[r].user_id==this.userId){this.usersDataFinished=!0;break}return i}}):0==this[i][r].locked&&(d!=this[i][r].hash_id?(this[i][r].data=this[i][r].data.concat(e[r].data),this[i][r].hash_id=d):this[i][r].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,r=0;r<e.data.length;r++)if(e.data[r].username==e.args.username){i=!0;break}if(i)for(var t=0;t<n.length;t++)e.data[r].username==n[t].username&&(n[t].id=e.data[r].id)}for(var d=!1,a=0;a<n.length;a++)if(""==n[a].id||"username"==n[a].id){d=!0;break}d||(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,r){var t,a;void 0!==(r=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter))&&(wdi_error_show=!0,r.find(".wdi_spinner").remove(),t=r.find(".wdi_js_error"),a=r.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)?(r.find(".wdi_single_user").remove(),a.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){}})):(r.find(".wdi_single_user").remove(),t.removeClass("wdi_js_error"),t.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 r,t=i;t<=e;t++)0!==jQuery("#wdi_feed_"+t).length&&((r=new WDIFeed(window["wdi_feed_"+t])).instagram=new WDIInstagram,r.instagram.filterArguments={feed:r},r.instagram.addToken(r.feed_row.access_token),wdi_front.access_token=r.feed_row.access_token,r.dataStorageRaw=[],r.dataStorage=[],r.dataStorageList=[],r.allResponseLength=0,r.currentResponseLength=0,r.temproraryUsersData=[],r.removedUsers=0,r.nowLoadingImages=!0,r.imageIndex=0,r.resIndex=0,r.currentPage=1,r.currentPageLoadMore=0,r.userSortFlags=[],r.customFilterChanged=!1,r.maxConditionalFiltersRequestCount=10,r.instagramRequestCounter=0,r.mediaRequestsDone=!1,r.conditionalFilterBuffer=[],r.stopInfiniteScrollFlag=!1,"masonry"==r.feed_row.feed_type&&(r.displayedData=[]),"pagination"==r.feed_row.feed_display_view?(r.feed_row.resort_after_load_more=0,"image_browser"!=r.feed_row.feed_type?(r.feed_row.load_more_number=parseInt(r.feed_row.pagination_per_page_number),r.feed_row.number_of_photos=(1+parseInt(r.feed_row.pagination_preload_number))*r.feed_row.load_more_number):(r.feed_row.number_of_photos=1+parseInt(r.feed_row.image_browser_preload_number),r.feed_row.load_more_number=parseInt(r.feed_row.image_browser_load_number)),r.freeSpaces=(Math.floor(r.feed_row.pagination_per_page_number/r.feed_row.number_of_columns)+1)*r.feed_row.number_of_columns-r.feed_row.pagination_per_page_number):r.freeSpaces=0,r.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(r),"masonry"==r.feed_row.feed_type&&jQuery(window).trigger("resize"),wdi_front.bindEvents(r),window["wdi_feed_"+t]=r,wdi_front.init(r))},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=[],r=[],t=[];void 0!==window.wdi_all_tags&&(i=window.wdi_all_tags);for(var a=0;a<e.feed_users.length;a++)"#"===e.feed_users[a].username[0]&&void 0!==e.feed_users[a].tag_id?(i[e.feed_users[a].tag_id]=e.feed_users[a],t[a]=e.feed_users[a]):r[0]=e.feed_users[a];window.wdi_all_tags=i,e.feed_users=void 0===t||wdi_front.isEmpty(t)?r:t;var d=wdi_front.getFeedItemResolution(e);e.feedImageResolution=d.image,e.feedVideoResolution=d.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 r=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter).find(".wdi_feed_wrapper");r.append('<div class="wdi_feed_item" id="wdi_feed_item_example"></div>'),wdi_responsive.columnControl(e,1);e=r.attr("wdi-res").split("wdi_col_");if(r.find("#wdi_feed_item_example").remove(),2!==e.length)return i;e=parseInt(e[1]);if(e<=0)return i;e=r.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,r){var t=this,e=r.feed_users;"string"==typeof e[i]&&"self"===e[i]?r.instagram.getRecentLikedMedia({success:function(e){void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,r),r.mediaRequestsDone=!0,0!=(e=t.checkMediaResponse(e,r))&&t.saveSelfUserData(e,r)}}):"hashtag"==this.getInputType(e[i].username)?r.instagram.getTagRecentMedia(this.stripHashtag(e[i].username),{success:function(e){if(void 0!==e.meta&&1==e.meta.error)return wdi_front.show_alert(!1,e,r),!1;r.mediaRequestsDone=!0,0!=(e=t.checkMediaResponse(e,r))&&t.saveUserData(e,r.feed_users[i],r)}},null,r.feed_row.hashtag_top_recent):"user"==this.getInputType(e[i].username)&&r.instagram.getUserMedia({user_id:e[i].id,success:function(e){if(void 0!==e.meta&&1==typeof e.meta.error)return wdi_front.show_alert(!1,e,r),!1;r.mediaRequestsDone=!0,0!=(e=t.checkMediaResponse(e,r))&&t.saveUserData(e,r.feed_users[i],r)}})},wdi_front.isHashtag=function(e){return"#"===e[0]},wdi_front.saveUserData=function(e,i,r){e.user_id=i.id,e.username=i.username,"#"===e.user_id[0]&&(e.data=wdi_front.appendRequestHashtag(e.data,e.user_id)),r.usersData.push(e),r.currentResponseLength=wdi_front.getArrayContentLength(r.usersData,"data"),r.allResponseLength+=r.currentResponseLength,r.dataCount==r.usersData.length&&(r.currentResponseLength<r.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(r)?wdi_front.loadMore("initial-keep",r):(wdi_front.displayFeed(r),wdi_front.applyFilters(r),wdi_front.activeUsersCount(r)||"load_more_btn"==r.feed_row.feed_display_view&&((r=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter)).find(".wdi_load_more").addClass("wdi_hidden"),r.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 r=0,t=e.usersData;void 0!==i&&(t=i);for(var a=0;a<t.length;a++)void 0===t[a].pagination&&(t[a].pagination=[]),"liked"===e.feed_row.liked_feed?void 0===t[a].pagination.next_max_like_id&&r++:void 0===t[a].pagination.next_max_id&&r++;return r==t.length?1:0},wdi_front.appendRequestHashtag=function(e,i){for(var r=0;r<e.length;r++)e[r].wdi_hashtag=i;return e},wdi_front.displayFeed=function(e,i){0==e.customFilterChanged&&(r=wdi_front.feedSort(e,i));var r,i=e.customFilterChanged;1==e.customFilterChanged&&(r=e.customFilteredData,e.parsedData=wdi_front.parseLighboxData(e,!0)),"1"!=e.feed_row.resort_after_load_more?0==e.customFilterChanged&&(e.dataStorageList=e.dataStorageList.concat(r)):0==e.customFilterChanged&&(e.dataStorageList=r),"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),wdi_front.getDataLength(e)<parseInt(e.feed_row.number_of_photos)+parseInt(e.feed_row.load_more_number*e.currentPageLoadMore)&&!i&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount&&!wdi_front.allDataHasFinished(e)?wdi_front.loadMore("",e):(e.currentPageLoadMore++,wdi_front.allImagesLoaded(e)),e.instagramRequestCounter>e.maxConditionalFiltersRequestCount&&(wdi_front.allImagesLoaded(e),0==r.length&&(e.stopInfiniteScrollFlag=!0)),"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"),e.instagramRequestCounter=0,e.conditionalFilterBuffer=[],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.masonryDisplayFeedItems=function(e,i){var r=[],t=[];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?r.push(0):r.push(jQuery(this).height()),t.push(jQuery(this))}),1==i.customFilterChanged&&(i.customFilterChanged=!1);for(var a,d,o,n=0;n<e.length;n++)"object"==typeof e[n].videos&&null==e[n].videos.standard_resolution||(i.displayedData.push(e[n]),a="",void 0!==e[n].wdi_hashtag&&(a=e[n].wdi_hashtag),d="image"==e[n].type?wdi_front.getPhotoTemplate(i,a):e[n].hasOwnProperty("videos")||"video"==e[n].type?wdi_front.getVideoTemplate(i,a):wdi_front.getSliderTemplate(i,a),o=e[n],a=d(wdi_front.createObject(o,i)),d=wdi_front.array_min(r),o=wdi_front.getImageResolution(e[n]),t[d.index].html(t[d.index].html()+a),r[d.index]+=t[d.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_"+_+" img.wdi_img").on("load",function(){i.wdi_loadedImages++,w(),!1===s&&(wdi_responsive.columnControl(i,1),s=!0)});w(),1==i.paginatorNextFlag&&wdi_front.updatePagination(i,"next"),i.infiniteScrollFlag=!1}function w(){i.wdi_load_count===i.wdi_loadedImages&&0!=i.wdi_loadedImages&&(i.loadedImages=0,i.wdi_load_count=0,wdi_front.allImagesLoaded(i))}},wdi_front.getImageResolution=function(e){var i=e.images.standard_resolution.width;return e.images.standard_resolution.height/i},wdi_front.getDataLength=function(e,i){var r=0;if(void 0===i)for(var t=0;t<e.dataStorage.length;t++)r+=e.dataStorage[t].length;else for(t=0;t<i.length;t++)r+=i[t].length;return r},wdi_front.getArrayContentLength=function(e,i){for(var r=0,t=0;t<e.length;t++)"finished"!=e[t].finished&&void 0===e[t].error&&(r+=e[t][i].length);return r},wdi_front.displayFeedItems=function(e,i){if(0!=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length){var r=i.feed_row.wdi_feed_counter,t=jQuery("#wdi_feed_"+r+" .wdi_feed_wrapper");"1"===i.feed_row.resort_after_load_more&&(t.html(""),i.imageIndex=0),1==i.customFilterChanged&&(t.html(""),i.imageIndex=0,i.customFilterChanged=!1);var a;wdi_front.getImgCount(i),e.length;"pagination"==i.feed_row.feed_display_view&&(a=i.feed_row.load_more_number,"image_browser"==i.feed_row.feed_type&&(a=1),(jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+' [wdi_page="'+(i.currentPage-1)+'"]').length<a||0==e.length)&&(i.currentPage=--i.currentPage<=1?1:i.currentPage));for(var d,o,n=0;n<e.length;n++){if(void 0===e[n])return;"object"==typeof e[n].videos&&null==e[n].videos.standard_resolution||(o="",void 0!==e[n].wdi_hashtag&&(o=e[n].wdi_hashtag),d="image"==e[n].type?wdi_front.getPhotoTemplate(i,o):e[n].hasOwnProperty("videos")?wdi_front.getVideoTemplate(i,o):wdi_front.getSliderTemplate(i,o),o=e[n],o=d(wdi_front.createObject(o,i)),t.html(t.html()+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;r=i.feed_row.wdi_feed_counter,t=jQuery("#wdi_feed_"+r+" img.wdi_img").on("load",function(){i.wdi_loadedImages++,i.wdi_load_count===i.wdi_loadedImages&&0!=i.wdi_loadedImages&&(i.loadedImages=0,i.wdi_load_count=0,wdi_front.allImagesLoaded(i)),!1===s&&(wdi_responsive.columnControl(i,1),s=!0)});1==i.paginatorNextFlag&&wdi_front.updatePagination(i,"next"),i.infiniteScrollFlag=!1}},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.sortingOperator=function(e,i){var r;switch(e){case"date":switch(i){case"asc":r=function(e,i){return e.created_time>i.created_time?1:-1};break;case"desc":r=function(e,i){return e.created_time>i.created_time?-1:1}}break;case"likes":switch(i){case"asc":r=function(e,i){return e.likes.count<i.likes.count?-1:1};break;case"desc":r=function(e,i){return e.likes.count<i.likes.count?1:-1}}break;case"comments":switch(i){case"asc":r=function(e,i){return e.comments.count<i.comments.count?-1:1};break;case"desc":r=function(e,i){return e.comments.count<i.comments.count?1:-1}}break;case"random":r=function(e,i){return.5<Math.random()?1:-1}}return r},wdi_front.feedSort=function(e,i){var r=e.feed_row.sort_images_by,t=e.feed_row.display_order;"1"===e.feed_row.resort_after_load_more?e.data=e.data.concat(wdi_front.smartPicker(e,i)):e.data=wdi_front.smartPicker(e,i);t=wdi_front.sortingOperator(r,t);return e.data.sort(t),e.data},wdi_front.smartPicker=function(e,i){var r=[],t=0,a=[],d=Math.ceil(e.feed_row.number_of_photos/e.usersData.length),o=parseInt(e.feed_row.number_of_photos),n=0;""!=i&&void 0!==i&&null!=i&&(o=parseInt(i),d=Math.ceil(o/wdi_front.activeUsersCount(e)));e.storeRawData(e.usersData,"dataStorageRaw");for(var s,_=e.dataStorageRaw.sort(function(e,i){return e.length()>i.length()?1:-1}),w=e.usersData.sort(function(e,i){return e.data.length>i.data.length?1:-1}),l=0;l<w.length;l++)n+=d,_[l].length()<=n?(n-=_[l].length(),r.push(_[l].getData(_[l].length())),t+=r[r.length-1].length):(o<t+n&&(n=o-t),(!(s=[])===e.auto_trigger||s.length+wdi_front.getDataLength(e)+wdi_front.getDataLength(e,r)<e.feed_row.number_of_photos)&&(s=s.concat(_[l].getData(n))),n=0,t+=s.length,r.push(s));for(l=0;l<r.length;l++)void 0===e.dataStorage[l]?e.dataStorage.push(r[l]):e.dataStorage[l]=e.dataStorage[l].concat(r[l]);for(e.parsedData=wdi_front.parseLighboxData(e),l=0;l<r.length;l++)a=a.concat(r[l]);return a},wdi_front.createObject=function(e,i){var r=null!=e.caption?e.caption.text:"&nbsp";switch(e.type){case"image":var t=e.images[i.feedImageResolution].url,a=void 0,d="image";break;case"video":t=void 0,a=e.hasOwnProperty("videos")?e.videos[i.feedVideoResolution].url:wdi_url.plugin_url+"images/video_missing.png",d="video";break;case"carousel":switch(e.carousel_media[0].type){case"image":t=e.carousel_media[0].images[i.feedImageResolution].url,a=void 0,d="image";break;case"video":t=void 0,a=e.carousel_media[0].videos[i.feedVideoResolution].url,d="video";break;default:t=wdi_url.plugin_url+"images/missing.png",a=wdi_url.plugin_url+"images/video_missing.png",d="image"}break;default:t=wdi_url.plugin_url+"images/missing.png",a=wdi_url.plugin_url+"images/video_missing.png",d="image"}var o=i.imageIndex,n="square",s=e.images.standard_resolution.height,_=e.images.standard_resolution.width;_<s?n="portrait":s<_&&(n="landscape");_=e.user.username;return""===_&&(_="no_user"),{id:e.id,thumbType:d,caption:wdi_front.escape_tags(r),image_url:t,likes:e.likes.count,comments:e.comments.count,wdi_index:o,wdi_res_index:i.resIndex,wdi_media_user:_,link:e.link,video_url:a,wdi_username:_,wdi_shape:n}},wdi_front.setPage=function(e){var i=e.feed_row.feed_display_view,r=e.feed_row.feed_type;if("pagination"!=i)return"";i=e.imageIndex;return r="image_browser"==r?1:Math.abs(e.feed_row.pagination_per_page_number),e.paginator=Math.ceil((i+1)/r),e.paginator},wdi_front.getPhotoTemplate=function(e,i){var r=wdi_front.setPage(e),t="",a="",d="",o="",n="tenweb-i-arrows-out",s="";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(n=""),sourceAttr=(""!=r&&(a='wdi_page="'+r+'"'),"src"),""!=r&&1!=r&&(t="wdi_hidden"),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(s='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(t+=" wdi_full_caption");r="";switch("blog_style"!==e.feed_row.feed_type&&(r="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":d="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":d="onclick=\"window.open ('<%= link%>','_blank')\"",o="wdi_hover_off",n="";break;case"custom_redirect":d="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",o="wdi_hover_off",n="";break;case"none":o="wdi_cursor_off wdi_hover_off",n=d=""}a='<div class="wdi_feed_item '+t+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+a+' 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\" "+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+o+'" >'+s+'<div class="wdi_thumb_icon" '+d+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+n+'"></i></div></div></div></div></div></div>',s=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(a+='<div class="wdi_photo_meta">',"1"===e.feed_row.show_likes&&0!=e.dataStorageList[s].likes.count&&(a+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"1"===e.feed_row.show_comments&&0!=e.dataStorageList[s].comments.count&&(a+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),a+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(a+='<div class="wdi_photo_title" onclick='+r+" ><%=caption%></div>"),a+="</div>"),a+="</div>",_.template(a)},wdi_front.getSliderTemplate=function(e,i){var r=wdi_front.setPage(e),t="",a="",d="",o="",n="tenweb-i-clone",s="";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(n=""),sourceAttr=(""!=r&&(a='wdi_page="'+r+'"'),"src"),""!=r&&1!=r&&(t="wdi_hidden"),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(s='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(t+=" wdi_full_caption");r="";switch("blog_style"!==e.feed_row.feed_type&&(r="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":d="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":d="onclick=\"window.open ('<%= link%>','_blank')\"",o="wdi_hover_off",n="tenweb-i-clone";break;case"custom_redirect":d="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",o="wdi_hover_off",n="";break;case"none":o="wdi_cursor_off wdi_hover_off",n=d=""}a='<div class="wdi_feed_item '+t+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+a+' 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') ) %>\"><% if (thumbType === 'video') { %><video class=\"wdi_img\" "+sourceAttr+'="<%=video_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"></video><% } else {%><img class="wdi_img" '+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><% }%><div class="wdi_photo_overlay '+o+'" >'+s+'<div class="wdi_thumb_icon" '+d+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+n+'"></i></div></div></div></div></div></div>',s=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(a+='<div class="wdi_photo_meta">',"1"===e.feed_row.show_likes&&0!=e.dataStorageList[s].likes.count&&(a+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"1"===e.feed_row.show_comments&&0!=e.dataStorageList[s].comments.count&&(a+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),a+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(a+='<div class="wdi_photo_title" onclick='+r+" ><%=caption%></div>"),a+="</div>"),a+="</div>",_.template(a)},wdi_front.replaceToVideo=function(e,i,r){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_"+r+' [wdi_index="'+i+'"] .wdi_photo_wrap_inner').html(overlayHtml),jQuery("#wdi_feed_"+r+' [wdi_index="'+i+'"] .wdi_photo_wrap_inner video').get(0).play()},wdi_front.getVideoTemplate=function(e,i){var r=wdi_front.setPage(e),t="",a="",d="tenweb-i-play",o="",n="",s="",w=(""!=r&&(a='wdi_page="'+r+'"'),"src");""!=r&&1!=r&&(t="wdi_hidden"),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(s='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(t+=" wdi_full_caption");r="";switch("blog_style"!==e.feed_row.feed_type&&(r="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":o="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":o="onclick=\"window.open ('<%= link%>','_blank')\"",n="wdi_hover_off",d="tenweb-i-play";break;case"custom_redirect":o="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",n="wdi_hover_off",d="";break;case"none":n="wdi_cursor_off wdi_hover_off",d="","blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(o="onclick=wdi_front.replaceToVideo('<%= video_url%>','<%= wdi_index%>',"+e.feed_row.wdi_feed_counter+")",n="",d="tenweb-i-play")}w='<div class="wdi_feed_item '+t+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+a+' 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') ) %>\"><video class=\"wdi_img\" "+w+'="<%=video_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"></video><div class="wdi_photo_overlay '+n+'" '+o+">"+s+'<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 '+d+'"></i></div></div></div></div></div></div>',s=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(w+='<div class="wdi_photo_meta">',"1"===e.feed_row.show_likes&&0!=e.dataStorageList[s].likes.count&&(w+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"1"===e.feed_row.show_comments&&0!=e.dataStorageList[s].comments.count&&(w+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),w+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(w+='<div class="wdi_photo_title" onclick='+r+" ><%=caption%></div>"),w+="</div>"),w+="</div>",_.template(w)},wdi_front.bindEvents=function(e){0!=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length&&("load_more_btn"==e.feed_row.feed_display_view&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_load_more_container").on(wdi_front.clickOrTouch,function(){wdi_front.loadMore(jQuery(this).find(".wdi_load_more_wrap"))}),"pagination"==e.feed_row.feed_display_view&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_next").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorNext(jQuery(this),e)}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_prev").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorPrev(jQuery(this),e)}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_last_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationLastPage(jQuery(this),e)}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_first_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationFirstPage(jQuery(this),e)}),e.paginatorNextFlag=!1),"infinite_scroll"==e.feed_row.feed_display_view&&(jQuery(window).on("scroll",function(){wdi_front.infiniteScroll(e)}),e.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&&(!1===e.infiniteScrollFlag&&0==e.stopInfiniteScrollFlag?(e.infiniteScrollFlag=!0,wdi_front.loadMore(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_infinite_scroll"),e)):e.stopInfiniteScrollFlag&&wdi_front.allImagesLoaded(e))},wdi_front.paginationFirstPage=function(e,i){var r;1!=i.paginator&&1!=i.currentPage&&(r=i.currentPage,i.currentPage=1,wdi_front.updatePagination(i,"custom",r),e.parent().find("#wdi_last_page").removeClass("wdi_disabled")),e.addClass("wdi_disabled")},wdi_front.paginationLastPage=function(e,i){var r;1!=i.paginator&&i.currentPage!=i.paginator&&(r=i.currentPage,i.currentPage=i.paginator,wdi_front.updatePagination(i,"custom",r),e.addClass("wdi_disabled"),e.parent().find("#wdi_first_page").removeClass("wdi_disabled"))},wdi_front.paginatorNext=function(e,i){var r,t=e.parent().find("#wdi_last_page"),a=e.parent().find("#wdi_first_page");i.paginatorNextFlag=!0,i.paginator!=i.currentPage||wdi_front.checkFeedFinished(i)?i.paginator>i.currentPage&&(i.currentPage++,wdi_front.updatePagination(i,"next"),i.paginator>i.currentPage?t.removeClass("wdi_disabled"):t.addClass("wdi_disabled")):(i.currentPage++,r=i.feed_row.number_of_photos,wdi_front.loadMore(e,i,r),t.addClass("wdi_disabled")),a.removeClass("wdi_disabled")},wdi_front.paginatorPrev=function(e,i){var r=e.parent().find("#wdi_last_page"),e=e.parent().find("#wdi_first_page");1!=i.currentPage?(i.currentPage--,wdi_front.updatePagination(i,"prev"),r.removeClass("wdi_disabled"),1==i.currentPage&&e.addClass("wdi_disabled")):e.addClass("wdi_disabled")},wdi_front.updatePagination=function(e,i,r){var t="#wdi_feed_"+e.feed_row.wdi_feed_counter;switch(jQuery(t+' [wdi_page="'+e.currentPage+'"]').each(function(){jQuery(this).removeClass("wdi_hidden")}),i){case"next":var r=e.currentPage-1;jQuery(t+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(t+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"prev":r=e.currentPage+1;jQuery(t+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(t+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"custom":(r=r)!=e.currentPage&&(jQuery(t+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(t+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")}))}e.paginatorNextFlag=!1,jQuery(t+" .wdi_feed_wrapper").css("height","auto"),jQuery(t+" #wdi_current_page").text(e.currentPage)},wdi_front.loadMore=function(e,i){var r,t=0;""!=e&&void 0!==e&&"initial"!=e&&"initial-keep"!=e&&(r=window[e.parent().parent().parent().parent().attr("id")]),void 0!==i&&(r=i);for(var a=0,d=0,o=0;o<r.userSortFlags.length;o++)if(!0===r.userSortFlags[o].flag){a++;for(var n=0;n<r.usersData.length;n++)r.userSortFlags[o].id===r.usersData[n].user_id&&"finished"===r.usersData[n].finished&&d++}if(a!==d||0==a){r.auto_trigger=""===e,wdi_front.ajaxLoader(r),"masonry"===r.feed_row.feed_type&&"pagination"==r.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)});for(o=0;o<r.usersData.length;o++)"finished"===r.usersData[o].finished&&t++;t===r.usersData.length&&(wdi_front.allImagesLoaded(r),jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter+" .wdi_load_more").remove());var s=r.usersData;r.loadMoreDataCount=r.feed_users.length;for(o=0;o<s.length;o++){var _=s[o].pagination,w={user_id:s[o].user_id,username:s[o].username};""!=_.next_url&&null!=_.next_url&&void 0!==_.next_url?(_=_.next_url,wdi_front.loadMoreRequest(w,_,r,e)):("initial-keep"==e&&(r.temproraryUsersData[o]=r.usersData[o]),r.loadMoreDataCount--,wdi_front.checkForLoadMoreDone(r,e))}}},wdi_front.loadMoreRequest=function(r,e,t,a){var d,i;t.mediaRequestsDone&&(t.usersData,d="",i=function(e){if(""===e||void 0===e||null==e)return d=wdi_front_messages.network_error,t.loadMoreDataCount--,void wdi_front.show_alert(d,e,t);if(void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,t),void 0!==e.meta&&void 0!==e.meta.code&&200!=e.meta.code)return d=e.meta.error_message,t.loadMoreDataCount--,void wdi_front.show_alert(d,e,t);e.user_id=r.user_id,e.username=r.username;for(var i=0;i<t.usersData.length;i++)e.user_id===t.usersData[i].user_id&&("#"===e.user_id[0]&&(e.data=wdi_front.appendRequestHashtag(e.data,e.user_id)),"initial-keep"==a&&(t.temproraryUsersData[i]=t.usersData[i]),t.usersData[i]=e,void 0===t.dataStorageRaw[i]?t.dataStorageRaw[i]={data:e.data}:t.dataStorageRaw[i].data=t.dataStorageRaw[i].data.concat(e.data),t.loadMoreDataCount--);wdi_front.checkForLoadMoreDone(t,a)},"#"!==r.username[0]?t.instagram.getUserMedia({user_id:r.username[0].id,success:i},e):t.instagram.getTagRecentMedia(r.username,{success:i},e,t.feed_row.hashtag_top_recent))},wdi_front.checkForLoadMoreDone=function(e,i){var r,t=e.feed_row.load_more_number,a=e.feed_row.number_of_photos;0==e.loadMoreDataCount&&(e.temproraryUsersData=wdi_front.mergeData(e.temproraryUsersData,e.usersData),r=wdi_front.getArrayContentLength(e.temproraryUsersData,"data"),"initial-keep"==i&&(i="initial"),"initial"==i?r<a&&!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=[]):r<t&&!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,t),wdi_front.applyFilters(e),e.temproraryUsersData=[])))},wdi_front.allDataHasFinished=function(e){for(var i=0,r=0;r<e.dataStorageRaw.length;r++)""==e.usersData[r].pagination.next_url&&(i++,e.usersData[r].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 r=0;r<i.length;r++)void 0!==e[r]?"finished"!=i[r].finished&&(void 0===e[r].pagination.next_max_id&&void 0===e[r].pagination.next_max_like_id||(e[r].data=e[r].data.concat(i[r].data),e[r].pagination=i[r].pagination,e[r].user_id=i[r].user_id,e[r].username=i[r].username,e[r].meta=i[r].meta)):e.push(i[r]);return e},wdi_front.brokenImageHandler=function(e){return!0},wdi_front.ajaxLoader=function(e){var i,r=e.feed_row.wdi_feed_counter,r=jQuery("#wdi_feed_"+r);"load_more_btn"==e.feed_row.feed_display_view&&(r.find(".wdi_load_more").addClass("wdi_hidden"),r.find(".wdi_spinner").removeClass("wdi_hidden")),"infinite_scroll"==e.feed_row.feed_display_view&&(0==r.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>'),r.append(i)):i=r.find(".wdi_ajax_loading"),i.removeClass("wdi_hidden"))},wdi_front.allImagesLoaded=function(e){var i=wdi_front.getDataLength(e);e.mediaRequestsDone||jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").remove("wdi_nomedia"),0!=i||!e.mediaRequestsDone||0!=e.feed_row.conditional_filters.length&&0!=e.feed_row.conditional_filter_enable||jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").append("<p class='wdi_nomedia'>"+wdi_front_messages.feed_nomedia+"</p>");i=e.feed_row.wdi_feed_counter,i=jQuery("#wdi_feed_"+i);"load_more_btn"==e.feed_row.feed_display_view&&(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 r,t,a=i.feed_row.wdi_feed_counter,d=jQuery("#wdi_feed_"+a+" .wdi_feed_container");"header"===e&&(r={feed_thumb:i.feed_row.feed_thumb,feed_name:i.feed_row.feed_name},t=wdi_front.getHeaderTemplate()(r),r=d.find(".wdi_feed_header").html(),d.find(".wdi_feed_header").html(r+t))},wdi_front.getUserTemplate=function(e,i){var r=e.dataCount,t="#"===i[0]?"//instagram.com/explore/tags/"+i.substr(1,i.length):"//instagram.com/"+i,a="onclick='"+('window.open("'+t+'","_blank")')+"'",t='<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<r&&(t+='<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>'),t+="</div>",t+="<h3 "+a+"><%= user_name%></h3>","#"!==i[0]?("1"==e.feed_row.follow_on_instagram_btn&&(t+='<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>"),t+='<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>'):t+='<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>',t+='<div class="wdi_clear"></div>',1==r&&"#"!==i[0]&&"1"==e.feed_row.display_user_info&&(t+='<div class="wdi_bio"><%= bio%></div>',t+='<div class="wdi_website"><a target="_blank" href="<%= website_url%>" ><%= website%></a></div>'),t+="</div></div>",_.template(t)},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 r=window["wdi_feed_"+i],i=r.dataCount;if(!(i<2)&&0==r.nowLoadingImages){i=jQuery("#wdi_feed_"+r.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"),r.customFilterChanged=!0,0==r.userSortFlags[e].flag?r.userSortFlags[e].flag=!0:r.userSortFlags[e].flag=!1;for(var t=0,a=0;a<r.userSortFlags.length;a++)1==r.userSortFlags[a].flag&&t++;"pagination"==r.feed_row.feed_display_view&&(r.resIndex=0),0!=t?wdi_front.filterData(r):r.customFilteredData=r.dataStorageList,wdi_front.displayFeed(r),"pagination"==r.feed_row.feed_display_view&&(r.paginator=Math.ceil(r.imageIndex/parseInt(r.feed_row.pagination_per_page_number)),r.currentPage=r.paginator,wdi_front.updatePagination(r,"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 r=0;r<e.dataStorageList.length;r++)for(var t=0;t<i.length;t++)(void 0!==e.dataStorageList[r].user.id&&e.dataStorageList[r].user.id==i[t].id||e.dataStorageList[r].wdi_hashtag==i[t].name)&&1==i[t].flag&&e.customFilteredData.push(e.dataStorageList[r])},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,r=0,t=0;t<i.length;t++)r+=i[t].length;return r},wdi_front.parseLighboxData=function(e,i){var r,t,a,d=e.dataStorage,o=e.feed_row.sort_images_by,n=e.feed_row.display_order,n=wdi_front.sortingOperator(o,n),s=[],_=[];if(1==i)s=e.customFilteredData;else{for(var w=0;w<d.length;w++)for(var l=0;l<d[w].length;l++)s.push(d[w][l]);s.sort(n)}for(w=0;w<s.length;w++)void 0!==s[w]&&(t=void 0!==s[w]&&void 0!==s[w].media_url?s[w].media_url:wdi_url.plugin_url+"images/video_missing.png",void 0!==s[w]&&void 0===s[w].media_url&&"carousel"===s[w].type&&(void 0!==(a=s[w].carousel_media[0])&&void 0!==a.images?t=a.images.standard_resolution.url:void 0!==a&&void 0!==a.videos&&(t=a.videos.standard_resolution.url)),void(a=0)!==s[w]&&void 0!==s[w].comments&&(a=s[w].comments.count),r={alt:"",avg_rating:"",comment_count:a,date:wdi_front.convertUnixDate(s[w].created_time),description:wdi_front.getDescription(void 0!==s[w].caption&&null!==s[w].caption?wdi_front.escape_tags(s[w].caption.text):""),filename:wdi_front.getFileName(s[w]),filetype:wdi_front.getFileType(s[w]),hit_count:"0",id:s[w].id,image_url:s[w].link,number:0,rate:"",rate_count:"0",username:void 0!==s[w].user?s[w].user.username:"",profile_picture:void 0!==s[w].user?s[w].user.profile_picture:"",thumb_url:t,comments_data:void 0!==s[w].comments?s[w].comments.data:"",images:s[w].images,carousel_media:void 0!==s[w].carousel_media?s[w].carousel_media:null},_.push(r));return _},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],r=0,t=1;t<e.length;t++)i<e[t]&&(i=e[t],r=t);return{value:i,index:r}},wdi_front.array_min=function(e){for(var i=e[0],r=0,t=1;t<e.length;t++)i>e[t]&&(i=e[t],r=t);return{value:i,index:r}},wdi_front.activeUsersCount=function(e){for(var i=0,r=0;r<e.usersData.length;r++)"finished"!=e.usersData[r].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&&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 r=!1,t=!1,a=i.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&"),i=new RegExp("(?:^|\\s)"+a+"(?:^|\\s)"),d=new RegExp("(?:^|\\s)"+a,"g");for(null!=i.exec(e)&&(r=!0);null!=(match=d.exec(e));)t=!0;return 1==r||1==t},wdi_front.replaceNewLines=function(e){var i,r="vUkCJvN2ps3t",t=[];for(e=e.replace(/\r?\n|\r/g,r),i=new RegExp(r,"g");null!=(match=i.exec(e));)t.push(match.index);for(var a=e.split(r),d=0,o=0;o<a.length;o++)""==a[o]?d++:d=0,0<d&&(a.splice(o,1),d--,o--);return e=a.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 r=0;r<i.length;r++)if(e.id==i[r].id)return!0;return!1},WDIFeed.prototype.getIdFromUrl=function(e){for(var i=e.split("/"),r=!1,t=0;t<i.length;t++)if("p"==i[t]&&void 0!==i[t+1]){r=i[t+1];break}return r},WDIFeed.prototype.avoidDuplicateMedia=function(e){var i=e.data,r=[];void 0===i&&(i=[]);for(var t=0;t<i.length;t++)this.mediaExists(i[t],this.dataStorageList)||this.mediaExists(i[t],r)||this.mediaExists(i[t],this.conditionalFilterBuffer)||r.push(i[t]);return this.conditionalFilterBuffer=this.conditionalFilterBuffer.concat(r),{data:r,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.storeRawData=function(e,i){var t=this;if("object"==typeof this[i]&&"number"==typeof this[i].length)for(var r=0;r<e.length;r++){var a="";wdi_front.isHashtag(e[r].user_id)?void 0!==e[r].pagination.cursors&&(a=e[r].pagination.cursors.after):"liked"==t.feed_row.liked_feed?void 0===(a=e[r].pagination.next_max_like_id)&&(a=""):(null==e[r].pagination&&(e[r].pagination=[]),void 0===(a=e[r].pagination.next_max_id)&&(a="")),void 0===this[i][r]?this[i].push({data:e[r].data,index:0,locked:!1,hash_id:a,usersDataFinished:!1,userId:e[r].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 r=0;r<t.usersData.length;r++)if(t.usersData[r].user_id==this.userId){this.usersDataFinished=!0;break}return i}}):0==this[i][r].locked&&(a!=this[i][r].hash_id?(this[i][r].data=this[i][r].data.concat(e[r].data),this[i][r].hash_id=a):this[i][r].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,r=0;r<e.data.length;r++)if(e.data[r].username==e.args.username){i=!0;break}if(i)for(var t=0;t<n.length;t++)e.data[r].username==n[t].username&&(n[t].id=e.data[r].id)}for(var a=!1,d=0;d<n.length;d++)if(""==n[d].id||"username"==n[d].id){a=!0;break}a||(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
@@ -103,6 +103,7 @@ function WDIInstagram(args) {
103
  return '';
104
  }
105
  }
 
106
  function getUserName() {
107
  if ( typeof _this.user !== 'undefined' && typeof _this.user.user_name !== 'undefined' ) {
108
  return _this.user.user_name
@@ -250,7 +251,13 @@ function WDIInstagram(args) {
250
  feed_id: wdi_ajax.feed_id,
251
  },
252
  success: function (response) {
253
- if ( typeof response.error !== 'undefined' && errorItercount < 5 ) {
 
 
 
 
 
 
254
  /* counter for break cycle */
255
  errorItercount++;
256
  _this.getTagRecentMedia(tagname, args, next_url, endpoint, iter)
@@ -281,8 +288,9 @@ function WDIInstagram(args) {
281
  window['wdi_all_tags'] = all_tags;
282
  }
283
  response = response.response;
 
284
  response = _this.convertHashtagData(response);
285
- response.meta = {"code": 200};
286
  response.tag_id = wdiTagId;
287
  success(response)
288
  }
@@ -459,17 +467,17 @@ function WDIInstagram(args) {
459
  "standard_resolution": {
460
  "width": 640,
461
  "height": 800,
462
- "url": media.thumb_url,
463
  },
464
  "low_bandwidth": {
465
  "width": 480,
466
  "height": 600,
467
- "url": media.thumb_url,
468
  },
469
  "low_resolution": {
470
  "width": 480,
471
  "height": 600,
472
- "url": media.thumb_url,
473
  }
474
  };
475
  }
@@ -664,8 +672,7 @@ function WDIInstagram(args) {
664
  * TOREMOVE ?
665
  * ***/
666
 
667
- this.searchForUsersByName = function (username, args)
668
- {
669
  var instagram = this,
670
  noArgument = false,
671
  successFlag = false,
@@ -768,8 +775,7 @@ function WDIInstagram(args) {
768
  /**
769
  * ToDo check if we still use liked media , or if this is allowed. Most probably thre is no endpoint for liked media on Graph API.
770
  * */
771
- this.getRecentLikedMedia = function (args)
772
- {
773
  var instagram = this,
774
  noArgument = false,
775
  successFlag = false,
@@ -904,8 +910,7 @@ function WDIInstagram(args) {
904
  * business - https://developers.facebook.com/docs/instagram-api/reference/user/media#get-media
905
  * personal - https://developers.facebook.com/docs/instagram-basic-display-api/reference/user/media#reading - requires more permissions
906
  * */
907
- this.getUserRecentMedia = function (user_id, args)
908
- {
909
  var instagram = this,
910
  noArgument = false,
911
  successFlag = false,
@@ -1014,7 +1019,6 @@ function WDIInstagram(args) {
1014
  });
1015
  }
1016
 
1017
-
1018
  /**
1019
  * Get the most recent media published by the owner of the access_token.
1020
  *
@@ -1060,7 +1064,8 @@ function WDIInstagram(args) {
1060
 
1061
  if (typeof args == 'undefined' || args.length === 0) {
1062
  noArgument = true;
1063
- } else {
 
1064
  if ('success' in args) {
1065
  successFlag = true;
1066
  }
@@ -1100,11 +1105,17 @@ function WDIInstagram(args) {
1100
  next_url:next_url,
1101
  iter:iter,
1102
  },
1103
- success: function (response)
1104
- {
1105
- if (typeof response.error !== 'undefined' && errorItercount < 5) {
 
 
 
 
 
 
1106
  errorItercount++;
1107
- _this.getUserMedia(args, next_url, response.iter)
1108
  return;
1109
  }
1110
 
@@ -1113,11 +1124,13 @@ function WDIInstagram(args) {
1113
  filterResponse.data = filterResponse.data.concat(response.data);
1114
  filterResponse.pagination = response.pagination;
1115
  _this.getUserMedia( args, next_url, response.iter)
1116
- } else {
 
1117
  if(filterResponse.data.length != 0) {
1118
  response = filterResponse;
1119
  }
1120
- response.meta = {"code": 200};
 
1121
  if (successFlag) {
1122
  if (typeof args.success == 'object' && args.success.length == 2) {
1123
  if (typeof window[args.success[0]] != 'undefined') {
@@ -1144,7 +1157,6 @@ function WDIInstagram(args) {
1144
  }
1145
  }
1146
  }
1147
-
1148
  },
1149
  error: function (response)
1150
  {
@@ -1457,8 +1469,7 @@ function WDIInstagram(args) {
1457
  * we may need it later . disabled now ?
1458
  * may require custom permissions
1459
  * */
1460
- this.getRecentMediaComments = function (media_id, args, next)
1461
- {
1462
  var instagram = this,
1463
  noArgument = false,
1464
  successFlag = false,
@@ -1584,8 +1595,7 @@ function WDIInstagram(args) {
1584
  * Probably we do not need this. We should get likes number in /media/media_id/
1585
  *
1586
  * */
1587
- this.getRecentMediaLikes = function (media_id, args)
1588
- {
1589
  var instagram = this,
1590
  noArgument = false,
1591
  successFlag = false,
@@ -1665,7 +1675,6 @@ function WDIInstagram(args) {
1665
  });
1666
  }
1667
 
1668
-
1669
  this.getDataFromCache = function (callback, cache_name, async) {
1670
  if(typeof async === "undefined"){
1671
  async = true;
103
  return '';
104
  }
105
  }
106
+
107
  function getUserName() {
108
  if ( typeof _this.user !== 'undefined' && typeof _this.user.user_name !== 'undefined' ) {
109
  return _this.user.user_name
251
  feed_id: wdi_ajax.feed_id,
252
  },
253
  success: function (response) {
254
+ var error = false;
255
+ var error_type = '';
256
+ if ( typeof response.error !== 'undefined' ) {
257
+ error = true;
258
+ error_type = response.error.type;
259
+ }
260
+ if ( typeof response.error !== 'undefined' && response.error.type !== "OAuthException" && errorItercount < 5 ) {
261
  /* counter for break cycle */
262
  errorItercount++;
263
  _this.getTagRecentMedia(tagname, args, next_url, endpoint, iter)
288
  window['wdi_all_tags'] = all_tags;
289
  }
290
  response = response.response;
291
+
292
  response = _this.convertHashtagData(response);
293
+ response.meta = {'code': 200, 'error': error, 'error_type': error_type};
294
  response.tag_id = wdiTagId;
295
  success(response)
296
  }
467
  "standard_resolution": {
468
  "width": 640,
469
  "height": 800,
470
+ "url": media.media_url,
471
  },
472
  "low_bandwidth": {
473
  "width": 480,
474
  "height": 600,
475
+ "url": media.media_url,
476
  },
477
  "low_resolution": {
478
  "width": 480,
479
  "height": 600,
480
+ "url": media.media_url,
481
  }
482
  };
483
  }
672
  * TOREMOVE ?
673
  * ***/
674
 
675
+ this.searchForUsersByName = function (username, args) {
 
676
  var instagram = this,
677
  noArgument = false,
678
  successFlag = false,
775
  /**
776
  * ToDo check if we still use liked media , or if this is allowed. Most probably thre is no endpoint for liked media on Graph API.
777
  * */
778
+ this.getRecentLikedMedia = function (args) {
 
779
  var instagram = this,
780
  noArgument = false,
781
  successFlag = false,
910
  * business - https://developers.facebook.com/docs/instagram-api/reference/user/media#get-media
911
  * personal - https://developers.facebook.com/docs/instagram-basic-display-api/reference/user/media#reading - requires more permissions
912
  * */
913
+ this.getUserRecentMedia = function (user_id, args) {
 
914
  var instagram = this,
915
  noArgument = false,
916
  successFlag = false,
1019
  });
1020
  }
1021
 
 
1022
  /**
1023
  * Get the most recent media published by the owner of the access_token.
1024
  *
1064
 
1065
  if (typeof args == 'undefined' || args.length === 0) {
1066
  noArgument = true;
1067
+ }
1068
+ else {
1069
  if ('success' in args) {
1070
  successFlag = true;
1071
  }
1105
  next_url:next_url,
1106
  iter:iter,
1107
  },
1108
+ success: function (response) {
1109
+ var error = false;
1110
+ var error_type = '';
1111
+ if ( typeof response.error !== 'undefined' ) {
1112
+ error = true;
1113
+ error_type = response.error.type;
1114
+ }
1115
+
1116
+ if ( typeof response.error !== 'undefined' && response.error.type !== "OAuthException" && errorItercount < 5) {
1117
  errorItercount++;
1118
+ _this.getUserMedia(args, next_url, response.iter);
1119
  return;
1120
  }
1121
 
1124
  filterResponse.data = filterResponse.data.concat(response.data);
1125
  filterResponse.pagination = response.pagination;
1126
  _this.getUserMedia( args, next_url, response.iter)
1127
+ }
1128
+ else {
1129
  if(filterResponse.data.length != 0) {
1130
  response = filterResponse;
1131
  }
1132
+ response.meta = {'code': 200, 'error': error, 'error_type': error_type};
1133
+
1134
  if (successFlag) {
1135
  if (typeof args.success == 'object' && args.success.length == 2) {
1136
  if (typeof window[args.success[0]] != 'undefined') {
1157
  }
1158
  }
1159
  }
 
1160
  },
1161
  error: function (response)
1162
  {
1469
  * we may need it later . disabled now ?
1470
  * may require custom permissions
1471
  * */
1472
+ this.getRecentMediaComments = function (media_id, args, next) {
 
1473
  var instagram = this,
1474
  noArgument = false,
1475
  successFlag = false,
1595
  * Probably we do not need this. We should get likes number in /media/media_id/
1596
  *
1597
  * */
1598
+ this.getRecentMediaLikes = function (media_id, args) {
 
1599
  var instagram = this,
1600
  noArgument = false,
1601
  successFlag = false,
1675
  });
1676
  }
1677
 
 
1678
  this.getDataFromCache = function (callback, cache_name, async) {
1679
  if(typeof async === "undefined"){
1680
  async = true;
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 d=this;function f(){return void 0!==d.user&&void 0!==d.user.user_name?d.user.user_name:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user?wdi_object.user.user_name:""}function u(){return void 0!==d.user&&void 0!==d.user.access_token?d.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 t=d.filters;if(void 0===t)return!1;for(var s=0;s<t.length;s++)if(t[s].where==e)if("object"==typeof t[s].what&&2==t[s].what.length){if(void 0!==window[t[s].what[0]]&&"function"==typeof window[t[s].what[0]][t[s].what[1]])return window[t[s].what[0]][t[s].what[1]]}else{if("string"!=typeof t[s].what)return"function"==typeof t[s].what&&t[s].what;if("function"==typeof window[t[s].what])return window[t[s].what]}return!1},this.addToken=function(e){"string"==typeof e&&d.access_tokens.push(e)},this.resetTokens=function(){d.access_tokens=[]};var w=0,l={data:new Array,paging:{}};this.getTagRecentMedia=function(o,r,i,n,c){c=void 0===c||"number"!=typeof c?0:c;var a=!1,e=this.statusCode,t=!1;this.getFilter("getTagRecentMedia");n=0===parseInt(n)?"top_media":"recent_media",void 0===r||0===r.length||("success"in r&&(a=!0),"statusCode"in r&&(e=r.statusCode),"error"in r&&(t=!0),"args"in r||(r.args={}),"count"in r?(r.count=parseInt(r.count),(!Number.isInteger(r.count)||r.count<=0)&&(r.count=33)):r.count=33);var u=this.getTagId(o);jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{iter:c,tagname:o,endpoint:n,wdi_nonce:wdi_ajax.wdi_nonce,wdiTagId:u,next_url:i,user_name:f(),action:"wdi_getTagRecentMedia",feed_id:wdi_ajax.feed_id},success:function(e){var t,s;void 0!==e.error&&w<5?(w++,d.getTagRecentMedia(o,r,i,n,c)):void 0!==e.response&&void 0!==e.response.iter&&l.data.length<parseInt(wdi_ajax.number_of_photos)&&c<10&&""!=e.response.paging.next?(i=e.response.paging.next,l.data=l.data.concat(e.response.data),l.paging=e.response.paging,d.getTagRecentMedia(o,r,i,n,e.response.iter)):(0!=l.data.length&&(e.response=l),!1===u&&(u=""),void 0!==e.tag_data&&(void 0!==(t=e.tag_data).tag_id&&(u=t.tag_id),s=[],void 0!==window.wdi_all_tags&&(s=window.wdi_all_tags),s[t.tag_id]=t,window.wdi_all_tags=s),e=e.response,(e=d.convertHashtagData(e)).meta={code:200},e.tag_id=u,function(e){void 0===e.data&&(e.data=[]);a&&("object"==typeof r.success&&2==r.success.length?void 0!==window[r.success[0]]&&"function"==typeof window[r.success[0]][r.success[1]]&&window[r.success[0]][r.success[1]](e):"string"==typeof r.success?"function"==typeof window[r.success]&&window[r.success](e):"function"==typeof r.success&&r.success(e))}(e))},error:function(e){t&&("object"==typeof r.error&&2==r.error.length?"function"==typeof window[r.error[0]][r.error[1]]&&window[r.error[0]][r.error[1]](e):"string"==typeof r.error?"function"==typeof window[r.error]&&window[r.error](e):"function"==typeof r.error&&r.error(e))},statusCode:e})},this.getTagId=function(e){var t,s,o=[];for(s in"undefined"!=typeof wdi_controller?0!==(o=wdi_controller.feed_users).length||void 0!==(t=jQuery("#WDI_feed_users").val())&&""!==t&&(o=JSON.parse(t)):void 0!==window.wdi_all_tags&&(o=window.wdi_all_tags),o)if(e===o[s].username||"#"+e===o[s].username)return void 0!==o[s].tag_id&&o[s].tag_id;return!1},this.convertHashtagData=function(e){var t={data:[],pagination:{}};if(void 0!==e&&void 0!==e.paging&&(t.pagination={cursors:{after:e.paging.cursors.after},next_url:e.paging.next}),void 0!==e&&void 0!==e.data)for(var s in e.data){var o,r=e.data[s],i="IMAGE"===r.media_type?"image":"VIDEO"===r.media_type?"video":"carousel",n={id:r.id,user:{id:"",full_name:"",profile_picture:"",username:""},images:{thumbnail:{width:150,height:150,url:r.media_url},low_resolution:{width:320,height:320,url:r.media_url},standard_resolution:{width:1080,height:1080,url:r.media_url}},created_time:r.timestamp,caption:{id:"",text:r.caption,created_time:"",from:{id:"",full_name:"",profile_picture:"",username:""}},user_has_liked:0<r.like_count,likes:{count:r.like_count},tags:[],filter:"Normal",comments:{count:r.comments_count},type:i,link:r.permalink,location:null,attribution:null,users_in_photo:[]};if("IMAGE"===r.media_type||"CAROUSEL_ALBUM"===r.media_type?n.images={thumbnail:{width:150,height:150,url:r.media_url},low_resolution:{width:320,height:320,url:r.media_url},standard_resolution:{width:1080,height:1080,url:r.media_url}}:"VIDEO"===r.media_type&&(n.videos={standard_resolution:{width:640,height:800,url:r.thumb_url},low_bandwidth:{width:480,height:600,url:r.thumb_url},low_resolution:{width:480,height:600,url:r.thumb_url}}),"CAROUSEL_ALBUM"===r.media_type)for(var c in n.carousel_media=[],r.children.data)o="IMAGE"===r.children.data[c].media_type?{images:{thumbnail:{width:150,height:150,url:r.children.data[c].media_url},low_resolution:{width:320,height:320,url:r.children.data[c].media_url},standard_resolution:{width:640,height:640,url:r.children.data[c].media_url}},users_in_photo:[],type:"image"}:{videos:{standard_resolution:{width:640,height:800,url:r.children.data[c].media_url,id:r.children.data[c].id},low_bandwidth:{width:480,height:600,url:r.children.data[c].media_url,id:r.children.data[c].id},low_resolution:{width:480,height:600,url:r.children.data[c].media_url,id:r.children.data[c].id}},users_in_photo:[],type:"video"},n.carousel_media.push(o);t.data.push(n)}return t},this.searchForTagsByName=function(e,s){var o=this,r=!1,i=this.statusCode,n=!1;filter=this.getFilter("searchForTagsByName"),void 0===s||0===s.length||("success"in s&&(r=!0),"error"in s&&(n=!0),"statusCode"in s&&(i=s.statusCode));var c="https://api.instagram.com/v1/tags/search?q="+e+"&access_token="+u();d.getDataFromCache(function(e){function t(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]]&&(filter&&(e=filter(e,o.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(filter&&(e=filter(e,o.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(filter&&(e=filter(e,o.filterArguments)),s.success(e)))}!1===e?jQuery.ajax({type:"POST",url:c,dataType:"jsonp",success:function(e){d.setDataToCache(c,e),t(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:i}):t(e)},c)},this.searchForUsersByName=function(e,t){var s=this,o=!1,r=(this.statusCode,!1),i=this.getFilter("searchForUsersByName");void 0===t||0===t.length||("success"in t&&(o=!0),"error"in t&&(r=!0),"statusCode"in t&&t.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 t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(i&&(e=i(e,s.filterArguments)),e.args=t,window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(i&&(e=i(e,s.filterArguments)),e.args=t,window[t.success](e)):"function"==typeof t.success&&(i&&(e=i(e,s.filterArguments)),(e.args=t).success(e)))},error:function(e){r&&("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:this.statusCode})},this.getRecentLikedMedia=function(t){var s=this,o=!1,e=this.statusCode,r=!1,i=this.getFilter("getRecentLikedMedia"),n="https://api.instagram.com/v1/users/self/media/liked?access_token="+u();void 0===t||0===t.length||("success"in t&&(o=!0),"error"in t&&(r=!0),"statusCode"in t&&(e=t.statusCode),"args"in t?argFlag=!0:t.args={},"count"in t?(t.count=parseInt(t.count),(!Number.isInteger(t.count)||t.count<=0)&&(t.count=20)):t.count=20,n+="&count="+t.count,"next_max_like_id"in t&&(n+="&next_max_like_id="+t.next_max_like_id)),jQuery.ajax({type:"POST",dataType:"jsonp",url:n,success:function(e){o&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(i&&(e=i(e,s.filterArguments,t.args)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(i&&(e=i(e,s.filterArguments,t.args)),window[t.success](e)):"function"==typeof t.success&&(i&&(e=i(e,s.filterArguments,t.args)),t.success(e)))},error:function(e){r&&("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:e})},this.getUserRecentMedia=function(e,t){var s=this,o=!1,r=this.statusCode,i=!1,n=this.getFilter("getUserRecentMedia"),e="https://api.instagram.com/v1/users/"+e+"/media/recent/?access_token="+u();void 0===t||0===t.length||("success"in t&&(o=!0),"statusCode"in t&&(r=t.statusCode),"args"in t||(t.args={}),"error"in t&&(i=!0),"count"in t?(t.count=parseInt(t.count),(!Number.isInteger(t.count)||t.count<=0)&&(t.count=33)):t.count=33,e+="&count="+t.count,"min_id"in t&&(e+="&min_id="+t.min_id),"max_id"in t&&(e+="&max_id="+t.max_id)),jQuery.ajax({type:"POST",dataType:"jsonp",url:e,success:function(e){void 0===e.data&&(e.data=[]),o&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(n&&(e=n(e,s.filterArguments,t.args)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(n&&(e=n(e,s.filterArguments,t.args)),window[t.success](e)):"function"==typeof t.success&&(n&&(e=n(e,s.filterArguments,t.args)),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))},statusCode:r})},this.getUserMedia=function(t,s,o){s=void 0===s?"":s,o=void 0===o||"number"!=typeof o?0:o;var r=this,i=!1,e=this.statusCode,n=!1,c=this.getFilter("getUserMedia");void 0===t||0===t.length||("success"in t&&(i=!0),"error"in t&&(n=!0),"statusCode"in t&&(e=t.statusCode),"args"in t||(t.args={}),"count"in t?(t.count=parseInt(t.count),(!Number.isInteger(t.count)||t.count<=0)&&(t.count=20)):t.count=20),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,action:"wdi_getUserMedia",user_name:f(),feed_id:wdi_ajax.feed_id,next_url:s,iter:o},success:function(e){if(void 0!==e.error&&w<5)return w++,void d.getUserMedia(t,s,e.iter);void 0!==e.iter&&l.data.length<parseInt(wdi_ajax.number_of_photos)&&o<20&&""!=e.pagination.next_url?(s=e.pagination.next_url,l.data=l.data.concat(e.data),l.pagination=e.pagination,d.getUserMedia(t,s,e.iter)):(0!=l.data.length&&(e=l),e.meta={code:200},i&&("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=d.addTags(e),e=c(e,r.filterArguments,t)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(c&&(e=d.addTags(e),e=c(e,r.filterArguments,t)),window[t.success](e)):"function"==typeof t.success&&t.success(e)))},error:function(e){n&&("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:e})},this.getUserInfo=function(e,t){var s=this,o=!1,r=this.statusCode,i=!1,n=this.getFilter("getUserInfo");void 0===t||0===t.length||("success"in t&&(o=!0),"error"in t&&(i=!0),"statusCode"in t&&(r=t.statusCode)),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/"+e+"/?access_token="+u(),success:function(e){o&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(n&&(e=n(e,s.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(n&&(e=n(e,s.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(n&&(e=n(e,s.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))},statusCode:r})},this.getSelfInfo=function(s){var o=this,r=!1,i=this.statusCode,n=!1,c=this.getFilter("getSelfInfo");void 0===s||0===s.length||("success"in s&&(r=!0),"error"in s&&(n=!0),"statusCode"in s&&(i=s.statusCode));var a="https://graph.facebook.com/v3.2/"+(void 0!==d.user&&void 0!==d.user.user_id?d.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();d.getDataFromCache(function(e){var t;!1===e?jQuery.ajax({type:"POST",dataType:"jsonp",url:a,statusCode:i,success:function(e){d.setDataToCache(a,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.meta={code:200},e=c(e,o.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(c&&(e.meta={code:200},e=c(e,o.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(c&&(e.meta={code:200},e=c(e,o.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))}}):(t=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&&(t=c(t,o.filterArguments)),window[s.success[0]][s.success[1]](t)):"string"==typeof s.success?"function"==typeof window[s.success]&&(c&&(t=c(t,o.filterArguments)),window[s.success](t)):"function"==typeof s.success&&(c&&(t=c(t,o.filterArguments)),s.success(t))))},a)},this.getRecentMediaComments=function(e,t,s){var o=this,r=!1,i=this.statusCode,n=!1,c=this.getFilter("getRecentMediaComments");void 0===t||0===t.length||("success"in t&&(r=!0),"error"in t&&(n=!0),"statusCode"in t&&(i=t.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:f(),media_id:e,next:s},success:function(e){e=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=c(e,o.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(c&&(e=c(e,o.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(c&&(e=c(e,o.filterArguments)),t.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){n&&("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:i})},this.getRecentMediaLikes=function(e,t){var s=this,o=!1,r=this.statusCode,i=!1,n=this.getFilter("getRecentMediaLikes");void 0===t||0===t.length||("success"in t&&(o=!0),"error"in t&&(i=!0),"statusCode"in t&&(r=t.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 t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(n&&(e=n(e,s.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(n&&(e=n(e,s.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(n&&(e=n(e,s.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))},statusCode:r})},this.getDataFromCache=function(t,e,s){void 0===s&&(s=!0),jQuery.ajax({type:"POST",async:s,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),t(e)):t(!1)}})},this.setDataToCache=function(e,t){jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_cache_name:e,wdi_cache_response:JSON.stringify(t),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 w=this;function l(){return void 0!==w.user&&void 0!==w.user.user_name?w.user.user_name:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user?wdi_object.user.user_name:""}function u(){return void 0!==w.user&&void 0!==w.user.access_token?w.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 t=w.filters;if(void 0===t)return!1;for(var s=0;s<t.length;s++)if(t[s].where==e)if("object"==typeof t[s].what&&2==t[s].what.length){if(void 0!==window[t[s].what[0]]&&"function"==typeof window[t[s].what[0]][t[s].what[1]])return window[t[s].what[0]][t[s].what[1]]}else{if("string"!=typeof t[s].what)return"function"==typeof t[s].what&&t[s].what;if("function"==typeof window[t[s].what])return window[t[s].what]}return!1},this.addToken=function(e){"string"==typeof e&&w.access_tokens.push(e)},this.resetTokens=function(){w.access_tokens=[]};var g=0,p={data:new Array,paging:{}};this.getTagRecentMedia=function(i,n,c,a,u){u=void 0===u||"number"!=typeof u?0:u;var d=!1,e=this.statusCode,t=!1;this.getFilter("getTagRecentMedia");a=0===parseInt(a)?"top_media":"recent_media",void 0===n||0===n.length||("success"in n&&(d=!0),"statusCode"in n&&(e=n.statusCode),"error"in n&&(t=!0),"args"in n||(n.args={}),"count"in n?(n.count=parseInt(n.count),(!Number.isInteger(n.count)||n.count<=0)&&(n.count=33)):n.count=33);var f=this.getTagId(i);jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{iter:u,tagname:i,endpoint:a,wdi_nonce:wdi_ajax.wdi_nonce,wdiTagId:f,next_url:c,user_name:l(),action:"wdi_getTagRecentMedia",feed_id:wdi_ajax.feed_id},success:function(e){var t,s,o=!1,r="";void 0!==e.error&&(o=!0,r=e.error.type),void 0!==e.error&&"OAuthException"!==e.error.type&&g<5?(g++,w.getTagRecentMedia(i,n,c,a,u)):void 0!==e.response&&void 0!==e.response.iter&&p.data.length<parseInt(wdi_ajax.number_of_photos)&&u<10&&""!=e.response.paging.next?(c=e.response.paging.next,p.data=p.data.concat(e.response.data),p.paging=e.response.paging,w.getTagRecentMedia(i,n,c,a,e.response.iter)):(0!=p.data.length&&(e.response=p),!1===f&&(f=""),void 0!==e.tag_data&&(void 0!==(t=e.tag_data).tag_id&&(f=t.tag_id),s=[],void 0!==window.wdi_all_tags&&(s=window.wdi_all_tags),s[t.tag_id]=t,window.wdi_all_tags=s),e=e.response,(e=w.convertHashtagData(e)).meta={code:200,error:o,error_type:r},e.tag_id=f,function(e){void 0===e.data&&(e.data=[]);d&&("object"==typeof n.success&&2==n.success.length?void 0!==window[n.success[0]]&&"function"==typeof window[n.success[0]][n.success[1]]&&window[n.success[0]][n.success[1]](e):"string"==typeof n.success?"function"==typeof window[n.success]&&window[n.success](e):"function"==typeof n.success&&n.success(e))}(e))},error:function(e){t&&("object"==typeof n.error&&2==n.error.length?"function"==typeof window[n.error[0]][n.error[1]]&&window[n.error[0]][n.error[1]](e):"string"==typeof n.error?"function"==typeof window[n.error]&&window[n.error](e):"function"==typeof n.error&&n.error(e))},statusCode:e})},this.getTagId=function(e){var t,s,o=[];for(s in"undefined"!=typeof wdi_controller?0!==(o=wdi_controller.feed_users).length||void 0!==(t=jQuery("#WDI_feed_users").val())&&""!==t&&(o=JSON.parse(t)):void 0!==window.wdi_all_tags&&(o=window.wdi_all_tags),o)if(e===o[s].username||"#"+e===o[s].username)return void 0!==o[s].tag_id&&o[s].tag_id;return!1},this.convertHashtagData=function(e){var t={data:[],pagination:{}};if(void 0!==e&&void 0!==e.paging&&(t.pagination={cursors:{after:e.paging.cursors.after},next_url:e.paging.next}),void 0!==e&&void 0!==e.data)for(var s in e.data){var o,r=e.data[s],i="IMAGE"===r.media_type?"image":"VIDEO"===r.media_type?"video":"carousel",n={id:r.id,user:{id:"",full_name:"",profile_picture:"",username:""},images:{thumbnail:{width:150,height:150,url:r.media_url},low_resolution:{width:320,height:320,url:r.media_url},standard_resolution:{width:1080,height:1080,url:r.media_url}},created_time:r.timestamp,caption:{id:"",text:r.caption,created_time:"",from:{id:"",full_name:"",profile_picture:"",username:""}},user_has_liked:0<r.like_count,likes:{count:r.like_count},tags:[],filter:"Normal",comments:{count:r.comments_count},type:i,link:r.permalink,location:null,attribution:null,users_in_photo:[]};if("IMAGE"===r.media_type||"CAROUSEL_ALBUM"===r.media_type?n.images={thumbnail:{width:150,height:150,url:r.media_url},low_resolution:{width:320,height:320,url:r.media_url},standard_resolution:{width:1080,height:1080,url:r.media_url}}:"VIDEO"===r.media_type&&(n.videos={standard_resolution:{width:640,height:800,url:r.media_url},low_bandwidth:{width:480,height:600,url:r.media_url},low_resolution:{width:480,height:600,url:r.media_url}}),"CAROUSEL_ALBUM"===r.media_type)for(var c in n.carousel_media=[],r.children.data)o="IMAGE"===r.children.data[c].media_type?{images:{thumbnail:{width:150,height:150,url:r.children.data[c].media_url},low_resolution:{width:320,height:320,url:r.children.data[c].media_url},standard_resolution:{width:640,height:640,url:r.children.data[c].media_url}},users_in_photo:[],type:"image"}:{videos:{standard_resolution:{width:640,height:800,url:r.children.data[c].media_url,id:r.children.data[c].id},low_bandwidth:{width:480,height:600,url:r.children.data[c].media_url,id:r.children.data[c].id},low_resolution:{width:480,height:600,url:r.children.data[c].media_url,id:r.children.data[c].id}},users_in_photo:[],type:"video"},n.carousel_media.push(o);t.data.push(n)}return t},this.searchForTagsByName=function(e,s){var o=this,r=!1,i=this.statusCode,n=!1;filter=this.getFilter("searchForTagsByName"),void 0===s||0===s.length||("success"in s&&(r=!0),"error"in s&&(n=!0),"statusCode"in s&&(i=s.statusCode));var c="https://api.instagram.com/v1/tags/search?q="+e+"&access_token="+u();w.getDataFromCache(function(e){function t(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]]&&(filter&&(e=filter(e,o.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(filter&&(e=filter(e,o.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(filter&&(e=filter(e,o.filterArguments)),s.success(e)))}!1===e?jQuery.ajax({type:"POST",url:c,dataType:"jsonp",success:function(e){w.setDataToCache(c,e),t(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:i}):t(e)},c)},this.searchForUsersByName=function(e,t){var s=this,o=!1,r=(this.statusCode,!1),i=this.getFilter("searchForUsersByName");void 0===t||0===t.length||("success"in t&&(o=!0),"error"in t&&(r=!0),"statusCode"in t&&t.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 t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(i&&(e=i(e,s.filterArguments)),e.args=t,window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(i&&(e=i(e,s.filterArguments)),e.args=t,window[t.success](e)):"function"==typeof t.success&&(i&&(e=i(e,s.filterArguments)),(e.args=t).success(e)))},error:function(e){r&&("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:this.statusCode})},this.getRecentLikedMedia=function(t){var s=this,o=!1,e=this.statusCode,r=!1,i=this.getFilter("getRecentLikedMedia"),n="https://api.instagram.com/v1/users/self/media/liked?access_token="+u();void 0===t||0===t.length||("success"in t&&(o=!0),"error"in t&&(r=!0),"statusCode"in t&&(e=t.statusCode),"args"in t?argFlag=!0:t.args={},"count"in t?(t.count=parseInt(t.count),(!Number.isInteger(t.count)||t.count<=0)&&(t.count=20)):t.count=20,n+="&count="+t.count,"next_max_like_id"in t&&(n+="&next_max_like_id="+t.next_max_like_id)),jQuery.ajax({type:"POST",dataType:"jsonp",url:n,success:function(e){o&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(i&&(e=i(e,s.filterArguments,t.args)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(i&&(e=i(e,s.filterArguments,t.args)),window[t.success](e)):"function"==typeof t.success&&(i&&(e=i(e,s.filterArguments,t.args)),t.success(e)))},error:function(e){r&&("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:e})},this.getUserRecentMedia=function(e,t){var s=this,o=!1,r=this.statusCode,i=!1,n=this.getFilter("getUserRecentMedia"),e="https://api.instagram.com/v1/users/"+e+"/media/recent/?access_token="+u();void 0===t||0===t.length||("success"in t&&(o=!0),"statusCode"in t&&(r=t.statusCode),"args"in t||(t.args={}),"error"in t&&(i=!0),"count"in t?(t.count=parseInt(t.count),(!Number.isInteger(t.count)||t.count<=0)&&(t.count=33)):t.count=33,e+="&count="+t.count,"min_id"in t&&(e+="&min_id="+t.min_id),"max_id"in t&&(e+="&max_id="+t.max_id)),jQuery.ajax({type:"POST",dataType:"jsonp",url:e,success:function(e){void 0===e.data&&(e.data=[]),o&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(n&&(e=n(e,s.filterArguments,t.args)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(n&&(e=n(e,s.filterArguments,t.args)),window[t.success](e)):"function"==typeof t.success&&(n&&(e=n(e,s.filterArguments,t.args)),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))},statusCode:r})},this.getUserMedia=function(o,r,i){r=void 0===r?"":r,i=void 0===i||"number"!=typeof i?0:i;var n=this,c=!1,e=this.statusCode,t=!1,a=this.getFilter("getUserMedia");void 0===o||0===o.length||("success"in o&&(c=!0),"error"in o&&(t=!0),"statusCode"in o&&(e=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),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,action:"wdi_getUserMedia",user_name:l(),feed_id:wdi_ajax.feed_id,next_url:r,iter:i},success:function(e){var t=!1,s="";if(void 0!==e.error&&(t=!0,s=e.error.type),void 0!==e.error&&"OAuthException"!==e.error.type&&g<5)return g++,void w.getUserMedia(o,r,e.iter);void 0!==e.iter&&p.data.length<parseInt(wdi_ajax.number_of_photos)&&i<20&&""!=e.pagination.next_url?(r=e.pagination.next_url,p.data=p.data.concat(e.data),p.pagination=e.pagination,w.getUserMedia(o,r,e.iter)):(0!=p.data.length&&(e=p),e.meta={code:200,error:t,error_type:s},c&&("object"==typeof o.success&&2==o.success.length?void 0!==window[o.success[0]]&&"function"==typeof window[o.success[0]][o.success[1]]&&(a&&(e=w.addTags(e),e=a(e,n.filterArguments,o)),window[o.success[0]][o.success[1]](e)):"string"==typeof o.success?"function"==typeof window[o.success]&&(a&&(e=w.addTags(e),e=a(e,n.filterArguments,o)),window[o.success](e)):"function"==typeof o.success&&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:e})},this.getUserInfo=function(e,t){var s=this,o=!1,r=this.statusCode,i=!1,n=this.getFilter("getUserInfo");void 0===t||0===t.length||("success"in t&&(o=!0),"error"in t&&(i=!0),"statusCode"in t&&(r=t.statusCode)),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/"+e+"/?access_token="+u(),success:function(e){o&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(n&&(e=n(e,s.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(n&&(e=n(e,s.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(n&&(e=n(e,s.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))},statusCode:r})},this.getSelfInfo=function(s){var o=this,r=!1,i=this.statusCode,n=!1,c=this.getFilter("getSelfInfo");void 0===s||0===s.length||("success"in s&&(r=!0),"error"in s&&(n=!0),"statusCode"in s&&(i=s.statusCode));var a="https://graph.facebook.com/v3.2/"+(void 0!==w.user&&void 0!==w.user.user_id?w.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();w.getDataFromCache(function(e){var t;!1===e?jQuery.ajax({type:"POST",dataType:"jsonp",url:a,statusCode:i,success:function(e){w.setDataToCache(a,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.meta={code:200},e=c(e,o.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(c&&(e.meta={code:200},e=c(e,o.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(c&&(e.meta={code:200},e=c(e,o.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))}}):(t=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&&(t=c(t,o.filterArguments)),window[s.success[0]][s.success[1]](t)):"string"==typeof s.success?"function"==typeof window[s.success]&&(c&&(t=c(t,o.filterArguments)),window[s.success](t)):"function"==typeof s.success&&(c&&(t=c(t,o.filterArguments)),s.success(t))))},a)},this.getRecentMediaComments=function(e,t,s){var o=this,r=!1,i=this.statusCode,n=!1,c=this.getFilter("getRecentMediaComments");void 0===t||0===t.length||("success"in t&&(r=!0),"error"in t&&(n=!0),"statusCode"in t&&(i=t.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:l(),media_id:e,next:s},success:function(e){e=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=c(e,o.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(c&&(e=c(e,o.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(c&&(e=c(e,o.filterArguments)),t.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){n&&("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:i})},this.getRecentMediaLikes=function(e,t){var s=this,o=!1,r=this.statusCode,i=!1,n=this.getFilter("getRecentMediaLikes");void 0===t||0===t.length||("success"in t&&(o=!0),"error"in t&&(i=!0),"statusCode"in t&&(r=t.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 t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(n&&(e=n(e,s.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(n&&(e=n(e,s.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(n&&(e=n(e,s.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))},statusCode:r})},this.getDataFromCache=function(t,e,s){void 0===s&&(s=!0),jQuery.ajax({type:"POST",async:s,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),t(e)):t(!1)}})},this.setDataToCache=function(e,t){jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_cache_name:e,wdi_cache_response:JSON.stringify(t),wdi_nonce:wdi_ajax.wdi_nonce,task:"set",action:"wdi_cache"},success:function(e){}})}}
js/wdi_responsive.js CHANGED
@@ -91,6 +91,9 @@ wdi_responsive.columnControl = function (currentFeed, load, customWidth)
91
  if (currentFeed.feed_row.feed_type == 'masonry') {
92
  var itemWidth = jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter + " .wdi_masonry_column").first().width();
93
  }
 
 
 
94
  var newClass = currentClass.substr(0, 8) + Math.round(containerWidth / itemWidth);
95
  wrapper.removeClass(currentClass);
96
  wrapper.attr('wdi-res', newClass);
91
  if (currentFeed.feed_row.feed_type == 'masonry') {
92
  var itemWidth = jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter + " .wdi_masonry_column").first().width();
93
  }
94
+ if( itemWidth === 0 ) {
95
+ itemWidth = containerWidth;
96
+ }
97
  var newClass = currentClass.substr(0, 8) + Math.round(containerWidth / itemWidth);
98
  wrapper.removeClass(currentClass);
99
  wrapper.attr('wdi-res', newClass);
js/wdi_responsive.min.js CHANGED
@@ -1 +1 @@
1
- function wdi_responsive(){}jQuery(document).ready(function(){}),wdi_responsive.columnControl=function(n,e,d){var r,i,_,t;n.openRows=[],1===e?(r=jQuery("#wdi_feed_"+n.feed_row.wdi_feed_counter+" .wdi_feed_wrapper"),_=jQuery("#wdi_feed_"+n.feed_row.wdi_feed_counter+" .wdi_feed_item").css("width")+"",i=r.first().width(),_="px"==_.substr(_.length-2,_.length)?parseFloat(_):.01*i*parseFloat(_),"masonry"==n.feed_row.feed_type&&(_=jQuery("#wdi_feed_"+n.feed_row.wdi_feed_counter+" .wdi_masonry_column").first().width()),null!=d&&(_=d),d=(e=r.attr("wdi-res")).substr(0,8)+Math.round(i/_),r.removeClass(e),r.attr("wdi-res",d),r.addClass(d),e!=d&&(d=d.substr(8,d.length),"pagination"==n.feed_row.feed_display_view&&(n.freeSpaces=(Math.floor(n.feed_row.pagination_per_page_number/Math.round(i/_))+1)*Math.round(i/_)-n.feed_row.pagination_per_page_number,n.freeSpaces%d==0&&(n.freeSpaces=0),t=n.resIndex=0,jQuery("#wdi_feed_"+n.feed_row.wdi_feed_counter+" .wdi_feed_item").each(function(){jQuery(this).attr("wdi_res_index",n.resIndex),(t+1)%n.feed_row.pagination_per_page_number==0?n.resIndex+=n.freeSpaces+1:n.resIndex++,t++})))):jQuery(window).resize(function(){var e=jQuery("#wdi_feed_"+n.feed_row.wdi_feed_counter+" .wdi_feed_wrapper");if(0!=e.length){var d=jQuery("#wdi_feed_"+n.feed_row.wdi_feed_counter+" .wdi_feed_item").css("width")+"",r=e.first().width();d="px"==d.substr(d.length-2,d.length)?parseFloat(d):.01*r*parseFloat(d);var i=e.attr("wdi-res");"masonry"==n.feed_row.feed_type&&(d=jQuery("#wdi_feed_"+n.feed_row.wdi_feed_counter+" .wdi_masonry_column").first().width());var _,t=i.substr(0,8)+Math.round(r/d);if(e.removeClass(i),e.attr("wdi-res",t),e.addClass(t),"thumbnails"===n.feed_row.feed_type&&wdi_responsive.fixRow(n),"masonry"===n.feed_row.feed_type&&i!=t){wdi_front.ajaxLoader(n);var o=t.substr(8,t.length);e.html("");for(var a="",s=0;s<o;s++)a+='<div class="wdi_masonry_column" wdi_mas_col="'+s+'"></div>';a+='<div class="wdi_clear">',e.html(a),n.imageIndex=0,n.resIndex=0;e=n.displayedData;n.displayedData=[],wdi_front.masonryDisplayFeedItems(e,n),wdi_front.applyFilters(n)}i!=t&&(o=t.substr(8,t.length),"pagination"==n.feed_row.feed_display_view&&(n.freeSpaces=(Math.floor(n.feed_row.number_of_photos/Math.round(r/d))+1)*Math.round(r/d)-n.feed_row.number_of_photos,n.freeSpaces%o==0&&(n.freeSpaces=0),_=n.resIndex=0,jQuery("#wdi_feed_"+n.feed_row.wdi_feed_counter+" .wdi_feed_item").each(function(){jQuery(this).attr("wdi_res_index",n.resIndex),(_+1)%n.feed_row.pagination_per_page_number==0?n.resIndex+=n.freeSpaces+1:n.resIndex++,_++})))}})},wdi_responsive.bindCaptionEvent=function(e,d){},wdi_responsive.bindMasonryCaptionEvent=function(e,d){},wdi_responsive.showCaption=function(e,d){var r,i=window["wdi_feed_"+d],_=e.parent().parent();r="pagination"===i.feed_row.feed_display_view?"wdi_res_index":"wdi_index";for(var t=_.attr(r),d=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").attr("wdi-res"),o=parseInt(d.substr(8,d.length)),a=Math.floor(t/o),s=[],n=0;n<o;n++){var w=n+a*o;s.push(w)}_.hasClass("wdi_full_caption")?(e.css("white-space","nowrap"),_.removeClass("wdi_full_caption")):(e.css("white-space","normal"),_.addClass("wdi_full_caption"),_.attr("wdi_scroll_to",_.offset().top-50)),_.css("height","auto");for(var f=0,n=0;n<s.length;n++)(u=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper ["+r+"="+s[n]+"]")).addClass("wdi_row_affected"),u.css("height","auto"),f<u.height()&&u.hasClass("wdi_full_caption")&&(f=u.height());0==f&&(f=_.height());for(var u,n=0;n<s.length;n++)(u=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper ["+r+"="+s[n]+"]")).height(f);i.affectedRow=!0},wdi_responsive.fixRow=function(e){jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_row_affected").each(function(){jQuery(this).css("height","auto"),jQuery(this).removeClass("wdi_row_affected")}),"pagination"===e.feed_row.feed_display_view?jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_full_caption").each(function(){jQuery(this).hasClass("wdi_hidden")||(jQuery(this).find(".wdi_photo_title").trigger(wdi_front.clickOrTouch),jQuery(this).find(".wdi_photo_title").trigger(wdi_front.clickOrTouch))}):jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_full_caption").each(function(){jQuery(this).find(".wdi_photo_title").trigger(wdi_front.clickOrTouch),jQuery(this).find(".wdi_photo_title").trigger(wdi_front.clickOrTouch)})},wdi_responsive.showMasonryCaption=function(e,d){window["wdi_feed_"+d];d=e.parent().parent();d.hasClass("wdi_full_caption")?(e.css("white-space","nowrap"),d.removeClass("wdi_full_caption")):(d.attr("wdi_scroll_to",d.offset().top-50),e.css("white-space","normal"),d.addClass("wdi_full_caption"))};
1
+ function wdi_responsive(){}jQuery(document).ready(function(){}),wdi_responsive.columnControl=function(n,e,d){var r,i,_,t;n.openRows=[],1===e?(r=jQuery("#wdi_feed_"+n.feed_row.wdi_feed_counter+" .wdi_feed_wrapper"),_=jQuery("#wdi_feed_"+n.feed_row.wdi_feed_counter+" .wdi_feed_item").css("width")+"",i=r.first().width(),_="px"==_.substr(_.length-2,_.length)?parseFloat(_):.01*i*parseFloat(_),"masonry"==n.feed_row.feed_type&&(_=jQuery("#wdi_feed_"+n.feed_row.wdi_feed_counter+" .wdi_masonry_column").first().width()),null!=d&&(_=d),d=(e=r.attr("wdi-res")).substr(0,8)+Math.round(i/_),r.removeClass(e),r.attr("wdi-res",d),r.addClass(d),e!=d&&(d=d.substr(8,d.length),"pagination"==n.feed_row.feed_display_view&&(n.freeSpaces=(Math.floor(n.feed_row.pagination_per_page_number/Math.round(i/_))+1)*Math.round(i/_)-n.feed_row.pagination_per_page_number,n.freeSpaces%d==0&&(n.freeSpaces=0),t=n.resIndex=0,jQuery("#wdi_feed_"+n.feed_row.wdi_feed_counter+" .wdi_feed_item").each(function(){jQuery(this).attr("wdi_res_index",n.resIndex),(t+1)%n.feed_row.pagination_per_page_number==0?n.resIndex+=n.freeSpaces+1:n.resIndex++,t++})))):jQuery(window).resize(function(){var e=jQuery("#wdi_feed_"+n.feed_row.wdi_feed_counter+" .wdi_feed_wrapper");if(0!=e.length){var d=jQuery("#wdi_feed_"+n.feed_row.wdi_feed_counter+" .wdi_feed_item").css("width")+"",r=e.first().width();d="px"==d.substr(d.length-2,d.length)?parseFloat(d):.01*r*parseFloat(d);var i=e.attr("wdi-res");"masonry"==n.feed_row.feed_type&&(d=jQuery("#wdi_feed_"+n.feed_row.wdi_feed_counter+" .wdi_masonry_column").first().width()),0===d&&(d=r);var _,t=i.substr(0,8)+Math.round(r/d);if(e.removeClass(i),e.attr("wdi-res",t),e.addClass(t),"thumbnails"===n.feed_row.feed_type&&wdi_responsive.fixRow(n),"masonry"===n.feed_row.feed_type&&i!=t){wdi_front.ajaxLoader(n);var o=t.substr(8,t.length);e.html("");for(var a="",s=0;s<o;s++)a+='<div class="wdi_masonry_column" wdi_mas_col="'+s+'"></div>';a+='<div class="wdi_clear">',e.html(a),n.imageIndex=0,n.resIndex=0;e=n.displayedData;n.displayedData=[],wdi_front.masonryDisplayFeedItems(e,n),wdi_front.applyFilters(n)}i!=t&&(o=t.substr(8,t.length),"pagination"==n.feed_row.feed_display_view&&(n.freeSpaces=(Math.floor(n.feed_row.number_of_photos/Math.round(r/d))+1)*Math.round(r/d)-n.feed_row.number_of_photos,n.freeSpaces%o==0&&(n.freeSpaces=0),_=n.resIndex=0,jQuery("#wdi_feed_"+n.feed_row.wdi_feed_counter+" .wdi_feed_item").each(function(){jQuery(this).attr("wdi_res_index",n.resIndex),(_+1)%n.feed_row.pagination_per_page_number==0?n.resIndex+=n.freeSpaces+1:n.resIndex++,_++})))}})},wdi_responsive.bindCaptionEvent=function(e,d){},wdi_responsive.bindMasonryCaptionEvent=function(e,d){},wdi_responsive.showCaption=function(e,d){var r,i=window["wdi_feed_"+d],_=e.parent().parent();r="pagination"===i.feed_row.feed_display_view?"wdi_res_index":"wdi_index";for(var t=_.attr(r),d=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").attr("wdi-res"),o=parseInt(d.substr(8,d.length)),a=Math.floor(t/o),s=[],n=0;n<o;n++){var w=n+a*o;s.push(w)}_.hasClass("wdi_full_caption")?(e.css("white-space","nowrap"),_.removeClass("wdi_full_caption")):(e.css("white-space","normal"),_.addClass("wdi_full_caption"),_.attr("wdi_scroll_to",_.offset().top-50)),_.css("height","auto");for(var f=0,n=0;n<s.length;n++)(u=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper ["+r+"="+s[n]+"]")).addClass("wdi_row_affected"),u.css("height","auto"),f<u.height()&&u.hasClass("wdi_full_caption")&&(f=u.height());0==f&&(f=_.height());for(var u,n=0;n<s.length;n++)(u=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper ["+r+"="+s[n]+"]")).height(f);i.affectedRow=!0},wdi_responsive.fixRow=function(e){jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_row_affected").each(function(){jQuery(this).css("height","auto"),jQuery(this).removeClass("wdi_row_affected")}),"pagination"===e.feed_row.feed_display_view?jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_full_caption").each(function(){jQuery(this).hasClass("wdi_hidden")||(jQuery(this).find(".wdi_photo_title").trigger(wdi_front.clickOrTouch),jQuery(this).find(".wdi_photo_title").trigger(wdi_front.clickOrTouch))}):jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_full_caption").each(function(){jQuery(this).find(".wdi_photo_title").trigger(wdi_front.clickOrTouch),jQuery(this).find(".wdi_photo_title").trigger(wdi_front.clickOrTouch)})},wdi_responsive.showMasonryCaption=function(e,d){window["wdi_feed_"+d];d=e.parent().parent();d.hasClass("wdi_full_caption")?(e.css("white-space","nowrap"),d.removeClass("wdi_full_caption")):(d.attr("wdi_scroll_to",d.offset().top-50),e.css("white-space","normal"),d.addClass("wdi_full_caption"))};
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.6
7
- Stable tag: 1.4.10
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.10 =
509
  Fixed: Open settings page after activation.
510
  Fixed: Load more functionality.
4
  Requires at least: 3.9
5
  Requires PHP: 5.2
6
  Tested up to: 5.6
7
+ Stable tag: 1.4.11
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.11 =
509
+ Fixed: Adding the Instagram Feed to the Elementor.
510
+ Fixed: Feed preview.
511
+ Fixed: Comments for feed.
512
+
513
  = 1.4.10 =
514
  Fixed: Open settings page after activation.
515
  Fixed: Load more functionality.
wd-instagram-feed.php CHANGED
@@ -1,16 +1,15 @@
1
  <?php
2
- /*
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.10
7
- Author: 10Web
8
- Author URI: https://10Web.io/plugins/?utm_source=instagram_feed&utm_medium=free_plugin
9
- License: GPLv2 or later
10
- */
11
-
12
- // define constants
13
- define('WDI_VERSION', '1.4.10');
14
  define('WDI_IS_FREE', TRUE);
15
  define('WDI_PREFIX', 'wdi');
16
  define('WDI_DIR', WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__)));
@@ -344,7 +343,7 @@ function wdi_create_sample_feed($new_options){
344
 
345
  $post_args = array(
346
  'post_content' => $post_content,
347
- 'post_status' => 'private',
348
  'post_title' => __('My Instagram Feed', 'wd-instagram-feed'),
349
  'post_type' => 'page',
350
  );
@@ -480,6 +479,7 @@ function wdi_load_scripts(){
480
  'nor' => __('NOR', 'wd-instagram-feed'),
481
  'do_you_want_to_delete_selected_items' => __('Do you want to delete selected items?', 'wd-instagram-feed'),
482
  'user_field_required' => __('You have not selected a user, the user field is required.', 'wd-instagram-feed'),
 
483
  'please_write_hashtag' => __('Please write hashtag.', 'wd-instagram-feed'),
484
  'you_can_add_only_hashtags' => __('You can add only hashtags.', 'wd-instagram-feed')
485
  ));
@@ -820,9 +820,7 @@ function wdi_token_error_flag_notice(){
820
  if($screen_base === "instagram-feed_page_wdi_settings"){
821
  $link_to_reset = "reset token";
822
  }
823
- echo "<div class='notice notice-error '>
824
- <p>Instagram token is invalid or expired. Please ".$link_to_reset." and sign-in again to get new one.</p>
825
- </div>";
826
  }
827
  }
828
 
1
  <?php
2
+ /**
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.11
7
+ * Author: 10Web
8
+ * Author URI: https://10Web.io/plugins/?utm_source=instagram_feed&utm_medium=free_plugin
9
+ * License: GPLv2 or later
10
+ */
11
+
12
+ define('WDI_VERSION', '1.4.11');
 
13
  define('WDI_IS_FREE', TRUE);
14
  define('WDI_PREFIX', 'wdi');
15
  define('WDI_DIR', WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__)));
343
 
344
  $post_args = array(
345
  'post_content' => $post_content,
346
+ 'post_status' => 'publish',
347
  'post_title' => __('My Instagram Feed', 'wd-instagram-feed'),
348
  'post_type' => 'page',
349
  );
479
  'nor' => __('NOR', 'wd-instagram-feed'),
480
  'do_you_want_to_delete_selected_items' => __('Do you want to delete selected items?', 'wd-instagram-feed'),
481
  'user_field_required' => __('You have not selected a user, the user field is required.', 'wd-instagram-feed'),
482
+ 'feed_title_field_required' => __('Title field is required.', 'wd-instagram-feed'),
483
  'please_write_hashtag' => __('Please write hashtag.', 'wd-instagram-feed'),
484
  'you_can_add_only_hashtags' => __('You can add only hashtags.', 'wd-instagram-feed')
485
  ));
820
  if($screen_base === "instagram-feed_page_wdi_settings"){
821
  $link_to_reset = "reset token";
822
  }
823
+ echo "<div class='notice notice-error'><p>Instagram token is invalid or expired. Please ". $link_to_reset ." and sign-in again to get new one.</p></div>";
 
 
824
  }
825
  }
826