WD Instagram Feed – Instagram Gallery - Version 1.3.11

Version Description

New: Create hashtag feeds for business profiles using Instagram Graph API

Download this release

Release Info

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

Code changes from version 1.3.10 to 1.3.11

admin-functions.php CHANGED
@@ -3,11 +3,14 @@
3
  * Checks if username and access_token exist, if not redirects to settings page
4
  */
5
 
6
- function wdi_check_necessary_params()
7
- {
8
  global $wdi_options;
9
- if (!isset($wdi_options['wdi_access_token']) || !isset($wdi_options['wdi_user_name']) || $wdi_options['wdi_access_token'] == '' || $wdi_options['wdi_user_name'] == '') {
10
- ?>
 
 
 
11
  <script>
12
  window.location = "<?php echo admin_url('admin.php?page=wdi_settings');?>";
13
  </script>
@@ -22,16 +25,14 @@ function wdi_check_necessary_params()
22
  * else it displays error message already uninstalled
23
  */
24
 
25
- function wdi_uninstall_notice($arg)
26
- {
27
  if ($arg == 1) {
28
  ?>
29
  <div class="updated">
30
  <p><?php _e('Succesfully Uninstalled!', "wd-instagram-feed"); ?></p>
31
  </div>
32
  <?php
33
- }
34
- else {
35
  ?>
36
  <div class="error">
37
  <p><?php _e('Already Unistalled', "wd-instagram-feed"); ?></p>
@@ -43,8 +44,7 @@ function wdi_uninstall_notice($arg)
43
  /**
44
  * checks if plugin is uninstalled it displays to all users uninstalled screen
45
  */
46
- function wdi_check_uninstalled()
47
- {
48
  global $wdi_options;
49
  if (isset($wdi_options['wdi_plugin_uninstalled']) && $wdi_options['wdi_plugin_uninstalled'] == 'true') {
50
  require_once(WDI_DIR . '/templates/plugin-uninstalled.php');
@@ -60,8 +60,7 @@ function wdi_check_uninstalled()
60
  * after adding this basic options,creates tables for plugin in wordpress database
61
  */
62
 
63
- function wdi_install()
64
- {
65
 
66
 
67
  wdi_get_options();
@@ -81,8 +80,8 @@ function wdi_install()
81
 
82
  $old_version = substr($saved_version, 2);
83
  $new_version = substr(WDI_VERSION, 2);
84
- $newer = version_compare($new_version, $old_version, '>');
85
 
 
86
  if ($newer) {
87
  require_once WDI_DIR . '/update/wdi_update.php';
88
  /*adds new params for new versions*/
@@ -91,6 +90,7 @@ function wdi_install()
91
  if (!update_option('wdi_version', WDI_VERSION)) {
92
  add_option('wdi_version', WDI_VERSION);
93
  }
 
94
  }
95
  wdi_set_options_defaults();
96
  return;
@@ -520,7 +520,7 @@ function wdi_configure_section_callback(){
520
  <?php
521
 
522
  if (!isset($options['wdi_access_token']) || $options['wdi_access_token'] == '' || !isset($options['wdi_user_name']) || $options['wdi_user_name'] == '')
523
- _e('You need Access Token for using Instagram API. Click sign in with Instagram button above to get yours. This will not show your Instagram media. After that you may create feed with desired user or hashtag media.', "wd-instagram-feed");
524
  ?>
525
  </div>
526
  <?php
@@ -657,29 +657,36 @@ function wdi_sanitize_options($input)
657
  }
658
  return apply_filters('wdi_sanitize_options', $output, $input);
659
  }
660
-
661
  //Sets all settings for admin pages and returns associative array of settings
662
- function wdi_get_settings()
663
- {
 
 
 
 
 
 
 
664
  $settings = array(
665
- 'wdi_access_token' => array('name' => 'wdi_access_token', 'sanitize_type' => 'text', 'input_size' => '53', 'type' => 'input', 'default' => '', 'field_or_not' => 'field', 'section' => 'wdi_configure_section', 'title' => __('Access Token', "wd-instagram-feed")),
666
- 'wdi_user_name' => array('name' => 'wdi_user_name', 'sanitize_type' => 'text', 'type' => 'input', 'input_size' => '53', 'section' => 'wdi_configure_section', 'field_or_not' => 'field', 'default' => '', 'title' => __('Username', "wd-instagram-feed")),
667
  'wdi_user_id' => array('name' => 'wdi_user_id', 'sanitize_type' => 'text', 'type' => 'input', 'section' => 'wdi_configure_section', 'readonly' => 'readonly', 'default' => '', 'field_or_not' => 'no_field'),
668
- 'wdi_feeds_min_capability' => array('name' => 'wdi_feeds_min_capability', "sanitize_type" => "text", 'title' => __('Minimal role to add and manage Feeds or Themes', "wd-instagram-feed"), 'type' => 'select', 'field_or_not' => 'field', "default" => "manage_options", 'section' => 'wdi_customize_section', 'valid_options' => array('manage_options' => __('Administrator', 'wd-instagram-feed'), 'publish_posts' => __('Author', 'wd-instagram-feed'))),
669
-
670
- 'wdi_transient_time' => array('name'=>'wdi_transient_time','sanitize_type'=>'number','field_or_not'=>'','type'=>'input', 'input_type'=>'number', 'section'=>'wdi_configure_section', 'title'=>__('Check for new posts every (min)',"wd-instagram-feed"),'default'=>'' ,'value'=>60),
671
- 'wdi_reset_cache' => array('name'=>'wdi_reset_cache','sanitize_type'=>'','field_or_not'=>'','type'=>'link_button', 'section'=>'wdi_configure_section', 'href'=>admin_url( 'admin.php?page=wdi_settings' ), 'title'=>__('Reset cache with Instagram data',"wd-instagram-feed"),'default'=>'', 'value'=>'Reset cache'),
672
- 'wdi_authenticated_users_list' => array('name' => 'wdi_authenticated_users_list','sanitize_type'=>'users_list','input_size'=>'53','type'=>'users_list','default'=>'[]','field_or_not'=>'field','section'=>'wdi_multiple_accounts_section','title'=>__('Multiple Instagram accounts ?',"wd-instagram-feed")),
673
 
 
 
 
 
674
  'wdi_custom_css' => array('name' => 'wdi_custom_css', 'sanitize_type' => 'css', 'type' => 'textarea', 'section' => 'wdi_customize_section', 'field_or_not' => 'field', 'default' => '', 'title' => __('Custom CSS', "wd-instagram-feed")),
675
  'wdi_custom_js' => array('name' => 'wdi_custom_js', 'sanitize_type' => 'css', 'type' => 'textarea', 'section' => 'wdi_customize_section', 'field_or_not' => 'field', 'default' => '', 'title' => __('Custom JavaScript', "wd-instagram-feed")),
676
  //'wdi_preserve_settings_when_remove'=>array('name'=>'wdi_preserve_settings_when_remove','field_or_not'=>'field','type'=>'checkbox','default'=>'1', 'section'=>'wdi_configure_section','title'=>__('Preserve Settings When Remove',"wd-instagram-feed")),
677
  'wdi_disable_fa' => array('name' => 'wdi_disable_fa', 'title' => __('Disable loading of font awesome', "wd-instagram-feed"), 'type' => 'checkbox', 'tooltip' => __('Disable loading of font awesome', "wd-instagram-feed"), 'sanitize_type' => 'number', 'field_or_not' => '', 'section' => 'wdi_customize_section'),
678
  'wdi_plugin_uninstalled' => array('name' => 'wdi_plugin_uninstalled', 'sanitize_type' => 'bool', 'field_or_not' => 'field', 'type' => 'input', 'input_type' => 'hidden', 'section' => 'wdi_customize_section', 'title' => '', 'default' => 'false', 'value' => 'false'),
 
 
679
  'wdi_uninstall' => array('name'=>'wdi_uninstall','sanitize_type'=>'','field_or_not'=>'','type'=>'link_button', 'section'=>'wdi_customize_section', 'href'=>admin_url( 'admin.php?page=wdi_uninstall' ), 'title'=>__('Uninstall',"wd-instagram-feed"),'default'=>''),
680
  //'wdi_version' => array('name'=>'wdi_version','field_or_not'=>'no_field','default'=>WDI_VERSION),
681
  //'wdi_first_time'=>array('name'=>'wdi_first_time','field_or_not'=>'no_field','default'=>'1')
682
-
683
  );
684
  return $settings;
685
  }
@@ -752,3 +759,23 @@ function wdi_get_create_feeds_cap()
752
 
753
  return $min_feeds_capability;
754
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  * Checks if username and access_token exist, if not redirects to settings page
4
  */
5
 
6
+ function wdi_check_necessary_params(){
7
+
8
  global $wdi_options;
9
+ $instagram = (!isset($wdi_options['wdi_access_token']) || !isset($wdi_options['wdi_user_name']) || $wdi_options['wdi_access_token']=='' || $wdi_options['wdi_user_name'] =='');
10
+ $fb = (empty($wdi_options['fb_token']) && empty($wdi_options['business_account_id']));
11
+
12
+ if($instagram && $fb){
13
+ ?>
14
  <script>
15
  window.location = "<?php echo admin_url('admin.php?page=wdi_settings');?>";
16
  </script>
25
  * else it displays error message already uninstalled
26
  */
27
 
28
+ function wdi_uninstall_notice($arg){
 
29
  if ($arg == 1) {
30
  ?>
31
  <div class="updated">
32
  <p><?php _e('Succesfully Uninstalled!', "wd-instagram-feed"); ?></p>
33
  </div>
34
  <?php
35
+ } else {
 
36
  ?>
37
  <div class="error">
38
  <p><?php _e('Already Unistalled', "wd-instagram-feed"); ?></p>
44
  /**
45
  * checks if plugin is uninstalled it displays to all users uninstalled screen
46
  */
47
+ function wdi_check_uninstalled(){
 
48
  global $wdi_options;
49
  if (isset($wdi_options['wdi_plugin_uninstalled']) && $wdi_options['wdi_plugin_uninstalled'] == 'true') {
50
  require_once(WDI_DIR . '/templates/plugin-uninstalled.php');
60
  * after adding this basic options,creates tables for plugin in wordpress database
61
  */
62
 
63
+ function wdi_install(){
 
64
 
65
 
66
  wdi_get_options();
80
 
81
  $old_version = substr($saved_version, 2);
82
  $new_version = substr(WDI_VERSION, 2);
 
83
 
84
+ $newer = version_compare($new_version, $old_version, '>');
85
  if ($newer) {
86
  require_once WDI_DIR . '/update/wdi_update.php';
87
  /*adds new params for new versions*/
90
  if (!update_option('wdi_version', WDI_VERSION)) {
91
  add_option('wdi_version', WDI_VERSION);
92
  }
93
+
94
  }
95
  wdi_set_options_defaults();
96
  return;
520
  <?php
521
 
522
  if (!isset($options['wdi_access_token']) || $options['wdi_access_token'] == '' || !isset($options['wdi_user_name']) || $options['wdi_user_name'] == '')
523
+ _e('You need Access Token for using Instagram API. Click sign in with Instagram button above to get yours. This will not show your Instagram media. After that you may create your feed.', "wd-instagram-feed");
524
  ?>
525
  </div>
526
  <?php
657
  }
658
  return apply_filters('wdi_sanitize_options', $output, $input);
659
  }
 
660
  //Sets all settings for admin pages and returns associative array of settings
661
+ function wdi_get_settings(){
662
+ $opt = wdi_get_options();
663
+
664
+ if(empty($opt['fb_token']) || empty($opt['business_account_id'])) {
665
+ $fb_button_text = "Log In with Facebook";
666
+ } else {
667
+ $fb_button_text = "Reconnect";
668
+ }
669
+
670
  $settings = array(
671
+ 'wdi_access_token' => array('name' => 'wdi_access_token', 'sanitize_type' => 'text', 'input_size' => '53', 'type' => 'input', 'default' => '', 'field_or_not' => 'field', 'section' => 'wdi_configure_section', 'title' => __('Primary Access Token', "wd-instagram-feed")),
672
+ 'wdi_user_name' => array('name' => 'wdi_user_name', 'sanitize_type' => 'text', 'type' => 'input', 'input_size' => '53', 'section' => 'wdi_configure_section', 'field_or_not' => 'field', 'default' => '', 'title' => __('Primary Username', "wd-instagram-feed")),
673
  'wdi_user_id' => array('name' => 'wdi_user_id', 'sanitize_type' => 'text', 'type' => 'input', 'section' => 'wdi_configure_section', 'readonly' => 'readonly', 'default' => '', 'field_or_not' => 'no_field'),
674
+ 'wdi_fb_auth' => array('name'=>'wdi_fb_auth','sanitize_type'=>'','field_or_not'=>'','type'=>'link_button', 'section'=>'wdi_configure_section', 'href'=>wdi_get_graph_auth_url(), 'title'=>__('Log in for hashtag feed',"wd-instagram-feed"),'default'=>'', 'value'=>$fb_button_text, 'description' => 'Connect to Facebook Graph API to get hashtag feeds. See more in <a href="https://help.10web.io/hc/en-us/articles/360021344111" target="_blank">documentation</a>.'),
 
 
 
 
675
 
676
+ 'wdi_transient_time' => array('name'=>'wdi_transient_time','sanitize_type'=>'number','field_or_not'=>'','type'=>'input', 'input_type'=>'number', 'section'=>'wdi_customize_section', 'title'=>__('Check for new posts every (min)',"wd-instagram-feed"),'default'=>'' ,'value'=>60),
677
+ 'wdi_reset_cache' => array('name'=>'wdi_reset_cache','sanitize_type'=>'','field_or_not'=>'','type'=>'link_button', 'section'=>'wdi_customize_section', 'href'=>admin_url( 'admin.php?page=wdi_settings' ), 'title'=>__('Reset cache with Instagram data',"wd-instagram-feed"),'default'=>'', 'value'=>'Reset cache'),
678
+ 'wdi_authenticated_users_list' => array('name' => 'wdi_authenticated_users_list','sanitize_type'=>'users_list','input_size'=>'53','type'=>'users_list','default'=>'[]','field_or_not'=>'field','section'=>'wdi_customize_section','title'=>__('Multiple Instagram accounts ?',"wd-instagram-feed")),
679
+ 'wdi_feeds_min_capability' => array('name' => 'wdi_feeds_min_capability', "sanitize_type" => "text", 'title' => __('Minimal role to add and manage Feeds or Themes', "wd-instagram-feed"), 'type' => 'select', 'field_or_not' => 'field', "default" => "manage_options", 'section' => 'wdi_customize_section', 'valid_options' => array('manage_options' => __('Administrator', 'wd-instagram-feed'), 'publish_posts' => __('Author', 'wd-instagram-feed'))),
680
  'wdi_custom_css' => array('name' => 'wdi_custom_css', 'sanitize_type' => 'css', 'type' => 'textarea', 'section' => 'wdi_customize_section', 'field_or_not' => 'field', 'default' => '', 'title' => __('Custom CSS', "wd-instagram-feed")),
681
  'wdi_custom_js' => array('name' => 'wdi_custom_js', 'sanitize_type' => 'css', 'type' => 'textarea', 'section' => 'wdi_customize_section', 'field_or_not' => 'field', 'default' => '', 'title' => __('Custom JavaScript', "wd-instagram-feed")),
682
  //'wdi_preserve_settings_when_remove'=>array('name'=>'wdi_preserve_settings_when_remove','field_or_not'=>'field','type'=>'checkbox','default'=>'1', 'section'=>'wdi_configure_section','title'=>__('Preserve Settings When Remove',"wd-instagram-feed")),
683
  'wdi_disable_fa' => array('name' => 'wdi_disable_fa', 'title' => __('Disable loading of font awesome', "wd-instagram-feed"), 'type' => 'checkbox', 'tooltip' => __('Disable loading of font awesome', "wd-instagram-feed"), 'sanitize_type' => 'number', 'field_or_not' => '', 'section' => 'wdi_customize_section'),
684
  'wdi_plugin_uninstalled' => array('name' => 'wdi_plugin_uninstalled', 'sanitize_type' => 'bool', 'field_or_not' => 'field', 'type' => 'input', 'input_type' => 'hidden', 'section' => 'wdi_customize_section', 'title' => '', 'default' => 'false', 'value' => 'false'),
685
+ 'fb_token' => array('name'=>'fb_token','sanitize_type'=>'','field_or_not'=>'field','type'=>'input','input_type'=>'hidden','section'=>'wdi_customize_section','title'=>'','default'=>''),
686
+ 'business_account_id' => array('name'=>'business_account_id','sanitize_type'=>'','field_or_not'=>'field','type'=>'input','input_type'=>'hidden','section'=>'wdi_customize_section','title'=>'','default'=>''),
687
  'wdi_uninstall' => array('name'=>'wdi_uninstall','sanitize_type'=>'','field_or_not'=>'','type'=>'link_button', 'section'=>'wdi_customize_section', 'href'=>admin_url( 'admin.php?page=wdi_uninstall' ), 'title'=>__('Uninstall',"wd-instagram-feed"),'default'=>''),
688
  //'wdi_version' => array('name'=>'wdi_version','field_or_not'=>'no_field','default'=>WDI_VERSION),
689
  //'wdi_first_time'=>array('name'=>'wdi_first_time','field_or_not'=>'no_field','default'=>'1')
 
690
  );
691
  return $settings;
692
  }
759
 
760
  return $min_feeds_capability;
761
  }
762
+
763
+ function wdi_get_graph_auth_url(){
764
+ $app_id = '356432828483035';
765
+ $redirect_uri = 'https://api.web-dorado.com/wdi/';
766
+
767
+ $admin_url = admin_url('admin.php?page=wdi_settings');
768
+
769
+ $state = array(
770
+ 'wp_site_url' => $admin_url
771
+ );
772
+
773
+ $fb_url = add_query_arg(array(
774
+ 'client_id' => $app_id,
775
+ 'redirect_uri' => $redirect_uri,
776
+ 'scope' => 'manage_pages,instagram_basic',
777
+ ), "https://www.facebook.com/dialog/oauth");
778
+
779
+ $fb_url .= '&state=' . base64_encode(json_encode($state));
780
+ return $fb_url;
781
+ }
admin/controllers/WDIControllerUninstall_wdi.php CHANGED
@@ -7,17 +7,17 @@ class WDIControllerUninstall_wdi{
7
  function __construct(){
8
 
9
  global $wdi_wd_plugin_options;
10
- if(!class_exists("TenWebConfig")){
11
  include_once (WDI_DIR . "/wd/config.php");
12
  }
13
 
14
  if(!class_exists("TenWebDeactivate")) {
15
  include_once(WDI_DIR . "/wd/includes/deactivate.php");
16
  }
17
- $config = new TenWebConfig();
18
 
19
  $config->set_options( $wdi_wd_plugin_options );
20
- $deactivate_reasons = new TenWebDeactivate($config);
21
  //$deactivate_reasons->add_deactivation_feedback_dialog_box();
22
  $deactivate_reasons->submit_and_deactivate();
23
 
7
  function __construct(){
8
 
9
  global $wdi_wd_plugin_options;
10
+ if(!class_exists("TenWebLibConfig")){
11
  include_once (WDI_DIR . "/wd/config.php");
12
  }
13
 
14
  if(!class_exists("TenWebDeactivate")) {
15
  include_once(WDI_DIR . "/wd/includes/deactivate.php");
16
  }
17
+ $config = new TenWebLibConfig();
18
 
19
  $config->set_options( $wdi_wd_plugin_options );
20
+ $deactivate_reasons = new TenWebLibDeactivate($config);
21
  //$deactivate_reasons->add_deactivation_feedback_dialog_box();
22
  $deactivate_reasons->submit_and_deactivate();
23
 
admin/views/WDIViewSettings_wdi.php CHANGED
@@ -74,7 +74,7 @@ private $model;
74
  </div>
75
  </form>
76
  <style>
77
- <?php if(!isset($wdi_options['wdi_access_token']) || empty($wdi_options['wdi_access_token'])){ ?>
78
  body.instagram-feed_page_wdi_settings table:nth-of-type(2) {
79
  display: none;
80
  }
@@ -129,7 +129,9 @@ private $model;
129
 
130
  jQuery('#wdi_access_token').attr('value','');
131
  jQuery('#wdi_user_name').attr('value','');
132
- document.cookie = "wdi_autofill=false";
 
 
133
  <?php if(get_option("wdi_token_error_flag") === "1"):?>
134
  jQuery.ajax({
135
  type: "POST",
74
  </div>
75
  </form>
76
  <style>
77
+ <?php if((!isset($wdi_options['wdi_access_token']) || empty($wdi_options['wdi_access_token'])) && empty($wdi_options['fb_token'])){ ?>
78
  body.instagram-feed_page_wdi_settings table:nth-of-type(2) {
79
  display: none;
80
  }
129
 
130
  jQuery('#wdi_access_token').attr('value','');
131
  jQuery('#wdi_user_name').attr('value','');
132
+ jQuery('#business_account_id').attr('value', '');
133
+ jQuery('#fb_token').attr('value', '');
134
+ document.cookie = "wdi_autofill=false";
135
  <?php if(get_option("wdi_token_error_flag") === "1"):?>
136
  jQuery.ajax({
137
  type: "POST",
changelog.txt CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  = 1.3.10 =
2
  Fixed: Gutenberg compatibility
3
  Fixed: Duplicate media when several filters are applied (Premium)
1
+ = 1.3.11 =
2
+ New: Create hashtag feeds for business profiles using Instagram Graph API
3
+
4
  = 1.3.10 =
5
  Fixed: Gutenberg compatibility
6
  Fixed: Duplicate media when several filters are applied (Premium)
css/wdi_backend.css CHANGED
@@ -311,6 +311,7 @@ border: 1px solid rgb(185, 185, 185);
311
  padding-bottom: 5px;
312
  }
313
 
 
314
  .wdi_multiple_accounts_section tr:not(:first-child) th{
315
  font-style: italic;
316
  }
@@ -344,7 +345,28 @@ border: 1px solid rgb(185, 185, 185);
344
  font-size: 14px;
345
  margin-right: 3px;
346
  }
 
347
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
348
  #wdi_options_page_buttons_wrapper .submit {
349
  display: inline;
350
  margin-left: 15px;
@@ -1761,7 +1783,7 @@ border: 1px solid rgb(185, 185, 185);
1761
  }
1762
 
1763
 
1764
- body.toplevel_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(3),
1765
  body.toplevel_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(4),
1766
  body.toplevel_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(5){
1767
  display: none;
311
  padding-bottom: 5px;
312
  }
313
 
314
+ /*
315
  .wdi_multiple_accounts_section tr:not(:first-child) th{
316
  font-style: italic;
317
  }
345
  font-size: 14px;
346
  margin-right: 3px;
347
  }
348
+ */
349
 
350
+ .wdi_advanced_option_open tr:nth-child(9),
351
+ .wdi_advanced_option_open tr:nth-child(10),
352
+ .wdi_advanced_option_open tr:nth-child(11){
353
+ display: none;
354
+ }
355
+
356
+ .instagram-feed_page_wdi_settings table #wdwt_wrap_wdi_fb_auth{
357
+ margin-left: 115px;
358
+ }
359
+
360
+ #wdwt_wrap_wdi_fb_auth .block a{
361
+ background-color: #4267b2;
362
+ color: #FFFFff;
363
+ }
364
+
365
+ .wdi_advanced_option .optioninput,
366
+ #wdwt_wrap_wdi_reset_cache .block,
367
+ #wdwt_wrap_wdi_authenticated_users_list .block{
368
+ display: inline-block;
369
+ }
370
  #wdi_options_page_buttons_wrapper .submit {
371
  display: inline;
372
  margin-left: 15px;
1783
  }
1784
 
1785
 
1786
+ /*body.toplevel_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(3),*/
1787
  body.toplevel_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(4),
1788
  body.toplevel_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(5){
1789
  display: none;
css/wdi_backend.min.css CHANGED
@@ -1 +1 @@
1
- .wdi_clear{clear:both}.wdi_clear_tag:after{content:"";display:table;clear:both}#wdi_unistall{background-color:#d82121;border-color:#d31818;box-shadow:inset 0 1px 0 rgba(230,120,120,0.5),0 1px 0 rgba(0,0,0,.15)}#wdi_unistall:hover{background-color:#da1313}#wdi_unistall_table th{width:45%}.display_type_content{background:#fff;border:1px solid #dedede;margin-bottom:15px}.wdi_tooltip,.wdi_settings_link{display:block;font-size:14px !important;font-weight:bold;line-height:20px;margin-bottom:5px;color:#444;text-decoration:none}p.wdi_about_filed{font-size:13px;font-style:italic}.wdi_tooltip:hover,.wdi_settings_link:hover{color:#23282d;position:relative}.wdi_tooltip:hover:after{content:attr(wdi-tooltip);padding:4px 8px;color:#dbdbe0;position:absolute;left:0;top:100%;white-space:nowrap;z-index:20;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:2px;-moz-box-shadow:0 0 4px #222;-webkit-box-shadow:0 0 4px #222;box-shadow:0 0 4px rgba(0,0,0,0.5);background-color:rgba(0,0,0,0.75);font-size:12px}.wdi_pro_only{font-style:italic;color:#4e4e4e !important;background-color:#ccc !important;text-decoration:none}.wdi_pro_only_op{opacity:.6}.wdi_pro_notice{text-align:right;color:#15699f;font-size:20px !important;padding:10px}.wdi_pro_only_btn{background-color:#c5c0c0 !important;border-top-color:#c5c0c0 !important}.wdi-pro-overlay img{opacity:.7}#wdi_feed_users{width:100%;margin-top:2px}#wdi_feed_tabs .wdi_feed_tabs{border:1px solid #f1f1f1;color:#444;cursor:pointer;font-size:13px;font-weight:bold;padding:12px;background:#fff;text-decoration:none;display:inline-block}#wdi_feed_tabs{margin:16px 0}#wdi_feed_tabs .wdi_feed_tab_active,#wdi_feed_tabs .wdi_feed_tabs:hover{background:none repeat scroll 0 0 #fff;color:#9a2465}#how_to_publish_tab .wdi_howto_container .wdi_howto_content .wdi_howto_wrapper{max-width:270px;margin:0 auto}#how_to_publish_tab .wdi_howto_container .wdi_howto_content .wdi_howto_wrapper img{max-width:100%}#wdi_feed_tabs .wdi_feed_tab_title{margin-top:1px;display:inline-block}.wdi_border_wrapper [scope='row']+td,.wdi_border_wrapper [scope='row']{padding:8px}.display_type_container.wdi_clear_tag{display:table;margin:10px auto}.display_type_container>div{float:left;margin-right:15px}.wdi_user{border:1px solid #b9b9b9;background-color:rgba(0,0,0,.05);margin:0 4px 0 0;border-radius:5px;height:28px;position:relative;display:inline-block}.wdi_user:hover{background-color:rgba(0,0,0,.08)}.wdi_user a{text-decoration:none;color:black;line-height:28px;width:70%;margin-left:12%;margin-right:18%;height:100%;display:table-row;padding-right:3px}.wdi_user .wdi_profile_pic{width:20px;height:20px;top:4px;left:30px;padding:5px;vertical-align:middle;display:table-cell}.wdi_user span{display:table-cell;vertical-align:middle;left:55px;font-weight:bold;font-size:14px}.wdi_user .wdi_remove_user,.wdi_user .wdi_check_thumb_user{position:absolute;right:4px;width:15px;height:15px;top:6.5px;transition:all .1s ease}.wdi_user .wdi_remove_user:hover{cursor:pointer;transform:rotate(180deg)}.wdi_user .wdi_check_thumb_user:hover{cursor:pointer}.wdi_user .wdi_check_thumb_user{left:4px}.wdi_border_wrapper [scope='row']{padding:2px;font-size:13px;min-width:250px}.wdi_border_wrapper [scope='row']+td,.wdi_border_wrapper [scope='row']{padding:2px}.small_input{width:60px;text-align:center}.display_type{text-align:center}.wdi_access_token_missing{font-size:14px;color:#000;clear:both;max-width:720px}.instagram-feed_page_wdi_settings form{width:65%}.instagram-feed_page_wdi_settings table td{padding-left:0;padding-right:0}.instagram-feed_page_wdi_settings table th{padding-left:4px}.instagram-feed_page_wdi_settings table input{float:right}#login_with_instagram{height:43px}#login_with_instagram .wdi_sign_in_button{background-image:url('../images/sign_in_with_instagram.png');background-repeat:no-repeat;background-position:left top;width:234px;height:43px;display:inline-block;float:left}#login_with_instagram .wdi_default_feed_button,#login_with_instagram .wdi_edit_default_feed_button{width:234px;height:43px;background-repeat:no-repeat;background-position:center top;display:inline-block}#login_with_instagram .wdi_default_feed_button{background-image:url('../images/default_feed_button.png');float:left;margin-right:10px}#login_with_instagram .wdi_edit_default_feed_button{background-image:url('../images/edit_feed_button.png');float:left}#wdwt_wrap_wdi_authenticated_users_list{display:inline-block;width:100%}#wdwt_wrap_wdi_authenticated_users_list .wdi_sign_in_button{background-image:url(../images/multiple_accounts.png);background-repeat:no-repeat;background-position:left top;width:228px;height:36px;display:inline-block;float:right;margin-top:2px;padding-bottom:5px}.wdi_multiple_accounts_section tr:not(:first-child) th{font-style:italic}.wdi_multiple_accounts_section tr:not(:first-child) th,.wdi_multiple_accounts_section tr:not(:first-child) td{padding-top:2px;padding-bottom:0;font-weight:400}.wdi_multiple_accounts_section tr:first-child th{padding-bottom:20px}.wdi_multiple_accounts_section .wdi_username_tr td{padding-bottom:5px !important}.wdi_multiple_accounts_section .wdi_input_wrapper{width:100%;display:inline-block}.wdi_multiple_accounts_section .wdi_remove_auth_user{display:inline-block;float:right;color:#0075a5;cursor:pointer;font-weight:300;font-size:14px;margin-right:3px}#wdi_options_page_buttons_wrapper .submit{display:inline;margin-left:15px}#wdi_reset_access_token{margin-top:0;float:left;width:232px;text-align:center}.wdi_advanced_option{width:100%;position:relative;font-weight:600}.wdi_advanced_option{background-color:#fff;cursor:pointer;border:1px solid #e3e3e3;border-radius:10px;border-collapse:separate;border-spacing:0}.wdi_advanced_option .wdi_advanced_option_head{border-bottom:1px solid #e3e3e3}.wdi_advanced_option .wdi_advanced_option_head th{padding-top:10px;padding-bottom:10px}.wdi_advanced_option.wdi_advanced_option_open .wdi_advanced_option_head th{border-bottom:1px solid #e3e3e3;border-bottom-left-radius:10px}.wdi_advanced_option.wdi_advanced_option_open .wdi_advanced_option_head td{border-bottom:1px solid #e3e3e3;border-bottom-right-radius:10px}.instagram-feed_page_wdi_settings table.wdi_advanced_option th{padding-left:12px}.instagram-feed_page_wdi_settings table.wdi_advanced_option td .wdwt_param{margin-left:15px}.instagram-feed_page_wdi_settings #wdwt_wrap_wdi_disable_fa .optioninput{display:inline-block}.wdi_advanced_option .wdi_advanced_option_icon{background-repeat:no-repeat;background-position:left top;width:20px;height:20px;display:inline-block;position:absolute;top:16px;right:10px}.wdi_advanced_option.wdi_advanced_option_close .wdi_advanced_option_icon{background-image:url('../images/arrow_1.png')}.wdi_advanced_option.wdi_advanced_option_open .wdi_advanced_option_icon{background-image:url('../images/arrow_2.png')}.wdi_advanced_option.wdi_advanced_option_close tbody tr:not(.wdi_advanced_option_head){display:none}.instagram-feed_page_wdi_settings form h2{display:none}#wdi_options_page_buttons_wrapper{margin-top:10px;width:700px}.wdi_hide{display:none}.wdi_hidden{display:none !important}.selectoff{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.wdi_filter_radio{margin:5px;display:inline-block}.wdi_filter_radio label{vertical-align:text-bottom}.wdi_filter_input{margin-top:10px}.wdi_filter_input input{height:28px;width:250px;margin-right:0;padding-right:0;line-height:28px}#wdi_filter_type{line-height:28px;margin:0;padding:0;position:relative;right:2px;top:-1px;font-weight:400}.wdi_filter_item{display:inline-block;padding:6px;margin-top:5px;border-radius:5px}.wdi_filter_by_username{background-color:#00a0d2;color:white}.wdi_filter_by_hashtag{background-color:#e08d11;color:white}.wdi_logic{display:inline-block;padding:5px;font-weight:bold}.wdi_filter_by_location{background-color:#509833;color:white}.wdi_filter_by_mention{background-color:#833888;color:white}.wdi_filter_by_description{background-color:#bd242b;color:white}.wdi_filter_by_url{background-color:#004eff;color:white}.wdi_remove_filter{padding-left:5px;color:white;font-size:13px}.wdi_remove_filter:hover{cursor:pointer}.wdi_source_user{display:inline-block;padding:5px}.wdi_source_img{display:inline-block}.wdi_source_img img{width:30px;height:30px;border-radius:15px;display:block}.wdi_source_username{display:inline-block;line-height:25px;font-size:15px !important;height:30px;vertical-align:bottom;padding:0 5px;font-weight:bold}#login_with_instagram>a:focus{-webkit-box-shadow:none;box-shadow:none}.wdi_help_bar_wrap{background-color:#fff;border:0;box-sizing:border-box;clear:both;color:#6e7990;font-size:14px;font-weight:bold;line-height:30px;padding:15px;vertical-align:middle;width:100%;margin:20px 0 0 0}.wdi_help_bar_text{float:left}.wdi_help_bar_text>a{color:#0073aa;text-decoration:none}.wdi_hb_buy_pro{float:right;padding:0}.wdi_hb_buy_pro a,.wdi_hb_buy_pro a:active,.wdi_hb_buy_pro a:visited,.wdi_hb_buy_pro a:hover{display:inline-block;font-weight:bold;font-size:14px;vertical-align:middle;border:0;box-shadow:none !important;text-decoration:none}.wdi_hb_buy_pro .wdi_support_link{color:#72777c !important;padding:0 10px}.wdi_hb_buy_pro .wdi_update_pro_link{background:#45a6b7;font-weight:bold;line-height:30px;padding:0 18px 0 18px;color:#fff !important}.wdi_hb_buy_pro img{border:0;display:inline-block;vertical-align:middle}#bullets_images_type,#bullets_images_color,#bull_style,#rl_butt_type,#rl_butt_color,#rl_butt_style{margin:0 10px 0 0;width:100px}.wds_ctrl_btn_upload{display:block !important;margin:5px 0 !important;text-align:center;vertical-align:middle;width:95%}.wds_reverse{margin:0 5px !important}.wds_free_button,.wds_free_button:hover{background:linear-gradient(to bottom,#e5e5e5,#e5e5e5) repeat scroll 0 0 #f3f3f3 !important;border-color:#bbb !important;color:#888 !important}.wdi_spider_free_version_label,.wdi_spider_free_version_label *{color:#808080 !important}.wdi_spider_free_version{background-color:#dfdfdf;border:1px solid #797979;border-radius:2px;padding:2px;width:210px}.wds_more{font-size:12px}.wrap .button{border-radius:3px !important;text-shadow:none !important}.wdi_spider_message_cont{display:none;width:99%}.wdi_spider_load{display:none}.wdi_spider_load_cont{background-color:rgba(0,0,0,0.2);left:0;height:100%;position:fixed;top:0;width:100%;z-index:99998}.wdi_spider_load_icon{left:0;height:100%;position:fixed;text-align:center;top:0;width:100%;z-index:99999}.wdi_spider_ajax_loading{border:none !important;margin-top:200px;width:50px;-webkit-animation:spin 2.5s infinite linear;-moz-animation:spin 2.5s infinite linear;-o-animation:spin 2.5s infinite linear;animation:spin 2.5s infinite linear}@-moz-keyframes spin{0{-moz-transform:rotate(0)}100%{-moz-transform:rotate(359deg)}}@-webkit-keyframes spin{0{-webkit-transform:rotate(0)}100%{-webkit-transform:rotate(359deg)}}@-o-keyframes spin{0{-o-transform:rotate(0)}100%{-o-transform:rotate(359deg)}}@-ms-keyframes spin{0{-ms-transform:rotate(0)}100%{-ms-transform:rotate(359deg)}}@keyframes spin{0{transform:rotate(0)}100%{transform:rotate(359deg)}}#TB_window,#TB_iframeContent{width:800px !important;height:500px !important}#TB_window{margin-left:-400px !important}.input_th{margin-left:0 !important;width:160px !important;font-family:sans-serif}.input_th2{margin-left:0 !important;width:160px !important;margin-top:5px;height:19px}.edit_input{height:28px !important;padding-bottom:7px !important}.add_tag_th{padding-left:21px;font-size:12px;font-family:sans-serif}.pointer{cursor:pointer}.non_selectable{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.wds_position_table td,.wds_position_table input{border:1px solid #ccc;margin:2px}.wds_position_table .wds_position_td{background-color:#f4f4f4;display:inline-block;line-height:1;padding:0 !important}.wdi_spider_div_options{background:none repeat scroll 0 0 #f4f4f4;border:1px solid #8f8d8d;border-radius:8px 8px 8px 8px;display:none;margin:2px 0 0 190px;padding:13px;min-height:300px;min-width:600px;vertical-align:top}.table_medium_col{text-align:center !important;width:70px}.table_medium_col_uncenter{width:80px}.table_extra_large_col{padding:4px !important;width:150px !important}.first-page,.prev-page,.next-page,.last-page,.table_extra_large_col a,.table_medium_col a,.table_big_col a,.table_small_col a{cursor:pointer}.wdi_spider_word_wrap{word-wrap:normal}.wdi_spider_description{color:#666;font-size:.923em;line-height:1.231em}.handle{background:url("../images/draggable.png") no-repeat transparent;border:0;cursor:move;display:inline-block;height:15px;margin:0 auto;vertical-align:middle;width:15px}.slider-icon{background-image:url("../images/slider-icon.png");background-repeat:no-repeat;border:0;float:left;height:32px;margin:7px 8px 0 0;width:32px}.uninstall-icon{background-image:url("../images/uninstall-icon.png");background-repeat:no-repeat;border:0;float:left;height:32px;margin:7px 8px 0 0;width:32px}.wdi_spider_label{font-weight:bold;width:100px}.wdi_spider_label_top{font-weight:bold;padding-top:3px;vertical-align:top;width:100px}.wdi_spider_fieldset .wdi_spider_label{font-weight:bold;vertical-align:top;width:150px}.wdi_spider_label_options{font-weight:bold;vertical-align:top;width:150px}.wdi_spider_choose_option{display:table;box-shadow:0 0 1px 1px #d2d2d2;margin-bottom:5px;border-radius:2px;padding:2px;box-sizing:border-box;cursor:pointer;width:100%}.wdi_spider_options_cont,.wdi_spider_bull_options_cont,.wdi_spider_pp_options_cont,.wdi_spider_options_color_cont,.wdi_spider_bull_options_color_cont,.wdi_spider_pp_options_color_cont{display:none;width:180px;height:150px;overflow:scroll;overflow-x:hidden;overflow-y:scroll}.wdi_spider_option_cont{display:block;border-bottom:1px solid #d3d3d3;padding:3px 0 3px 0;box-sizing:content-box;width:98%;border-radius:0;cursor:pointer}.wdi_spider_option_cont_title{display:table-cell;vertical-align:middle;padding:0 0 0 4px}.wdi_spider_option_cont_img{display:table-cell;width:23%;height:15px;text-align:right;padding:5px 4px 0 0;box-sizing:border-box;background-color:#eee}.wdi_spider_option_main_title{display:table-cell;width:65%;vertical-align:middle;padding:0 0 0 4px;color:#555}.wdi_spider_sel_option_ic{display:table-cell;width:20%;height:15px;text-align:right;padding:0 6px 0 0;box-sizing:border-box}.wdi_spider_int_input{width:45px}.wdi_spider_char_input{width:115px}.wdi_spider_text_input{width:190px}.wdi_spider_slider_div{display:inline-block;vertical-align:middle;width:140px}.wdi_spider_slider_percentage,.wdi_spider_slider_percentage input,.wdi_spider_slider_percentage input :focus{background:transparent;border:0;color:#00aeef;display:inline;font-weight:bold;text-align:right;vertical-align:middle;width:30px}.updated,.error{margin:5px 0 2px !important}.buttons_div{clear:both;float:right;margin:5px 0}.buttons_div_left{float:left;margin:5px 0}.buttons_div_right{float:right;margin:5px 0}.wdi_spider_delete_img{background-image:url("../images/delete.png");border:0;cursor:pointer;display:inline-block;vertical-align:middle;height:14px;width:14px}.wdi_spider_delete_img_small{background-image:url("../images/delete.png");background-size:10px auto;border:medium none;cursor:pointer;display:inline-block;height:10px;margin-top:2px;vertical-align:middle;width:10px}.wdi_spider_fieldset{background:none repeat scroll 0 0 #f4f4f4;border:1px solid #8f8d8d;border-radius:8px 8px 8px 8px;display:none;float:left;margin:4px;padding:13px;width:97%}.wdi_spider_type_fieldset{background:none repeat scroll 0 0 #f4f4f4;border-radius:8px 8px 8px 8px;display:none;float:left;width:100%}.wdi_spider_child_fieldset{background:none repeat scroll 0 0 #f4f4f4;border:1px solid #8f8d8d;border-radius:8px 8px 8px 8px;float:left;margin:4px;width:30%;padding:13px;display:block}.wdi_spider_table td{padding:0;vertical-align:middle}.wdi_spider_ctrls{padding:4px;text-align:center;width:40px}.theme_type{background-color:#f4f4f4;border:1px solid #8f8d8d;border-radius:8px 8px 8px 8px;cursor:pointer;display:inline-block;font-size:16px;height:24px;padding-top:5px;text-align:center;vertical-align:middle;width:123px;margin:2px 0 2px 0}.ui-slider-handle{cursor:pointer !important}.thumb{border:1px solid #ccc;max-height:120px;max-width:120px}.fileDescription{color:#666;cursor:pointer;font-family:sans-serif;font-size:12px}.filename{font-size:13px}.tag_div{background-clip:padding-box;background-color:#f3f3f3;border:1px solid #aaa;border-radius:3px 3px 3px 3px;box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,0.05);color:#666;line-height:13px;margin:2px 0;padding:2px 5px 2px 5px;width:132px}.tags_div{overflow-y:auto;height:65px}.tag_name{width:118px}.edit_thumb{cursor:pointer}.wdi_spider_rotate{border-radius:2px;border:1px solid #fff;height:30px}.wdi_spider_search_value{height:2em;margin:0 0 4px}#th_order,.wdi_spider_order{display:none}.wds_add_video,.wds_resize_image,.wds_import,.wds_exports{display:none;padding:10px;height:60px;background-color:#fff;border:1px solid #999;top:50%;position:fixed;left:50%;text-align:left;z-index:100000;border-radius:3px;margin-top:-45px}.wds_add_video,.wds_resize_image{margin-left:-340px}.wds_exports{margin-left:-240px}.wds_import{margin-left:-185px}.wds_add_video input[type="text"],.wds_resize_image input[type="text"]{width:500px}.wds_opacity_video,.wds_opacity_import,.wds_opacity_export{background-color:#000;display:none;opacity:.75;filter:Alpha(opacity=75);position:fixed;top:0;left:0;width:100%;height:100%;z-index:99998}.wds_tabs{clear:both;display:none;position:relative;z-index:1}.wds_tabs a.wds_sub_active,.wds_tabs a.wds_active{background-color:#f5f5f5;border-bottom:1px solid #f5f5f5;color:#333}.wds_tabs a{background-color:#f9f9f9;border:1px solid #dfdfdf;border-top-left-radius:3px;border-top-right-radius:3px;color:#c7c7c7;display:block !important;float:left;font:bold 17px/32px Arial,serif;height:30px;margin:3px 3px 0 0;padding:0 10px;position:relative;text-decoration:none;width:130px}.wbs_subtab a{font:bold 14px/26px Arial,serif;height:26px;padding:0 5px;width:105px}.wds_add_layer{font:normal 20px/28px Arial,serif !important;width:initial !important;padding:0 9px !important}.wds_tab_title{background:none repeat scroll 0 0 transparent !important;border:none !important;cursor:pointer;opacity:.5;filter:Alpha(opacity=50);padding:1px;vertical-align:middle;width:50px}.wds_sub_active .wds_tab_title,.wds_layer_title{background-color:#fff !important;border-color:#dfdfdf !important;border-radius:3px !important;border-style:solid !important;border-width:1px !important;cursor:pointer;opacity:1;filter:Alpha(opacity=100)}.wds_tab_remove{background-image:url("../images/close.png");background-repeat:no-repeat;background-size:100% 100%;display:inline-block;width:9px;height:9px;opacity:.5;filter:Alpha(opacity=50);vertical-align:middle}.wds_layer_remove{background-image:url("../images/close.png");background-repeat:no-repeat;background-size:100% 100%;display:inline-block;width:15px;height:15px;margin:5px;float:right}.wds_layer_dublicate{background-image:url("../images/duplicate.png");background-repeat:no-repeat;background-size:100% 100%;display:inline-block;width:15px;height:15px;margin:5px;float:right}.wds_slide_dublicate{background-image:url("../images/duplicate.png");background-repeat:no-repeat;background-size:100% 100%;display:inline-block;width:12px;height:12px;vertical-align:middle}.wds_layer_depth{float:right;font-size:13px;line-height:15px;margin:1px 5px;text-align:left;width:40px}.wds_layer_label{display:inline-block;font-size:13px;width:80%}.wds_sub_active .wds_tab_remove{cursor:pointer !important;opacity:1;filter:Alpha(opacity=100)}.wds_box.wds_sub_active,.wds_box.wds_active{display:block}.wds_tab_label{display:block;width:inherit}.wds_box{display:none;margin-top:0 !important;position:relative;top:-1px}.wds_box{border:1px solid #dfdfdf;border-radius:3px;box-shadow:0 0 10px #f2f2f2;margin-top:15px;position:relative}.wds_clear{clear:both;float:none !important}.wds_box thead td{border-bottom:0 none !important}.wds_box tbody{background-color:#fff;border-top:0 none;padding-left:10px}.wds_box thead{background:-webkit-linear-gradient(#f5f5f5,#fff);background:-o-linear-gradient(#f5f5f5,#fff);background:-moz-linear-gradient(#f5f5f5,#fff);background:linear-gradient(#f5f5f5,#fff);border-top:0 none;border-bottom:0 none;color:#333;font:bold 12px/29px Arial,serif;height:29px;margin:0;padding:0 10px;text-align:left;text-shadow:0 1px 0 #fff}.wds_box table{border-collapse:collapse;border-spacing:0;width:100%}.wds_nav_tabs{background-color:#f5f5f5;border-right:1px solid #dfdfdf;float:left;height:640px;margin:0;width:150px}.wds_nav_tabs ul{list-style:none outside none;margin:10px 0;padding:0}.wds_nav_tabs .wds_sub_active,.wds_nav_tabs .wds_sub_active a,.wds_nav_tabs .wds_sub_active a:hover,.wds_nav_tabs .wds_active,.wds_nav_tabs .wds_active a,.wds_nav_tabs .wds_active a:hover{background:none repeat scroll 0 0 #fff;color:#333}.wds_nav_tabs .wds_active{border-color:#dfdfdf;border-width:1px 0 1px 1px;border-style:solid;margin:0 -1px 0 -4px;padding:0}.wds_nav_tabs li{border-color:transparent;border-style:solid;border-width:1px 0;list-style-type:none;margin-bottom:0}.wds_nav_tabs a{display:block;line-height:18px;padding:5px 5px 5px 12px;text-decoration:none}.wds_nav_box{background:none repeat scroll 0 0 #fff;display:none;height:610px;overflow:auto;padding:15px}.wds_nav_box.wds_active{display:block}.wds_layer_head{background-color:#f5f5f5;border-bottom:1px solid #dfdfdf;border-top:1px solid #dfdfdf;cursor:pointer;padding:5px}.wds_layer_head .handle{cursor:move;display:inline-block;margin:5px}.wds_box td{padding:10px !important}.wds_draggable{box-sizing:border-box;cursor:move}.wds_box .color{width:60px}.wds_active_layer{box-shadow:#2c2424 0 0 5px;border-radius:3px}.wds_draggable a,.wds_draggable a:hover{color:inherit !important;font-size:inherit !important;font-style:inherit !important;font-weight:inherit !important;text-decoration:none}#add_embed_help{height:200px;width:672px;top:40%}#add_embed input[type="text"]{width:500px}.wds_buttons{float:right;font-weight:normal;position:relative}.wds_reset_button{display:none;font-weight:normal;margin:10px 0;position:absolute;right:40px;z-index:1}#wdi_save_feed .two .section_col{width:47%;float:left;margin:0 1.5% 18px}#wdi_save_feed .wdi_element{margin:0 0 18px}#wdi_save_feed .half .wdi_element,#wdi_save_feed .one .wdi_element{width:96%;float:none;margin:0 2% 20px}.wdi_element_name_liked_feed{display:none !important}#wdi_save_feed .wdi_element p{margin:2px 0 0}.wdi_section_name{font-size:19px;margin:0 auto 15px;width:100%;box-sizing:border-box;padding:15px;border-bottom:1px solid #f1f1f1;color:#444;cursor:pointer}.wdi_section{border:1px solid #dedede;margin-bottom:20px;background:#fff}.wdi_section .optioninput *{text-align:left}.wdi_section.half{width:49%;float:left;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.wdi_buttons{text-align:right;margin-top:7px}.wdi_tab .wdi_section.half:last-child{margin-left:2%}#how_to_publish_tab .wdi_howto_container{display:flex;flex-wrap:wrap}#how_to_publish_tab .wdi_howto_content{border:1px #ddd solid;display:flex;flex:1;flex-direction:column;margin:5px;min-width:250px;max-width:calc(25% - 20px);padding:20px 10px;text-align:center}#how_to_publish_tab .wdi_howto_container h2{font-size:23px;font-weight:normal;line-height:29px;margin:0;padding:11px 15px 4px 0}#how_to_publish_tab .wdi_howto_container .wdi_howto_content input{margin:0 auto;text-align:center;width:100%}.wdi_buttons button.button.preview-button{height:28px}@media(max-width:782px){.wdi_buttons button.button.preview-button{height:auto}}@media(min-width:768px){.wdi_border_wrapper .wdi_element_content{width:100%;display:block}.wdi_border_wrapper .wdi_element_title{display:block}.wdi_border_wrapper .wdi_element_content input[type=text]:not(.wp-color-picker){width:calc(100% - 30px);height:28px}.wdi_border_wrapper .wdi_element_content input#wdi_add_user_ajax_input{width:calc(100% - 78px)}.wdi_border_wrapper .wdi_element_content input[type=number]{width:calc(100% - 30px)}.wdi_border_wrapper .wdi_element_content select{width:calc(100% - 30px)}}@media(max-width:768px){#wdi_save_feed .two .section_col{width:96%;float:none;margin:0 2% 18px}.wdi_section.half{width:100%;float:none;margin:0 0 20px 0 !important}}.wdi_section_close::before{content:"\f142";display:inline-block;font:400 20px/1 dashicons;speak:none;float:right;cursor:pointer}.wdi_section_open::before{content:"\f140";display:inline-block;font:400 20px/1 dashicons;speak:none;float:right;cursor:pointer}.wdi-page-header{width:98%;padding:10px}.wdi-page-header .wdi_buttons{float:right}.wdi-page-header .WDI_title_input{padding:3px 8px;font-size:1.7em;line-height:100%;height:1.5em;width:30%;outline:0;margin:0 0 3px;background-color:#fff}.wdi_demo_img{margin-top:20px}#wdi_feed_form .wd-page-title.wd-header{width:100%;padding:10px 0}@media screen and (max-width:782px){#wdi_feed_form p.search-box{margin-bottom:0}#wdi_feed_form p.search-box input[type="search"]{width:100%;height:auto !important}#wdi_feed_form p.search-box input[type="button"]{margin-bottom:10px;padding:6px 14px;line-height:normal;font-size:14px;height:auto}.wdi-page-header .WDI_title_input{width:60%}.wdi-page-header .wdi_buttons{float:none;text-align:center}}.wdi_reset_cache_success{float:right}#wdi_reset_cache{float:right}body.toplevel_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(3),body.toplevel_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(4),body.toplevel_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(5){display:none}body.instagram-feed_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(3){display:table-row !important}body.instagram-feed_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(4){display:table-row !important}
1
+ .wdi_clear{clear:both}.wdi_clear_tag:after{content:"";display:table;clear:both}#wdi_unistall{background-color:#d82121;border-color:#d31818;box-shadow:inset 0 1px 0 rgba(230,120,120,0.5),0 1px 0 rgba(0,0,0,.15)}#wdi_unistall:hover{background-color:#da1313}#wdi_unistall_table th{width:45%}.display_type_content{background:#fff;border:1px solid #dedede;margin-bottom:15px}.wdi_tooltip,.wdi_settings_link{display:block;font-size:14px !important;font-weight:bold;line-height:20px;margin-bottom:5px;color:#444;text-decoration:none}p.wdi_about_filed{font-size:13px;font-style:italic}.wdi_tooltip:hover,.wdi_settings_link:hover{color:#23282d;position:relative}.wdi_tooltip:hover:after{content:attr(wdi-tooltip);padding:4px 8px;color:#dbdbe0;position:absolute;left:0;top:100%;white-space:nowrap;z-index:20;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:2px;-moz-box-shadow:0 0 4px #222;-webkit-box-shadow:0 0 4px #222;box-shadow:0 0 4px rgba(0,0,0,0.5);background-color:rgba(0,0,0,0.75);font-size:12px}.wdi_pro_only{font-style:italic;color:#4e4e4e !important;background-color:#ccc !important;text-decoration:none}.wdi_pro_only_op{opacity:.6}.wdi_pro_notice{text-align:right;color:#15699f;font-size:20px !important;padding:10px}.wdi_pro_only_btn{background-color:#c5c0c0 !important;border-top-color:#c5c0c0 !important}.wdi-pro-overlay img{opacity:.7}#wdi_feed_users{width:100%;margin-top:2px}#wdi_feed_tabs .wdi_feed_tabs{border:1px solid #f1f1f1;color:#444;cursor:pointer;font-size:13px;font-weight:bold;padding:12px;background:#fff;text-decoration:none;display:inline-block}#wdi_feed_tabs{margin:16px 0}#wdi_feed_tabs .wdi_feed_tab_active,#wdi_feed_tabs .wdi_feed_tabs:hover{background:none repeat scroll 0 0 #fff;color:#9a2465}#how_to_publish_tab .wdi_howto_container .wdi_howto_content .wdi_howto_wrapper{max-width:270px;margin:0 auto}#how_to_publish_tab .wdi_howto_container .wdi_howto_content .wdi_howto_wrapper img{max-width:100%}#wdi_feed_tabs .wdi_feed_tab_title{margin-top:1px;display:inline-block}.wdi_border_wrapper [scope='row']+td,.wdi_border_wrapper [scope='row']{padding:8px}.display_type_container.wdi_clear_tag{display:table;margin:10px auto}.display_type_container>div{float:left;margin-right:15px}.wdi_user{border:1px solid #b9b9b9;background-color:rgba(0,0,0,.05);margin:0 4px 0 0;border-radius:5px;height:28px;position:relative;display:inline-block}.wdi_user:hover{background-color:rgba(0,0,0,.08)}.wdi_user a{text-decoration:none;color:black;line-height:28px;width:70%;margin-left:12%;margin-right:18%;height:100%;display:table-row;padding-right:3px}.wdi_user .wdi_profile_pic{width:20px;height:20px;top:4px;left:30px;padding:5px;vertical-align:middle;display:table-cell}.wdi_user span{display:table-cell;vertical-align:middle;left:55px;font-weight:bold;font-size:14px}.wdi_user .wdi_remove_user,.wdi_user .wdi_check_thumb_user{position:absolute;right:4px;width:15px;height:15px;top:6.5px;transition:all .1s ease}.wdi_user .wdi_remove_user:hover{cursor:pointer;transform:rotate(180deg)}.wdi_user .wdi_check_thumb_user:hover{cursor:pointer}.wdi_user .wdi_check_thumb_user{left:4px}.wdi_border_wrapper [scope='row']{padding:2px;font-size:13px;min-width:250px}.wdi_border_wrapper [scope='row']+td,.wdi_border_wrapper [scope='row']{padding:2px}.small_input{width:60px;text-align:center}.display_type{text-align:center}.wdi_access_token_missing{font-size:14px;color:#000;clear:both;max-width:720px}.instagram-feed_page_wdi_settings form{width:65%}.instagram-feed_page_wdi_settings table td{padding-left:0;padding-right:0}.instagram-feed_page_wdi_settings table th{padding-left:4px}.instagram-feed_page_wdi_settings table input{float:right}#login_with_instagram{height:43px}#login_with_instagram .wdi_sign_in_button{background-image:url('../images/sign_in_with_instagram.png');background-repeat:no-repeat;background-position:left top;width:234px;height:43px;display:inline-block;float:left}#login_with_instagram .wdi_default_feed_button,#login_with_instagram .wdi_edit_default_feed_button{width:234px;height:43px;background-repeat:no-repeat;background-position:center top;display:inline-block}#login_with_instagram .wdi_default_feed_button{background-image:url('../images/default_feed_button.png');float:left;margin-right:10px}#login_with_instagram .wdi_edit_default_feed_button{background-image:url('../images/edit_feed_button.png');float:left}#wdwt_wrap_wdi_authenticated_users_list{display:inline-block;width:100%}#wdwt_wrap_wdi_authenticated_users_list .wdi_sign_in_button{background-image:url(../images/multiple_accounts.png);background-repeat:no-repeat;background-position:left top;width:228px;height:36px;display:inline-block;float:right;margin-top:2px;padding-bottom:5px}.wdi_advanced_option_open tr:nth-child(9),.wdi_advanced_option_open tr:nth-child(10),.wdi_advanced_option_open tr:nth-child(11){display:none}.instagram-feed_page_wdi_settings table #wdwt_wrap_wdi_fb_auth{margin-left:115px}#wdwt_wrap_wdi_fb_auth .block a{background-color:#4267b2;color:#fff}.wdi_advanced_option .optioninput,#wdwt_wrap_wdi_reset_cache .block,#wdwt_wrap_wdi_authenticated_users_list .block{display:inline-block}#wdi_options_page_buttons_wrapper .submit{display:inline;margin-left:15px}#wdi_reset_access_token{margin-top:0;float:left;width:232px;text-align:center}.wdi_advanced_option{width:100%;position:relative;font-weight:600}.wdi_advanced_option{background-color:#fff;cursor:pointer;border:1px solid #e3e3e3;border-radius:10px;border-collapse:separate;border-spacing:0}.wdi_advanced_option .wdi_advanced_option_head{border-bottom:1px solid #e3e3e3}.wdi_advanced_option .wdi_advanced_option_head th{padding-top:10px;padding-bottom:10px}.wdi_advanced_option.wdi_advanced_option_open .wdi_advanced_option_head th{border-bottom:1px solid #e3e3e3;border-bottom-left-radius:10px}.wdi_advanced_option.wdi_advanced_option_open .wdi_advanced_option_head td{border-bottom:1px solid #e3e3e3;border-bottom-right-radius:10px}.instagram-feed_page_wdi_settings table.wdi_advanced_option th{padding-left:12px}.instagram-feed_page_wdi_settings table.wdi_advanced_option td .wdwt_param{margin-left:15px}.instagram-feed_page_wdi_settings #wdwt_wrap_wdi_disable_fa .optioninput{display:inline-block}.wdi_advanced_option .wdi_advanced_option_icon{background-repeat:no-repeat;background-position:left top;width:20px;height:20px;display:inline-block;position:absolute;top:16px;right:10px}.wdi_advanced_option.wdi_advanced_option_close .wdi_advanced_option_icon{background-image:url('../images/arrow_1.png')}.wdi_advanced_option.wdi_advanced_option_open .wdi_advanced_option_icon{background-image:url('../images/arrow_2.png')}.wdi_advanced_option.wdi_advanced_option_close tbody tr:not(.wdi_advanced_option_head){display:none}.instagram-feed_page_wdi_settings form h2{display:none}#wdi_options_page_buttons_wrapper{margin-top:10px;width:700px}.wdi_hide{display:none}.wdi_hidden{display:none !important}.selectoff{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.wdi_filter_radio{margin:5px;display:inline-block}.wdi_filter_radio label{vertical-align:text-bottom}.wdi_filter_input{margin-top:10px}.wdi_filter_input input{height:28px;width:250px;margin-right:0;padding-right:0;line-height:28px}#wdi_filter_type{line-height:28px;margin:0;padding:0;position:relative;right:2px;top:-1px;font-weight:400}.wdi_filter_item{display:inline-block;padding:6px;margin-top:5px;border-radius:5px}.wdi_filter_by_username{background-color:#00a0d2;color:white}.wdi_filter_by_hashtag{background-color:#e08d11;color:white}.wdi_logic{display:inline-block;padding:5px;font-weight:bold}.wdi_filter_by_location{background-color:#509833;color:white}.wdi_filter_by_mention{background-color:#833888;color:white}.wdi_filter_by_description{background-color:#bd242b;color:white}.wdi_filter_by_url{background-color:#004eff;color:white}.wdi_remove_filter{padding-left:5px;color:white;font-size:13px}.wdi_remove_filter:hover{cursor:pointer}.wdi_source_user{display:inline-block;padding:5px}.wdi_source_img{display:inline-block}.wdi_source_img img{width:30px;height:30px;border-radius:15px;display:block}.wdi_source_username{display:inline-block;line-height:25px;font-size:15px !important;height:30px;vertical-align:bottom;padding:0 5px;font-weight:bold}#login_with_instagram>a:focus{-webkit-box-shadow:none;box-shadow:none}.wdi_help_bar_wrap{background-color:#fff;border:0;box-sizing:border-box;clear:both;color:#6e7990;font-size:14px;font-weight:bold;line-height:30px;padding:15px;vertical-align:middle;width:100%;margin:20px 0 0 0}.wdi_help_bar_text{float:left}.wdi_help_bar_text>a{color:#0073aa;text-decoration:none}.wdi_hb_buy_pro{float:right;padding:0}.wdi_hb_buy_pro a,.wdi_hb_buy_pro a:active,.wdi_hb_buy_pro a:visited,.wdi_hb_buy_pro a:hover{display:inline-block;font-weight:bold;font-size:14px;vertical-align:middle;border:0;box-shadow:none !important;text-decoration:none}.wdi_hb_buy_pro .wdi_support_link{color:#72777c !important;padding:0 10px}.wdi_hb_buy_pro .wdi_update_pro_link{background:#45a6b7;font-weight:bold;line-height:30px;padding:0 18px 0 18px;color:#fff !important}.wdi_hb_buy_pro img{border:0;display:inline-block;vertical-align:middle}#bullets_images_type,#bullets_images_color,#bull_style,#rl_butt_type,#rl_butt_color,#rl_butt_style{margin:0 10px 0 0;width:100px}.wds_ctrl_btn_upload{display:block !important;margin:5px 0 !important;text-align:center;vertical-align:middle;width:95%}.wds_reverse{margin:0 5px !important}.wds_free_button,.wds_free_button:hover{background:linear-gradient(to bottom,#e5e5e5,#e5e5e5) repeat scroll 0 0 #f3f3f3 !important;border-color:#bbb !important;color:#888 !important}.wdi_spider_free_version_label,.wdi_spider_free_version_label *{color:#808080 !important}.wdi_spider_free_version{background-color:#dfdfdf;border:1px solid #797979;border-radius:2px;padding:2px;width:210px}.wds_more{font-size:12px}.wrap .button{border-radius:3px !important;text-shadow:none !important}.wdi_spider_message_cont{display:none;width:99%}.wdi_spider_load{display:none}.wdi_spider_load_cont{background-color:rgba(0,0,0,0.2);left:0;height:100%;position:fixed;top:0;width:100%;z-index:99998}.wdi_spider_load_icon{left:0;height:100%;position:fixed;text-align:center;top:0;width:100%;z-index:99999}.wdi_spider_ajax_loading{border:none !important;margin-top:200px;width:50px;-webkit-animation:spin 2.5s infinite linear;-moz-animation:spin 2.5s infinite linear;-o-animation:spin 2.5s infinite linear;animation:spin 2.5s infinite linear}@-moz-keyframes spin{0{-moz-transform:rotate(0)}100%{-moz-transform:rotate(359deg)}}@-webkit-keyframes spin{0{-webkit-transform:rotate(0)}100%{-webkit-transform:rotate(359deg)}}@-o-keyframes spin{0{-o-transform:rotate(0)}100%{-o-transform:rotate(359deg)}}@-ms-keyframes spin{0{-ms-transform:rotate(0)}100%{-ms-transform:rotate(359deg)}}@keyframes spin{0{transform:rotate(0)}100%{transform:rotate(359deg)}}#TB_window,#TB_iframeContent{width:800px !important;height:500px !important}#TB_window{margin-left:-400px !important}.input_th{margin-left:0 !important;width:160px !important;font-family:sans-serif}.input_th2{margin-left:0 !important;width:160px !important;margin-top:5px;height:19px}.edit_input{height:28px !important;padding-bottom:7px !important}.add_tag_th{padding-left:21px;font-size:12px;font-family:sans-serif}.pointer{cursor:pointer}.non_selectable{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.wds_position_table td,.wds_position_table input{border:1px solid #ccc;margin:2px}.wds_position_table .wds_position_td{background-color:#f4f4f4;display:inline-block;line-height:1;padding:0 !important}.wdi_spider_div_options{background:none repeat scroll 0 0 #f4f4f4;border:1px solid #8f8d8d;border-radius:8px 8px 8px 8px;display:none;margin:2px 0 0 190px;padding:13px;min-height:300px;min-width:600px;vertical-align:top}.table_medium_col{text-align:center !important;width:70px}.table_medium_col_uncenter{width:80px}.table_extra_large_col{padding:4px !important;width:150px !important}.first-page,.prev-page,.next-page,.last-page,.table_extra_large_col a,.table_medium_col a,.table_big_col a,.table_small_col a{cursor:pointer}.wdi_spider_word_wrap{word-wrap:normal}.wdi_spider_description{color:#666;font-size:.923em;line-height:1.231em}.handle{background:url("../images/draggable.png") no-repeat transparent;border:0;cursor:move;display:inline-block;height:15px;margin:0 auto;vertical-align:middle;width:15px}.slider-icon{background-image:url("../images/slider-icon.png");background-repeat:no-repeat;border:0;float:left;height:32px;margin:7px 8px 0 0;width:32px}.uninstall-icon{background-image:url("../images/uninstall-icon.png");background-repeat:no-repeat;border:0;float:left;height:32px;margin:7px 8px 0 0;width:32px}.wdi_spider_label{font-weight:bold;width:100px}.wdi_spider_label_top{font-weight:bold;padding-top:3px;vertical-align:top;width:100px}.wdi_spider_fieldset .wdi_spider_label{font-weight:bold;vertical-align:top;width:150px}.wdi_spider_label_options{font-weight:bold;vertical-align:top;width:150px}.wdi_spider_choose_option{display:table;box-shadow:0 0 1px 1px #d2d2d2;margin-bottom:5px;border-radius:2px;padding:2px;box-sizing:border-box;cursor:pointer;width:100%}.wdi_spider_options_cont,.wdi_spider_bull_options_cont,.wdi_spider_pp_options_cont,.wdi_spider_options_color_cont,.wdi_spider_bull_options_color_cont,.wdi_spider_pp_options_color_cont{display:none;width:180px;height:150px;overflow:scroll;overflow-x:hidden;overflow-y:scroll}.wdi_spider_option_cont{display:block;border-bottom:1px solid #d3d3d3;padding:3px 0 3px 0;box-sizing:content-box;width:98%;border-radius:0;cursor:pointer}.wdi_spider_option_cont_title{display:table-cell;vertical-align:middle;padding:0 0 0 4px}.wdi_spider_option_cont_img{display:table-cell;width:23%;height:15px;text-align:right;padding:5px 4px 0 0;box-sizing:border-box;background-color:#eee}.wdi_spider_option_main_title{display:table-cell;width:65%;vertical-align:middle;padding:0 0 0 4px;color:#555}.wdi_spider_sel_option_ic{display:table-cell;width:20%;height:15px;text-align:right;padding:0 6px 0 0;box-sizing:border-box}.wdi_spider_int_input{width:45px}.wdi_spider_char_input{width:115px}.wdi_spider_text_input{width:190px}.wdi_spider_slider_div{display:inline-block;vertical-align:middle;width:140px}.wdi_spider_slider_percentage,.wdi_spider_slider_percentage input,.wdi_spider_slider_percentage input :focus{background:transparent;border:0;color:#00aeef;display:inline;font-weight:bold;text-align:right;vertical-align:middle;width:30px}.updated,.error{margin:5px 0 2px !important}.buttons_div{clear:both;float:right;margin:5px 0}.buttons_div_left{float:left;margin:5px 0}.buttons_div_right{float:right;margin:5px 0}.wdi_spider_delete_img{background-image:url("../images/delete.png");border:0;cursor:pointer;display:inline-block;vertical-align:middle;height:14px;width:14px}.wdi_spider_delete_img_small{background-image:url("../images/delete.png");background-size:10px auto;border:medium none;cursor:pointer;display:inline-block;height:10px;margin-top:2px;vertical-align:middle;width:10px}.wdi_spider_fieldset{background:none repeat scroll 0 0 #f4f4f4;border:1px solid #8f8d8d;border-radius:8px 8px 8px 8px;display:none;float:left;margin:4px;padding:13px;width:97%}.wdi_spider_type_fieldset{background:none repeat scroll 0 0 #f4f4f4;border-radius:8px 8px 8px 8px;display:none;float:left;width:100%}.wdi_spider_child_fieldset{background:none repeat scroll 0 0 #f4f4f4;border:1px solid #8f8d8d;border-radius:8px 8px 8px 8px;float:left;margin:4px;width:30%;padding:13px;display:block}.wdi_spider_table td{padding:0;vertical-align:middle}.wdi_spider_ctrls{padding:4px;text-align:center;width:40px}.theme_type{background-color:#f4f4f4;border:1px solid #8f8d8d;border-radius:8px 8px 8px 8px;cursor:pointer;display:inline-block;font-size:16px;height:24px;padding-top:5px;text-align:center;vertical-align:middle;width:123px;margin:2px 0 2px 0}.ui-slider-handle{cursor:pointer !important}.thumb{border:1px solid #ccc;max-height:120px;max-width:120px}.fileDescription{color:#666;cursor:pointer;font-family:sans-serif;font-size:12px}.filename{font-size:13px}.tag_div{background-clip:padding-box;background-color:#f3f3f3;border:1px solid #aaa;border-radius:3px 3px 3px 3px;box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,0.05);color:#666;line-height:13px;margin:2px 0;padding:2px 5px 2px 5px;width:132px}.tags_div{overflow-y:auto;height:65px}.tag_name{width:118px}.edit_thumb{cursor:pointer}.wdi_spider_rotate{border-radius:2px;border:1px solid #fff;height:30px}.wdi_spider_search_value{height:2em;margin:0 0 4px}#th_order,.wdi_spider_order{display:none}.wds_add_video,.wds_resize_image,.wds_import,.wds_exports{display:none;padding:10px;height:60px;background-color:#fff;border:1px solid #999;top:50%;position:fixed;left:50%;text-align:left;z-index:100000;border-radius:3px;margin-top:-45px}.wds_add_video,.wds_resize_image{margin-left:-340px}.wds_exports{margin-left:-240px}.wds_import{margin-left:-185px}.wds_add_video input[type="text"],.wds_resize_image input[type="text"]{width:500px}.wds_opacity_video,.wds_opacity_import,.wds_opacity_export{background-color:#000;display:none;opacity:.75;filter:Alpha(opacity=75);position:fixed;top:0;left:0;width:100%;height:100%;z-index:99998}.wds_tabs{clear:both;display:none;position:relative;z-index:1}.wds_tabs a.wds_sub_active,.wds_tabs a.wds_active{background-color:#f5f5f5;border-bottom:1px solid #f5f5f5;color:#333}.wds_tabs a{background-color:#f9f9f9;border:1px solid #dfdfdf;border-top-left-radius:3px;border-top-right-radius:3px;color:#c7c7c7;display:block !important;float:left;font:bold 17px/32px Arial,serif;height:30px;margin:3px 3px 0 0;padding:0 10px;position:relative;text-decoration:none;width:130px}.wbs_subtab a{font:bold 14px/26px Arial,serif;height:26px;padding:0 5px;width:105px}.wds_add_layer{font:normal 20px/28px Arial,serif !important;width:initial !important;padding:0 9px !important}.wds_tab_title{background:none repeat scroll 0 0 transparent !important;border:none !important;cursor:pointer;opacity:.5;filter:Alpha(opacity=50);padding:1px;vertical-align:middle;width:50px}.wds_sub_active .wds_tab_title,.wds_layer_title{background-color:#fff !important;border-color:#dfdfdf !important;border-radius:3px !important;border-style:solid !important;border-width:1px !important;cursor:pointer;opacity:1;filter:Alpha(opacity=100)}.wds_tab_remove{background-image:url("../images/close.png");background-repeat:no-repeat;background-size:100% 100%;display:inline-block;width:9px;height:9px;opacity:.5;filter:Alpha(opacity=50);vertical-align:middle}.wds_layer_remove{background-image:url("../images/close.png");background-repeat:no-repeat;background-size:100% 100%;display:inline-block;width:15px;height:15px;margin:5px;float:right}.wds_layer_dublicate{background-image:url("../images/duplicate.png");background-repeat:no-repeat;background-size:100% 100%;display:inline-block;width:15px;height:15px;margin:5px;float:right}.wds_slide_dublicate{background-image:url("../images/duplicate.png");background-repeat:no-repeat;background-size:100% 100%;display:inline-block;width:12px;height:12px;vertical-align:middle}.wds_layer_depth{float:right;font-size:13px;line-height:15px;margin:1px 5px;text-align:left;width:40px}.wds_layer_label{display:inline-block;font-size:13px;width:80%}.wds_sub_active .wds_tab_remove{cursor:pointer !important;opacity:1;filter:Alpha(opacity=100)}.wds_box.wds_sub_active,.wds_box.wds_active{display:block}.wds_tab_label{display:block;width:inherit}.wds_box{display:none;margin-top:0 !important;position:relative;top:-1px}.wds_box{border:1px solid #dfdfdf;border-radius:3px;box-shadow:0 0 10px #f2f2f2;margin-top:15px;position:relative}.wds_clear{clear:both;float:none !important}.wds_box thead td{border-bottom:0 none !important}.wds_box tbody{background-color:#fff;border-top:0 none;padding-left:10px}.wds_box thead{background:-webkit-linear-gradient(#f5f5f5,#fff);background:-o-linear-gradient(#f5f5f5,#fff);background:-moz-linear-gradient(#f5f5f5,#fff);background:linear-gradient(#f5f5f5,#fff);border-top:0 none;border-bottom:0 none;color:#333;font:bold 12px/29px Arial,serif;height:29px;margin:0;padding:0 10px;text-align:left;text-shadow:0 1px 0 #fff}.wds_box table{border-collapse:collapse;border-spacing:0;width:100%}.wds_nav_tabs{background-color:#f5f5f5;border-right:1px solid #dfdfdf;float:left;height:640px;margin:0;width:150px}.wds_nav_tabs ul{list-style:none outside none;margin:10px 0;padding:0}.wds_nav_tabs .wds_sub_active,.wds_nav_tabs .wds_sub_active a,.wds_nav_tabs .wds_sub_active a:hover,.wds_nav_tabs .wds_active,.wds_nav_tabs .wds_active a,.wds_nav_tabs .wds_active a:hover{background:none repeat scroll 0 0 #fff;color:#333}.wds_nav_tabs .wds_active{border-color:#dfdfdf;border-width:1px 0 1px 1px;border-style:solid;margin:0 -1px 0 -4px;padding:0}.wds_nav_tabs li{border-color:transparent;border-style:solid;border-width:1px 0;list-style-type:none;margin-bottom:0}.wds_nav_tabs a{display:block;line-height:18px;padding:5px 5px 5px 12px;text-decoration:none}.wds_nav_box{background:none repeat scroll 0 0 #fff;display:none;height:610px;overflow:auto;padding:15px}.wds_nav_box.wds_active{display:block}.wds_layer_head{background-color:#f5f5f5;border-bottom:1px solid #dfdfdf;border-top:1px solid #dfdfdf;cursor:pointer;padding:5px}.wds_layer_head .handle{cursor:move;display:inline-block;margin:5px}.wds_box td{padding:10px !important}.wds_draggable{box-sizing:border-box;cursor:move}.wds_box .color{width:60px}.wds_active_layer{box-shadow:#2c2424 0 0 5px;border-radius:3px}.wds_draggable a,.wds_draggable a:hover{color:inherit !important;font-size:inherit !important;font-style:inherit !important;font-weight:inherit !important;text-decoration:none}#add_embed_help{height:200px;width:672px;top:40%}#add_embed input[type="text"]{width:500px}.wds_buttons{float:right;font-weight:normal;position:relative}.wds_reset_button{display:none;font-weight:normal;margin:10px 0;position:absolute;right:40px;z-index:1}#wdi_save_feed .two .section_col{width:47%;float:left;margin:0 1.5% 18px}#wdi_save_feed .wdi_element{margin:0 0 18px}#wdi_save_feed .half .wdi_element,#wdi_save_feed .one .wdi_element{width:96%;float:none;margin:0 2% 20px}.wdi_element_name_liked_feed{display:none !important}#wdi_save_feed .wdi_element p{margin:2px 0 0}.wdi_section_name{font-size:19px;margin:0 auto 15px;width:100%;box-sizing:border-box;padding:15px;border-bottom:1px solid #f1f1f1;color:#444;cursor:pointer}.wdi_section{border:1px solid #dedede;margin-bottom:20px;background:#fff}.wdi_section .optioninput *{text-align:left}.wdi_section.half{width:49%;float:left;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.wdi_buttons{text-align:right;margin-top:7px}.wdi_tab .wdi_section.half:last-child{margin-left:2%}#how_to_publish_tab .wdi_howto_container{display:flex;flex-wrap:wrap}#how_to_publish_tab .wdi_howto_content{border:1px #ddd solid;display:flex;flex:1;flex-direction:column;margin:5px;min-width:250px;max-width:calc(25% - 20px);padding:20px 10px;text-align:center}#how_to_publish_tab .wdi_howto_container h2{font-size:23px;font-weight:normal;line-height:29px;margin:0;padding:11px 15px 4px 0}#how_to_publish_tab .wdi_howto_container .wdi_howto_content input{margin:0 auto;text-align:center;width:100%}.wdi_buttons button.button.preview-button{height:28px}@media(max-width:782px){.wdi_buttons button.button.preview-button{height:auto}}@media(min-width:768px){.wdi_border_wrapper .wdi_element_content{width:100%;display:block}.wdi_border_wrapper .wdi_element_title{display:block}.wdi_border_wrapper .wdi_element_content input[type=text]:not(.wp-color-picker){width:calc(100% - 30px);height:28px}.wdi_border_wrapper .wdi_element_content input#wdi_add_user_ajax_input{width:calc(100% - 78px)}.wdi_border_wrapper .wdi_element_content input[type=number]{width:calc(100% - 30px)}.wdi_border_wrapper .wdi_element_content select{width:calc(100% - 30px)}}@media(max-width:768px){#wdi_save_feed .two .section_col{width:96%;float:none;margin:0 2% 18px}.wdi_section.half{width:100%;float:none;margin:0 0 20px 0 !important}}.wdi_section_close::before{content:"\f142";display:inline-block;font:400 20px/1 dashicons;speak:none;float:right;cursor:pointer}.wdi_section_open::before{content:"\f140";display:inline-block;font:400 20px/1 dashicons;speak:none;float:right;cursor:pointer}.wdi-page-header{width:98%;padding:10px}.wdi-page-header .wdi_buttons{float:right}.wdi-page-header .WDI_title_input{padding:3px 8px;font-size:1.7em;line-height:100%;height:1.5em;width:30%;outline:0;margin:0 0 3px;background-color:#fff}.wdi_demo_img{margin-top:20px}#wdi_feed_form .wd-page-title.wd-header{width:100%;padding:10px 0}@media screen and (max-width:782px){#wdi_feed_form p.search-box{margin-bottom:0}#wdi_feed_form p.search-box input[type="search"]{width:100%;height:auto !important}#wdi_feed_form p.search-box input[type="button"]{margin-bottom:10px;padding:6px 14px;line-height:normal;font-size:14px;height:auto}.wdi-page-header .WDI_title_input{width:60%}.wdi-page-header .wdi_buttons{float:none;text-align:center}}.wdi_reset_cache_success{float:right}#wdi_reset_cache{float:right}body.toplevel_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(4),body.toplevel_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(5){display:none}body.instagram-feed_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(3){display:table-row !important}body.instagram-feed_page_wdi_settings table:nth-of-type(1) tr:nth-of-type(4){display:table-row !important}
framework/WDI_admin_view.php CHANGED
@@ -31,6 +31,9 @@ class WDI_admin_view{
31
  <div class="block margin">
32
  <a href="<?php echo $element['href']; ?>" id="<?php echo $element['name']; ?>" class="button" style="text-decoration:none;"><?php echo (isset($element['value']))?esc_html($element['value']):esc_html($element['title']); ?></a>
33
  </div>
 
 
 
34
  </div>
35
  <?php
36
  }
@@ -228,7 +231,7 @@ class WDI_admin_view{
228
  </div>
229
  </div>
230
  </div>
231
- <div style="text-align: right;font-style: italic;">
232
  <p>Log out from the previous account before signing up.</p>
233
  </div>
234
  <?php
31
  <div class="block margin">
32
  <a href="<?php echo $element['href']; ?>" id="<?php echo $element['name']; ?>" class="button" style="text-decoration:none;"><?php echo (isset($element['value']))?esc_html($element['value']):esc_html($element['title']); ?></a>
33
  </div>
34
+ <?php if(isset($element['description'])){ ?>
35
+ <p style="font-style: italic;"><?php echo $element['description']; ?></p>
36
+ <?php } ?>
37
  </div>
38
  <?php
39
  }
231
  </div>
232
  </div>
233
  </div>
234
+ <div style="margin-left: 15px;font-style: italic;">
235
  <p>Log out from the previous account before signing up.</p>
236
  </div>
237
  <?php
frontend/shortcode.php CHANGED
@@ -82,7 +82,7 @@ function wdi_feed($atts, $widget_params = '')
82
 
83
  //checking if access token is not set or removed display proper error message
84
  global $wdi_options;
85
- if (!isset($wdi_options['wdi_access_token']) || $wdi_options['wdi_access_token'] == '') {
86
  ob_get_clean();
87
  return __('Access Token is invalid, please get it again ', "wd-instagram-feed");
88
  }
@@ -202,11 +202,21 @@ function wdi_register_frontend_scripts(){
202
  ));
203
 
204
  $wdi_token_error_flag = get_option("wdi_token_error_flag");
 
 
 
 
 
 
 
205
  wp_localize_script("wdi_frontend", 'wdi_ajax', array(
206
  'ajax_url' => admin_url('admin-ajax.php'),
207
  'wdi_nonce' => wp_create_nonce("wdi_cache"),
208
  'WDI_MINIFY' => (WDI_MINIFY) ? 'true' : 'false',
 
 
209
  ));
 
210
  wp_localize_script("wdi_frontend", 'wdi_url', array('plugin_url' => WDI_URL . '/',
211
  'ajax_url' => admin_url('admin-ajax.php')));
212
 
82
 
83
  //checking if access token is not set or removed display proper error message
84
  global $wdi_options;
85
+ if ((!isset($wdi_options['wdi_access_token']) || $wdi_options['wdi_access_token'] == '') && empty($wdi_options['fb_token'])) {
86
  ob_get_clean();
87
  return __('Access Token is invalid, please get it again ', "wd-instagram-feed");
88
  }
202
  ));
203
 
204
  $wdi_token_error_flag = get_option("wdi_token_error_flag");
205
+
206
+ $options = wdi_get_options();
207
+
208
+ $business_account_id = (!empty($options['business_account_id'])) ? $options['business_account_id'] : "";
209
+ $fb_token = (!empty($options['fb_token'])) ? $options['fb_token'] : "";
210
+
211
+
212
  wp_localize_script("wdi_frontend", 'wdi_ajax', array(
213
  'ajax_url' => admin_url('admin-ajax.php'),
214
  'wdi_nonce' => wp_create_nonce("wdi_cache"),
215
  'WDI_MINIFY' => (WDI_MINIFY) ? 'true' : 'false',
216
+ 'business_account_id' => $business_account_id,
217
+ 'fb_token' => $fb_token,
218
  ));
219
+
220
  wp_localize_script("wdi_frontend", 'wdi_url', array('plugin_url' => WDI_URL . '/',
221
  'ajax_url' => admin_url('admin-ajax.php')));
222
 
js/gallerybox/wdi_gallery_box.js CHANGED
@@ -158,7 +158,7 @@ var wdi_construct_popup = function (popup, currentFeed, image_rows, current_imag
158
  'height:'+image_thumb_height+'px;' +
159
  'margin-left:'+thumb_left+'px;' +
160
  'margin-top:'+thumb_top+'px;';
161
- var src = (typeof image_row.images[currentFeed.feedImageResolution]['url'] !== 'undefined') ? image_row.images[currentFeed.feedImageResolution]['url'] : image_row.thumb_url;
162
  var onclick = 'wdi_change_image(parseInt(jQuery(\'#wdi_current_image_key\').val()), \'' + i + '\', wdi_data)';
163
  var ontouchend = 'wdi_change_image(parseInt(jQuery(\'#wdi_current_image_key\').val()), \'' + i + '\', wdi_data)';
164
 
158
  'height:'+image_thumb_height+'px;' +
159
  'margin-left:'+thumb_left+'px;' +
160
  'margin-top:'+thumb_top+'px;';
161
+ 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;
162
  var onclick = 'wdi_change_image(parseInt(jQuery(\'#wdi_current_image_key\').val()), \'' + i + '\', wdi_data)';
163
  var ontouchend = 'wdi_change_image(parseInt(jQuery(\'#wdi_current_image_key\').val()), \'' + i + '\', wdi_data)';
164
 
js/gallerybox/wdi_gallery_box.min.js CHANGED
@@ -1 +1 @@
1
- var isPopUpOpened=false;var wdi_data=[];function wdi_spider_createpopup(a,k,b,m,e,l,f,j,h){a=a.replace(/&#038;/g,"&");if(isPopUpOpened){return}isPopUpOpened=true;if(wdi_spider_hasalreadyreceivedpopup(l)||wdi_spider_isunsupporteduseragent()){return}jQuery("html").attr("style","overflow:hidden !important;");jQuery("#wdi_spider_popup_loading_"+k).css({display:"block"});jQuery("#wdi_spider_popup_overlay_"+k).css({display:"block"});var d=0;var c;for(var g=0;g<j.parsedData.length;g++){if(j.parsedData[g].id===h){d=g;c=[j.parsedData[g]];break}}jQuery.ajax({type:"POST",url:a,dataType:"text",data:{action:"WDIGalleryBox",image_rows:JSON.stringify(c),feed_id:j.feed_row.id,feed_counter:j.feed_row.wdi_feed_counter,current_image_index:d,image_rows_count:j.parsedData.length,carousel_media_row:JSON.stringify(c[0].carousel_media)},success:function(o){var n=jQuery('<div id="wdi_spider_popup_wrap" class="wdi_spider_popup_wrap wdi_lightbox_theme_'+j.feed_row.theme_id+'" style="width:'+b+"px;height:"+m+"px;margin-top:-"+(m/2)+"px;margin-left: -"+(b/2)+'px; ">'+o+"</div>");var p=new wdi_construct_popup(n,j,j.parsedData,h);p.construct();n.hide().appendTo("body");wdi_spider_showpopup(l,f,n,e);jQuery("#wdi_spider_popup_loading_"+k).css({display:"none !important;"})}})}var wdi_construct_popup=function(a,b,c,d){this.theme_row={};this.construct=function(){this.theme_row=window["wdi_theme_"+b.feed_row.theme_id];if(b.feed_row.popup_enable_filmstrip&&b.feed_row.popup_enable_filmstrip==="1"){this.add_filmstrip()}this.set_wdi_data()};this.add_filmstrip=function(){var l="horizontal";if(this.theme_row.lightbox_filmstrip_pos==="right"||this.theme_row.lightbox_filmstrip_pos==="left"){l="vertical"}var y=(l==="horizontal")?"fa-angle-left":"fa-angle-up";var x=(l==="horizontal")?"fa-angle-right":"fa-angle-down";var h="";var q,f;if(l==="horizontal"){f=q=(typeof b.feed_row.popup_filmstrip_height!=="undefined")?(b.feed_row.popup_filmstrip_height):"20"}else{f=q=(typeof b.feed_row.popup_filmstrip_height!=="undefined")?(b.feed_row.popup_filmstrip_height):"50"}q=f=parseInt(f);for(var w=0;w<c.length;w++){var e=c[w];var s,k,A;if(e.resolution&&e.resolution!==""){var n=e.resolution.split(" ");var p=intval($resolution_arr[0]);var z=intval($resolution_arr[2]);if(p!==0&&z!==0){A=Math.max(f/p,q/z);s=p*A;k=z*A}else{s=f;k=q}}else{s=f;k=q}A=Math.max(f/s,q/k);s*=A;k*=A;var g=(f-s)/2;var j=(q-k)/2;var u="wdi_filmstrip_thumbnail "+((parseInt(e.id)===parseInt(d))?"wdi_thumb_active":"wdi_thumb_deactive");var t="width:"+s+"px;height:"+k+"px;margin-left:"+g+"px;margin-top:"+j+"px;";var m=(typeof e.images[b.feedImageResolution]["url"]!=="undefined")?e.images[b.feedImageResolution]["url"]:e.thumb_url;var B="wdi_change_image(parseInt(jQuery('#wdi_current_image_key').val()), '"+w+"', wdi_data)";var v="wdi_change_image(parseInt(jQuery('#wdi_current_image_key').val()), '"+w+"', wdi_data)";var r='<img style="'+t+'" class="wdi_filmstrip_thumbnail_img" src="'+m+'" onclick="'+B+'" ontouchend="'+v+'" image_id="'+e.id+'" image_key="'+w+'" alt="'+e.alt+'" />';h+='<div id="wdi_filmstrip_thumbnail_'+w+'" class="'+u+'">'+r+"</div>"}var o='<div class="wdi_filmstrip_left"><i class="fa '+y+'"></i></div><div class="wdi_filmstrip"><div class="wdi_filmstrip_thumbnails">'+h+'</div></div><div class="wdi_filmstrip_right"><i class="fa '+x+'"></i></div>';a.find(".wdi_filmstrip_container").append(o)};this.set_wdi_data=function(){wdi_data=[];for(var e=0;e<c.length;e++){wdi_data[e]=[];wdi_data[e]["number"]=e+1;wdi_data[e]["id"]=c[e].id;wdi_data[e]["alt"]=c[e].alt;wdi_data[e]["description"]=wdi_front.escape_tags(c[e].description);wdi_data[e]["username"]=c[e].username;wdi_data[e]["profile_picture"]=c[e].profile_picture;wdi_data[e]["image_url"]=c[e].image_url;wdi_data[e]["thumb_url"]=c[e].thumb_url;wdi_data[e]["date"]=c[e].date;wdi_data[e]["comment_count"]=c[e].comment_count;wdi_data[e]["filetype"]=c[e].filetype;wdi_data[e]["filename"]=c[e].filename;wdi_data[e]["avg_rating"]=c[e].avg_rating;wdi_data[e]["rate"]=c[e].rate;wdi_data[e]["rate_count"]=c[e].rate_count;wdi_data[e]["hit_count"]=c[e].hit_count;wdi_data[e]["comments_data"]=(typeof c[e].comments_data!=="undefined")?c[e].comments_data:"null";wdi_data[e]["carousel_media"]=(typeof c[e]["carousel_media"]!=="undefined")?c[e]["carousel_media"]:null}}};function wdi_spider_showpopup(c,a,b,d){isPopUpOpened=true;b.show();wdi_spider_receivedpopup(c,a)}function wdi_spider_hasalreadyreceivedpopup(a){if(document.cookie.indexOf(a)>-1){delete document.cookie[document.cookie.indexOf(a)]}return false}function wdi_spider_receivedpopup(c,a){var b=new Date();b.setDate(b.getDate()+a);document.cookie=c+"=true;expires="+b.toUTCString()+";path=/"}function wdi_spider_isunsupporteduseragent(){return(!window.XMLHttpRequest)}function wdi_spider_destroypopup(d){if(document.getElementById("wdi_spider_popup_wrap")!=null){wdi_comments_manager.popup_destroyed();if(typeof jQuery().fullscreen!=="undefined"&&jQuery.isFunction(jQuery().fullscreen)){if(jQuery.fullscreen.isFullScreen()){jQuery.fullscreen.exit()}}if(typeof enable_addthis!="undefined"&&enable_addthis){jQuery(".at4-share-outer").hide()}setTimeout(function(){jQuery(".wdi_spider_popup_wrap").remove();jQuery(".wdi_spider_popup_loading").css({display:"none"});jQuery(".wdi_spider_popup_overlay").css({display:"none"});jQuery(document).off("keydown");jQuery("html").attr("style","")},20)}isPopUpOpened=false;var a=(/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));var c=document.querySelector('meta[name="viewport"]');if(a&&c){c.content="width=device-width, initial-scale=1"}var b=jQuery(document).scrollTop();window.location.hash="";jQuery(document).scrollTop(b);if(typeof wdi_playInterval!="undefined"){clearInterval(wdi_playInterval)}}Object.size=function(c){var b=0,a;for(a in c){if(c.hasOwnProperty(a)){b++}}return b};function wdi_spider_ajax_save(a,b){wdi_comments_manager.init(b);return false}wdi_comments_manager={media_id:"",mediaComments:[],load_more_count:10,commentCounter:0,currentKey:-1,init:function(a){this.instagram=new WDIInstagram();this.instagram.addToken(wdi_front.access_token);if(this.currentKey!=a){this.currentKey=a;this.reset_comments()}else{}},reset_comments:function(){jQuery("#wdi_load_more_comments").remove();jQuery("#wdi_added_comments").html("");this.commentCounter=0;this.media_id=wdi_data[this.currentKey]["id"];this.getAjaxComments(this.currentKey)},popup_destroyed:function(){this.media_id="";this.mediaComments=[];this.commentCounter=0;this.currentKey=-1},showComments:function(f,e){if(Object.size(f)-this.commentCounter-e<0||e===undefined){e=Object.size(f)-this.commentCounter}var b=this.commentCounter;for(i=Object.size(f)-b-1;i>=Object.size(f)-b-e;i--){this.commentCounter++;var d=(f[i]["text"]);d=wdi_front.escape_tags(d);d=this.filterCommentText(d);var g=(f[i]["from"]["username"]);var c=(f[i]["from"]["profile_picture"]);var a=jQuery('<div class="wdi_single_comment"></div>');a.append(jQuery('<p class="wdi_comment_header_p"><span class="wdi_comment_header"><a target="_blank" href="//instagram.com/'+g+'">'+g+'</a></span><span class="wdi_comment_date">'+wdi_front.convertUnixDate(f[i]["created_time"])+"</span></p>"));a.append(jQuery('<div class="wdi_comment_body_p"><span class="wdi_comment_body"><p>'+d+"</p></span></div>"));jQuery("#wdi_added_comments").prepend(a)}this.updateScrollbar()},updateScrollbar:function(){var b=jQuery("#wdi_comments");var a=jQuery("#wdi_added_comments");jQuery(".wdi_comments").attr("class","wdi_comments");jQuery(".wdi_comments").html("");jQuery(".wdi_comments").append(b);jQuery(".wdi_comments").append(a);jQuery(".wdi_comments_close_btn").on("click",wdi_comment)},getAjaxComments:function(){this.instagram.getRecentMediaComments(this.media_id,{success:function(a){if(a==""||a==undefined||a==null){errorMessage="Network Error, please try again later :(";console.log("%c"+errorMessage,"color:#cc0000;");return}if(a.meta["code"]!=200){errorMessage=a.meta["error_message"];console.log("%c"+errorMessage,"color:#cc0000;");return}wdi_comments_manager.mediaComments=a.data;var b=wdi_data[wdi_comments_manager.currentKey];b.comments_data=a.data;wdi_comments_manager.showComments(b.comments_data,wdi_comments_manager.load_more_count);wdi_comments_manager.ajax_comments_ready(a.data)}})},ajax_comments_ready:function(a){this.createLoadMoreAndBindEvent()},createLoadMoreAndBindEvent:function(){jQuery("#wdi_added_comments").prepend(jQuery('<p id="wdi_load_more_comments" class="wdi_load_more_comments">load more comments</p>'));jQuery(".wdi_comment_container #wdi_load_more_comments").on("click",function(){jQuery(this).remove();wdi_comments_manager.showComments(wdi_comments_manager.mediaComments,wdi_comments_manager.load_more_count);wdi_comments_manager.createLoadMoreAndBindEvent()})},filterCommentText:function(d){var c=d.split(" ");var b="";for(var a=0;a<c.length;a++){switch(c[a][0]){case"@":b+='<a target="blank" class="wdi_comm_text_link" href="//instagram.com/'+c[a].substring(1,c[a].length)+'">'+c[a]+"</a> ";break;case"#":b+='<a target="blank" class="wdi_comm_text_link" href="//instagram.com/explore/tags/'+c[a].substring(1,c[a].length)+'">'+c[a]+"</a> ";break;default:b+=c[a]+" "}}b=b.substring(0,b.length-1);return b}};function wdi_spider_set_input_value(b,a){if(document.getElementById(b)){document.getElementById(b).value=a}}function wdi_spider_form_submit(b,a){if(document.getElementById(a)){document.getElementById(a).submit()}if(b.preventDefault){b.preventDefault()}else{b.returnValue=false}}function wdi_spider_check_required(b,a){if(jQuery("#"+b).val()==""){wdi_front.show_alert(a+"* "+wdi_objectL10n.wdi_field_required);jQuery("#"+b).attr("style","border-color: #FF0000;");jQuery("#"+b).focus();return true}else{return false}}function wdi_spider_check_email(b){if(jQuery("#"+b).val()!=""){var a=jQuery("#"+b).val().replace(/^\s+|\s+$/g,"");if(a.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)==-1){wdi_front.show_alert(wdi_objectL10n.wdi_mail_validation);return true}return false}}function wdi_captcha_refresh(a){if(document.getElementById(a+"_img")&&document.getElementById(a+"_input")){srcArr=document.getElementById(a+"_img").src.split("&r=");document.getElementById(a+"_img").src=srcArr[0]+"&r="+Math.floor(Math.random()*100);document.getElementById(a+"_img").style.display="inline-block";document.getElementById(a+"_input").value=""}}function wdi_play_pause(e){var f=navigator.userAgent.indexOf("Chrome")>-1;var d=navigator.userAgent.indexOf("Safari")>-1;if((f)&&(d)){d=false}if(d){return}var c=e.get(0);var b=/firefox/i;var a=false;if(navigator.userAgent.match(b)){a=true}if(!a){if(!c.paused){c.pause()}else{c.play()}}}function wdi_spider_display_embed(m,n,j,g){var b="";switch(m){case"EMBED_OEMBED_YOUTUBE_VIDEO":var k="<iframe ";if(n!=""){k+=' src="//www.youtube.com/embed/'+n+'?enablejsapi=1&wmode=transparent"'}for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){k+=" "+attr+'="'+j[attr]+'"'}}}k+=" ></iframe>";b+=k;break;case"EMBED_OEMBED_VIMEO_VIDEO":var f="<iframe ";if(n!=""){f+=' src="//player.vimeo.com/video/'+n+'?enablejsapi=1"'}for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){f+=" "+attr+'="'+j[attr]+'"'}}}f+=" ></iframe>";b+=f;break;case"EMBED_OEMBED_FLICKR_IMAGE":var d="<div ";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){d+=" "+attr+'="'+j[attr]+'"'}}}d+=" >";if(n!=""){d+='<img src="'+n+'" style="max-width:100% !important; max-height:100% !important; width:auto !important; height:auto !important;">'}d+="</div>";b+=d;break;case"EMBED_OEMBED_FLICKR_VIDEO":break;case"EMBED_OEMBED_INSTAGRAM_VIDEO":var e="<div ";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){e+=" "+attr+'="'+j[attr]+'"'}}}e+=" >";if(n!=""){e+='<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls><source src="'+n+'" type="video/mp4"> Your browser does not support the video tag. </video>'}e+="</div>";b+=e;break;case"EMBED_OEMBED_INSTAGRAM_IMAGE":var e="<div ";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){e+=" "+attr+'="'+j[attr]+'"'}}}e+=" >";if(g!=null&&g.length){for(var c=0;c<g.length;c++){if(g[c]["type"]=="image"){e+='<img src="'+g[c]["images"]["standard_resolution"]["url"]+'" style="max-width:100% !important; max-height:100% !important; width:auto !important; height:auto !important;" data-id="'+c+'" class="carousel_media '+(c==0?"active":"")+'">'}else{if(g[c]["type"]=="video"){e+='<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls data-id="'+c+'" class="carousel_media '+(c==0?"active":"")+'"><source src="'+g[c]["videos"]["standard_resolution"]["url"]+'" type="video/mp4"> Your browser does not support the video tag. </video>'}}}}else{if(n!=""){e+='<img src="//instagram.com/p/'+n+'/media/?size=l" style=" max-width:100% !important; max-height:100% !important; width:auto; height:auto;">'}}e+="</div>";b+=e;break;case"EMBED_OEMBED_INSTAGRAM_POST":var e="<div ";var a="";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){e+=" "+attr+'="'+j[attr]+'"';if(attr=="CLASS"||attr=="class"||attr=="Class"){obj_class=j[attr]}}}}e+=" >";if(n!=""){e+='<iframe class="inner_instagram_iframe_'+obj_class+'" src="//instagr.am/p/'+n+'/embed/?enablejsapi=1" style="max-width:100% !important; max-height:100% !important; width:100%; height:100%; margin:0; display:table-cell; vertical-align:middle;"frameborder="0" scrolling="no" allowtransparency="false" allowfullscreen></iframe>'}e+="</div>";b+=e;break;case"EMBED_OEMBED_DAILYMOTION_VIDEO":var l="<iframe ";if(n!=""){l+=' src="//www.dailymotion.com/embed/video/'+n+'?api=postMessage"'}for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){l+=" "+attr+'="'+j[attr]+'"'}}}l+=" ></iframe>";b+=l;break;case"EMBED_OEMBED_IMGUR":var h="<div ";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){e+=" "+attr+'="'+j[attr]+'"'}}}h+=" >";if(n!=""){h+='<img src="'+n+'" style="max-width:100% !important; max-height:100% !important; width:auto; height:auto !important;">'}h+="</div>";b+=h;break;default:}return b}function wdi_testBrowser_cssTransitions(){return wdi_testDom("Transition")}function wdi_testBrowser_cssTransforms3d(){return wdi_testDom("Perspective")}function wdi_testDom(d){var a=["","-webkit-","-moz-","-ms-","-o-","-khtml-"];var c=["","Webkit","Moz","ms","O","Khtml"];var b=c.length;while(b--){if(typeof document.body.style[c[b]+d]!=="undefined"){return true}}return false}function wdi_cube(c,d,b,a,k,l,h,j,e,g){if(!wdi_testBrowser_cssTransitions()){return wdi_fallback(j,e,g)}if(!wdi_testBrowser_cssTransforms3d()){return wdi_fallback3d(j,e,g)}wdi_trans_in_progress=true;jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive");jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");jQuery(".wdi_slide_bg").css("perspective",1000);jQuery(j).css({transform:"translateZ("+c+"px)",backfaceVisibility:"hidden"});jQuery(e).css({opacity:1,filter:"Alpha(opacity=100)",backfaceVisibility:"hidden",transform:"translateY("+b+"px) translateX("+d+"px) rotateY("+k+"deg) rotateX("+a+"deg)"});jQuery(".wdi_slider").css({transform:"translateZ(-"+c+"px)",transformStyle:"preserve-3d"});setTimeout(function(){jQuery(".wdi_slider").css({transition:"all "+wdi_transition_duration+"ms ease-in-out",transform:"translateZ(-"+c+"px) rotateX("+l+"deg) rotateY("+h+"deg)"})},20);jQuery(".wdi_slider").one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(f));function f(){jQuery(j).removeAttr("style");jQuery(e).removeAttr("style");jQuery(".wdi_slider").removeAttr("style");jQuery(j).css({opacity:0,filter:"Alpha(opacity=0)","z-index":1});jQuery(e).css({opacity:1,filter:"Alpha(opacity=100)","z-index":2});wdi_trans_in_progress=false;jQuery(j).html("");if(typeof event_stack!=="undefined"){if(event_stack.length>0){key=event_stack[0].split("-");event_stack.shift();wdi_change_image(key[0],key[1],wdi_data,true)}}wdi_change_watermark_container()}}function wdi_cubeH(b,a,d){var c=jQuery(b).width()/2;if(d=="right"){wdi_cube(c,c,0,0,90,0,-90,b,a,d)}else{if(d=="left"){wdi_cube(c,-c,0,0,-90,0,90,b,a,d)}}}function wdi_cubeV(b,a,d){var c=jQuery(b).height()/2;if(d=="right"){wdi_cube(c,0,-c,90,0,-90,0,b,a,d)}else{if(d=="left"){wdi_cube(c,0,c,-90,0,90,0,b,a,d)}}}function wdi_fallback(b,a,c){wdi_fade(b,a,c)}function wdi_fallback3d(b,a,c){wdi_sliceV(b,a,c)}function wdi_none(b,a,c){jQuery(b).css({opacity:0,"z-index":1});jQuery(a).css({opacity:1,"z-index":2});jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive");jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");wdi_trans_in_progress=false;jQuery(b).html("");wdi_change_watermark_container()}function wdi_fade(b,a,c){jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive");jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");if(wdi_testBrowser_cssTransitions()){jQuery(a).css("transition","opacity "+wdi_transition_duration+"ms linear");jQuery(b).css({opacity:0,"z-index":1});jQuery(a).css({opacity:1,"z-index":2});wdi_change_watermark_container()}else{jQuery(b).animate({opacity:0,"z-index":1},wdi_transition_duration);jQuery(a).animate({opacity:1,"z-index":2},{duration:wdi_transition_duration,complete:function(){wdi_trans_in_progress=false;jQuery(b).html("");wdi_change_watermark_container()}});jQuery(b).fadeTo(wdi_transition_duration,0);jQuery(a).fadeTo(wdi_transition_duration,1)}}function wdi_grid(k,L,w,I,H,o,u,A,M,g){if(!wdi_testBrowser_cssTransitions()){return wdi_fallback(A,M,g)}wdi_trans_in_progress=true;jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive");jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");var F=(wdi_transition_duration)/(k+L);function x(P,Y,V,R,Q,X,O,W,U,T,j){var S=(T+j)*F;return jQuery('<span class="wdi_gridlet" />').css({display:"block",width:P,height:Y,top:V,left:Q,backgroundImage:'url("'+O+'")',backgroundColor:jQuery(".wdi_spider_popup_wrap").css("background-color"),backgroundRepeat:"no-repeat",backgroundPosition:X+"px "+R+"px",backgroundSize:W+"px "+U+"px",transition:"all "+wdi_transition_duration+"ms ease-in-out "+S+"ms",transform:"none"})}var v=jQuery(A).find("img");var D=jQuery('<span style="display: block;" />').addClass("wdi_grid");jQuery(A).prepend(D);var z=jQuery(".wdi_slide_bg");var n=v.width();var b=v.height();var C=z.width(),h=z.height(),q=Math.floor(C/k),e=Math.floor(h/L),d=C-(k*q),G=Math.ceil(d/k),p=h-(L*e),f=Math.ceil(p/L),t=0,y=Math.ceil((jQuery(".wdi_slide_bg").width()-v.width())/2);var E=typeof v.attr("src")=="undefined"?"":v.attr("src");I=I==="auto"?C:I;I=I==="min-auto"?-C:I;H=H==="auto"?h:H;H=H==="min-auto"?-h:H;for(var K=0;K<k;K++){var N=0,m=Math.floor((jQuery(".wdi_slide_bg").height()-v.height())/2),B=q;if(d>0){var c=d>=G?G:d;B+=c;d-=c}for(var J=0;J<L;J++){var r=e,s=p;if(s>0){c=s>=f?f:p;r+=c;s-=c}D.append(x(B,r,N,m,t,y,E,n,b,K,J));N+=r;m-=r}y-=B;t+=B}var a=D.children().last();D.show();v.css("opacity",0);D.children().first().addClass("rs-top-left");D.children().last().addClass("rs-bottom-right");D.children().eq(L-1).addClass("rs-bottom-left");D.children().eq(-L).addClass("rs-top-right");setTimeout(function(){D.children().css({opacity:u,transform:"rotate("+w+"deg) translateX("+I+"px) translateY("+H+"px) scale("+o+")"})},1);jQuery(M).css("opacity",1);jQuery(a).one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(l));function l(){jQuery(A).css({opacity:0,"z-index":1});jQuery(M).css({opacity:1,"z-index":2});v.css("opacity",1);D.remove();wdi_trans_in_progress=false;jQuery(A).html("");if(typeof event_stack!=="undefined"){if(event_stack.length>0){key=event_stack[0].split("-");event_stack.shift();wdi_change_image(key[0],key[1],wdi_data,true)}}wdi_change_watermark_container()}}function wdi_sliceH(b,a,c){if(c=="right"){var d="min-auto"}else{if(c=="left"){var d="auto"}}wdi_grid(1,8,0,d,0,1,0,b,a,c)}function wdi_sliceV(b,a,d){if(d=="right"){var c="min-auto"}else{if(d=="left"){var c="auto"}}wdi_grid(10,1,0,0,c,1,0,b,a,d)}function wdi_slideV(b,a,d){if(d=="right"){var c="auto"}else{if(d=="left"){var c="min-auto"}}wdi_grid(1,1,0,0,c,1,1,b,a,d)}function wdi_slideH(b,a,c){if(c=="right"){var d="min-auto"}else{if(c=="left"){var d="auto"}}wdi_grid(1,1,0,d,0,1,1,b,a,c)}function wdi_scaleOut(b,a,c){wdi_grid(1,1,0,0,0,1.5,0,b,a,c)}function wdi_scaleIn(b,a,c){wdi_grid(1,1,0,0,0,0.5,0,b,a,c)}function wdi_blockScale(b,a,c){wdi_grid(8,6,0,0,0,0.6,0,b,a,c)}function wdi_kaleidoscope(b,a,c){wdi_grid(10,8,0,0,0,1,0,b,a,c)}function wdi_fan(b,a,d){if(d=="right"){var c=45;var e=100}else{if(d=="left"){var c=-45;var e=-100}}wdi_grid(1,10,c,e,0,1,0,b,a,d)}function wdi_blindV(b,a,c){wdi_grid(1,8,0,0,0,0.7,0,b,a)}function wdi_blindH(b,a,c){wdi_grid(10,1,0,0,0,0.7,0,b,a)}function wdi_random(c,b,d){var a=["sliceH","sliceV","slideH","slideV","scaleOut","scaleIn","blockScale","kaleidoscope","fan","blindH","blindV"];this["wdi_"+a[Math.floor(Math.random()*a.length)]](c,b,d)}function wdi_pause_stream(a){jQuery(a).find("video").each(function(){jQuery(this).get(0).pause()})}function wdi_reset_zoom(){var a=(/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));var b=document.querySelector('meta[name="viewport"]');if(a){if(b){b.content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0"}}};
1
+ var isPopUpOpened=false;var wdi_data=[];function wdi_spider_createpopup(a,k,b,m,e,l,f,j,h){a=a.replace(/&#038;/g,"&");if(isPopUpOpened){return}isPopUpOpened=true;if(wdi_spider_hasalreadyreceivedpopup(l)||wdi_spider_isunsupporteduseragent()){return}jQuery("html").attr("style","overflow:hidden !important;");jQuery("#wdi_spider_popup_loading_"+k).css({display:"block"});jQuery("#wdi_spider_popup_overlay_"+k).css({display:"block"});var d=0;var c;for(var g=0;g<j.parsedData.length;g++){if(j.parsedData[g].id===h){d=g;c=[j.parsedData[g]];break}}jQuery.ajax({type:"POST",url:a,dataType:"text",data:{action:"WDIGalleryBox",image_rows:JSON.stringify(c),feed_id:j.feed_row.id,feed_counter:j.feed_row.wdi_feed_counter,current_image_index:d,image_rows_count:j.parsedData.length,carousel_media_row:JSON.stringify(c[0].carousel_media)},success:function(o){var n=jQuery('<div id="wdi_spider_popup_wrap" class="wdi_spider_popup_wrap wdi_lightbox_theme_'+j.feed_row.theme_id+'" style="width:'+b+"px;height:"+m+"px;margin-top:-"+(m/2)+"px;margin-left: -"+(b/2)+'px; ">'+o+"</div>");var p=new wdi_construct_popup(n,j,j.parsedData,h);p.construct();n.hide().appendTo("body");wdi_spider_showpopup(l,f,n,e);jQuery("#wdi_spider_popup_loading_"+k).css({display:"none !important;"})}})}var wdi_construct_popup=function(a,b,c,d){this.theme_row={};this.construct=function(){this.theme_row=window["wdi_theme_"+b.feed_row.theme_id];if(b.feed_row.popup_enable_filmstrip&&b.feed_row.popup_enable_filmstrip==="1"){this.add_filmstrip()}this.set_wdi_data()};this.add_filmstrip=function(){var l="horizontal";if(this.theme_row.lightbox_filmstrip_pos==="right"||this.theme_row.lightbox_filmstrip_pos==="left"){l="vertical"}var y=(l==="horizontal")?"fa-angle-left":"fa-angle-up";var x=(l==="horizontal")?"fa-angle-right":"fa-angle-down";var h="";var q,f;if(l==="horizontal"){f=q=(typeof b.feed_row.popup_filmstrip_height!=="undefined")?(b.feed_row.popup_filmstrip_height):"20"}else{f=q=(typeof b.feed_row.popup_filmstrip_height!=="undefined")?(b.feed_row.popup_filmstrip_height):"50"}q=f=parseInt(f);for(var w=0;w<c.length;w++){var e=c[w];var s,k,A;if(e.resolution&&e.resolution!==""){var n=e.resolution.split(" ");var p=intval($resolution_arr[0]);var z=intval($resolution_arr[2]);if(p!==0&&z!==0){A=Math.max(f/p,q/z);s=p*A;k=z*A}else{s=f;k=q}}else{s=f;k=q}A=Math.max(f/s,q/k);s*=A;k*=A;var g=(f-s)/2;var j=(q-k)/2;var u="wdi_filmstrip_thumbnail "+((parseInt(e.id)===parseInt(d))?"wdi_thumb_active":"wdi_thumb_deactive");var t="width:"+s+"px;height:"+k+"px;margin-left:"+g+"px;margin-top:"+j+"px;";var m=(typeof e.images[b.feedImageResolution]!=="undefined"&&typeof e.images[b.feedImageResolution]["url"]!=="undefined")?e.images[b.feedImageResolution]["url"]:e.thumb_url;var B="wdi_change_image(parseInt(jQuery('#wdi_current_image_key').val()), '"+w+"', wdi_data)";var v="wdi_change_image(parseInt(jQuery('#wdi_current_image_key').val()), '"+w+"', wdi_data)";var r='<img style="'+t+'" class="wdi_filmstrip_thumbnail_img" src="'+m+'" onclick="'+B+'" ontouchend="'+v+'" image_id="'+e.id+'" image_key="'+w+'" alt="'+e.alt+'" />';h+='<div id="wdi_filmstrip_thumbnail_'+w+'" class="'+u+'">'+r+"</div>"}var o='<div class="wdi_filmstrip_left"><i class="fa '+y+'"></i></div><div class="wdi_filmstrip"><div class="wdi_filmstrip_thumbnails">'+h+'</div></div><div class="wdi_filmstrip_right"><i class="fa '+x+'"></i></div>';a.find(".wdi_filmstrip_container").append(o)};this.set_wdi_data=function(){wdi_data=[];for(var e=0;e<c.length;e++){wdi_data[e]=[];wdi_data[e]["number"]=e+1;wdi_data[e]["id"]=c[e].id;wdi_data[e]["alt"]=c[e].alt;wdi_data[e]["description"]=wdi_front.escape_tags(c[e].description);wdi_data[e]["username"]=c[e].username;wdi_data[e]["profile_picture"]=c[e].profile_picture;wdi_data[e]["image_url"]=c[e].image_url;wdi_data[e]["thumb_url"]=c[e].thumb_url;wdi_data[e]["date"]=c[e].date;wdi_data[e]["comment_count"]=c[e].comment_count;wdi_data[e]["filetype"]=c[e].filetype;wdi_data[e]["filename"]=c[e].filename;wdi_data[e]["avg_rating"]=c[e].avg_rating;wdi_data[e]["rate"]=c[e].rate;wdi_data[e]["rate_count"]=c[e].rate_count;wdi_data[e]["hit_count"]=c[e].hit_count;wdi_data[e]["comments_data"]=(typeof c[e].comments_data!=="undefined")?c[e].comments_data:"null";wdi_data[e]["carousel_media"]=(typeof c[e]["carousel_media"]!=="undefined")?c[e]["carousel_media"]:null}}};function wdi_spider_showpopup(c,a,b,d){isPopUpOpened=true;b.show();wdi_spider_receivedpopup(c,a)}function wdi_spider_hasalreadyreceivedpopup(a){if(document.cookie.indexOf(a)>-1){delete document.cookie[document.cookie.indexOf(a)]}return false}function wdi_spider_receivedpopup(c,a){var b=new Date();b.setDate(b.getDate()+a);document.cookie=c+"=true;expires="+b.toUTCString()+";path=/"}function wdi_spider_isunsupporteduseragent(){return(!window.XMLHttpRequest)}function wdi_spider_destroypopup(d){if(document.getElementById("wdi_spider_popup_wrap")!=null){wdi_comments_manager.popup_destroyed();if(typeof jQuery().fullscreen!=="undefined"&&jQuery.isFunction(jQuery().fullscreen)){if(jQuery.fullscreen.isFullScreen()){jQuery.fullscreen.exit()}}if(typeof enable_addthis!="undefined"&&enable_addthis){jQuery(".at4-share-outer").hide()}setTimeout(function(){jQuery(".wdi_spider_popup_wrap").remove();jQuery(".wdi_spider_popup_loading").css({display:"none"});jQuery(".wdi_spider_popup_overlay").css({display:"none"});jQuery(document).off("keydown");jQuery("html").attr("style","")},20)}isPopUpOpened=false;var a=(/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));var c=document.querySelector('meta[name="viewport"]');if(a&&c){c.content="width=device-width, initial-scale=1"}var b=jQuery(document).scrollTop();window.location.hash="";jQuery(document).scrollTop(b);if(typeof wdi_playInterval!="undefined"){clearInterval(wdi_playInterval)}}Object.size=function(c){var b=0,a;for(a in c){if(c.hasOwnProperty(a)){b++}}return b};function wdi_spider_ajax_save(a,b){wdi_comments_manager.init(b);return false}wdi_comments_manager={media_id:"",mediaComments:[],load_more_count:10,commentCounter:0,currentKey:-1,init:function(a){this.instagram=new WDIInstagram();this.instagram.addToken(wdi_front.access_token);if(this.currentKey!=a){this.currentKey=a;this.reset_comments()}else{}},reset_comments:function(){jQuery("#wdi_load_more_comments").remove();jQuery("#wdi_added_comments").html("");this.commentCounter=0;this.media_id=wdi_data[this.currentKey]["id"];this.getAjaxComments(this.currentKey)},popup_destroyed:function(){this.media_id="";this.mediaComments=[];this.commentCounter=0;this.currentKey=-1},showComments:function(f,e){if(Object.size(f)-this.commentCounter-e<0||e===undefined){e=Object.size(f)-this.commentCounter}var b=this.commentCounter;for(i=Object.size(f)-b-1;i>=Object.size(f)-b-e;i--){this.commentCounter++;var d=(f[i]["text"]);d=wdi_front.escape_tags(d);d=this.filterCommentText(d);var g=(f[i]["from"]["username"]);var c=(f[i]["from"]["profile_picture"]);var a=jQuery('<div class="wdi_single_comment"></div>');a.append(jQuery('<p class="wdi_comment_header_p"><span class="wdi_comment_header"><a target="_blank" href="//instagram.com/'+g+'">'+g+'</a></span><span class="wdi_comment_date">'+wdi_front.convertUnixDate(f[i]["created_time"])+"</span></p>"));a.append(jQuery('<div class="wdi_comment_body_p"><span class="wdi_comment_body"><p>'+d+"</p></span></div>"));jQuery("#wdi_added_comments").prepend(a)}this.updateScrollbar()},updateScrollbar:function(){var b=jQuery("#wdi_comments");var a=jQuery("#wdi_added_comments");jQuery(".wdi_comments").attr("class","wdi_comments");jQuery(".wdi_comments").html("");jQuery(".wdi_comments").append(b);jQuery(".wdi_comments").append(a);jQuery(".wdi_comments_close_btn").on("click",wdi_comment)},getAjaxComments:function(){this.instagram.getRecentMediaComments(this.media_id,{success:function(a){if(a==""||a==undefined||a==null){errorMessage="Network Error, please try again later :(";console.log("%c"+errorMessage,"color:#cc0000;");return}if(a.meta["code"]!=200){errorMessage=a.meta["error_message"];console.log("%c"+errorMessage,"color:#cc0000;");return}wdi_comments_manager.mediaComments=a.data;var b=wdi_data[wdi_comments_manager.currentKey];b.comments_data=a.data;wdi_comments_manager.showComments(b.comments_data,wdi_comments_manager.load_more_count);wdi_comments_manager.ajax_comments_ready(a.data)}})},ajax_comments_ready:function(a){this.createLoadMoreAndBindEvent()},createLoadMoreAndBindEvent:function(){jQuery("#wdi_added_comments").prepend(jQuery('<p id="wdi_load_more_comments" class="wdi_load_more_comments">load more comments</p>'));jQuery(".wdi_comment_container #wdi_load_more_comments").on("click",function(){jQuery(this).remove();wdi_comments_manager.showComments(wdi_comments_manager.mediaComments,wdi_comments_manager.load_more_count);wdi_comments_manager.createLoadMoreAndBindEvent()})},filterCommentText:function(d){var c=d.split(" ");var b="";for(var a=0;a<c.length;a++){switch(c[a][0]){case"@":b+='<a target="blank" class="wdi_comm_text_link" href="//instagram.com/'+c[a].substring(1,c[a].length)+'">'+c[a]+"</a> ";break;case"#":b+='<a target="blank" class="wdi_comm_text_link" href="//instagram.com/explore/tags/'+c[a].substring(1,c[a].length)+'">'+c[a]+"</a> ";break;default:b+=c[a]+" "}}b=b.substring(0,b.length-1);return b}};function wdi_spider_set_input_value(b,a){if(document.getElementById(b)){document.getElementById(b).value=a}}function wdi_spider_form_submit(b,a){if(document.getElementById(a)){document.getElementById(a).submit()}if(b.preventDefault){b.preventDefault()}else{b.returnValue=false}}function wdi_spider_check_required(b,a){if(jQuery("#"+b).val()==""){wdi_front.show_alert(a+"* "+wdi_objectL10n.wdi_field_required);jQuery("#"+b).attr("style","border-color: #FF0000;");jQuery("#"+b).focus();return true}else{return false}}function wdi_spider_check_email(b){if(jQuery("#"+b).val()!=""){var a=jQuery("#"+b).val().replace(/^\s+|\s+$/g,"");if(a.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)==-1){wdi_front.show_alert(wdi_objectL10n.wdi_mail_validation);return true}return false}}function wdi_captcha_refresh(a){if(document.getElementById(a+"_img")&&document.getElementById(a+"_input")){srcArr=document.getElementById(a+"_img").src.split("&r=");document.getElementById(a+"_img").src=srcArr[0]+"&r="+Math.floor(Math.random()*100);document.getElementById(a+"_img").style.display="inline-block";document.getElementById(a+"_input").value=""}}function wdi_play_pause(e){var f=navigator.userAgent.indexOf("Chrome")>-1;var d=navigator.userAgent.indexOf("Safari")>-1;if((f)&&(d)){d=false}if(d){return}var c=e.get(0);var b=/firefox/i;var a=false;if(navigator.userAgent.match(b)){a=true}if(!a){if(!c.paused){c.pause()}else{c.play()}}}function wdi_spider_display_embed(m,n,j,g){var b="";switch(m){case"EMBED_OEMBED_YOUTUBE_VIDEO":var k="<iframe ";if(n!=""){k+=' src="//www.youtube.com/embed/'+n+'?enablejsapi=1&wmode=transparent"'}for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){k+=" "+attr+'="'+j[attr]+'"'}}}k+=" ></iframe>";b+=k;break;case"EMBED_OEMBED_VIMEO_VIDEO":var f="<iframe ";if(n!=""){f+=' src="//player.vimeo.com/video/'+n+'?enablejsapi=1"'}for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){f+=" "+attr+'="'+j[attr]+'"'}}}f+=" ></iframe>";b+=f;break;case"EMBED_OEMBED_FLICKR_IMAGE":var d="<div ";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){d+=" "+attr+'="'+j[attr]+'"'}}}d+=" >";if(n!=""){d+='<img src="'+n+'" style="max-width:100% !important; max-height:100% !important; width:auto !important; height:auto !important;">'}d+="</div>";b+=d;break;case"EMBED_OEMBED_FLICKR_VIDEO":break;case"EMBED_OEMBED_INSTAGRAM_VIDEO":var e="<div ";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){e+=" "+attr+'="'+j[attr]+'"'}}}e+=" >";if(n!=""){e+='<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls><source src="'+n+'" type="video/mp4"> Your browser does not support the video tag. </video>'}e+="</div>";b+=e;break;case"EMBED_OEMBED_INSTAGRAM_IMAGE":var e="<div ";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){e+=" "+attr+'="'+j[attr]+'"'}}}e+=" >";if(g!=null&&g.length){for(var c=0;c<g.length;c++){if(g[c]["type"]=="image"){e+='<img src="'+g[c]["images"]["standard_resolution"]["url"]+'" style="max-width:100% !important; max-height:100% !important; width:auto !important; height:auto !important;" data-id="'+c+'" class="carousel_media '+(c==0?"active":"")+'">'}else{if(g[c]["type"]=="video"){e+='<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls data-id="'+c+'" class="carousel_media '+(c==0?"active":"")+'"><source src="'+g[c]["videos"]["standard_resolution"]["url"]+'" type="video/mp4"> Your browser does not support the video tag. </video>'}}}}else{if(n!=""){e+='<img src="//instagram.com/p/'+n+'/media/?size=l" style=" max-width:100% !important; max-height:100% !important; width:auto; height:auto;">'}}e+="</div>";b+=e;break;case"EMBED_OEMBED_INSTAGRAM_POST":var e="<div ";var a="";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){e+=" "+attr+'="'+j[attr]+'"';if(attr=="CLASS"||attr=="class"||attr=="Class"){obj_class=j[attr]}}}}e+=" >";if(n!=""){e+='<iframe class="inner_instagram_iframe_'+obj_class+'" src="//instagr.am/p/'+n+'/embed/?enablejsapi=1" style="max-width:100% !important; max-height:100% !important; width:100%; height:100%; margin:0; display:table-cell; vertical-align:middle;"frameborder="0" scrolling="no" allowtransparency="false" allowfullscreen></iframe>'}e+="</div>";b+=e;break;case"EMBED_OEMBED_DAILYMOTION_VIDEO":var l="<iframe ";if(n!=""){l+=' src="//www.dailymotion.com/embed/video/'+n+'?api=postMessage"'}for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){l+=" "+attr+'="'+j[attr]+'"'}}}l+=" ></iframe>";b+=l;break;case"EMBED_OEMBED_IMGUR":var h="<div ";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){e+=" "+attr+'="'+j[attr]+'"'}}}h+=" >";if(n!=""){h+='<img src="'+n+'" style="max-width:100% !important; max-height:100% !important; width:auto; height:auto !important;">'}h+="</div>";b+=h;break;default:}return b}function wdi_testBrowser_cssTransitions(){return wdi_testDom("Transition")}function wdi_testBrowser_cssTransforms3d(){return wdi_testDom("Perspective")}function wdi_testDom(d){var a=["","-webkit-","-moz-","-ms-","-o-","-khtml-"];var c=["","Webkit","Moz","ms","O","Khtml"];var b=c.length;while(b--){if(typeof document.body.style[c[b]+d]!=="undefined"){return true}}return false}function wdi_cube(c,d,b,a,k,l,h,j,e,g){if(!wdi_testBrowser_cssTransitions()){return wdi_fallback(j,e,g)}if(!wdi_testBrowser_cssTransforms3d()){return wdi_fallback3d(j,e,g)}wdi_trans_in_progress=true;jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive");jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");jQuery(".wdi_slide_bg").css("perspective",1000);jQuery(j).css({transform:"translateZ("+c+"px)",backfaceVisibility:"hidden"});jQuery(e).css({opacity:1,filter:"Alpha(opacity=100)",backfaceVisibility:"hidden",transform:"translateY("+b+"px) translateX("+d+"px) rotateY("+k+"deg) rotateX("+a+"deg)"});jQuery(".wdi_slider").css({transform:"translateZ(-"+c+"px)",transformStyle:"preserve-3d"});setTimeout(function(){jQuery(".wdi_slider").css({transition:"all "+wdi_transition_duration+"ms ease-in-out",transform:"translateZ(-"+c+"px) rotateX("+l+"deg) rotateY("+h+"deg)"})},20);jQuery(".wdi_slider").one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(f));function f(){jQuery(j).removeAttr("style");jQuery(e).removeAttr("style");jQuery(".wdi_slider").removeAttr("style");jQuery(j).css({opacity:0,filter:"Alpha(opacity=0)","z-index":1});jQuery(e).css({opacity:1,filter:"Alpha(opacity=100)","z-index":2});wdi_trans_in_progress=false;jQuery(j).html("");if(typeof event_stack!=="undefined"){if(event_stack.length>0){key=event_stack[0].split("-");event_stack.shift();wdi_change_image(key[0],key[1],wdi_data,true)}}wdi_change_watermark_container()}}function wdi_cubeH(b,a,d){var c=jQuery(b).width()/2;if(d=="right"){wdi_cube(c,c,0,0,90,0,-90,b,a,d)}else{if(d=="left"){wdi_cube(c,-c,0,0,-90,0,90,b,a,d)}}}function wdi_cubeV(b,a,d){var c=jQuery(b).height()/2;if(d=="right"){wdi_cube(c,0,-c,90,0,-90,0,b,a,d)}else{if(d=="left"){wdi_cube(c,0,c,-90,0,90,0,b,a,d)}}}function wdi_fallback(b,a,c){wdi_fade(b,a,c)}function wdi_fallback3d(b,a,c){wdi_sliceV(b,a,c)}function wdi_none(b,a,c){jQuery(b).css({opacity:0,"z-index":1});jQuery(a).css({opacity:1,"z-index":2});jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive");jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");wdi_trans_in_progress=false;jQuery(b).html("");wdi_change_watermark_container()}function wdi_fade(b,a,c){jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive");jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");if(wdi_testBrowser_cssTransitions()){jQuery(a).css("transition","opacity "+wdi_transition_duration+"ms linear");jQuery(b).css({opacity:0,"z-index":1});jQuery(a).css({opacity:1,"z-index":2});wdi_change_watermark_container()}else{jQuery(b).animate({opacity:0,"z-index":1},wdi_transition_duration);jQuery(a).animate({opacity:1,"z-index":2},{duration:wdi_transition_duration,complete:function(){wdi_trans_in_progress=false;jQuery(b).html("");wdi_change_watermark_container()}});jQuery(b).fadeTo(wdi_transition_duration,0);jQuery(a).fadeTo(wdi_transition_duration,1)}}function wdi_grid(k,L,w,I,H,o,u,A,M,g){if(!wdi_testBrowser_cssTransitions()){return wdi_fallback(A,M,g)}wdi_trans_in_progress=true;jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive");jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");var F=(wdi_transition_duration)/(k+L);function x(P,Y,V,R,Q,X,O,W,U,T,j){var S=(T+j)*F;return jQuery('<span class="wdi_gridlet" />').css({display:"block",width:P,height:Y,top:V,left:Q,backgroundImage:'url("'+O+'")',backgroundColor:jQuery(".wdi_spider_popup_wrap").css("background-color"),backgroundRepeat:"no-repeat",backgroundPosition:X+"px "+R+"px",backgroundSize:W+"px "+U+"px",transition:"all "+wdi_transition_duration+"ms ease-in-out "+S+"ms",transform:"none"})}var v=jQuery(A).find("img");var D=jQuery('<span style="display: block;" />').addClass("wdi_grid");jQuery(A).prepend(D);var z=jQuery(".wdi_slide_bg");var n=v.width();var b=v.height();var C=z.width(),h=z.height(),q=Math.floor(C/k),e=Math.floor(h/L),d=C-(k*q),G=Math.ceil(d/k),p=h-(L*e),f=Math.ceil(p/L),t=0,y=Math.ceil((jQuery(".wdi_slide_bg").width()-v.width())/2);var E=typeof v.attr("src")=="undefined"?"":v.attr("src");I=I==="auto"?C:I;I=I==="min-auto"?-C:I;H=H==="auto"?h:H;H=H==="min-auto"?-h:H;for(var K=0;K<k;K++){var N=0,m=Math.floor((jQuery(".wdi_slide_bg").height()-v.height())/2),B=q;if(d>0){var c=d>=G?G:d;B+=c;d-=c}for(var J=0;J<L;J++){var r=e,s=p;if(s>0){c=s>=f?f:p;r+=c;s-=c}D.append(x(B,r,N,m,t,y,E,n,b,K,J));N+=r;m-=r}y-=B;t+=B}var a=D.children().last();D.show();v.css("opacity",0);D.children().first().addClass("rs-top-left");D.children().last().addClass("rs-bottom-right");D.children().eq(L-1).addClass("rs-bottom-left");D.children().eq(-L).addClass("rs-top-right");setTimeout(function(){D.children().css({opacity:u,transform:"rotate("+w+"deg) translateX("+I+"px) translateY("+H+"px) scale("+o+")"})},1);jQuery(M).css("opacity",1);jQuery(a).one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(l));function l(){jQuery(A).css({opacity:0,"z-index":1});jQuery(M).css({opacity:1,"z-index":2});v.css("opacity",1);D.remove();wdi_trans_in_progress=false;jQuery(A).html("");if(typeof event_stack!=="undefined"){if(event_stack.length>0){key=event_stack[0].split("-");event_stack.shift();wdi_change_image(key[0],key[1],wdi_data,true)}}wdi_change_watermark_container()}}function wdi_sliceH(b,a,c){if(c=="right"){var d="min-auto"}else{if(c=="left"){var d="auto"}}wdi_grid(1,8,0,d,0,1,0,b,a,c)}function wdi_sliceV(b,a,d){if(d=="right"){var c="min-auto"}else{if(d=="left"){var c="auto"}}wdi_grid(10,1,0,0,c,1,0,b,a,d)}function wdi_slideV(b,a,d){if(d=="right"){var c="auto"}else{if(d=="left"){var c="min-auto"}}wdi_grid(1,1,0,0,c,1,1,b,a,d)}function wdi_slideH(b,a,c){if(c=="right"){var d="min-auto"}else{if(c=="left"){var d="auto"}}wdi_grid(1,1,0,d,0,1,1,b,a,c)}function wdi_scaleOut(b,a,c){wdi_grid(1,1,0,0,0,1.5,0,b,a,c)}function wdi_scaleIn(b,a,c){wdi_grid(1,1,0,0,0,0.5,0,b,a,c)}function wdi_blockScale(b,a,c){wdi_grid(8,6,0,0,0,0.6,0,b,a,c)}function wdi_kaleidoscope(b,a,c){wdi_grid(10,8,0,0,0,1,0,b,a,c)}function wdi_fan(b,a,d){if(d=="right"){var c=45;var e=100}else{if(d=="left"){var c=-45;var e=-100}}wdi_grid(1,10,c,e,0,1,0,b,a,d)}function wdi_blindV(b,a,c){wdi_grid(1,8,0,0,0,0.7,0,b,a)}function wdi_blindH(b,a,c){wdi_grid(10,1,0,0,0,0.7,0,b,a)}function wdi_random(c,b,d){var a=["sliceH","sliceV","slideH","slideV","scaleOut","scaleIn","blockScale","kaleidoscope","fan","blindH","blindV"];this["wdi_"+a[Math.floor(Math.random()*a.length)]](c,b,d)}function wdi_pause_stream(a){jQuery(a).find("video").each(function(){jQuery(this).get(0).pause()})}function wdi_reset_zoom(){var a=(/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));var b=document.querySelector('meta[name="viewport"]');if(a){if(b){b.content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0"}}};
js/wdi_admin.js CHANGED
@@ -164,9 +164,9 @@ function wdi_multiple_accounts_option_controller(){
164
 
165
  function wdi_advanced_option_controller() {
166
 
167
- var $table = jQuery(jQuery('#wdi_user_id').closest('form').find('.form-table').get(2));
168
  $table.addClass('wdi_advanced_option wdi_advanced_option_close');
169
- var tr = "<tr class='wdi_advanced_option_head'><th>ADVANCED OPTIONS</th><td><div class='wdi_advanced_option_icon'></div></td></tr>";
170
  $tr = jQuery(tr);
171
  $table.prepend($tr);
172
 
@@ -546,24 +546,40 @@ wdi_controller.makeInstagramUserRequest = function(user_input, ignoreConfirm) {
546
  if (wdi_version.is_pro == 'false') {
547
  if (jQuery('.wdi_user').length == 1) {
548
  alert(wdi_messages.only_one_user_or_hashtag);
549
- return;
550
  }
551
  }
552
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
553
 
 
554
 
555
  switch (input_type) {
556
  case 'user':
557
  {
 
 
 
 
558
 
559
- if(_this.feed_users.length > 0){
560
- for(var i in _this.feed_users){
561
- if(_this.feed_users[i].username[0] !== '#'){
562
- alert("You can add only one username");
563
- return false;
564
- }
565
- }
566
- }
567
 
568
  var token = '';
569
  if(user_input === wdi_options.wdi_user_name){
@@ -572,7 +588,7 @@ wdi_controller.makeInstagramUserRequest = function(user_input, ignoreConfirm) {
572
  token = _this.users_list[user_input].access_token;
573
  }else{
574
  alert("You can add only your usernames ( " + _this.usersnames.join(', ') + " )");
575
- return;
576
  }
577
 
578
  this.instagram.resetTokens();
@@ -581,6 +597,8 @@ wdi_controller.makeInstagramUserRequest = function(user_input, ignoreConfirm) {
581
  this.instagram.getSelfInfo({
582
  success: function(response) {
583
 
 
 
584
  //contains information about response such as error messages and if
585
  //response is valid or not
586
  var vObj = _this.isValidResponse(response);
@@ -638,10 +656,17 @@ wdi_controller.makeInstagramUserRequest = function(user_input, ignoreConfirm) {
638
  case 'hashtag':
639
  {
640
 
 
 
 
 
 
641
  var tagname = user_input.substr(1, user_input.length);
642
  tagname = tagname.replace(" ",'');
643
  this.instagram.getTagRecentMedia(tagname, {
644
  success: function(response) {
 
 
645
  //contain information about response such as error messages and if
646
  //response is valid or not
647
  var vObj = _this.isValidResponse(response);
@@ -745,7 +770,8 @@ wdi_controller.stringifyUserData = function(feed_users) {
745
  for (var i = 0; i < feed_users.length; i++) {
746
  users.push({
747
  username: feed_users[i]['username'],
748
- id: feed_users[i]['id']
 
749
  })
750
  }
751
  return JSON.stringify(users);
@@ -759,13 +785,31 @@ wdi_controller.stringifyUserData = function(feed_users) {
759
  */
760
  wdi_controller.bindAddNewUserOrHashtagEvent = function() {
761
  jQuery('#wdi_add_user_ajax').on('click', function() {
 
 
 
 
 
 
762
  var user_input = jQuery('#wdi_add_user_ajax_input').val().trim().toLowerCase();
763
- wdi_controller.makeInstagramUserRequest(user_input);
 
 
764
  });
765
  jQuery('#wdi_add_user_ajax_input').on("keypress", function(e) {
766
  if (e.keyCode == 13) {
767
  var user_input = jQuery('#wdi_add_user_ajax_input').val().trim().toLowerCase();
768
- wdi_controller.makeInstagramUserRequest(user_input);
 
 
 
 
 
 
 
 
 
 
769
  return false; // prevent the button click from happening
770
  }
771
  });
@@ -1035,7 +1079,7 @@ wdi_controller.addHashtag = function(tagname, response) {
1035
  jQuery('#wdi_add_user_ajax_input').attr('value', '');
1036
  var profile_picture;
1037
  if (typeof response != 'undefined') {
1038
- profile_picture = (response['data'].length != 0) ? response['data'][0]['images']['thumbnail']['url'] : '';
1039
  } else {
1040
  profile_picture = '';
1041
  }
@@ -1043,7 +1087,8 @@ wdi_controller.addHashtag = function(tagname, response) {
1043
  this.feed_users.push({
1044
  username: '#' + tagname,
1045
  id: '#' + tagname,
1046
- profile_picture: profile_picture
 
1047
  });
1048
 
1049
  var user_input = '#' + tagname;
164
 
165
  function wdi_advanced_option_controller() {
166
 
167
+ var $table = jQuery(jQuery('#wdi_user_id').closest('form').find('.form-table').get(1));
168
  $table.addClass('wdi_advanced_option wdi_advanced_option_close');
169
+ var tr = "<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>";
170
  $tr = jQuery(tr);
171
  $table.prepend($tr);
172
 
546
  if (wdi_version.is_pro == 'false') {
547
  if (jQuery('.wdi_user').length == 1) {
548
  alert(wdi_messages.only_one_user_or_hashtag);
549
+ return false;
550
  }
551
  }
552
 
553
+ var hashtag_feed = input_type === "hashtag";
554
+ var user_feed = input_type === "user";
555
+
556
+ for(var i in _this.feed_users){
557
+
558
+ if(_this.feed_users[i].username.charAt(0) === "#"){
559
+ hashtag_feed = true;
560
+ }else{
561
+ user_feed = true;
562
+ }
563
+
564
+ if(user_feed && hashtag_feed){
565
+ alert("You can add only username or hashtags.");//todo
566
+ return false;
567
+ }
568
 
569
+ }
570
 
571
  switch (input_type) {
572
  case 'user':
573
  {
574
+ if(typeof wdi_options.wdi_access_token === "undefined" || wdi_options.wdi_access_token === ""){
575
+ alert("To display your feed media , get Instagram API token from settings page.");
576
+ return false;
577
+ }
578
 
579
+ if (_this.feed_users.length > 0) {
580
+ alert("You can add only one username");
581
+ return false;
582
+ }
 
 
 
 
583
 
584
  var token = '';
585
  if(user_input === wdi_options.wdi_user_name){
588
  token = _this.users_list[user_input].access_token;
589
  }else{
590
  alert("You can add only your usernames ( " + _this.usersnames.join(', ') + " )");
591
+ return false;
592
  }
593
 
594
  this.instagram.resetTokens();
597
  this.instagram.getSelfInfo({
598
  success: function(response) {
599
 
600
+ jQuery('#wdi_add_user_ajax').removeAttr('disabled');
601
+
602
  //contains information about response such as error messages and if
603
  //response is valid or not
604
  var vObj = _this.isValidResponse(response);
656
  case 'hashtag':
657
  {
658
 
659
+ if(typeof wdi_options.fb_token === "undefined" || wdi_options.fb_token === ""){
660
+ alert("To display hashtag media , get Facebook API token from settings page.");
661
+ return false;
662
+ }
663
+
664
  var tagname = user_input.substr(1, user_input.length);
665
  tagname = tagname.replace(" ",'');
666
  this.instagram.getTagRecentMedia(tagname, {
667
  success: function(response) {
668
+ jQuery('#wdi_add_user_ajax').removeAttr('disabled');
669
+
670
  //contain information about response such as error messages and if
671
  //response is valid or not
672
  var vObj = _this.isValidResponse(response);
770
  for (var i = 0; i < feed_users.length; i++) {
771
  users.push({
772
  username: feed_users[i]['username'],
773
+ id: feed_users[i]['id'],
774
+ tag_id: (typeof feed_users[i]['tag_id'] !== "undefined") ? feed_users[i]['tag_id'] : ""
775
  })
776
  }
777
  return JSON.stringify(users);
785
  */
786
  wdi_controller.bindAddNewUserOrHashtagEvent = function() {
787
  jQuery('#wdi_add_user_ajax').on('click', function() {
788
+ if(typeof jQuery(this).attr('disabled') !== "undefined"){
789
+ return;
790
+ }else{
791
+ jQuery(this).attr('disabled', 'disabled');
792
+ }
793
+
794
  var user_input = jQuery('#wdi_add_user_ajax_input').val().trim().toLowerCase();
795
+ if(wdi_controller.makeInstagramUserRequest(user_input) === false){
796
+ jQuery(this).removeAttr('disabled', 'disabled');
797
+ }
798
  });
799
  jQuery('#wdi_add_user_ajax_input').on("keypress", function(e) {
800
  if (e.keyCode == 13) {
801
  var user_input = jQuery('#wdi_add_user_ajax_input').val().trim().toLowerCase();
802
+
803
+ if(typeof jQuery("#wdi_add_user_ajax").attr('disabled') !== "undefined"){
804
+ return;
805
+ }else{
806
+ jQuery("#wdi_add_user_ajax").attr('disabled', 'disabled');
807
+ }
808
+
809
+ if(wdi_controller.makeInstagramUserRequest(user_input) === false){
810
+ jQuery("#wdi_add_user_ajax").removeAttr('disabled', 'disabled');
811
+ }
812
+
813
  return false; // prevent the button click from happening
814
  }
815
  });
1079
  jQuery('#wdi_add_user_ajax_input').attr('value', '');
1080
  var profile_picture;
1081
  if (typeof response != 'undefined') {
1082
+ profile_picture = (response['data'].length != 0 && typeof response['data'][0]['images']['thumbnail'] !== "undefined") ? response['data'][0]['images']['thumbnail']['url'] : '';
1083
  } else {
1084
  profile_picture = '';
1085
  }
1087
  this.feed_users.push({
1088
  username: '#' + tagname,
1089
  id: '#' + tagname,
1090
+ profile_picture: profile_picture,
1091
+ tag_id: response.tag_id
1092
  });
1093
 
1094
  var user_input = '#' + tagname;
js/wdi_admin.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(){jQuery("#wdi_reset_cache").click(function(c){jQuery(".wdi_reset_cache_success").remove();c.preventDefault();jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,action:"wdi_set_reset_cache"},success:function(d){if(d.success===false){jQuery("#wdi_reset_cache").before("<span class='wdi_reset_cache_success' style='color: #fc0000; margin-left: 15px; line-height: 2;'>Failed</span>")}else{jQuery("#wdi_reset_cache").before("<span class='wdi_reset_cache_success' style='color: #029117; margin-left: 15px; line-height: 2;'>Success</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("#wdi_add_user_ajax").after(jQuery("<br><label class='wdi_pro_only' for='wdi_add_user_ajax_input'>"+wdi_messages.username_hashtag_multiple+"</label>"));if(jQuery("body").hasClass("instagram-feed_page_wdi_settings")){wdi_multiple_accounts_option_controller();wdi_advanced_option_controller()}jQuery(".wdi_section_name").click(function(){b(jQuery(this))});b(false);function b(f){if(f===false){var d={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"};var g=JSON.parse(localStorage.getItem("wdi_sections"));if(g===null||g===false){g=d;localStorage.setItem("wdi_sections",JSON.stringify(g))}for(i in g){var j=jQuery("#wdi_save_feed").find("[data-section_name='"+i+"']");a(g[i],j)}}else{var c=jQuery(f).data("section_name");var h=null;if(f.hasClass("wdi_section_open")){a("show",f);h="show"}else{if(f.hasClass("wdi_section_close")){a("hide",f);h="hide"}}if(h!=null){var e=JSON.parse(localStorage.getItem("wdi_sections"))||{};e[c]=h;localStorage.setItem("wdi_sections",JSON.stringify(e))}}}function a(e,d){if(e==="show"){var c=d.closest(".wdi_section").find(".wdi_elements");if(c.data("display")==="table"){c.css({display:"table"})}else{c.css({display:"block"})}d.css({"border-bottom":"1px solid #f1f1f1",margin:"0 auto 15px"});d.removeClass("wdi_section_open");d.addClass("wdi_section_close")}else{d.closest(".wdi_section").find(".wdi_elements").css({display:"none"});d.css({"border-bottom":"0px",margin:"0 auto 0px"});d.removeClass("wdi_section_close");d.addClass("wdi_section_open")}}});function wdi_multiple_accounts_option_controller(){var b=jQuery(jQuery("#wdi_user_id").closest("form").find(".form-table").get(1));b.addClass("wdi_multiple_accounts_section");var d="";var e=JSON.parse(wdi_options.wdi_authenticated_users_list);var a=0;for(var c in e){d+="<tr data-multiple-account='"+a+"'>";d+="<th>Access Token</th>";d+='<td><input type="text" name="wdi_instagram_options[wdi_authenticated_users_list][access_token][]" size="53" required="" value="'+e[c].access_token+'"></td>';d+="</tr>";d+="<tr data-multiple-account='"+a+"' class='wdi_username_tr'>";d+="<th>Username</th>";d+='<td><div class="wdi_input_wrapper"><input type="text" name="wdi_instagram_options[wdi_authenticated_users_list][user_name][]" size="53" required="" value="'+e[c].user_name+'"></div><div class="wdi_remove_auth_user">Delete</div></td>';d+='<input type="hidden" name="wdi_instagram_options[wdi_authenticated_users_list][user_id][]" size="53" required="" value="'+e[c].user_id+'">';d+="</tr>";a++}b.append(d);jQuery(".wdi_remove_auth_user").on("click",function(g){g.preventDefault();var f=jQuery(this).closest(".wdi_username_tr").data("multiple-account");jQuery(this).closest(".wdi_multiple_accounts_section").find('tr[data-multiple-account="'+f+'"]').remove();return false})}function wdi_advanced_option_controller(){var a=jQuery(jQuery("#wdi_user_id").closest("form").find(".form-table").get(2));a.addClass("wdi_advanced_option wdi_advanced_option_close");var b="<tr class='wdi_advanced_option_head'><th>ADVANCED OPTIONS</th><td><div class='wdi_advanced_option_icon'></div></td></tr>";$tr=jQuery(b);a.prepend($tr);$tr.on("click",function(){if(a.hasClass("wdi_advanced_option_open")){a.removeClass("wdi_advanced_option_open");a.addClass("wdi_advanced_option_close")}else{a.removeClass("wdi_advanced_option_close");a.addClass("wdi_advanced_option_open")}})}function wdi_controller(){}wdi_controller.getParameterByName=function(a){a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var c=new RegExp("[\\?&]"+a+"=([^&#]*)"),b=c.exec(location.search);return b===null?"":decodeURIComponent(b[1].replace(/\+/g," "))};wdi_controller.apiRedirected=function(){var d=this.getParameterByName("access_token");var a=d.split(".");var b=/^[^\\\/&?><"']*$/;for(i=0;i<a.length;i++){if(a[i].match(b)===null){return}}var c=a.join(".");jQuery(document).ready(function(){if(wdi_options.wdi_access_token===""){jQuery("#wdi_access_token").attr("value",c)}else{jQuery(".wdi_more_token_template .wdi_more_access_token").prop("disabled",false);jQuery(".wdi_more_token_template .wdi_more_access_token").attr("value",c)}});wdi_controller.instagram.addToken(c);wdi_controller.getUserInfo(c)};wdi_controller.getUserInfo=function(a){this.instagram.getSelfInfo({success:function(b){if(wdi_options.wdi_access_token===""){jQuery("#wdi_user_name").attr("value",b.data["username"]);jQuery("#wdi_user_id").attr("value",b.data["id"])}else{jQuery(".wdi_more_token_template .wdi_more_user_name").prop("disabled",false);jQuery(".wdi_more_token_template .wdi_more_user_id").prop("disabled",false);jQuery(".wdi_more_token_template .wdi_more_user_name").attr("value",b.data["username"]);jQuery(".wdi_more_token_template .wdi_more_user_id").attr("value",b.data["id"])}jQuery(document).trigger("wdi_settings_filled")}})};wdi_controller.oldDisplayType={};wdi_controller.displayTypeMemory={};wdi_controller.switchFeedTabs=function(d,b){jQuery("#wdi_refresh_tab").attr("value",d);jQuery(".wdi_tab").hide();jQuery("#"+d+"_tab").show();jQuery(".display_type").css("display","none");jQuery('.display_type[tab="'+d+'"]').css("display","block");if(!jQuery('.display_type[tab="'+d+'"]').length){jQuery(".display_type_content").hide()}else{jQuery(".display_type_content").show()}jQuery(".wdi_feed_tabs").filter(".wdi_feed_tab_active").each(function(){jQuery(this).removeClass("wdi_feed_tab_active")});jQuery("#wdi_"+d).addClass("wdi_feed_tab_active");var a=jQuery();var c=false;if(b!=undefined&&b!=""){a=jQuery(".display_type #"+b).prop("checked",true);jQuery("#wdi_feed_type").attr("value",b)}if(!c){a=jQuery('.display_type[tab="'+d+'"] input[name="feed_type"]:checked');if(a.length!=0){c=true}}if(!c){a=jQuery('.display_type[tab="'+d+'"] #thumbnails');if(a.length!=0){c=true;a.prop("checked",true);jQuery("#wdi_feed_type").attr("value","thumbnails")}}if(c){wdi_controller.displaySettingsSection(a)}if(d!="conditional_filters"){jQuery("#wdi-conditional-filters-ui").addClass("wdi_hidden")}else{jQuery("#wdi-conditional-filters-ui").removeClass("wdi_hidden")}};wdi_controller.displaySettingsSection=function(h){var d=h.attr("id").toLowerCase().trim();var g=h.parent().parent().attr("tab");var a=jQuery("#wdi_refresh_section");wdi_controller.oldDisplayType={section:d,tab:g};wdi_controller.displayTypeMemory[g]=wdi_controller.oldDisplayType;if(a!=undefined){a.attr("value",d)}var f=jQuery(".wdi_border_wrapper .form-table");jQuery("#wdi_feed_type").attr("value",d);var e=0,c=0;var b=false;f.find(".wdi_element").each(function(){e++;var j=jQuery(this).find(".wdwt_param").children().children().children().attr("section");if(j!==undefined){b=false;var k=j.toLowerCase().trim().split(",");for(c=0;c<k.length;c++){if(k[c]===d){jQuery(this).css("display","block");b=true}}if(b===false){jQuery(this).css("display","none")}}})};wdi_controller.switchThemeTabs=function(b,a){jQuery(".wdi_feed_tabs").filter(".wdi_feed_tab_active").each(function(){jQuery(this).removeClass("wdi_feed_tab_active")});jQuery("#wdi_"+b).addClass("wdi_feed_tab_active");jQuery("[tab]").each(function(){if(jQuery(this).attr("tab")!=b){jQuery(this).parent().parent().parent().parent().parent().filter("tr").css("display","none")}else{jQuery(this).parent().parent().parent().parent().parent().filter("tr").css("display","block")}});jQuery(".display_type").css("display","none");jQuery('.display_type[tab="'+b+'"]').css("display","block");jQuery("#wdi_refresh_tab").attr("value",b);if(a!=undefined&&a!=""){jQuery("#wdi_refresh_section").attr("value",a)}if(a==undefined&&a!=""){if(wdi_controller.displayTypeMemory[b]!=undefined){jQuery(".display_type #"+wdi_controller.displayTypeMemory[b]["section"]).trigger("click")}else{jQuery('.display_type[tab="'+b+'"]').first().find("input").trigger("click")}}else{jQuery(".display_type #"+a).trigger("click")}};wdi_controller.bindSaveFeedEvent=function(){var a=this;jQuery("#wdi_save_feed_submit").on("click",function(){a.save_feed("save_feed")});jQuery("#wdi_save_feed_apply").on("click",function(){a.save_feed("apply_changes")});jQuery("#wdi_cancel_changes").on("click",function(){a.save_feed("cancel")})};wdi_controller.save_feed=function(d){if("cancel"==d){window.location=window.location.href}wdi_controller.checkIfUserNotSaved(d);if(wdi_controller.waitingAjaxRequestEnd.button!=0){return}jQuery("#task").attr("value",d);var a=this.feed_users,b,c,f,j,h,e={username:jQuery("#wdi_default_user").val(),id:jQuery("#wdi_default_user_id").val()};if(a.length==0){a.push(e);this.updateFeaturedImageSelect(e.username,"add","selected")}b=this.stringifyUserData(a);jQuery("#WDI_feed_users").val(b);if(d=="apply_changes"||d=="save_feed"){c=jQuery("#wdi_add_or_edit").attr("value");jQuery("#wdi_current_id").attr("value",c)}f=jQuery("#WDI_thumb_user").val();h=this.getUserProfilePic(f);if("false"==h||typeof h=="undefined"){var g=this;this.instagram.getSelfInfo({success:function(m){var l=g.isValidResponse(m),k=m.data,n;if(l.valid&&g.hasData(m)&&k){n=k.profile_picture}else{n=""}}});jQuery("#wdi_feed_thumb").attr("value",h);jQuery("#wdi_save_feed").submit()}else{jQuery("#wdi_feed_thumb").attr("value",h);jQuery("#wdi_save_feed").submit()}};wdi_controller.makeInstagramUserRequest=function(d,b){var j,a,g=this,e;a=this.getInputType(d);if(wdi_version.is_pro=="false"){if(jQuery(".wdi_user").length==1){alert(wdi_messages.only_one_user_or_hashtag);return}}switch(a){case"user":if(g.feed_users.length>0){for(var f in g.feed_users){if(g.feed_users[f].username[0]!=="#"){alert("You can add only one username");return false}}}var c="";if(d===wdi_options.wdi_user_name){c=wdi_options.wdi_access_token}else{if(typeof g.users_list[d]!=="undefined"){c=g.users_list[d].access_token}else{alert("You can add only your usernames ( "+g.usersnames.join(", ")+" )");return}}this.instagram.resetTokens();this.instagram.addToken(c);this.instagram.getSelfInfo({success:function(m){var l=g.isValidResponse(m);if(l.valid==false){alert(l.msg);return}var k=m.data;if(l.valid&&g.hasData(m)){g.addUser(k)}else{if(!k){alert(wdi_messages.user_not_exist.replace("%s",'"'+d+'"'))}else{alert(l.msg)}}}});break;case"hashtag":var h=d.substr(1,d.length);h=h.replace(" ","");this.instagram.getTagRecentMedia(h,{success:function(l){var k=g.isValidResponse(l);if(k.valid&&g.hasData(l)){g.addHashtag(h,l);if(wdi_version.is_pro=="false"){if(jQuery(".wdi_user").length==1){jQuery("#wdi_add_user_ajax_input").attr("disabled","disabled");jQuery("#wdi_add_user_ajax_input").attr("placeholder",wdi_messages.available_in_pro)}}}else{if(!g.hasData(l)&&k.msg=="success"){if(b!=true){if(confirm(wdi_messages.hashtag_no_data)){g.addHashtag(h,l);if(wdi_version.is_pro=="false"){if(jQuery(".wdi_user").length==1){jQuery("#wdi_add_user_ajax_input").attr("disabled","disabled");jQuery("#wdi_add_user_ajax_input").attr("placeholder",wdi_messages.available_in_pro)}}}else{jQuery("#wdi_add_user_ajax_input").val("")}}else{g.addHashtag(h,l);if(wdi_version.is_pro=="false"){if(jQuery(".wdi_user").length==1){jQuery("#wdi_add_user_ajax_input").attr("disabled","disabled");jQuery("#wdi_add_user_ajax_input").attr("placeholder",wdi_messages.available_in_pro)}}}}else{alert(k.msg)}}}});break}};wdi_controller.checkForDuplicateUser=function(b){for(var a=0;a<this.feed_users.length;a++){if(b==this.feed_users[a]["username"]){return true}}return false};wdi_controller.getInputType=function(a){switch(a[0]){case"#":return"hashtag";break;case"%":return"location";break;default:return"user";break}};wdi_controller.stringifyUserData=function(a){var c=[];for(var b=0;b<a.length;b++){c.push({username:a[b]["username"],id:a[b]["id"]})}return JSON.stringify(c)};wdi_controller.bindAddNewUserOrHashtagEvent=function(){jQuery("#wdi_add_user_ajax").on("click",function(){var a=jQuery("#wdi_add_user_ajax_input").val().trim().toLowerCase();wdi_controller.makeInstagramUserRequest(a)});jQuery("#wdi_add_user_ajax_input").on("keypress",function(b){if(b.keyCode==13){var a=jQuery("#wdi_add_user_ajax_input").val().trim().toLowerCase();wdi_controller.makeInstagramUserRequest(a);return false}})};wdi_controller.removeFeedUser=function(b){var c=b.parent().find("a span").text();if(b.parent().find("a span").hasClass("wdi_hashtag")){c="#"+c}for(var a=0;a<this.feed_users.length;a++){if(this.feed_users[a]["username"]==c){this.feed_users.splice(a,1);break}}b.parent().remove();if(c!==jQuery("#wdi_default_user").val()){wdi_controller.updateFeaturedImageSelect(c,"remove")}if(wdi_version.is_pro=="false"){if(jQuery(".wdi_user").length==0){jQuery("#wdi_add_user_ajax_input").removeAttr("disabled");jQuery("#wdi_add_user_ajax_input").attr("placeholder","")}}};wdi_controller.updateFeaturedImageSelect=function(f,e,d){var a=jQuery("#WDI_thumb_user");if(d!="selected"){d=""}switch(e){case"add":var b=a.find('option[value="'+f+'"]').length;if(!b){var c=jQuery("<option "+d+' value="'+f+'">'+f+"</option>");a.append(c)}break;case"remove":a.find('option[value="'+f+'"]').remove();if(this.feed_users.length>0){a.val(this.feed_users[0].username)}break}};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 a=jQuery("#wdi_add_or_edit").attr("value");jQuery("#wdi_current_id").attr("value",a);jQuery("#wdi_save_feed").submit()});jQuery("#wdi_save_theme_reset").on("click",function(){jQuery("#task").attr("value","reset_changes");var a=jQuery("#wdi_add_or_edit").attr("value");jQuery("#wdi_current_id").attr("value",a);jQuery("#wdi_save_feed").submit()})};wdi_controller.checkIfUserNotSaved=function(b){switch(b){case"save_feed":b="submit";break;case"apply_changes":b="apply";break;case"reset_changes":b="reset";break}if(jQuery("#wdi_add_user_ajax_input").val().trim()!=""){var a=jQuery("#wdi_add_user_ajax_input").val().trim().toLowerCase();wdi_controller.waitingAjaxRequestEnd={button:b};wdi_controller.makeInstagramUserRequest(a);return 1}else{wdi_controller.waitingAjaxRequestEnd={button:0};return 0}};wdi_controller.saveFeedAfterAjaxWait=function(b){if(wdi_controller.waitingAjaxRequestEnd!=undefined){var a=wdi_controller.waitingAjaxRequestEnd.button;if(b&&a!=0){jQuery("#wdi_save_feed_"+a).trigger("click")}wdi_controller.waitingAjaxRequestEnd=undefined}};wdi_controller.getCookie=function(a){var b="; "+document.cookie;var c=b.split("; "+a+"=");if(c.length==2){return c.pop().split(";").shift()}};wdi_controller.isValidResponse=function(a){var b={};if(typeof a=="undefined"||typeof a.meta["code"]=="undefined"||a.meta["code"]!=200){b.valid=false;if(typeof a=="undefined"){b.msg=wdi_messages.instagram_server_error}else{if(a.meta["code"]!==200){b.msg=a.meta["error_message"]}else{b.msg=""}}}else{b.valid=true;b.msg="success"}return b};wdi_controller.hasData=function(a){if(typeof a!="undefined"&&typeof a.data!="undefined"&&a.data.length!=0){return true}else{return false}};wdi_controller.thumbUser=function(a){return(this.feed_users.length>0&&this.feed_users[0].username===a)};wdi_controller.findUser=function(d,a){var c=[];if(typeof a!="undefined"&&typeof a.data!="undefined"){c=a.data}for(var b=0;b<c.length;b++){if(c[b]["username"]==d){return c[b]}}return false};wdi_controller.addHashtag=function(e,c){if(e.match(/[~!@$%&*#^()<>?]/)==null){if(this.checkForDuplicateUser("#"+e)==false){var b=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").append(b);jQuery("#wdi_add_user_ajax_input").attr("value","");var d;if(typeof c!="undefined"){d=(c.data.length!=0)?c.data[0]["images"]["thumbnail"]["url"]:""}else{d=""}this.feed_users.push({username:"#"+e,id:"#"+e,profile_picture:d});var a="#"+e;selected=this.thumbUser(a)?"selected":"";wdi_controller.updateFeaturedImageSelect(a,"add",selected)}else{alert("#"+e+" "+wdi_messages.already_added)}}else{alert(wdi_messages.invalid_hashtag)}this.updateConditionalFiltersUi();wdi_controller.saveFeedAfterAjaxWait(true)};wdi_controller.addUser=function(a){if(this.checkForDuplicateUser(a.username)==false){newUser=jQuery('<div class="wdi_user"><a target="_blank" href="http://www.instagram.com/'+a.username+'"><img class="wdi_profile_pic" src="'+a.profile_picture+'"><span class="wdi_username">'+a.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").append(newUser);jQuery("#wdi_add_user_ajax_input").attr("value","");this.feed_users.push({username:a.username,id:a.id,profile_picture:a.profile_picture})}else{alert(a.username+" "+wdi_messages.already_added)}selected=this.thumbUser(a.username)?"selected":"";this.updateFeaturedImageSelect(a.username,"add",selected);this.updateConditionalFiltersUi();wdi_controller.saveFeedAfterAjaxWait(true)};wdi_controller.getUserProfilePic=function(b){for(var a=0;a<this.feed_users.length;a++){if(b==this.feed_users[a]["username"]){return this.feed_users[a]["profile_picture"]}}return"false"};wdi_controller.conditionalFiltersTabInit=function(){this.setInitialFilters();this.updateFiltersUi();var b=this;jQuery("#wdi_add_filter").on("click",function(){b.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(c){if(c.keyCode==13){b.addConditionalFilter();jQuery(this).val("");return false}});a();jQuery("#WDI_wrap_conditional_filter_enable input").on("change",function(){a()});function a(){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");break}}jQuery("#WDI_conditional_filter_type").on("change",function(){if(jQuery(this).val()=="none"){}else{jQuery("#WDI_conditional_filters").css("display","block")}jQuery(this).parent().find("label").css({"line-height":"24px",height:"24px",padding:"2px 5px",display:"inline-block","font-size":"15px",color:"black","font-weight":"500","-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","-o-user-select":"none","user-select":"none"});switch(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);break}wdi_controller.updateFiltersUi()});jQuery("#WDI_conditional_filter_type").trigger("change")};wdi_controller.addConditionalFilter=function(){var b=jQuery("#wdi_filter_input").val(),a=jQuery("#wdi_filter_type").val(),c={};if(b==""){return}b=b.trim();switch(a){case"username":if(b[0]=="@"){b=b.substr(1,b.length)}break;case"mention":if(b[0]=="@"){b=b.substr(1,b.length)}break;case"hashtag":if(b[0]=="#"){b=b.substr(1,b.length)}break;case"url":var d=/^(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;if(!d.test(b)){alert(wdi_messages.invalid_url);return}break}c={filter_type:a,filter_by:b,id:this.randomId()};if(a!=null){if(!this.filterExists(c)){this.conditionalFilters.push(c);this.updateFiltersUi()}else{alert(b+" "+wdi_messages.already_added)}}else{alert(wdi_messages.selectConditionType)}};wdi_controller.filterExists=function(b){for(var a=0;a<this.conditionalFilters.length;a++){if(this.conditionalFilters[a].filter_type==b.filter_type&&this.conditionalFilters[a].filter_by==b.filter_by){return true}}return false};wdi_controller.updateFiltersUi=function(){var a=jQuery("#wdi_filters_ui").html("");for(var b=0;b<this.conditionalFilters.length;b++){if(b==0){if(this.conditionalFilters.length!=1){switch(jQuery("#WDI_conditional_filter_type").val()){case"AND":break;case"OR":a.append(jQuery('<span class="wdi_logic">'+wdi_messages.either+"</span>"));break;case"NOR":a.append(jQuery('<span class="wdi_logic">'+wdi_messages.neither+"</span>"));break}}else{switch(jQuery("#WDI_conditional_filter_type").val()){case"AND":break;case"OR":break;case"NOR":a.append(jQuery('<span class="wdi_logic">'+wdi_messages.not+"</span>"));break}}}var c;switch(jQuery("#WDI_conditional_filter_type").val()){case"AND":c=wdi_messages.and;break;case"OR":c=wdi_messages.or;break;case"NOR":c=wdi_messages.nor;break}if(b>=1){a.append(jQuery('<span class="wdi_logic">'+c+"</span>"))}a.append(this.createUiElement(this.conditionalFilters[b]))}this.updateFilterTextarea()};wdi_controller.createUiElement=function(b){var c;switch(b.filter_type){case"mention":c="@";break;case"hashtag":c="#";break;case"location":c="%";break;default:c="";break}var a=jQuery('<span data-id="'+b.id+'" class="wdi_filter_item wdi_filter_by_'+b.filter_type+'"></span>').html(c+b.filter_by+'<span onclick="wdi_controller.removeConditionalFilter(jQuery(this));" class="wdi_remove_filter">X</span>');return a};wdi_controller.randomId=function(){var c="";var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(var b=0;b<5;b++){c+=a.charAt(Math.floor(Math.random()*a.length))}return c};wdi_controller.removeConditionalFilter=function(b){var c=b.parent().attr("data-id");for(var a=0;a<this.conditionalFilters.length;a++){if(this.conditionalFilters[a]["id"]==c){this.conditionalFilters.splice(a,1)}}this.updateFiltersUi()};wdi_controller.updateFilterTextarea=function(){var a,b=this.conditionalFilters;a=JSON.stringify(b);jQuery("#wdi_conditional_filters_textarea").val(a)};wdi_controller.setInitialFilters=function(){var b=[],a=jQuery("#wdi_conditional_filters_textarea").val();if(this.isJsonString(a)){b=JSON.parse(a)}this.conditionalFilters=b};wdi_controller.updateConditionalFiltersUi=function(){wdi_controller.updateFilterSource()};wdi_controller.updateFilterSource=function(){if(jQuery('input[name="wdi_feed_settings[liked_feed]"]:checked').val()=="liked"){var a=jQuery("#wdi_filter_source").html("");var d="<div class='wdi_source_user'><span class='wdi_source_username'>Media I liked</span></div>";a.html(a.html()+d);return}var f=[],e,c;jQuery(".wdi_user").each(function(){if(jQuery(this).find(".wdi_username").length!=0){e=jQuery(this).find(".wdi_username").text()}else{e=jQuery(this).find(".wdi_hashtag").text()}c=jQuery(this).find("img").attr("src");f.push({username:e,image:c})});var a=jQuery("#wdi_filter_source").html("");for(var b=0;b<f.length;b++){var d="<div class='wdi_source_user'><span class='wdi_source_img'><img src='"+f[b].image+"'></span><span class='wdi_source_username'>"+f[b].username+"</span></div>";a.html(a.html()+d)}};wdi_controller.isJsonString=function(b){try{JSON.parse(b)}catch(a){return false}return true};function wdi_spider_select_value(a){a.focus();a.select()}function wdi_spider_set_input_value(b,a){if(a==="add"){if(jQuery("#wdi_access_token").attr("value")==""){alert("Please get your access token")}}if(document.getElementById(b)){document.getElementById(b).value=a}}function wdi_spider_form_submit(b,a){if(document.getElementById(a)){document.getElementById(a).submit()}if(b.preventDefault){b.preventDefault()}else{b.returnValue=false}}function wdi_bulk_actions(a){var b=jQuery(a).val();if(b!=""){if(b=="delete_all"){if(!confirm(wdi_messages.do_you_want_to_delete_selected_items)){return false}}wdi_spider_set_input_value("task",b);jQuery("#wdi_feed_form").submit()}else{return false}return true}function wdi_spider_check_all_items(){wdi_spider_check_all_items_checkbox();jQuery("#check_all").trigger("click")}function wdi_spider_check_all_items_checkbox(){if(jQuery("#check_all_items").attr("checked")){jQuery("#check_all_items").attr("checked",false);jQuery("#draganddrop").hide()}else{var b=(parseInt(jQuery(".displaying-num").html())?parseInt(jQuery(".displaying-num").html()):0);var a=(jQuery('input[id^="check_pr_"]').length?parseInt(jQuery('input[id^="check_pr_"]').length):0);var c=a+b;jQuery("#check_all_items").attr("checked",true);if(c){jQuery("#draganddrop").html("<strong><p>Selected "+c+" item"+(c>1?"s":"")+".</p></strong>");jQuery("#draganddrop").show()}}}function wdi_spider_check_all(a){if(!jQuery(a).attr("checked")){jQuery("#check_all_items").attr("checked",false);jQuery("#draganddrop").hide()}}function wdi_spider_set_input_value(b,a){if(a==="add"){if(jQuery("#wdi_access_token").attr("value")==""){alert("Please get your access token")}}if(document.getElementById(b)){document.getElementById(b).value=a}};
1
+ jQuery(document).ready(function(){jQuery("#wdi_reset_cache").click(function(c){jQuery(".wdi_reset_cache_success").remove();c.preventDefault();jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,action:"wdi_set_reset_cache"},success:function(d){if(d.success===false){jQuery("#wdi_reset_cache").before("<span class='wdi_reset_cache_success' style='color: #fc0000; margin-left: 15px; line-height: 2;'>Failed</span>")}else{jQuery("#wdi_reset_cache").before("<span class='wdi_reset_cache_success' style='color: #029117; margin-left: 15px; line-height: 2;'>Success</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("#wdi_add_user_ajax").after(jQuery("<br><label class='wdi_pro_only' for='wdi_add_user_ajax_input'>"+wdi_messages.username_hashtag_multiple+"</label>"));if(jQuery("body").hasClass("instagram-feed_page_wdi_settings")){wdi_multiple_accounts_option_controller();wdi_advanced_option_controller()}jQuery(".wdi_section_name").click(function(){b(jQuery(this))});b(false);function b(f){if(f===false){var d={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"};var g=JSON.parse(localStorage.getItem("wdi_sections"));if(g===null||g===false){g=d;localStorage.setItem("wdi_sections",JSON.stringify(g))}for(i in g){var j=jQuery("#wdi_save_feed").find("[data-section_name='"+i+"']");a(g[i],j)}}else{var c=jQuery(f).data("section_name");var h=null;if(f.hasClass("wdi_section_open")){a("show",f);h="show"}else{if(f.hasClass("wdi_section_close")){a("hide",f);h="hide"}}if(h!=null){var e=JSON.parse(localStorage.getItem("wdi_sections"))||{};e[c]=h;localStorage.setItem("wdi_sections",JSON.stringify(e))}}}function a(e,d){if(e==="show"){var c=d.closest(".wdi_section").find(".wdi_elements");if(c.data("display")==="table"){c.css({display:"table"})}else{c.css({display:"block"})}d.css({"border-bottom":"1px solid #f1f1f1",margin:"0 auto 15px"});d.removeClass("wdi_section_open");d.addClass("wdi_section_close")}else{d.closest(".wdi_section").find(".wdi_elements").css({display:"none"});d.css({"border-bottom":"0px",margin:"0 auto 0px"});d.removeClass("wdi_section_close");d.addClass("wdi_section_open")}}});function wdi_multiple_accounts_option_controller(){var b=jQuery(jQuery("#wdi_user_id").closest("form").find(".form-table").get(1));b.addClass("wdi_multiple_accounts_section");var d="";var e=JSON.parse(wdi_options.wdi_authenticated_users_list);var a=0;for(var c in e){d+="<tr data-multiple-account='"+a+"'>";d+="<th>Access Token</th>";d+='<td><input type="text" name="wdi_instagram_options[wdi_authenticated_users_list][access_token][]" size="53" required="" value="'+e[c].access_token+'"></td>';d+="</tr>";d+="<tr data-multiple-account='"+a+"' class='wdi_username_tr'>";d+="<th>Username</th>";d+='<td><div class="wdi_input_wrapper"><input type="text" name="wdi_instagram_options[wdi_authenticated_users_list][user_name][]" size="53" required="" value="'+e[c].user_name+'"></div><div class="wdi_remove_auth_user">Delete</div></td>';d+='<input type="hidden" name="wdi_instagram_options[wdi_authenticated_users_list][user_id][]" size="53" required="" value="'+e[c].user_id+'">';d+="</tr>";a++}b.append(d);jQuery(".wdi_remove_auth_user").on("click",function(g){g.preventDefault();var f=jQuery(this).closest(".wdi_username_tr").data("multiple-account");jQuery(this).closest(".wdi_multiple_accounts_section").find('tr[data-multiple-account="'+f+'"]').remove();return false})}function wdi_advanced_option_controller(){var a=jQuery(jQuery("#wdi_user_id").closest("form").find(".form-table").get(1));a.addClass("wdi_advanced_option wdi_advanced_option_close");var b="<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>";$tr=jQuery(b);a.prepend($tr);$tr.on("click",function(){if(a.hasClass("wdi_advanced_option_open")){a.removeClass("wdi_advanced_option_open");a.addClass("wdi_advanced_option_close")}else{a.removeClass("wdi_advanced_option_close");a.addClass("wdi_advanced_option_open")}})}function wdi_controller(){}wdi_controller.getParameterByName=function(a){a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var c=new RegExp("[\\?&]"+a+"=([^&#]*)"),b=c.exec(location.search);return b===null?"":decodeURIComponent(b[1].replace(/\+/g," "))};wdi_controller.apiRedirected=function(){var d=this.getParameterByName("access_token");var a=d.split(".");var b=/^[^\\\/&?><"']*$/;for(i=0;i<a.length;i++){if(a[i].match(b)===null){return}}var c=a.join(".");jQuery(document).ready(function(){if(wdi_options.wdi_access_token===""){jQuery("#wdi_access_token").attr("value",c)}else{jQuery(".wdi_more_token_template .wdi_more_access_token").prop("disabled",false);jQuery(".wdi_more_token_template .wdi_more_access_token").attr("value",c)}});wdi_controller.instagram.addToken(c);wdi_controller.getUserInfo(c)};wdi_controller.getUserInfo=function(a){this.instagram.getSelfInfo({success:function(b){if(wdi_options.wdi_access_token===""){jQuery("#wdi_user_name").attr("value",b.data["username"]);jQuery("#wdi_user_id").attr("value",b.data["id"])}else{jQuery(".wdi_more_token_template .wdi_more_user_name").prop("disabled",false);jQuery(".wdi_more_token_template .wdi_more_user_id").prop("disabled",false);jQuery(".wdi_more_token_template .wdi_more_user_name").attr("value",b.data["username"]);jQuery(".wdi_more_token_template .wdi_more_user_id").attr("value",b.data["id"])}jQuery(document).trigger("wdi_settings_filled")}})};wdi_controller.oldDisplayType={};wdi_controller.displayTypeMemory={};wdi_controller.switchFeedTabs=function(d,b){jQuery("#wdi_refresh_tab").attr("value",d);jQuery(".wdi_tab").hide();jQuery("#"+d+"_tab").show();jQuery(".display_type").css("display","none");jQuery('.display_type[tab="'+d+'"]').css("display","block");if(!jQuery('.display_type[tab="'+d+'"]').length){jQuery(".display_type_content").hide()}else{jQuery(".display_type_content").show()}jQuery(".wdi_feed_tabs").filter(".wdi_feed_tab_active").each(function(){jQuery(this).removeClass("wdi_feed_tab_active")});jQuery("#wdi_"+d).addClass("wdi_feed_tab_active");var a=jQuery();var c=false;if(b!=undefined&&b!=""){a=jQuery(".display_type #"+b).prop("checked",true);jQuery("#wdi_feed_type").attr("value",b)}if(!c){a=jQuery('.display_type[tab="'+d+'"] input[name="feed_type"]:checked');if(a.length!=0){c=true}}if(!c){a=jQuery('.display_type[tab="'+d+'"] #thumbnails');if(a.length!=0){c=true;a.prop("checked",true);jQuery("#wdi_feed_type").attr("value","thumbnails")}}if(c){wdi_controller.displaySettingsSection(a)}if(d!="conditional_filters"){jQuery("#wdi-conditional-filters-ui").addClass("wdi_hidden")}else{jQuery("#wdi-conditional-filters-ui").removeClass("wdi_hidden")}};wdi_controller.displaySettingsSection=function(h){var d=h.attr("id").toLowerCase().trim();var g=h.parent().parent().attr("tab");var a=jQuery("#wdi_refresh_section");wdi_controller.oldDisplayType={section:d,tab:g};wdi_controller.displayTypeMemory[g]=wdi_controller.oldDisplayType;if(a!=undefined){a.attr("value",d)}var f=jQuery(".wdi_border_wrapper .form-table");jQuery("#wdi_feed_type").attr("value",d);var e=0,c=0;var b=false;f.find(".wdi_element").each(function(){e++;var j=jQuery(this).find(".wdwt_param").children().children().children().attr("section");if(j!==undefined){b=false;var k=j.toLowerCase().trim().split(",");for(c=0;c<k.length;c++){if(k[c]===d){jQuery(this).css("display","block");b=true}}if(b===false){jQuery(this).css("display","none")}}})};wdi_controller.switchThemeTabs=function(b,a){jQuery(".wdi_feed_tabs").filter(".wdi_feed_tab_active").each(function(){jQuery(this).removeClass("wdi_feed_tab_active")});jQuery("#wdi_"+b).addClass("wdi_feed_tab_active");jQuery("[tab]").each(function(){if(jQuery(this).attr("tab")!=b){jQuery(this).parent().parent().parent().parent().parent().filter("tr").css("display","none")}else{jQuery(this).parent().parent().parent().parent().parent().filter("tr").css("display","block")}});jQuery(".display_type").css("display","none");jQuery('.display_type[tab="'+b+'"]').css("display","block");jQuery("#wdi_refresh_tab").attr("value",b);if(a!=undefined&&a!=""){jQuery("#wdi_refresh_section").attr("value",a)}if(a==undefined&&a!=""){if(wdi_controller.displayTypeMemory[b]!=undefined){jQuery(".display_type #"+wdi_controller.displayTypeMemory[b]["section"]).trigger("click")}else{jQuery('.display_type[tab="'+b+'"]').first().find("input").trigger("click")}}else{jQuery(".display_type #"+a).trigger("click")}};wdi_controller.bindSaveFeedEvent=function(){var a=this;jQuery("#wdi_save_feed_submit").on("click",function(){a.save_feed("save_feed")});jQuery("#wdi_save_feed_apply").on("click",function(){a.save_feed("apply_changes")});jQuery("#wdi_cancel_changes").on("click",function(){a.save_feed("cancel")})};wdi_controller.save_feed=function(d){if("cancel"==d){window.location=window.location.href}wdi_controller.checkIfUserNotSaved(d);if(wdi_controller.waitingAjaxRequestEnd.button!=0){return}jQuery("#task").attr("value",d);var a=this.feed_users,b,c,f,j,h,e={username:jQuery("#wdi_default_user").val(),id:jQuery("#wdi_default_user_id").val()};if(a.length==0){a.push(e);this.updateFeaturedImageSelect(e.username,"add","selected")}b=this.stringifyUserData(a);jQuery("#WDI_feed_users").val(b);if(d=="apply_changes"||d=="save_feed"){c=jQuery("#wdi_add_or_edit").attr("value");jQuery("#wdi_current_id").attr("value",c)}f=jQuery("#WDI_thumb_user").val();h=this.getUserProfilePic(f);if("false"==h||typeof h=="undefined"){var g=this;this.instagram.getSelfInfo({success:function(m){var l=g.isValidResponse(m),k=m.data,n;if(l.valid&&g.hasData(m)&&k){n=k.profile_picture}else{n=""}}});jQuery("#wdi_feed_thumb").attr("value",h);jQuery("#wdi_save_feed").submit()}else{jQuery("#wdi_feed_thumb").attr("value",h);jQuery("#wdi_save_feed").submit()}};wdi_controller.makeInstagramUserRequest=function(d,b){var l,a,h=this,e;a=this.getInputType(d);if(wdi_version.is_pro=="false"){if(jQuery(".wdi_user").length==1){alert(wdi_messages.only_one_user_or_hashtag);return false}}var k=a==="hashtag";var g=a==="user";for(var f in h.feed_users){if(h.feed_users[f].username.charAt(0)==="#"){k=true}else{g=true}if(g&&k){alert("You can add only username or hashtags.");return false}}switch(a){case"user":if(typeof wdi_options.wdi_access_token==="undefined"||wdi_options.wdi_access_token===""){alert("To display your feed media , get Instagram API token from settings page.");return false}if(h.feed_users.length>0){alert("You can add only one username");return false}var c="";if(d===wdi_options.wdi_user_name){c=wdi_options.wdi_access_token}else{if(typeof h.users_list[d]!=="undefined"){c=h.users_list[d].access_token}else{alert("You can add only your usernames ( "+h.usersnames.join(", ")+" )");return false}}this.instagram.resetTokens();this.instagram.addToken(c);this.instagram.getSelfInfo({success:function(o){jQuery("#wdi_add_user_ajax").removeAttr("disabled");var n=h.isValidResponse(o);if(n.valid==false){alert(n.msg);return}var m=o.data;if(n.valid&&h.hasData(o)){h.addUser(m)}else{if(!m){alert(wdi_messages.user_not_exist.replace("%s",'"'+d+'"'))}else{alert(n.msg)}}}});break;case"hashtag":if(typeof wdi_options.fb_token==="undefined"||wdi_options.fb_token===""){alert("To display hashtag media , get Facebook API token from settings page.");return false}var j=d.substr(1,d.length);j=j.replace(" ","");this.instagram.getTagRecentMedia(j,{success:function(n){jQuery("#wdi_add_user_ajax").removeAttr("disabled");var m=h.isValidResponse(n);if(m.valid&&h.hasData(n)){h.addHashtag(j,n);if(wdi_version.is_pro=="false"){if(jQuery(".wdi_user").length==1){jQuery("#wdi_add_user_ajax_input").attr("disabled","disabled");jQuery("#wdi_add_user_ajax_input").attr("placeholder",wdi_messages.available_in_pro)}}}else{if(!h.hasData(n)&&m.msg=="success"){if(b!=true){if(confirm(wdi_messages.hashtag_no_data)){h.addHashtag(j,n);if(wdi_version.is_pro=="false"){if(jQuery(".wdi_user").length==1){jQuery("#wdi_add_user_ajax_input").attr("disabled","disabled");jQuery("#wdi_add_user_ajax_input").attr("placeholder",wdi_messages.available_in_pro)}}}else{jQuery("#wdi_add_user_ajax_input").val("")}}else{h.addHashtag(j,n);if(wdi_version.is_pro=="false"){if(jQuery(".wdi_user").length==1){jQuery("#wdi_add_user_ajax_input").attr("disabled","disabled");jQuery("#wdi_add_user_ajax_input").attr("placeholder",wdi_messages.available_in_pro)}}}}else{alert(m.msg)}}}});break}};wdi_controller.checkForDuplicateUser=function(b){for(var a=0;a<this.feed_users.length;a++){if(b==this.feed_users[a]["username"]){return true}}return false};wdi_controller.getInputType=function(a){switch(a[0]){case"#":return"hashtag";break;case"%":return"location";break;default:return"user";break}};wdi_controller.stringifyUserData=function(a){var c=[];for(var b=0;b<a.length;b++){c.push({username:a[b]["username"],id:a[b]["id"],tag_id:(typeof a[b]["tag_id"]!=="undefined")?a[b]["tag_id"]:""})}return JSON.stringify(c)};wdi_controller.bindAddNewUserOrHashtagEvent=function(){jQuery("#wdi_add_user_ajax").on("click",function(){if(typeof jQuery(this).attr("disabled")!=="undefined"){return}else{jQuery(this).attr("disabled","disabled")}var a=jQuery("#wdi_add_user_ajax_input").val().trim().toLowerCase();if(wdi_controller.makeInstagramUserRequest(a)===false){jQuery(this).removeAttr("disabled","disabled")}});jQuery("#wdi_add_user_ajax_input").on("keypress",function(b){if(b.keyCode==13){var a=jQuery("#wdi_add_user_ajax_input").val().trim().toLowerCase();if(typeof jQuery("#wdi_add_user_ajax").attr("disabled")!=="undefined"){return}else{jQuery("#wdi_add_user_ajax").attr("disabled","disabled")}if(wdi_controller.makeInstagramUserRequest(a)===false){jQuery("#wdi_add_user_ajax").removeAttr("disabled","disabled")}return false}})};wdi_controller.removeFeedUser=function(b){var c=b.parent().find("a span").text();if(b.parent().find("a span").hasClass("wdi_hashtag")){c="#"+c}for(var a=0;a<this.feed_users.length;a++){if(this.feed_users[a]["username"]==c){this.feed_users.splice(a,1);break}}b.parent().remove();if(c!==jQuery("#wdi_default_user").val()){wdi_controller.updateFeaturedImageSelect(c,"remove")}if(wdi_version.is_pro=="false"){if(jQuery(".wdi_user").length==0){jQuery("#wdi_add_user_ajax_input").removeAttr("disabled");jQuery("#wdi_add_user_ajax_input").attr("placeholder","")}}};wdi_controller.updateFeaturedImageSelect=function(f,e,d){var a=jQuery("#WDI_thumb_user");if(d!="selected"){d=""}switch(e){case"add":var b=a.find('option[value="'+f+'"]').length;if(!b){var c=jQuery("<option "+d+' value="'+f+'">'+f+"</option>");a.append(c)}break;case"remove":a.find('option[value="'+f+'"]').remove();if(this.feed_users.length>0){a.val(this.feed_users[0].username)}break}};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 a=jQuery("#wdi_add_or_edit").attr("value");jQuery("#wdi_current_id").attr("value",a);jQuery("#wdi_save_feed").submit()});jQuery("#wdi_save_theme_reset").on("click",function(){jQuery("#task").attr("value","reset_changes");var a=jQuery("#wdi_add_or_edit").attr("value");jQuery("#wdi_current_id").attr("value",a);jQuery("#wdi_save_feed").submit()})};wdi_controller.checkIfUserNotSaved=function(b){switch(b){case"save_feed":b="submit";break;case"apply_changes":b="apply";break;case"reset_changes":b="reset";break}if(jQuery("#wdi_add_user_ajax_input").val().trim()!=""){var a=jQuery("#wdi_add_user_ajax_input").val().trim().toLowerCase();wdi_controller.waitingAjaxRequestEnd={button:b};wdi_controller.makeInstagramUserRequest(a);return 1}else{wdi_controller.waitingAjaxRequestEnd={button:0};return 0}};wdi_controller.saveFeedAfterAjaxWait=function(b){if(wdi_controller.waitingAjaxRequestEnd!=undefined){var a=wdi_controller.waitingAjaxRequestEnd.button;if(b&&a!=0){jQuery("#wdi_save_feed_"+a).trigger("click")}wdi_controller.waitingAjaxRequestEnd=undefined}};wdi_controller.getCookie=function(a){var b="; "+document.cookie;var c=b.split("; "+a+"=");if(c.length==2){return c.pop().split(";").shift()}};wdi_controller.isValidResponse=function(a){var b={};if(typeof a=="undefined"||typeof a.meta["code"]=="undefined"||a.meta["code"]!=200){b.valid=false;if(typeof a=="undefined"){b.msg=wdi_messages.instagram_server_error}else{if(a.meta["code"]!==200){b.msg=a.meta["error_message"]}else{b.msg=""}}}else{b.valid=true;b.msg="success"}return b};wdi_controller.hasData=function(a){if(typeof a!="undefined"&&typeof a.data!="undefined"&&a.data.length!=0){return true}else{return false}};wdi_controller.thumbUser=function(a){return(this.feed_users.length>0&&this.feed_users[0].username===a)};wdi_controller.findUser=function(d,a){var c=[];if(typeof a!="undefined"&&typeof a.data!="undefined"){c=a.data}for(var b=0;b<c.length;b++){if(c[b]["username"]==d){return c[b]}}return false};wdi_controller.addHashtag=function(e,c){if(e.match(/[~!@$%&*#^()<>?]/)==null){if(this.checkForDuplicateUser("#"+e)==false){var b=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").append(b);jQuery("#wdi_add_user_ajax_input").attr("value","");var d;if(typeof c!="undefined"){d=(c.data.length!=0&&typeof c.data[0]["images"]["thumbnail"]!=="undefined")?c.data[0]["images"]["thumbnail"]["url"]:""}else{d=""}this.feed_users.push({username:"#"+e,id:"#"+e,profile_picture:d,tag_id:c.tag_id});var a="#"+e;selected=this.thumbUser(a)?"selected":"";wdi_controller.updateFeaturedImageSelect(a,"add",selected)}else{alert("#"+e+" "+wdi_messages.already_added)}}else{alert(wdi_messages.invalid_hashtag)}this.updateConditionalFiltersUi();wdi_controller.saveFeedAfterAjaxWait(true)};wdi_controller.addUser=function(a){if(this.checkForDuplicateUser(a.username)==false){newUser=jQuery('<div class="wdi_user"><a target="_blank" href="http://www.instagram.com/'+a.username+'"><img class="wdi_profile_pic" src="'+a.profile_picture+'"><span class="wdi_username">'+a.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").append(newUser);jQuery("#wdi_add_user_ajax_input").attr("value","");this.feed_users.push({username:a.username,id:a.id,profile_picture:a.profile_picture})}else{alert(a.username+" "+wdi_messages.already_added)}selected=this.thumbUser(a.username)?"selected":"";this.updateFeaturedImageSelect(a.username,"add",selected);this.updateConditionalFiltersUi();wdi_controller.saveFeedAfterAjaxWait(true)};wdi_controller.getUserProfilePic=function(b){for(var a=0;a<this.feed_users.length;a++){if(b==this.feed_users[a]["username"]){return this.feed_users[a]["profile_picture"]}}return"false"};wdi_controller.conditionalFiltersTabInit=function(){this.setInitialFilters();this.updateFiltersUi();var b=this;jQuery("#wdi_add_filter").on("click",function(){b.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(c){if(c.keyCode==13){b.addConditionalFilter();jQuery(this).val("");return false}});a();jQuery("#WDI_wrap_conditional_filter_enable input").on("change",function(){a()});function a(){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");break}}jQuery("#WDI_conditional_filter_type").on("change",function(){if(jQuery(this).val()=="none"){}else{jQuery("#WDI_conditional_filters").css("display","block")}jQuery(this).parent().find("label").css({"line-height":"24px",height:"24px",padding:"2px 5px",display:"inline-block","font-size":"15px",color:"black","font-weight":"500","-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","-o-user-select":"none","user-select":"none"});switch(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);break}wdi_controller.updateFiltersUi()});jQuery("#WDI_conditional_filter_type").trigger("change")};wdi_controller.addConditionalFilter=function(){var b=jQuery("#wdi_filter_input").val(),a=jQuery("#wdi_filter_type").val(),c={};if(b==""){return}b=b.trim();switch(a){case"username":if(b[0]=="@"){b=b.substr(1,b.length)}break;case"mention":if(b[0]=="@"){b=b.substr(1,b.length)}break;case"hashtag":if(b[0]=="#"){b=b.substr(1,b.length)}break;case"url":var d=/^(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;if(!d.test(b)){alert(wdi_messages.invalid_url);return}break}c={filter_type:a,filter_by:b,id:this.randomId()};if(a!=null){if(!this.filterExists(c)){this.conditionalFilters.push(c);this.updateFiltersUi()}else{alert(b+" "+wdi_messages.already_added)}}else{alert(wdi_messages.selectConditionType)}};wdi_controller.filterExists=function(b){for(var a=0;a<this.conditionalFilters.length;a++){if(this.conditionalFilters[a].filter_type==b.filter_type&&this.conditionalFilters[a].filter_by==b.filter_by){return true}}return false};wdi_controller.updateFiltersUi=function(){var a=jQuery("#wdi_filters_ui").html("");for(var b=0;b<this.conditionalFilters.length;b++){if(b==0){if(this.conditionalFilters.length!=1){switch(jQuery("#WDI_conditional_filter_type").val()){case"AND":break;case"OR":a.append(jQuery('<span class="wdi_logic">'+wdi_messages.either+"</span>"));break;case"NOR":a.append(jQuery('<span class="wdi_logic">'+wdi_messages.neither+"</span>"));break}}else{switch(jQuery("#WDI_conditional_filter_type").val()){case"AND":break;case"OR":break;case"NOR":a.append(jQuery('<span class="wdi_logic">'+wdi_messages.not+"</span>"));break}}}var c;switch(jQuery("#WDI_conditional_filter_type").val()){case"AND":c=wdi_messages.and;break;case"OR":c=wdi_messages.or;break;case"NOR":c=wdi_messages.nor;break}if(b>=1){a.append(jQuery('<span class="wdi_logic">'+c+"</span>"))}a.append(this.createUiElement(this.conditionalFilters[b]))}this.updateFilterTextarea()};wdi_controller.createUiElement=function(b){var c;switch(b.filter_type){case"mention":c="@";break;case"hashtag":c="#";break;case"location":c="%";break;default:c="";break}var a=jQuery('<span data-id="'+b.id+'" class="wdi_filter_item wdi_filter_by_'+b.filter_type+'"></span>').html(c+b.filter_by+'<span onclick="wdi_controller.removeConditionalFilter(jQuery(this));" class="wdi_remove_filter">X</span>');return a};wdi_controller.randomId=function(){var c="";var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(var b=0;b<5;b++){c+=a.charAt(Math.floor(Math.random()*a.length))}return c};wdi_controller.removeConditionalFilter=function(b){var c=b.parent().attr("data-id");for(var a=0;a<this.conditionalFilters.length;a++){if(this.conditionalFilters[a]["id"]==c){this.conditionalFilters.splice(a,1)}}this.updateFiltersUi()};wdi_controller.updateFilterTextarea=function(){var a,b=this.conditionalFilters;a=JSON.stringify(b);jQuery("#wdi_conditional_filters_textarea").val(a)};wdi_controller.setInitialFilters=function(){var b=[],a=jQuery("#wdi_conditional_filters_textarea").val();if(this.isJsonString(a)){b=JSON.parse(a)}this.conditionalFilters=b};wdi_controller.updateConditionalFiltersUi=function(){wdi_controller.updateFilterSource()};wdi_controller.updateFilterSource=function(){if(jQuery('input[name="wdi_feed_settings[liked_feed]"]:checked').val()=="liked"){var a=jQuery("#wdi_filter_source").html("");var d="<div class='wdi_source_user'><span class='wdi_source_username'>Media I liked</span></div>";a.html(a.html()+d);return}var f=[],e,c;jQuery(".wdi_user").each(function(){if(jQuery(this).find(".wdi_username").length!=0){e=jQuery(this).find(".wdi_username").text()}else{e=jQuery(this).find(".wdi_hashtag").text()}c=jQuery(this).find("img").attr("src");f.push({username:e,image:c})});var a=jQuery("#wdi_filter_source").html("");for(var b=0;b<f.length;b++){var d="<div class='wdi_source_user'><span class='wdi_source_img'><img src='"+f[b].image+"'></span><span class='wdi_source_username'>"+f[b].username+"</span></div>";a.html(a.html()+d)}};wdi_controller.isJsonString=function(b){try{JSON.parse(b)}catch(a){return false}return true};function wdi_spider_select_value(a){a.focus();a.select()}function wdi_spider_set_input_value(b,a){if(a==="add"){if(jQuery("#wdi_access_token").attr("value")==""){alert("Please get your access token")}}if(document.getElementById(b)){document.getElementById(b).value=a}}function wdi_spider_form_submit(b,a){if(document.getElementById(a)){document.getElementById(a).submit()}if(b.preventDefault){b.preventDefault()}else{b.returnValue=false}}function wdi_bulk_actions(a){var b=jQuery(a).val();if(b!=""){if(b=="delete_all"){if(!confirm(wdi_messages.do_you_want_to_delete_selected_items)){return false}}wdi_spider_set_input_value("task",b);jQuery("#wdi_feed_form").submit()}else{return false}return true}function wdi_spider_check_all_items(){wdi_spider_check_all_items_checkbox();jQuery("#check_all").trigger("click")}function wdi_spider_check_all_items_checkbox(){if(jQuery("#check_all_items").attr("checked")){jQuery("#check_all_items").attr("checked",false);jQuery("#draganddrop").hide()}else{var b=(parseInt(jQuery(".displaying-num").html())?parseInt(jQuery(".displaying-num").html()):0);var a=(jQuery('input[id^="check_pr_"]').length?parseInt(jQuery('input[id^="check_pr_"]').length):0);var c=a+b;jQuery("#check_all_items").attr("checked",true);if(c){jQuery("#draganddrop").html("<strong><p>Selected "+c+" item"+(c>1?"s":"")+".</p></strong>");jQuery("#draganddrop").show()}}}function wdi_spider_check_all(a){if(!jQuery(a).attr("checked")){jQuery("#check_all_items").attr("checked",false);jQuery("#draganddrop").hide()}}function wdi_spider_set_input_value(b,a){if(a==="add"){if(jQuery("#wdi_access_token").attr("value")==""){alert("Please get your access token")}}if(document.getElementById(b)){document.getElementById(b).value=a}};
js/wdi_frontend.js CHANGED
@@ -306,6 +306,18 @@ wdi_front.init = function (currentFeed)
306
 
307
  //wdi_front.loadInstagramMedia( currentFeed, currentFeed.feed_row.number_of_photos);
308
 
 
 
 
 
 
 
 
 
 
 
 
 
309
  currentFeed.dataCount = currentFeed.feed_users.length; //1 in case of self feed
310
  var feedResolution = wdi_front.getFeedItemResolution(currentFeed);
311
  currentFeed.feedImageResolution = feedResolution.image;
@@ -857,7 +869,7 @@ wdi_front.masonryDisplayFeedItems = function (data, currentFeed)
857
  /*carousel feature*/
858
  if (data[i]['type'] == 'image') {
859
  var photoTemplate = wdi_front.getPhotoTemplate(currentFeed);
860
- } else if(data[i].hasOwnProperty('videos')) {
861
  var photoTemplate = wdi_front.getVideoTemplate(currentFeed);
862
  }
863
  else{
@@ -1435,7 +1447,11 @@ wdi_front.createObject = function (obj, currentFeed)
1435
  videoUrl = obj.hasOwnProperty('videos') ? obj['videos'][currentFeed.feedVideoResolution]['url'] : '';
1436
  }
1437
 
1438
- var image_url = obj.images[currentFeed.feedImageResolution].url;
 
 
 
 
1439
 
1440
  var imageIndex = currentFeed.imageIndex;
1441
 
@@ -2165,9 +2181,8 @@ wdi_front.loadMoreRequest = function (user, next_url, currentFeed, button)
2165
  /**/
2166
  ///jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter + " .wdi_feed_wrapper").remove(".wdi_nomedia");
2167
 
2168
- currentFeed.instagram.requestByUrl(next_url, {
2169
- success: function (response)
2170
- {
2171
 
2172
  if(typeof response.meta!= "undefined" && typeof response.meta.error_type != "undefined"){
2173
  wdi_front.show_alert(false, response, currentFeed);
@@ -2213,9 +2228,16 @@ wdi_front.loadMoreRequest = function (user, next_url, currentFeed, button)
2213
 
2214
  //checks if load more done then displays feed
2215
  wdi_front.checkForLoadMoreDone(currentFeed, button);
2216
- }
2217
- });
2218
 
 
 
 
 
 
 
 
 
2219
 
2220
 
2221
  }
@@ -2502,7 +2524,7 @@ wdi_front.show = function (name, currentFeed)
2502
  });
2503
  }
2504
  else
2505
- if (_this.getInputType(_user.username) == 'hashtag') {
2506
  currentFeed.instagram.searchForTagsByName(_this.stripHashtag(_user.username), {
2507
  /*currentFeed.instagram.getTagRecentMedia(_this.stripHashtag(_user.username), {*/
2508
  success: function (response)
@@ -3624,7 +3646,9 @@ WDIFeed.prototype.storeRawData = function (objects, variable)
3624
 
3625
  var hash_id = "";
3626
  if (wdi_front.isHashtag(objects[i].user_id)) {
3627
- hash_id = objects[i].pagination.next_max_tag_id;
 
 
3628
  }
3629
  else
3630
  if (_this.feed_row.liked_feed == 'liked') {
306
 
307
  //wdi_front.loadInstagramMedia( currentFeed, currentFeed.feed_row.number_of_photos);
308
 
309
+ var all_tags = [];
310
+ if (typeof window["wdi_all_tags"] !== "undefined") {
311
+ all_tags = window["wdi_all_tags"];
312
+ }
313
+
314
+ for (var k in currentFeed.feed_users) {
315
+ if (currentFeed.feed_users[k].username[0] === "#" && typeof currentFeed.feed_users[k].tag_id !== "undefined") {
316
+ all_tags[currentFeed.feed_users[k].tag_id] = currentFeed.feed_users[k];
317
+ }
318
+ }
319
+ window["wdi_all_tags"] = all_tags;
320
+
321
  currentFeed.dataCount = currentFeed.feed_users.length; //1 in case of self feed
322
  var feedResolution = wdi_front.getFeedItemResolution(currentFeed);
323
  currentFeed.feedImageResolution = feedResolution.image;
869
  /*carousel feature*/
870
  if (data[i]['type'] == 'image') {
871
  var photoTemplate = wdi_front.getPhotoTemplate(currentFeed);
872
+ } else if(data[i].hasOwnProperty('videos') || data[i]['type'] == 'video') {
873
  var photoTemplate = wdi_front.getVideoTemplate(currentFeed);
874
  }
875
  else{
1447
  videoUrl = obj.hasOwnProperty('videos') ? obj['videos'][currentFeed.feedVideoResolution]['url'] : '';
1448
  }
1449
 
1450
+ if(typeof obj.images[currentFeed.feedImageResolution] == "undefined"){
1451
+ var image_url = wdi_url.plugin_url + "images/missing.png";
1452
+ }else {
1453
+ var image_url = obj.images[currentFeed.feedImageResolution].url;
1454
+ }
1455
 
1456
  var imageIndex = currentFeed.imageIndex;
1457
 
2181
  /**/
2182
  ///jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter + " .wdi_feed_wrapper").remove(".wdi_nomedia");
2183
 
2184
+
2185
+ var success_function = function (response) {
 
2186
 
2187
  if(typeof response.meta!= "undefined" && typeof response.meta.error_type != "undefined"){
2188
  wdi_front.show_alert(false, response, currentFeed);
2228
 
2229
  //checks if load more done then displays feed
2230
  wdi_front.checkForLoadMoreDone(currentFeed, button);
2231
+ };
 
2232
 
2233
+ if(user.username[0] !== "#") {
2234
+ currentFeed.instagram.requestByUrl(next_url, {
2235
+ success: success_function
2236
+ });
2237
+ }else{
2238
+ currentFeed.instagram.getTagRecentMedia(user.username, {success
2239
+ :success_function}, next_url)
2240
+ }
2241
 
2242
 
2243
  }
2524
  });
2525
  }
2526
  else
2527
+ if (false && _this.getInputType(_user.username) == 'hashtag') {
2528
  currentFeed.instagram.searchForTagsByName(_this.stripHashtag(_user.username), {
2529
  /*currentFeed.instagram.getTagRecentMedia(_this.stripHashtag(_user.username), {*/
2530
  success: function (response)
3646
 
3647
  var hash_id = "";
3648
  if (wdi_front.isHashtag(objects[i].user_id)) {
3649
+ if(typeof objects[i].pagination.cursors !== "undefined") {
3650
+ hash_id = objects[i].pagination.cursors.after;
3651
+ }
3652
  }
3653
  else
3654
  if (_this.feed_row.liked_feed == 'liked') {
js/wdi_frontend.min.js CHANGED
@@ -1 +1 @@
1
- if(typeof wdi_front=="undefined"){wdi_front={type:"not_declared"}}wdi_front.detectEvent=function(){var a=(/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));if(a){return"touchend"}else{return"click"}};var wdi_error_show=false;wdi_front.escape_tags=function(e){var b=/</g,c=/>/g,d=/'/g,a=/"/g;if(typeof e=="undefined"){e=""}e=e.toString().replace(b,"&lt;").replace(c,"&gt;").replace(d,"&#39;").replace(a,"&#34;");return e};wdi_front.show_alert=function(e,b,f){f=jQuery("#wdi_feed_"+f.feed_row.wdi_feed_counter);if(b.meta["code"]===400&&b.meta["error_type"]==="APINotAllowedError"){if(typeof b.wdi_current_feed_name!="undefined"){var a=b.wdi_current_feed_name;var d=f.find(".wdi_private_feed_names");d.html(a);f.find(".wdi_private_feed_error").removeClass("wdi_hidden")}f.find(".wdi_spinner").remove()}if(typeof f!="undefined"&&b.meta["error_type"]!="APINotAllowedError"){f.find(".wdi_spinner").remove();wdi_error_show=true;var c=f.find(".wdi_js_error");var g=f.find(".wdi_token_error");if(b!=false&&typeof b.meta!=undefined&&b.meta.error_type==="OAuthAccessTokenException"){g.removeClass("wdi_hidden");if(wdi_front_messages.wdi_token_error_flag!="1"){jQuery.ajax({type:"POST",url:wdi_url.ajax_url,dataType:"json",data:{action:"wdi_token_flag",wdi_token_flag_nonce:wdi_front_messages.wdi_token_flag_nonce},success:function(h){}})}}else{c.removeClass("wdi_js_error");c.addClass("wdi_js_error_no_animate");jQuery(".wdi_js_error_no_animate").show()}if(wdi_front_messages.show_alerts){}else{console.log("%c"+e,"color:#cc0000;")}}wdi_error_show=true};wdi_front.globalInit=function(){var a=wdi_front.feed_counter;if(typeof wdi_ajax.ajax_response!="undefined"){var c=wdi_feed_counter_init.wdi_feed_counter_init}else{var c=0}for(var b=c;b<=a;b++){if(jQuery("#wdi_feed_"+b).length===0){continue}var d=new WDIFeed(window["wdi_feed_"+b]);d.instagram=new WDIInstagram();d.instagram.filterArguments={feed:d};d.instagram.filters=[{where:"getUserRecentMedia",what:function(f,g,e){return g.feed.conditionalFilter(f,e)}},{where:"getTagRecentMedia",what:function(f,g,e){return g.feed.conditionalFilter(f,e)}},{where:"getRecentLikedMedia",what:function(f,g,e){return g.feed.conditionalFilter(f,e)}},{where:"requestByUrl",what:function(f,g,e){return g.feed.conditionalFilter(f,e)}}];d.instagram.addToken(d.feed_row["access_token"]);wdi_front.access_token=d.feed_row["access_token"];d.dataStorageRaw=[];d.dataStorage=[];d.dataStorageList=[];d.allResponseLength=0;d.currentResponseLength=0;d.temproraryUsersData=[];d.removedUsers=0;d.nowLoadingImages=true;d.imageIndex=0;d.resIndex=0;d.currentPage=1;d.userSortFlags=[];d.customFilterChanged=false;d.maxConditionalFiltersRequestCount=10;d.instagramRequestCounter=0;d.mediaRequestsDone=false;d.conditionalFilterBuffer=[];d.stopInfiniteScrollFlag=false;if(d.feed_row.feed_type=="masonry"){d.displayedData=[]}if(d.feed_row.feed_display_view=="pagination"){d.feed_row.resort_after_load_more=0;if(d.feed_row.feed_type!="image_browser"){d.feed_row.load_more_number=parseInt(d.feed_row.pagination_per_page_number);d.feed_row.number_of_photos=(1+parseInt(d.feed_row.pagination_preload_number))*d.feed_row.load_more_number}else{d.feed_row.number_of_photos=1+parseInt(d.feed_row.image_browser_preload_number);d.feed_row.load_more_number=parseInt(d.feed_row.image_browser_load_number)}d.freeSpaces=(Math.floor(d.feed_row.pagination_per_page_number/d.feed_row.number_of_columns)+1)*d.feed_row.number_of_columns-d.feed_row.pagination_per_page_number}else{d.freeSpaces=0}d.galleryBox=function(e){wdi_spider_createpopup(wdi_url.ajax_url+"?gallery_id="+this.feed_row.id+"&image_id="+e,this.feed_row.wdi_feed_counter,this.feed_row.lightbox_width,this.feed_row.lightbox_height,1,"testpopup",5,this,e)};wdi_responsive.columnControl(d);if(d.feed_row.feed_type=="masonry"){jQuery(window).trigger("resize")}wdi_front.bindEvents(d);window["wdi_feed_"+b]=d;wdi_front.init(d)}};wdi_front.init=function(c){jQuery(".wdi_js_error").hide();c.photoCounter=c.feed_row.number_of_photos;if(c.feed_row.liked_feed=="liked"){c.feed_users=["self"]}else{if(wdi_front.isJsonString(c.feed_row.feed_users)){c.feed_users=JSON.parse(c.feed_row.feed_users)}else{wdi_front.show_alert(wdi_front_messages.invalid_users_format,false,c);return}}c.dataCount=c.feed_users.length;var a=wdi_front.getFeedItemResolution(c);c.feedImageResolution=a.image;c.feedVideoResolution=a.video;for(var b=0;b<c.dataCount;b++){wdi_front.instagramRequest(b,c)}if(c.feed_row.number_of_photos>0){wdi_front.ajaxLoader(c)}if(c.feed_row["display_header"]==="1"){wdi_front.show("header",c)}if(c.feed_row["show_usernames"]==="1"){wdi_front.show("users",c)}};wdi_front.getFeedItemResolution=function(g){var d={image:"standard_resolution",video:"standard_resolution"};if(g.feed_row.feed_resolution==="thumbnail"){return{image:"thumbnail",video:"low_bandwidth"}}else{if(g.feed_row.feed_resolution==="low"){return{image:"low_resolution",video:"low_resolution"}}else{if(g.feed_row.feed_resolution==="standard"){return{image:"standard_resolution",video:"standard_resolution"}}}}var c=jQuery("#wdi_feed_"+g.feed_row.wdi_feed_counter).find(".wdi_feed_wrapper");c.append('<div class="wdi_feed_item" id="wdi_feed_item_example"></div>');wdi_responsive.columnControl(g,1);var b=c.attr("wdi-res").split("wdi_col_");c.find("#wdi_feed_item_example").remove();if(b.length!==2){return d}var a=parseInt(b[1]);if(a<=0){return d}var f=(c.width()/a)-10;var e=d;if(f<=150){e.image="thumbnail";e.video="low_bandwidth"}else{if(f>150&&f<=320){e.image="low_resolution";e.video="low_resolution"}else{e.image="standard_resolution";e.video="standard_resolution"}}return e};wdi_front.isJsonString=function(b){try{JSON.parse(b)}catch(a){return false}return true};wdi_front.instagramRequest=function(d,b){var a=b.feed_users,c=this;if(typeof a[d]==="string"&&a[d]==="self"){b.instagram.getRecentLikedMedia({success:function(e){if(typeof e.meta!="undefined"&&typeof e.meta.error_type!="undefined"){wdi_front.show_alert(false,e,b)}b.mediaRequestsDone=true;e=c.checkMediaResponse(e,b);if(e!=false){c.saveSelfUserData(e,b)}}})}else{if(this.getInputType(a[d]["username"])=="hashtag"){b.instagram.getTagRecentMedia(this.stripHashtag(a[d]["username"]),{success:function(e){if(typeof e.meta!="undefined"&&typeof e.meta.error_type!="undefined"){wdi_front.show_alert(false,e,b)}b.mediaRequestsDone=true;e=c.checkMediaResponse(e,b);if(e!=false){c.saveUserData(e,b.feed_users[d],b)}}})}else{if(this.getInputType(a[d]["username"])=="user"){b.instagram.getSelfRecentMedia({success:function(e){if(typeof e.meta!="undefined"&&typeof e.meta.error_type!="undefined"){e.wdi_current_feed_name=a[d].username;wdi_front.show_alert(false,e,b)}b.mediaRequestsDone=true;e=c.checkMediaResponse(e,b);if(e!=false){c.saveUserData(e,b.feed_users[d],b)}}})}}}};wdi_front.isHashtag=function(a){return(a[0]==="#")};wdi_front.saveUserData=function(d,a,b){d.username=a.username;d.user_id=a.id;if(d.user_id[0]==="#"){d.data=wdi_front.appendRequestHashtag(d.data,d.user_id)}b.usersData.push(d);b.currentResponseLength=wdi_front.getArrayContentLength(b.usersData,"data");b.allResponseLength+=b.currentResponseLength;if(b.dataCount==b.usersData.length){if(b.currentResponseLength<b.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(b)){wdi_front.loadMore("initial-keep",b)}else{wdi_front.displayFeed(b);wdi_front.applyFilters(b);if(!wdi_front.activeUsersCount(b)){if(b.feed_row.feed_display_view=="load_more_btn"){var c=jQuery("#wdi_feed_"+b.feed_row.wdi_feed_counter);c.find(".wdi_load_more").addClass("wdi_hidden");c.find(".wdi_spinner").addClass("wdi_hidden")}}}}};wdi_front.saveSelfUserData=function(c,a){c.username="";c.user_id="";a.usersData.push(c);a.currentResponseLength=wdi_front.getArrayContentLength(a.usersData,"data");a.allResponseLength+=a.currentResponseLength;if(a.dataCount==a.usersData.length){if(a.currentResponseLength<a.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(a)){wdi_front.loadMore("initial-keep",a)}else{wdi_front.displayFeed(a);wdi_front.applyFilters(a);if(!wdi_front.activeUsersCount(a)){if(a.feed_row.feed_display_view=="load_more_btn"){var b=jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter);b.find(".wdi_load_more").addClass("wdi_hidden");b.find(".wdi_spinner").addClass("wdi_hidden")}}}}};wdi_front.userHasNoPhoto=function(c,e){var a=0;var d=c.usersData;if(typeof e!="undefined"){d=e}for(var b=0;b<d.length;b++){if(typeof d[b]["pagination"]=="undefined"){d[b]["pagination"]=[]}if(c.feed_row.liked_feed==="liked"){if(typeof d[b]["pagination"]["next_max_like_id"]=="undefined"){a++}}else{if(typeof d[b]["pagination"]["next_max_id"]=="undefined"){a++}}}if(a==d.length){return 1}else{return 0}};wdi_front.appendRequestHashtag=function(c,b){for(var a=0;a<c.length;a++){c[a]["wdi_hashtag"]=b}return c};wdi_front.displayFeed=function(c,b){if(c.customFilterChanged==false){var d=wdi_front.feedSort(c,b)}var a=c.customFilterChanged;if(c.customFilterChanged==true){var d=c.customFilteredData;c.parsedData=wdi_front.parseLighboxData(c,true)}if(c.feed_row.resort_after_load_more!="1"){if(c.customFilterChanged==false){c.dataStorageList=c.dataStorageList.concat(d)}}else{if(c.customFilterChanged==false){c.dataStorageList=d}}if(c.feed_row.feed_type=="masonry"){wdi_front.masonryDisplayFeedItems(d,c)}if(c.feed_row.feed_type=="thumbnails"||c.feed_row.feed_type=="blog_style"||c.feed_row.feed_type=="image_browser"){wdi_front.displayFeedItems(d,c)}var e=wdi_front.getDataLength(c);if(e<c.photoCounter&&!a&&c.instagramRequestCounter<=c.maxConditionalFiltersRequestCount&&!wdi_front.allDataHasFinished(c)){wdi_front.loadMore("",c)}else{wdi_front.allImagesLoaded(c)}if(c.instagramRequestCounter>c.maxConditionalFiltersRequestCount){wdi_front.allImagesLoaded(c);if(d.length==0){c.stopInfiniteScrollFlag=true}}if(c.feed_row.feed_display_view=="pagination"&&c.currentPage<c.paginator){jQuery("#wdi_feed_"+c.feed_row.wdi_feed_counter).find("#wdi_last_page").removeClass("wdi_disabled")}c.instagramRequestCounter=0;c.conditionalFilterBuffer=[];wdi_front.updateUsersImages(c)};wdi_front.updateUsersImages=function(a){var b=jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter).find(".wdi_single_user .wdi_user_img_wrap img");b.each(function(){if(jQuery(this).attr("src")==wdi_url.plugin_url+"images/missing.png"||jQuery(this).attr("src")==""){if(a.feed_row.liked_feed=="liked"){return}for(var c=0;c<a.usersData.length;c++){if(a.usersData[c]["username"]==jQuery(this).parent().parent().find("h3").text()){if(a.usersData[c]["data"].length!=0){jQuery(this).attr("src",a.usersData[c]["data"][0]["images"]["thumbnail"]["url"])}}}}})};wdi_front.masonryDisplayFeedItems=function(d,h){var b=[];var p=[];if(jQuery("#wdi_feed_"+h.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length==0){return}jQuery("#wdi_feed_"+h.feed_row.wdi_feed_counter+" .wdi_masonry_column").each(function(){if(h.feed_row.resort_after_load_more==1){jQuery(this).html("");h.imageIndex=0}if(h.customFilterChanged==true){jQuery(this).html("");h.imageIndex=0}if(h.feed_row.feed_display_view=="pagination"){b.push(0)}else{b.push(jQuery(this).height())}p.push(jQuery(this))});if(h.customFilterChanged==true){h.customFilterChanged=false}for(var e=0;e<d.length;e++){h.displayedData.push(d[e]);if(d[e]["type"]=="image"){var n=wdi_front.getPhotoTemplate(h)}else{if(d[e].hasOwnProperty("videos")){var n=wdi_front.getVideoTemplate(h)}else{var n=wdi_front.getSliderTemplate(h)}}var g=d[e];var o=wdi_front.createObject(g,h);var f=n(o);var m=wdi_front.array_min(b);var l=wdi_front.getImageResolution(d[e]);p[m.index].html(p[m.index].html()+f);b[m.index]+=p[m.index].width()*l;h.imageIndex++;if(h.feed_row.feed_display_view=="pagination"){if((e+1)%h.feed_row.pagination_per_page_number===0){h.resIndex+=h.freeSpaces+1}else{h.resIndex++}}}h.wdi_loadedImages=0;var j=false;h.wdi_load_count=e;var a=h.feed_row.wdi_feed_counter;var k=jQuery("#wdi_feed_"+a+" img.wdi_img").on("load",function(){h.wdi_loadedImages++;c();if(j===false){wdi_responsive.columnControl(h,1);j=true}});c();function c(){if(h.wdi_load_count===h.wdi_loadedImages&&h.wdi_loadedImages!=0){h.loadedImages=0;h.wdi_load_count=0;wdi_front.allImagesLoaded(h)}}if(h.paginatorNextFlag==true){wdi_front.updatePagination(h,"next")}h.infiniteScrollFlag=false};wdi_front.getImageResolution=function(c){var d=c.images["standard_resolution"]["width"];var b=c.images["standard_resolution"]["height"];var a=b/d;return a};wdi_front.getDataLength=function(b,d){var c=0;if(typeof d==="undefined"){for(var a=0;a<b.dataStorage.length;a++){c+=b.dataStorage[a].length}}else{for(var a=0;a<d.length;a++){c+=d[a].length}}return c};wdi_front.getArrayContentLength=function(d,c){var b=0;for(var a=0;a<d.length;a++){if(d[a]["finished"]=="finished"){continue}b+=d[a][c].length}return b};wdi_front.displayFeedItems=function(d,j){if(jQuery("#wdi_feed_"+j.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length==0){return}var a=j.feed_row.wdi_feed_counter;var l=jQuery("#wdi_feed_"+a+" .wdi_feed_wrapper");if(j.feed_row.resort_after_load_more==="1"){l.html("");j.imageIndex=0}if(j.customFilterChanged==true){l.html("");j.imageIndex=0;j.customFilterChanged=false}var g=wdi_front.getImgCount(j)-d.length-1;if(j.feed_row.feed_display_view=="pagination"){var b=j.feed_row.load_more_number;if(j.feed_row.feed_type=="image_browser"){b=1}if(jQuery("#wdi_feed_"+j.feed_row.wdi_feed_counter+' [wdi_page="'+(j.currentPage-1)+'"]').length<b||d.length==0){j.currentPage=(--j.currentPage<=1)?1:j.currentPage}}for(var e=0;e<d.length;e++){if(d[e]["type"]=="image"){var m=wdi_front.getPhotoTemplate(j)}else{if(d[e].hasOwnProperty("videos")){var m=wdi_front.getVideoTemplate(j)}else{var m=wdi_front.getSliderTemplate(j)}}var h=d[e];var n=wdi_front.createObject(h,j);var f=m(n);l.html(l.html()+f);j.imageIndex++;if(j.feed_row.feed_display_view=="pagination"){if((e+1)%j.feed_row.pagination_per_page_number===0){j.resIndex+=j.freeSpaces+1}else{j.resIndex++}}}j.wdi_loadedImages=0;var k=false;j.wdi_load_count=e;var a=j.feed_row.wdi_feed_counter;var l=jQuery("#wdi_feed_"+a+" img.wdi_img").on("load",function(){j.wdi_loadedImages++;c();if(k===false){wdi_responsive.columnControl(j,1);k=true}});function c(){if(j.wdi_load_count===j.wdi_loadedImages&&j.wdi_loadedImages!=0){j.loadedImages=0;j.wdi_load_count=0;wdi_front.allImagesLoaded(j)}}if(j.paginatorNextFlag==true){wdi_front.updatePagination(j,"next")}j.infiniteScrollFlag=false};wdi_front.checkFeedFinished=function(b){for(var a=0;a<b.usersData.length;a++){if(typeof b.usersData[a]["finished"]=="undefined"){return false}}return true};wdi_front.sortingOperator=function(c,b){var a;switch(c){case"date":switch(b){case"asc":a=function(e,d){return(e.created_time>d.created_time)?1:-1};break;case"desc":a=function(e,d){return(e.created_time>d.created_time)?-1:1};break}break;case"likes":switch(b){case"asc":a=function(e,d){return(e.likes["count"]<d.likes["count"])?-1:1};break;case"desc":a=function(e,d){return(e.likes["count"]<d.likes["count"])?1:-1};break}break;case"comments":switch(b){case"asc":a=function(e,d){return(e.comments["count"]<d.comments["count"])?-1:1};break;case"desc":a=function(e,d){return(e.comments["count"]<d.comments["count"])?1:-1};break}break;case"random":a=function(e,d){var f=Math.random();return(f>0.5)?1:-1};break}return a};wdi_front.feedSort=function(e,b){var d=e.feed_row.sort_images_by;var c=e.feed_row.display_order;if(e.feed_row.resort_after_load_more==="1"){e.data=e.data.concat(wdi_front.smartPicker(e,b))}else{e.data=wdi_front.smartPicker(e,b)}var a=wdi_front.sortingOperator(d,c);e.data.sort(a);return e.data};wdi_front.smartPicker=function(l,c){var g=[];var a=0;var k=[];var f=Math.ceil(l.feed_row["number_of_photos"]/l.usersData.length);var b=parseInt(l.feed_row["number_of_photos"]);var n=0;if(c!=""&&typeof c!="undefined"&&c!=null){b=parseInt(c);f=Math.ceil(b/wdi_front.activeUsersCount(l))}var j=function(p,i){return(p.data.length>i.data.length)?1:-1};var e=function(p,i){return(p.length()>i.length())?1:-1};l.storeRawData(l.usersData,"dataStorageRaw");var o=l.dataStorageRaw.sort(e);var h=l.usersData.sort(j);for(var d=0;d<h.length;d++){n+=f;if(o[d].length()<=n){n-=o[d].length();g.push(o[d].getData(o[d].length()));a+=g[g.length-1].length}else{if(a+n>b){n=b-a}var m=[];if(l.auto_trigger===false){m=m.concat(o[d].getData(n))}else{if(m.length+wdi_front.getDataLength(l)+wdi_front.getDataLength(l,g)<l.feed_row["number_of_photos"]){m=m.concat(o[d].getData(n))}}n=0;a+=m.length;g.push(m)}}for(d=0;d<g.length;d++){if(typeof l.dataStorage[d]==="undefined"){l.dataStorage.push(g[d])}else{l.dataStorage[d]=l.dataStorage[d].concat(g[d])}}l.parsedData=wdi_front.parseLighboxData(l);for(d=0;d<g.length;d++){k=k.concat(g[d])}return k};wdi_front.createObject=function(e,h){var j=(e.caption!=null)?e.caption["text"]:"&nbsp";var i="";if(e.type=="video"){i=e.hasOwnProperty("videos")?e.videos[h.feedVideoResolution]["url"]:""}var f=e.images[h.feedImageResolution].url;var a=h.imageIndex;var b="square";var d=e.images["standard_resolution"]["height"];var g=e.images["standard_resolution"]["width"];if(d>g){b="portrait"}else{if(d<g){b="landscape"}}var c={id:e.id,caption:wdi_front.escape_tags(j),image_url:f,likes:e.likes["count"],comments:e.comments["count"],wdi_index:a,wdi_res_index:h.resIndex,wdi_media_user:e.user["username"],link:e.link,video_url:i,wdi_username:e.user["username"],wdi_shape:b};return c};wdi_front.setPage=function(c){var b=c.feed_row.feed_display_view;var e=c.feed_row.feed_type;if(b!="pagination"){return""}var a=c.imageIndex;if(e=="image_browser"){var d=1}else{var d=Math.abs(c.feed_row.pagination_per_page_number)}c.paginator=Math.ceil((a+1)/d);return c.paginator};wdi_front.getPhotoTemplate=function(g){var e=wdi_front.setPage(g);var j="";var k="";var l="";var d="";var m="fa-arrows-alt";var c="";if(g.feed_row.feed_type=="blog_style"||g.feed_row.feed_type=="image_browser"){m=""}if(e!=""){k='wdi_page="'+e+'"';sourceAttr="src"}else{sourceAttr="src"}if(e!=""&&e!=1){j="wdi_hidden"}if(g.feed_row.show_username_on_thumb=="1"){c='<span class="wdi_media_user">@<%= wdi_username%></span>'}if(g.feed_row.show_full_description==1&&g.feed_row.feed_type=="masonry"){j+=" wdi_full_caption"}var f="";if(g.feed_row.feed_type!=="blog_style"){if(g.feed_row.feed_type=="masonry"){f="wdi_responsive.showMasonryCaption(jQuery(this),"+g.feed_row.wdi_feed_counter+");"}else{f="wdi_responsive.showCaption(jQuery(this),"+g.feed_row.wdi_feed_counter+");"}}switch(g.feed_row.feed_item_onclick){case"lightbox":l="onclick=wdi_feed_"+g.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":l="onclick=\"window.open ('<%= link%>','_blank')\"";d="wdi_hover_off";m="";break;case"custom_redirect":l="onclick=\"window.open ('"+g.feed_row.redirect_url+"','_self')\"";d="wdi_hover_off";m="";break;case"none":l="";d="wdi_cursor_off wdi_hover_off";m=""}var h="<%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>";var b=g.feed_row.wdi_feed_counter;var a='<div class="wdi_feed_item '+j+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+k+' wdi_type="image" id="wdi_'+b+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img '+h+'"><img class="wdi_img" '+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+d+'" >'+c+'<div class="wdi_thumb_icon" '+l+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="fa '+m+'"></i></div></div></div></div></div></div>';if(g.feed_row["show_likes"]==="1"||g.feed_row["show_comments"]==="1"||g.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_meta">';if(g.feed_row["show_likes"]==="1"){a+='<div class="wdi_thumb_likes"><i class="fa fa-heart-o">&nbsp;<%= likes%></i></div>'}if(g.feed_row["show_comments"]==="1"){a+='<div class="wdi_thumb_comments"><i class="fa fa-comment-o">&nbsp;<%= comments%></i></div>'}a+='<div class="wdi_clear"></div>';if(g.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_title" onclick='+f+" ><%=caption%></div>"}a+="</div>"}a+="</div>";var i=_.template(a);return i};wdi_front.getSliderTemplate=function(g){var e=wdi_front.setPage(g);var j="";var k="";var l="";var d="";var m="fa-clone";var c="";if(g.feed_row.feed_type=="blog_style"||g.feed_row.feed_type=="image_browser"){m=""}if(e!=""){k='wdi_page="'+e+'"';sourceAttr="src"}else{sourceAttr="src"}if(e!=""&&e!=1){j="wdi_hidden"}if(g.feed_row.show_username_on_thumb=="1"){c='<span class="wdi_media_user">@<%= wdi_username%></span>'}if(g.feed_row.show_full_description==1&&g.feed_row.feed_type=="masonry"){j+=" wdi_full_caption"}var f="";if(g.feed_row.feed_type!=="blog_style"){if(g.feed_row.feed_type=="masonry"){f="wdi_responsive.showMasonryCaption(jQuery(this),"+g.feed_row.wdi_feed_counter+");"}else{f="wdi_responsive.showCaption(jQuery(this),"+g.feed_row.wdi_feed_counter+");"}}switch(g.feed_row.feed_item_onclick){case"lightbox":l="onclick=wdi_feed_"+g.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":l="onclick=\"window.open ('<%= link%>','_blank')\"";d="wdi_hover_off";m="fa-clone";break;case"custom_redirect":l="onclick=\"window.open ('"+g.feed_row.redirect_url+"','_self')\"";d="wdi_hover_off";m="";break;case"none":l="";d="wdi_cursor_off wdi_hover_off";m=""}var h="<%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>";var b=g.feed_row.wdi_feed_counter;var a='<div class="wdi_feed_item '+j+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+k+' wdi_type="slideshow" id="wdi_'+b+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img '+h+'"><img class="wdi_img" '+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+d+'" >'+c+'<div class="wdi_thumb_icon" '+l+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="fa '+m+'"></i></div></div></div></div></div></div>';if(g.feed_row["show_likes"]==="1"||g.feed_row["show_comments"]==="1"||g.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_meta">';if(g.feed_row["show_likes"]==="1"){a+='<div class="wdi_thumb_likes"><i class="fa fa-heart-o">&nbsp;<%= likes%></i></div>'}if(g.feed_row["show_comments"]==="1"){a+='<div class="wdi_thumb_comments"><i class="fa fa-comment-o">&nbsp;<%= comments%></i></div>'}a+='<div class="wdi_clear"></div>';if(g.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_title" onclick='+f+" ><%=caption%></div>"}a+="</div>"}a+="</div>";var i=_.template(a);return i};wdi_front.replaceToVideo=function(b,a,c){overlayHtml="<video style='width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;' controls=''><source src='"+b+"' type='video/mp4'>Your browser does not support the video tag. </video>";jQuery("#wdi_feed_"+c+' [wdi_index="'+a+'"] .wdi_photo_wrap_inner').html(overlayHtml);jQuery("#wdi_feed_"+c+' [wdi_index="'+a+'"] .wdi_photo_wrap_inner video').get(0).play()};wdi_front.getVideoTemplate=function(h){var f=wdi_front.setPage(h);var k="";var l="";var n="fa-play";var m="";var d="";var e;var c="";if(f!=""){l='wdi_page="'+f+'"';e="src"}else{e="src"}if(f!=""&&f!=1){k="wdi_hidden"}if(h.feed_row.show_username_on_thumb=="1"){c='<span class="wdi_media_user">@<%= wdi_username%></span>'}if(h.feed_row.show_full_description==1&&h.feed_row.feed_type=="masonry"){k+=" wdi_full_caption"}var g="";if(h.feed_row.feed_type!=="blog_style"){if(h.feed_row.feed_type=="masonry"){g="wdi_responsive.showMasonryCaption(jQuery(this),"+h.feed_row.wdi_feed_counter+");"}else{g="wdi_responsive.showCaption(jQuery(this),"+h.feed_row.wdi_feed_counter+");"}}switch(h.feed_row.feed_item_onclick){case"lightbox":m="onclick=wdi_feed_"+h.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":m="onclick=\"window.open ('<%= link%>','_blank')\"";d="wdi_hover_off";n="fa-play";break;case"custom_redirect":m="onclick=\"window.open ('"+h.feed_row.redirect_url+"','_self')\"";d="wdi_hover_off";n="";break;case"none":d="wdi_cursor_off wdi_hover_off";n="";if(h.feed_row.feed_type=="blog_style"||h.feed_row.feed_type=="image_browser"){m="onclick=wdi_front.replaceToVideo('<%= video_url%>','<%= wdi_index%>',"+h.feed_row.wdi_feed_counter+")";d="";n="fa-play"}}var i="<%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>";var b=h.feed_row.wdi_feed_counter;var a='<div class="wdi_feed_item '+k+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+l+' wdi_type="image" id="wdi_'+b+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img '+i+'"><img class="wdi_img" '+e+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+d+'" '+m+">"+c+'<div class="wdi_thumb_icon" style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="fa '+n+'"></i></div></div></div></div></div></div>';if(h.feed_row["show_likes"]==="1"||h.feed_row["show_comments"]==="1"||h.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_meta">';if(h.feed_row["show_likes"]==="1"){a+='<div class="wdi_thumb_likes"><i class="fa fa-heart-o">&nbsp;<%= likes%></i></div>'}if(h.feed_row["show_comments"]==="1"){a+='<div class="wdi_thumb_comments"><i class="fa fa-comment-o">&nbsp;<%= comments%></i></div>'}a+='<div class="wdi_clear"></div>';if(h.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_title" onclick='+g+" ><%=caption%></div>"}a+="</div>"}a+="</div>";var j=_.template(a);return j};wdi_front.bindEvents=function(a){if(jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length==0){return}if(a.feed_row.feed_display_view=="load_more_btn"){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_load_more_container").on(wdi_front.clickOrTouch,function(){wdi_front.loadMore(jQuery(this).find(".wdi_load_more_wrap"))})}if(a.feed_row.feed_display_view=="pagination"){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_next").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorNext(jQuery(this),a)});jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_prev").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorPrev(jQuery(this),a)});jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_last_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationLastPage(jQuery(this),a)});jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_first_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationFirstPage(jQuery(this),a)});a.paginatorNextFlag=false}if(a.feed_row.feed_display_view=="infinite_scroll"){jQuery(window).on("scroll",function(){wdi_front.infiniteScroll(a)});a.infiniteScrollFlag=false}};wdi_front.infiniteScroll=function(a){if((jQuery(window).scrollTop()+jQuery(window).height()-100)>=jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_infinite_scroll").offset().top){if(a.infiniteScrollFlag===false&&a.stopInfiniteScrollFlag==false){a.infiniteScrollFlag=true;wdi_front.loadMore(jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_infinite_scroll"),a)}else{if(a.stopInfiniteScrollFlag){wdi_front.allImagesLoaded(a)}}}};wdi_front.paginationFirstPage=function(b,c){if(c.paginator==1||c.currentPage==1){b.addClass("wdi_disabled");return}var d=c.currentPage;c.currentPage=1;wdi_front.updatePagination(c,"custom",d);var a=b.parent().find("#wdi_last_page");a.removeClass("wdi_disabled");b.addClass("wdi_disabled")};wdi_front.paginationLastPage=function(a,b){if(b.paginator==1||b.currentPage==b.paginator){return}var d=b.currentPage;b.currentPage=b.paginator;wdi_front.updatePagination(b,"custom",d);a.addClass("wdi_disabled");var c=a.parent().find("#wdi_first_page");c.removeClass("wdi_disabled")};wdi_front.paginatorNext=function(b,c){var a=b.parent().find("#wdi_last_page");var d=b.parent().find("#wdi_first_page");c.paginatorNextFlag=true;if(c.paginator==c.currentPage&&!wdi_front.checkFeedFinished(c)){c.currentPage++;var e=c.feed_row.number_of_photos;wdi_front.loadMore(b,c,e);a.addClass("wdi_disabled")}else{if(c.paginator>c.currentPage){c.currentPage++;wdi_front.updatePagination(c,"next");if(c.paginator>c.currentPage){a.removeClass("wdi_disabled")}else{a.addClass("wdi_disabled")}}}d.removeClass("wdi_disabled")};wdi_front.paginatorPrev=function(b,c){var a=b.parent().find("#wdi_last_page");var d=b.parent().find("#wdi_first_page");if(c.currentPage==1){d.addClass("wdi_disabled");return}c.currentPage--;wdi_front.updatePagination(c,"prev");a.removeClass("wdi_disabled");if(c.currentPage==1){d.addClass("wdi_disabled")}};wdi_front.updatePagination=function(b,a,d){var c="#wdi_feed_"+b.feed_row.wdi_feed_counter;jQuery(c+' [wdi_page="'+b.currentPage+'"]').each(function(){jQuery(this).removeClass("wdi_hidden")});switch(a){case"next":var d=b.currentPage-1;jQuery(c+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height());jQuery(c+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"prev":var d=b.currentPage+1;jQuery(c+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height());jQuery(c+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"custom":var d=d;if(d!=b.currentPage){jQuery(c+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height());jQuery(c+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")})}break}b.paginatorNextFlag=false;jQuery(c+" .wdi_feed_wrapper").css("height","auto");jQuery(c+" #wdi_current_page").text(b.currentPage)};wdi_front.loadMore=function(f,k){var b=0;if(f!=""&&typeof f!="undefined"&&f!="initial"&&f!="initial-keep"){var l=window[f.parent().parent().parent().parent().attr("id")]}if(typeof k!="undefined"){var l=k}var n=0,g=0;for(var e=0;e<l.userSortFlags.length;e++){if(l.userSortFlags[e].flag===true){n++;for(var d=0;d<l.usersData.length;d++){if(l.userSortFlags[e]["id"]===l.usersData[d]["user_id"]){if(l.usersData[d]["finished"]==="finished"){g++}}}}}if(n===g&&n!=0){return}if(f===""){l.auto_trigger=true}else{l.auto_trigger=false}wdi_front.ajaxLoader(l);if(l.feed_row.feed_type==="masonry"&&l.feed_row.feed_display_view=="pagination"){jQuery("#wdi_feed_"+wdi_front.feed_counter+" .wdi_full_caption").each(function(){jQuery(this).find(".wdi_photo_title").trigger(wdi_front.clickOrTouch)})}for(var e=0;e<l.usersData.length;e++){if(l.usersData[e]["finished"]==="finished"){b++}}if(b===l.usersData.length){wdi_front.allImagesLoaded(l);jQuery("#wdi_feed_"+l.feed_row["wdi_feed_counter"]+" .wdi_load_more").remove()}var h=l.usersData;l.loadMoreDataCount=l.feed_users.length;for(var e=0;e<h.length;e++){var m=h[e]["pagination"];var c={user_id:h[e]["user_id"],username:h[e]["username"]};if(m.next_url!=""&&m.next_url!=null&&typeof m.next_url!="undefined"){var a=m.next_url;wdi_front.loadMoreRequest(c,a,l,f)}else{if(f=="initial-keep"){l.temproraryUsersData[e]=l.usersData[e]}l.loadMoreDataCount--;wdi_front.checkForLoadMoreDone(l,f);continue}}};wdi_front.loadMoreRequest=function(b,a,e,d){if(!e.mediaRequestsDone){return}var f=e.usersData;var c="";e.instagram.requestByUrl(a,{success:function(g){if(typeof g.meta!="undefined"&&typeof g.meta.error_type!="undefined"){wdi_front.show_alert(false,g,e)}if(g===""||typeof g=="undefined"||g==null){c=wdi_front_messages.network_error;e.loadMoreDataCount--;wdi_front.show_alert(c,g,e);return}if(g.meta["code"]!=200){c=g.meta["error_message"];e.loadMoreDataCount--;wdi_front.show_alert(c,g,e);return}g.user_id=b.user_id;g.username=b.username;for(var h=0;h<e.usersData.length;h++){if(g.user_id===e.usersData[h]["user_id"]){if(g.user_id[0]==="#"){g.data=wdi_front.appendRequestHashtag(g.data,g.user_id)}if(d=="initial-keep"){e.temproraryUsersData[h]=e.usersData[h]}e.usersData[h]=g;e.loadMoreDataCount--}}wdi_front.checkForLoadMoreDone(e,d)}})};wdi_front.checkForLoadMoreDone=function(c,b){var a=c.feed_row.load_more_number;var e=c.feed_row.number_of_photos;if(c.loadMoreDataCount==0){c.temproraryUsersData=wdi_front.mergeData(c.temproraryUsersData,c.usersData);var d=wdi_front.getArrayContentLength(c.temproraryUsersData,"data");if(b=="initial-keep"){b="initial"}if(b=="initial"){if(d<e&&!wdi_front.userHasNoPhoto(c,c.temproraryUsersData)&&c.instagramRequestCounter<=c.maxConditionalFiltersRequestCount){wdi_front.loadMore("initial",c)}else{c.usersData=c.temproraryUsersData;wdi_front.displayFeed(c);wdi_front.applyFilters(c);c.temproraryUsersData=[]}}else{if(d<a&&!wdi_front.userHasNoPhoto(c,c.temproraryUsersData)&&c.instagramRequestCounter<=c.maxConditionalFiltersRequestCount){wdi_front.loadMore(undefined,c)}else{c.usersData=c.temproraryUsersData;if(!wdi_front.activeUsersCount(c)){return}wdi_front.displayFeed(c,a);wdi_front.applyFilters(c);c.temproraryUsersData=[]}}}};wdi_front.allDataHasFinished=function(b){var d=0;for(var a=0;a<b.dataStorageRaw.length;a++){if(b.dataStorageRaw[a].length()==0&&b.dataStorageRaw[a].locked==true){d++}}return(d==b.dataStorageRaw.length)};wdi_front.mergeData=function(c,b){for(var a=0;a<b.length;a++){if(typeof c[a]!="undefined"){if(b[a]["finished"]=="finished"){continue}if(typeof c[a]["pagination"]["next_max_id"]=="undefined"&&typeof c[a]["pagination"]["next_max_like_id"]=="undefined"){continue}c[a]["data"]=c[a]["data"].concat(b[a]["data"]);c[a]["pagination"]=b[a]["pagination"];c[a]["user_id"]=b[a]["user_id"];c[a]["username"]=b[a]["username"];c[a]["meta"]=b[a]["meta"]}else{c.push(b[a])}}return c};wdi_front.brokenImageHandler=function(a){a.src=wdi_url.plugin_url+"images/missing.png";a.onerror="";return true};wdi_front.ajaxLoader=function(a){var d=a.feed_row.wdi_feed_counter;var c=jQuery("#wdi_feed_"+d);if(a.feed_row.feed_display_view=="load_more_btn"){c.find(".wdi_load_more").addClass("wdi_hidden");c.find(".wdi_spinner").removeClass("wdi_hidden")}if(a.feed_row.feed_display_view=="infinite_scroll"){var b;if(c.find(".wdi_ajax_loading").length==0){b=jQuery('<div class="wdi_ajax_loading"><div><div><img class="wdi_load_more_spinner" src="'+wdi_url.plugin_url+'images/ajax_loader.png"></div></div></div>');c.append(b)}else{b=c.find(".wdi_ajax_loading")}b.removeClass("wdi_hidden")}};wdi_front.allImagesLoaded=function(a){var d=wdi_front.getDataLength(a);if(!a.mediaRequestsDone){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").remove("wdi_nomedia")}if(d==0&&a.mediaRequestsDone&&(a.feed_row.conditional_filters.length==0||a.feed_row.conditional_filter_enable==0)){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").append("<p class='wdi_nomedia'>"+wdi_front_messages.feed_nomedia+"</p>")}var c=a.feed_row.wdi_feed_counter;var b=jQuery("#wdi_feed_"+c);if(a.feed_row.feed_display_view=="load_more_btn"){b.find(".wdi_load_more").removeClass("wdi_hidden");b.find(".wdi_spinner").addClass("wdi_hidden")}if(a.feed_row.feed_display_view=="infinite_scroll"){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_ajax_loading").addClass("wdi_hidden")}b.trigger("wdi_feed_loaded")};wdi_front.show=function(b,c){var e=c.feed_row.wdi_feed_counter;var d=jQuery("#wdi_feed_"+e+" .wdi_feed_container");var g=this;switch(b){case"header":f();break;case"users":a(c);break}function f(){var i={feed_thumb:c.feed_row["feed_thumb"],feed_name:c.feed_row["feed_name"]};var k=wdi_front.getHeaderTemplate(),h=k(i),j=d.find(".wdi_feed_header").html();d.find(".wdi_feed_header").html(j+h)}function a(j){d.find(".wdi_feed_users").html("");var n=j.feed_users;var m=j.feed_row["access_token"];var h=0;j.headerUserinfo=[];k();function k(){if(j.headerUserinfo.length==n.length){l(j.headerUserinfo,j);return}var i=n[j.headerUserinfo.length];if(typeof i==="string"&&i==="self"){j.instagram.getSelfInfo({success:function(o){if(typeof o.meta!="undefined"&&typeof o.meta.error_type!="undefined"){wdi_front.show_alert(false,o,j)}o=g.checkMediaResponse(o,j);if(o!=false&&o.meta["code"]===400&&o.meta["error_type"]==="APINotAllowedError"){var p=null;j.headerUserinfo.push(p);h++;k()}if(o!=false&&o.meta["code"]===200){var p={id:o.data["id"],name:o.data["username"],url:o.data["profile_picture"],bio:wdi_front.escape_tags(o.data["bio"]),counts:o.data["counts"],website:wdi_front.escape_tags(o.data["website"]),full_name:wdi_front.escape_tags(o.data["full_name"])};j.headerUserinfo.push(p);h++;k()}},args:{ignoreFiltering:true}})}else{if(g.getInputType(i.username)=="hashtag"){j.instagram.searchForTagsByName(g.stripHashtag(i.username),{success:function(o){if(typeof o.meta!="undefined"&&typeof o.meta.error_type!="undefined"){wdi_front.show_alert(false,o,j)}o=g.checkMediaResponse(o,j);if(o!=false){if(o.data.length==0){var p="";var q={media:""}}else{var p="";var q={media:o.data[0]["media_count"]}}var r={name:n[h]["username"],url:p,counts:q};h++;j.headerUserinfo.push(r);k()}},args:{ignoreFiltering:true}})}else{if(g.getInputType(i.username)=="user"){j.instagram.getSelfInfo({success:function(o){if(typeof o.meta!="undefined"&&typeof o.meta.error_type!="undefined"){wdi_front.show_alert(false,o,j)}o=g.checkMediaResponse(o,j);if(o!=false&&o.meta["code"]===400&&o.meta["error_type"]==="APINotAllowedError"){var p=null;j.headerUserinfo.push(p);h++;k()}if(o!=false&&o.meta["code"]===200){var p={id:o.data["id"],name:o.data["username"],url:o.data["profile_picture"],bio:wdi_front.escape_tags(o.data["bio"]),counts:o.data["counts"],website:wdi_front.escape_tags(o.data["website"]),full_name:wdi_front.escape_tags(o.data["full_name"])};j.headerUserinfo.push(p);h++;k()}},args:{ignoreFiltering:true}})}}}}function l(i,t){d.find(".wdi_feed_users").html("");for(var q=0;q<i.length;q++){if(i[q]===null){continue}var v={flag:false,id:i[q]["id"],name:i[q]["name"]};var p=(i[q]["name"][0]=="#")?"wdi_header_hashtag":"";var u=wdi_extractHostname(i[q]["website"]);var o={user_index:q,user_img_url:i[q]["url"],counts:i[q]["counts"],feed_counter:t.feed_row.wdi_feed_counter,user_name:i[q]["name"],bio:wdi_front.escape_tags(i[q]["bio"]),website:u,website_url:i[q]["website"],usersCount:t.feed_row.feed_users.length,hashtagClass:p};var x=wdi_front.getUserTemplate(t,i[q]["name"]),r=x(o),s=d.find(".wdi_feed_users").html();d.find(".wdi_feed_users").html(s+r);t.userSortFlags.push(v);var w=jQuery('<div class="wdi_clear"></div>')}d.find(".wdi_feed_users").append(w);wdi_front.updateUsersImages(t)}}};wdi_front.getUserTemplate=function(c,h){var a=c.dataCount,d,f,g;switch(h[0]){case"#":d="//instagram.com/explore/tags/"+h.substr(1,h.length);break;default:d="//instagram.com/"+h;break}g='window.open("'+d+'","_blank")';f="onclick='"+g+"'";var e='<div class="wdi_single_user" user_index="<%=user_index%>"><div class="wdi_header_user_text <%=hashtagClass%>"><div class="wdi_user_img_wrap"><img onerror="wdi_front.brokenImageHandler(this);" src="<%= user_img_url%>">';if(a>1){e+='<div title="'+wdi_front_messages.filter_title+'" class="wdi_filter_overlay"><div class="wdi_filter_icon"><span onclick="wdi_front.addFilter(<%=user_index%>,<%=feed_counter%>);" class="fa fa-filter"></span></div></div>'}e+="</div>";e+="<h3 "+f+"><%= user_name%></h3>";if(h[0]!=="#"){if(c.feed_row.follow_on_instagram_btn=="1"){e+='<div class="wdi_user_controls"><div class="wdi_follow_btn" onclick="window.open(\'//instagram.com/<%= user_name%>\',\'_blank\')"><span> '+wdi_front_messages.follow+"</span></div></div>"}e+='<div class="wdi_media_info"><p class="wdi_posts"><span class="fa fa-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span class="fa fa-user"></span><%= counts.followed_by%></p></div>'}else{e+='<div class="wdi_user_controls"></div><div class="wdi_media_info"><p class="wdi_posts"><span class="fa fa-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span></span></p></div>'}e+='<div class="wdi_clear"></div>';if(a==1&&h[0]!=="#"&&c.feed_row.display_user_info=="1"){e+='<div class="wdi_bio"><%= bio%></div>';e+='<div class="wdi_website"><a target="_blank" href="<%= website_url%>" ><%= website%></a></div>'}e+="</div></div>";var b=_.template(e);return b};wdi_front.getHeaderTemplate=function(){var b='<div class="wdi_header_wrapper"><div class="wdi_header_img_wrap"><img src="<%=feed_thumb%>"></div><div class="wdi_header_text"><%=feed_name%></div><div class="wdi_clear"></div>';var a=_.template(b);return a};wdi_front.addFilter=function(e,g){var f=window["wdi_feed_"+g];var d=f.dataCount;if(d<2){return}if(f.nowLoadingImages!=false){return}else{var c=jQuery("#wdi_feed_"+f.feed_row.wdi_feed_counter+'_users [user_index="'+e+'"]');c.find(".wdi_filter_overlay").toggleClass("wdi_filter_active_bg");c.find(".wdi_header_user_text h3").toggleClass("wdi_filter_active_col");c.find(".wdi_media_info").toggleClass("wdi_filter_active_col");c.find(".wdi_follow_btn").toggleClass("wdi_filter_active_col");f.customFilterChanged=true;if(f.userSortFlags[e]["flag"]==false){f.userSortFlags[e]["flag"]=true}else{f.userSortFlags[e]["flag"]=false}var a=0;for(var b=0;b<f.userSortFlags.length;b++){if(f.userSortFlags[b]["flag"]==true){a++}}if(f.feed_row.feed_display_view=="pagination"){f.resIndex=0}if(a!=0){wdi_front.filterData(f);wdi_front.displayFeed(f)}else{f.customFilteredData=f.dataStorageList;wdi_front.displayFeed(f)}if(f.feed_row.feed_display_view=="pagination"){f.paginator=Math.ceil((f.imageIndex)/parseInt(f.feed_row.pagination_per_page_number));f.currentPage=f.paginator;wdi_front.updatePagination(f,"custom",1);jQuery("#wdi_first_page").removeClass("wdi_disabled");jQuery("#wdi_last_page").addClass("wdi_disabled")}}};wdi_front.filterData=function(c){var d=c.userSortFlags;c.customFilteredData=[];for(var b=0;b<c.dataStorageList.length;b++){for(var a=0;a<d.length;a++){if((c.dataStorageList[b]["user"]["id"]==d[a]["id"]||c.dataStorageList[b]["wdi_hashtag"]==d[a]["name"])&&d[a]["flag"]==true){c.customFilteredData.push(c.dataStorageList[b])}}}};wdi_front.applyFilters=function(c){for(var b=0;b<c.userSortFlags.length;b++){if(c.userSortFlags[b]["flag"]==true){var a=jQuery("#wdi_feed_"+c.feed_row.wdi_feed_counter+'[user_index="'+b+'"]');wdi_front.addFilter(b,c.feed_row.wdi_feed_counter);wdi_front.addFilter(b,c.feed_row.wdi_feed_counter)}}};wdi_front.getImgCount=function(b){var d=b.dataStorage;var c=0;for(var a=0;a<d.length;a++){c+=d[a].length}return c};wdi_front.parseLighboxData=function(k,m){var g=k.dataStorage;var l=k.feed_row.sort_images_by;var a=k.feed_row.display_order;var h=wdi_front.sortingOperator(l,a);var f=[];var b=[];var e={};if(m==true){f=k.customFilteredData}else{for(var d=0;d<g.length;d++){for(var c=0;c<g[d].length;c++){f.push(g[d][c])}}f.sort(h)}for(d=0;d<f.length;d++){e={alt:"",avg_rating:"",comment_count:f[d]["comments"]["count"],date:wdi_front.convertUnixDate(f[d]["created_time"]),description:wdi_front.getDescription((f[d]["caption"]!==null)?wdi_front.escape_tags(f[d]["caption"]["text"]):""),filename:wdi_front.getFileName(f[d]),filetype:wdi_front.getFileType(f[d]),hit_count:"0",id:f[d]["id"],image_url:f[d]["link"],number:0,rate:"",rate_count:"0",username:f[d]["user"]["username"],profile_picture:f[d]["user"]["profile_picture"],thumb_url:f[d]["link"]+"media/?size=t",comments_data:f[d]["comments"]["data"],images:f[d]["images"],carousel_media:(typeof f[d]["carousel_media"]!=="undefined")?f[d]["carousel_media"]:null};b.push(e)}return b};wdi_front.convertUnixDate=function(b){var c=parseInt(b);var a=new Date(0);a.setUTCSeconds(c);var d=a.getFullYear()+"-"+a.getMonth()+"-"+a.getDate();d+=" "+a.getHours()+":"+a.getMinutes();return d};wdi_front.getDescription=function(a){a=a.replace(/\r?\n|\r/g," ");return a};wdi_front.getFileName=function(d){var c=d.link;var b=d.type;if(b==="video"&&d.hasOwnProperty("videos")){return d.videos["standard_resolution"]["url"]}else{var a=c.split("/");return a[a.length-2]}};wdi_front.getFileType=function(a){if(a.type=="video"&&a.hasOwnProperty("videos")){return"EMBED_OEMBED_INSTAGRAM_VIDEO"}else{return"EMBED_OEMBED_INSTAGRAM_IMAGE"}};wdi_front.array_max=function(d){var a=d[0];var b=0;for(var c=1;c<d.length;c++){if(a<d[c]){a=d[c];b=c}}return{value:a,index:b}};wdi_front.array_min=function(d){var c=d[0];var a=0;for(var b=1;b<d.length;b++){if(c>d[b]){c=d[b];a=b}}return{value:c,index:a}};wdi_front.activeUsersCount=function(c){var a=0;for(var b=0;b<c.usersData.length;b++){if(c.usersData[b].finished!="finished"){a++}}return a};wdi_front.checkMediaResponse=function(a,b){if(a!=""&&typeof a!="undefined"&&a!=null&&a.meta["code"]===400&&a.meta["error_type"]==="APINotAllowedError"){return a}if(a==""||typeof a=="undefined"||a==null){errorMessage=wdi_front_messages.connection_error;wdi_front.show_alert(errorMessage,a,b);return false}if(a.meta["code"]!=200){errorMessage=a.meta["error_message"];wdi_front.show_alert(errorMessage,a,b);return false}return a};wdi_front.stripHashtag=function(a){switch(a[0]){case"#":return a.substr(1,a.length);break;default:return a;break}};wdi_front.getInputType=function(a){switch(a[0]){case"#":return"hashtag";break;case"%":return"location";break;default:return"user";break}};wdi_front.regexpTestCaption=function(h,e){var d=false,b=false,f=[],g=e.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&"),c=new RegExp("(?:^|\\s)"+g+"(?:^|\\s)"),a=new RegExp("(?:^|\\s)"+g,"g");if(c.exec(h)!=null){d=true}while((match=a.exec(h))!=null){if(match.index==h.length-e.length-1){b=true}}if(d==true||b==true){return true}else{return false}};wdi_front.replaceNewLines=function(c){var b="vUkCJvN2ps3t",a=[],g;c=c.replace(/\r?\n|\r/g,b);g=new RegExp(b,"g");while((match=g.exec(c))!=null){a.push(match.index)}var f=c.split(b);var e=0;for(var d=0;d<f.length;d++){if(f[d]==""){e++}else{e=0}if(e>0){f.splice(d,1);e--;d--}}c=f.join(" ");return c};wdi_front.isEmptyObject=function(a){for(var b in a){if(a.hasOwnProperty(b)){return false}}return true};var WDIFeed=function(a){this["data"]=a.data;this["dataCount"]=a.dataCount;this["feed_row"]=a.feed_row;this["usersData"]=a.usersData;_this=this;this.set_images_loading_flag=function(b){window.addEventListener("load",function(){b.nowLoadingImages=false})};this.set_images_loading_flag(_this)};WDIFeed.prototype.conditionalFilter=function(a,c){var d=this,b=d.feed_row.conditional_filter_type,e=d.feed_row.conditional_filters;if(c.ignoreFiltering==true){}else{a=this.avoidDuplicateMedia(a)}if(!wdi_front.isJsonString(e)){return a}else{e=JSON.parse(e);if(e.length==0){return a}}if(d.feed_row.conditional_filter_enable=="0"){return a}d.instagramRequestCounter++;switch(b){case"AND":a=this.applyANDLogic(a,e,d);break;case"OR":a=this.applyORLogic(a,e,d);break;case"NOR":a=this.applyNORLogic(a,e,d);break;default:break}return a};WDIFeed.prototype.applyANDLogic=function(a,d){var c=this;for(var b=0;b<d.length;b++){a=this.filterResponse(a,d[b])}return a};WDIFeed.prototype.applyORLogic=function(d,c){var h=this;var a=[],g,j=[],f,b;for(var e=0;e<c.length;e++){g=this.filterResponse(d,c[e]);a=a.concat(g.data);g={}}for(e=0;e<a.length;e++){b=a[e];if(!this.mediaExists(b,j)&&!this.mediaExists(b,h.dataStorageList)){j.push(b)}}f={data:j,meta:d.meta,pagination:d.pagination};return f};WDIFeed.prototype.applyNORLogic=function(c,h){var f=c,g=this,b=this.applyORLogic(c,h,g),d=[],a;for(var e=0;e<f.data.length;e++){if(!this.mediaExists(f.data[e],b.data)){d.push(f.data[e])}}a={data:d,meta:f.meta,pagination:f.pagination};return a};WDIFeed.prototype.mediaExists=function(b,c){for(var a=0;a<c.length;a++){if(b.id==c[a]["id"]){return true}}return false};WDIFeed.prototype.filterResponse=function(a,b){switch(b.filter_type){case"hashtag":return this.filterByHashtag(a,b);break;case"username":return this.filterByUsername(a,b);break;case"mention":return this.filterByMention(a,b);break;case"description":return this.filterByDescription(a,b);break;case"location":return this.filterByLocation(a,b);break;case"url":return this.filterByUrl(a,b);break}};WDIFeed.prototype.filterByHashtag=function(b,g){var d=[],f,h,a;for(var e=0;e<b.data.length;e++){h=b.data[e];for(var c=0;c<h.tags.length;c++){tag=h.tags[c];if(tag.toLowerCase()==g.filter_by.toLowerCase()){d.push(h)}}}a={data:d,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.filterByUsername=function(b,e){var c=[],f,a;for(var d=0;d<b.data.length;d++){f=b.data[d];if(f.user.username.toLowerCase()==e.filter_by.toLowerCase()){c.push(f)}}a={data:c,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.filterByMention=function(b,e){var c=[],f,g,a;for(var d=0;d<b.data.length;d++){f=b.data[d];if(f.caption!==null){g=f.caption["text"].toLowerCase();if(g.indexOf("@"+e.filter_by.toLowerCase())!=-1){c.push(f)}}}a={data:c,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.filterByDescription=function(c,f){var d=[],g,h,b;for(var e=0;e<c.data.length;e++){g=c.data[e];if(g.caption!==null){h=g.caption["text"].toLowerCase();h=wdi_front.replaceNewLines(h);var a=f.filter_by.toLowerCase();if(wdi_front.regexpTestCaption(h,a)){d.push(g)}}}b={data:d,meta:c.meta,pagination:c.pagination};return b};WDIFeed.prototype.filterByLocation=function(b,f){var c=[],g,e,a;for(var d=0;d<b.data.length;d++){g=b.data[d];if(g.location!==null){e=g.location["id"];if(e==f.filter_by){c.push(g)}}}a={data:c,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.filterByUrl=function(b,e){var c=[],g,h,a,f;e.filter_by=this.getIdFromUrl(e.filter_by);for(var d=0;d<b.data.length;d++){g=b.data[d];if(g.link!==null){h=this.getIdFromUrl(g.link);if(h==e.filter_by){c.push(g)}}}a={data:c,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.getIdFromUrl=function(a){var c=a.split("/"),d=false;for(var b=0;b<c.length;b++){if(c[b]=="p"){if(typeof c[b+1]!="undefined"){d=c[b+1];break}}}return d};WDIFeed.prototype.avoidDuplicateMedia=function(b){var e=b.data,d=[],a={};if(typeof e=="undefined"){e=[]}for(var c=0;c<e.length;c++){if(!this.mediaExists(e[c],this.dataStorageList)&&!this.mediaExists(e[c],d)&&!this.mediaExists(e[c],this.conditionalFilterBuffer)){d.push(e[c])}}this.conditionalFilterBuffer=this.conditionalFilterBuffer.concat(d);a={data:d,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.storeRawData=function(c,a){var e=this;if(typeof this[a]=="object"&&typeof this[a].length=="number"){for(var b=0;b<c.length;b++){var d="";if(wdi_front.isHashtag(c[b].user_id)){d=c[b].pagination.next_max_tag_id}else{if(e.feed_row.liked_feed=="liked"){d=c[b].pagination.next_max_like_id;if(typeof d=="undefined"){d=""}}else{if(c[b].pagination==null){c[b].pagination=[]}d=c[b].pagination.next_max_id;if(typeof d=="undefined"){d=""}}}if(typeof this[a][b]=="undefined"){this[a].push({data:c[b].data,index:0,locked:false,hash_id:d,usersDataFinished:false,userId:c[b].user_id,length:function(){return this.data.length-this.index},getData:function(g){var h=this.data.slice(this.index,this.index+g);this.index+=Math.min(g,this.length());if(this.index==this.data.length&&this.locked==true&&this.usersDataFinished==false){for(var f=0;f<e.usersData.length;f++){if(e.usersData[f]["user_id"]==this.userId){e.usersData[f].finished="finished";this.usersDataFinished=true;break}}}return h}})}else{if(this[a][b].locked==false){if(d!=this[a][b].hash_id){this[a][b].data=this[a][b].data.concat(c[b].data);this[a][b].hash_id=d}else{this[a][b].locked=true}}}}}};wdi_front.updateUsersIfNecessary=function(c){var d=c.feed_users;var a=false;for(var b=0;b<d.length;b++){if("#"==d[b].username.substr(0,1)){d[b].id=d[b].username;continue}if(""==d[b].id||"username"==d[b].id){a=true;c.instagram.searchForUsersByName(d[b].username,{success:function(i){if(typeof i.meta!="undefined"&&typeof i.meta.error_type!="undefined"){wdi_front.show_alert(false,i,c)}if(i.meta.code==200&&i.data.length>0){var l=false;for(var g=0;g<i.data.length;g++){if(i.data[g].username==i.args.username){l=true;break}}if(l){for(var h=0;h<d.length;h++){if(i.data[g].username==d[h].username){d[h].id=i.data[g].id}}}}var f=false;for(var e=0;e<d.length;e++){if(d[e].id==""||d[e].id=="username"){f=true;break}}if(!f){c.feed_row.feed_users=JSON.stringify(d);wdi_front.init(c)}},username:d[b].username})}}return a};if(typeof wdi_ajax.ajax_response!="undefined"){jQuery(document).one("ajaxStop",function(){if(wdi_front.type!="not_declared"){wdi_front.clickOrTouch=wdi_front.detectEvent();wdi_front.globalInit()}else{return}})}else{jQuery(document).ready(function(){if(wdi_front.type!="not_declared"){wdi_front.clickOrTouch=wdi_front.detectEvent();wdi_front.globalInit()}else{return}})}jQuery(document).ready(function(){setTimeout(function(){if(wdi_front_messages.show_alerts==="1"&&jQuery(".wdi_check_fontawesome .fa-instagram").prop("tagName")!=="I"){console.log("Font Awesome is not loaded properly. Please ask for support https://wordpress.org/support/plugin/wd-instagram-feed/")}},2000)});function wdi_extractHostname(b){if(typeof b==="undefined"||b===""){return""}var a=b.replace(/(^\w+:|^)\/\//,"");return a};
1
+ if(typeof wdi_front=="undefined"){wdi_front={type:"not_declared"}}wdi_front.detectEvent=function(){var a=(/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));if(a){return"touchend"}else{return"click"}};var wdi_error_show=false;wdi_front.escape_tags=function(e){var b=/</g,c=/>/g,d=/'/g,a=/"/g;if(typeof e=="undefined"){e=""}e=e.toString().replace(b,"&lt;").replace(c,"&gt;").replace(d,"&#39;").replace(a,"&#34;");return e};wdi_front.show_alert=function(e,b,f){f=jQuery("#wdi_feed_"+f.feed_row.wdi_feed_counter);if(b.meta["code"]===400&&b.meta["error_type"]==="APINotAllowedError"){if(typeof b.wdi_current_feed_name!="undefined"){var a=b.wdi_current_feed_name;var d=f.find(".wdi_private_feed_names");d.html(a);f.find(".wdi_private_feed_error").removeClass("wdi_hidden")}f.find(".wdi_spinner").remove()}if(typeof f!="undefined"&&b.meta["error_type"]!="APINotAllowedError"){f.find(".wdi_spinner").remove();wdi_error_show=true;var c=f.find(".wdi_js_error");var g=f.find(".wdi_token_error");if(b!=false&&typeof b.meta!=undefined&&b.meta.error_type==="OAuthAccessTokenException"){g.removeClass("wdi_hidden");if(wdi_front_messages.wdi_token_error_flag!="1"){jQuery.ajax({type:"POST",url:wdi_url.ajax_url,dataType:"json",data:{action:"wdi_token_flag",wdi_token_flag_nonce:wdi_front_messages.wdi_token_flag_nonce},success:function(h){}})}}else{c.removeClass("wdi_js_error");c.addClass("wdi_js_error_no_animate");jQuery(".wdi_js_error_no_animate").show()}if(wdi_front_messages.show_alerts){}else{console.log("%c"+e,"color:#cc0000;")}}wdi_error_show=true};wdi_front.globalInit=function(){var a=wdi_front.feed_counter;if(typeof wdi_ajax.ajax_response!="undefined"){var c=wdi_feed_counter_init.wdi_feed_counter_init}else{var c=0}for(var b=c;b<=a;b++){if(jQuery("#wdi_feed_"+b).length===0){continue}var d=new WDIFeed(window["wdi_feed_"+b]);d.instagram=new WDIInstagram();d.instagram.filterArguments={feed:d};d.instagram.filters=[{where:"getUserRecentMedia",what:function(f,g,e){return g.feed.conditionalFilter(f,e)}},{where:"getTagRecentMedia",what:function(f,g,e){return g.feed.conditionalFilter(f,e)}},{where:"getRecentLikedMedia",what:function(f,g,e){return g.feed.conditionalFilter(f,e)}},{where:"requestByUrl",what:function(f,g,e){return g.feed.conditionalFilter(f,e)}}];d.instagram.addToken(d.feed_row["access_token"]);wdi_front.access_token=d.feed_row["access_token"];d.dataStorageRaw=[];d.dataStorage=[];d.dataStorageList=[];d.allResponseLength=0;d.currentResponseLength=0;d.temproraryUsersData=[];d.removedUsers=0;d.nowLoadingImages=true;d.imageIndex=0;d.resIndex=0;d.currentPage=1;d.userSortFlags=[];d.customFilterChanged=false;d.maxConditionalFiltersRequestCount=10;d.instagramRequestCounter=0;d.mediaRequestsDone=false;d.conditionalFilterBuffer=[];d.stopInfiniteScrollFlag=false;if(d.feed_row.feed_type=="masonry"){d.displayedData=[]}if(d.feed_row.feed_display_view=="pagination"){d.feed_row.resort_after_load_more=0;if(d.feed_row.feed_type!="image_browser"){d.feed_row.load_more_number=parseInt(d.feed_row.pagination_per_page_number);d.feed_row.number_of_photos=(1+parseInt(d.feed_row.pagination_preload_number))*d.feed_row.load_more_number}else{d.feed_row.number_of_photos=1+parseInt(d.feed_row.image_browser_preload_number);d.feed_row.load_more_number=parseInt(d.feed_row.image_browser_load_number)}d.freeSpaces=(Math.floor(d.feed_row.pagination_per_page_number/d.feed_row.number_of_columns)+1)*d.feed_row.number_of_columns-d.feed_row.pagination_per_page_number}else{d.freeSpaces=0}d.galleryBox=function(e){wdi_spider_createpopup(wdi_url.ajax_url+"?gallery_id="+this.feed_row.id+"&image_id="+e,this.feed_row.wdi_feed_counter,this.feed_row.lightbox_width,this.feed_row.lightbox_height,1,"testpopup",5,this,e)};wdi_responsive.columnControl(d);if(d.feed_row.feed_type=="masonry"){jQuery(window).trigger("resize")}wdi_front.bindEvents(d);window["wdi_feed_"+b]=d;wdi_front.init(d)}};wdi_front.init=function(d){jQuery(".wdi_js_error").hide();d.photoCounter=d.feed_row.number_of_photos;if(d.feed_row.liked_feed=="liked"){d.feed_users=["self"]}else{if(wdi_front.isJsonString(d.feed_row.feed_users)){d.feed_users=JSON.parse(d.feed_row.feed_users)}else{wdi_front.show_alert(wdi_front_messages.invalid_users_format,false,d);return}}var e=[];if(typeof window.wdi_all_tags!=="undefined"){e=window.wdi_all_tags}for(var a in d.feed_users){if(d.feed_users[a].username[0]==="#"&&typeof d.feed_users[a].tag_id!=="undefined"){e[d.feed_users[a].tag_id]=d.feed_users[a]}}window.wdi_all_tags=e;d.dataCount=d.feed_users.length;var b=wdi_front.getFeedItemResolution(d);d.feedImageResolution=b.image;d.feedVideoResolution=b.video;for(var c=0;c<d.dataCount;c++){wdi_front.instagramRequest(c,d)}if(d.feed_row.number_of_photos>0){wdi_front.ajaxLoader(d)}if(d.feed_row["display_header"]==="1"){wdi_front.show("header",d)}if(d.feed_row["show_usernames"]==="1"){wdi_front.show("users",d)}};wdi_front.getFeedItemResolution=function(g){var d={image:"standard_resolution",video:"standard_resolution"};if(g.feed_row.feed_resolution==="thumbnail"){return{image:"thumbnail",video:"low_bandwidth"}}else{if(g.feed_row.feed_resolution==="low"){return{image:"low_resolution",video:"low_resolution"}}else{if(g.feed_row.feed_resolution==="standard"){return{image:"standard_resolution",video:"standard_resolution"}}}}var c=jQuery("#wdi_feed_"+g.feed_row.wdi_feed_counter).find(".wdi_feed_wrapper");c.append('<div class="wdi_feed_item" id="wdi_feed_item_example"></div>');wdi_responsive.columnControl(g,1);var b=c.attr("wdi-res").split("wdi_col_");c.find("#wdi_feed_item_example").remove();if(b.length!==2){return d}var a=parseInt(b[1]);if(a<=0){return d}var f=(c.width()/a)-10;var e=d;if(f<=150){e.image="thumbnail";e.video="low_bandwidth"}else{if(f>150&&f<=320){e.image="low_resolution";e.video="low_resolution"}else{e.image="standard_resolution";e.video="standard_resolution"}}return e};wdi_front.isJsonString=function(b){try{JSON.parse(b)}catch(a){return false}return true};wdi_front.instagramRequest=function(d,b){var a=b.feed_users,c=this;if(typeof a[d]==="string"&&a[d]==="self"){b.instagram.getRecentLikedMedia({success:function(e){if(typeof e.meta!="undefined"&&typeof e.meta.error_type!="undefined"){wdi_front.show_alert(false,e,b)}b.mediaRequestsDone=true;e=c.checkMediaResponse(e,b);if(e!=false){c.saveSelfUserData(e,b)}}})}else{if(this.getInputType(a[d]["username"])=="hashtag"){b.instagram.getTagRecentMedia(this.stripHashtag(a[d]["username"]),{success:function(e){if(typeof e.meta!="undefined"&&typeof e.meta.error_type!="undefined"){wdi_front.show_alert(false,e,b)}b.mediaRequestsDone=true;e=c.checkMediaResponse(e,b);if(e!=false){c.saveUserData(e,b.feed_users[d],b)}}})}else{if(this.getInputType(a[d]["username"])=="user"){b.instagram.getSelfRecentMedia({success:function(e){if(typeof e.meta!="undefined"&&typeof e.meta.error_type!="undefined"){e.wdi_current_feed_name=a[d].username;wdi_front.show_alert(false,e,b)}b.mediaRequestsDone=true;e=c.checkMediaResponse(e,b);if(e!=false){c.saveUserData(e,b.feed_users[d],b)}}})}}}};wdi_front.isHashtag=function(a){return(a[0]==="#")};wdi_front.saveUserData=function(d,a,b){d.username=a.username;d.user_id=a.id;if(d.user_id[0]==="#"){d.data=wdi_front.appendRequestHashtag(d.data,d.user_id)}b.usersData.push(d);b.currentResponseLength=wdi_front.getArrayContentLength(b.usersData,"data");b.allResponseLength+=b.currentResponseLength;if(b.dataCount==b.usersData.length){if(b.currentResponseLength<b.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(b)){wdi_front.loadMore("initial-keep",b)}else{wdi_front.displayFeed(b);wdi_front.applyFilters(b);if(!wdi_front.activeUsersCount(b)){if(b.feed_row.feed_display_view=="load_more_btn"){var c=jQuery("#wdi_feed_"+b.feed_row.wdi_feed_counter);c.find(".wdi_load_more").addClass("wdi_hidden");c.find(".wdi_spinner").addClass("wdi_hidden")}}}}};wdi_front.saveSelfUserData=function(c,a){c.username="";c.user_id="";a.usersData.push(c);a.currentResponseLength=wdi_front.getArrayContentLength(a.usersData,"data");a.allResponseLength+=a.currentResponseLength;if(a.dataCount==a.usersData.length){if(a.currentResponseLength<a.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(a)){wdi_front.loadMore("initial-keep",a)}else{wdi_front.displayFeed(a);wdi_front.applyFilters(a);if(!wdi_front.activeUsersCount(a)){if(a.feed_row.feed_display_view=="load_more_btn"){var b=jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter);b.find(".wdi_load_more").addClass("wdi_hidden");b.find(".wdi_spinner").addClass("wdi_hidden")}}}}};wdi_front.userHasNoPhoto=function(c,e){var a=0;var d=c.usersData;if(typeof e!="undefined"){d=e}for(var b=0;b<d.length;b++){if(typeof d[b]["pagination"]=="undefined"){d[b]["pagination"]=[]}if(c.feed_row.liked_feed==="liked"){if(typeof d[b]["pagination"]["next_max_like_id"]=="undefined"){a++}}else{if(typeof d[b]["pagination"]["next_max_id"]=="undefined"){a++}}}if(a==d.length){return 1}else{return 0}};wdi_front.appendRequestHashtag=function(c,b){for(var a=0;a<c.length;a++){c[a]["wdi_hashtag"]=b}return c};wdi_front.displayFeed=function(c,b){if(c.customFilterChanged==false){var d=wdi_front.feedSort(c,b)}var a=c.customFilterChanged;if(c.customFilterChanged==true){var d=c.customFilteredData;c.parsedData=wdi_front.parseLighboxData(c,true)}if(c.feed_row.resort_after_load_more!="1"){if(c.customFilterChanged==false){c.dataStorageList=c.dataStorageList.concat(d)}}else{if(c.customFilterChanged==false){c.dataStorageList=d}}if(c.feed_row.feed_type=="masonry"){wdi_front.masonryDisplayFeedItems(d,c)}if(c.feed_row.feed_type=="thumbnails"||c.feed_row.feed_type=="blog_style"||c.feed_row.feed_type=="image_browser"){wdi_front.displayFeedItems(d,c)}var e=wdi_front.getDataLength(c);if(e<c.photoCounter&&!a&&c.instagramRequestCounter<=c.maxConditionalFiltersRequestCount&&!wdi_front.allDataHasFinished(c)){wdi_front.loadMore("",c)}else{wdi_front.allImagesLoaded(c)}if(c.instagramRequestCounter>c.maxConditionalFiltersRequestCount){wdi_front.allImagesLoaded(c);if(d.length==0){c.stopInfiniteScrollFlag=true}}if(c.feed_row.feed_display_view=="pagination"&&c.currentPage<c.paginator){jQuery("#wdi_feed_"+c.feed_row.wdi_feed_counter).find("#wdi_last_page").removeClass("wdi_disabled")}c.instagramRequestCounter=0;c.conditionalFilterBuffer=[];wdi_front.updateUsersImages(c)};wdi_front.updateUsersImages=function(a){var b=jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter).find(".wdi_single_user .wdi_user_img_wrap img");b.each(function(){if(jQuery(this).attr("src")==wdi_url.plugin_url+"images/missing.png"||jQuery(this).attr("src")==""){if(a.feed_row.liked_feed=="liked"){return}for(var c=0;c<a.usersData.length;c++){if(a.usersData[c]["username"]==jQuery(this).parent().parent().find("h3").text()){if(a.usersData[c]["data"].length!=0){jQuery(this).attr("src",a.usersData[c]["data"][0]["images"]["thumbnail"]["url"])}}}}})};wdi_front.masonryDisplayFeedItems=function(d,h){var b=[];var p=[];if(jQuery("#wdi_feed_"+h.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length==0){return}jQuery("#wdi_feed_"+h.feed_row.wdi_feed_counter+" .wdi_masonry_column").each(function(){if(h.feed_row.resort_after_load_more==1){jQuery(this).html("");h.imageIndex=0}if(h.customFilterChanged==true){jQuery(this).html("");h.imageIndex=0}if(h.feed_row.feed_display_view=="pagination"){b.push(0)}else{b.push(jQuery(this).height())}p.push(jQuery(this))});if(h.customFilterChanged==true){h.customFilterChanged=false}for(var e=0;e<d.length;e++){h.displayedData.push(d[e]);if(d[e]["type"]=="image"){var n=wdi_front.getPhotoTemplate(h)}else{if(d[e].hasOwnProperty("videos")||d[e]["type"]=="video"){var n=wdi_front.getVideoTemplate(h)}else{var n=wdi_front.getSliderTemplate(h)}}var g=d[e];var o=wdi_front.createObject(g,h);var f=n(o);var m=wdi_front.array_min(b);var l=wdi_front.getImageResolution(d[e]);p[m.index].html(p[m.index].html()+f);b[m.index]+=p[m.index].width()*l;h.imageIndex++;if(h.feed_row.feed_display_view=="pagination"){if((e+1)%h.feed_row.pagination_per_page_number===0){h.resIndex+=h.freeSpaces+1}else{h.resIndex++}}}h.wdi_loadedImages=0;var j=false;h.wdi_load_count=e;var a=h.feed_row.wdi_feed_counter;var k=jQuery("#wdi_feed_"+a+" img.wdi_img").on("load",function(){h.wdi_loadedImages++;c();if(j===false){wdi_responsive.columnControl(h,1);j=true}});c();function c(){if(h.wdi_load_count===h.wdi_loadedImages&&h.wdi_loadedImages!=0){h.loadedImages=0;h.wdi_load_count=0;wdi_front.allImagesLoaded(h)}}if(h.paginatorNextFlag==true){wdi_front.updatePagination(h,"next")}h.infiniteScrollFlag=false};wdi_front.getImageResolution=function(c){var d=c.images["standard_resolution"]["width"];var b=c.images["standard_resolution"]["height"];var a=b/d;return a};wdi_front.getDataLength=function(b,d){var c=0;if(typeof d==="undefined"){for(var a=0;a<b.dataStorage.length;a++){c+=b.dataStorage[a].length}}else{for(var a=0;a<d.length;a++){c+=d[a].length}}return c};wdi_front.getArrayContentLength=function(d,c){var b=0;for(var a=0;a<d.length;a++){if(d[a]["finished"]=="finished"){continue}b+=d[a][c].length}return b};wdi_front.displayFeedItems=function(d,j){if(jQuery("#wdi_feed_"+j.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length==0){return}var a=j.feed_row.wdi_feed_counter;var l=jQuery("#wdi_feed_"+a+" .wdi_feed_wrapper");if(j.feed_row.resort_after_load_more==="1"){l.html("");j.imageIndex=0}if(j.customFilterChanged==true){l.html("");j.imageIndex=0;j.customFilterChanged=false}var g=wdi_front.getImgCount(j)-d.length-1;if(j.feed_row.feed_display_view=="pagination"){var b=j.feed_row.load_more_number;if(j.feed_row.feed_type=="image_browser"){b=1}if(jQuery("#wdi_feed_"+j.feed_row.wdi_feed_counter+' [wdi_page="'+(j.currentPage-1)+'"]').length<b||d.length==0){j.currentPage=(--j.currentPage<=1)?1:j.currentPage}}for(var e=0;e<d.length;e++){if(d[e]["type"]=="image"){var m=wdi_front.getPhotoTemplate(j)}else{if(d[e].hasOwnProperty("videos")){var m=wdi_front.getVideoTemplate(j)}else{var m=wdi_front.getSliderTemplate(j)}}var h=d[e];var n=wdi_front.createObject(h,j);var f=m(n);l.html(l.html()+f);j.imageIndex++;if(j.feed_row.feed_display_view=="pagination"){if((e+1)%j.feed_row.pagination_per_page_number===0){j.resIndex+=j.freeSpaces+1}else{j.resIndex++}}}j.wdi_loadedImages=0;var k=false;j.wdi_load_count=e;var a=j.feed_row.wdi_feed_counter;var l=jQuery("#wdi_feed_"+a+" img.wdi_img").on("load",function(){j.wdi_loadedImages++;c();if(k===false){wdi_responsive.columnControl(j,1);k=true}});function c(){if(j.wdi_load_count===j.wdi_loadedImages&&j.wdi_loadedImages!=0){j.loadedImages=0;j.wdi_load_count=0;wdi_front.allImagesLoaded(j)}}if(j.paginatorNextFlag==true){wdi_front.updatePagination(j,"next")}j.infiniteScrollFlag=false};wdi_front.checkFeedFinished=function(b){for(var a=0;a<b.usersData.length;a++){if(typeof b.usersData[a]["finished"]=="undefined"){return false}}return true};wdi_front.sortingOperator=function(c,b){var a;switch(c){case"date":switch(b){case"asc":a=function(e,d){return(e.created_time>d.created_time)?1:-1};break;case"desc":a=function(e,d){return(e.created_time>d.created_time)?-1:1};break}break;case"likes":switch(b){case"asc":a=function(e,d){return(e.likes["count"]<d.likes["count"])?-1:1};break;case"desc":a=function(e,d){return(e.likes["count"]<d.likes["count"])?1:-1};break}break;case"comments":switch(b){case"asc":a=function(e,d){return(e.comments["count"]<d.comments["count"])?-1:1};break;case"desc":a=function(e,d){return(e.comments["count"]<d.comments["count"])?1:-1};break}break;case"random":a=function(e,d){var f=Math.random();return(f>0.5)?1:-1};break}return a};wdi_front.feedSort=function(e,b){var d=e.feed_row.sort_images_by;var c=e.feed_row.display_order;if(e.feed_row.resort_after_load_more==="1"){e.data=e.data.concat(wdi_front.smartPicker(e,b))}else{e.data=wdi_front.smartPicker(e,b)}var a=wdi_front.sortingOperator(d,c);e.data.sort(a);return e.data};wdi_front.smartPicker=function(l,c){var g=[];var a=0;var k=[];var f=Math.ceil(l.feed_row["number_of_photos"]/l.usersData.length);var b=parseInt(l.feed_row["number_of_photos"]);var n=0;if(c!=""&&typeof c!="undefined"&&c!=null){b=parseInt(c);f=Math.ceil(b/wdi_front.activeUsersCount(l))}var j=function(p,i){return(p.data.length>i.data.length)?1:-1};var e=function(p,i){return(p.length()>i.length())?1:-1};l.storeRawData(l.usersData,"dataStorageRaw");var o=l.dataStorageRaw.sort(e);var h=l.usersData.sort(j);for(var d=0;d<h.length;d++){n+=f;if(o[d].length()<=n){n-=o[d].length();g.push(o[d].getData(o[d].length()));a+=g[g.length-1].length}else{if(a+n>b){n=b-a}var m=[];if(l.auto_trigger===false){m=m.concat(o[d].getData(n))}else{if(m.length+wdi_front.getDataLength(l)+wdi_front.getDataLength(l,g)<l.feed_row["number_of_photos"]){m=m.concat(o[d].getData(n))}}n=0;a+=m.length;g.push(m)}}for(d=0;d<g.length;d++){if(typeof l.dataStorage[d]==="undefined"){l.dataStorage.push(g[d])}else{l.dataStorage[d]=l.dataStorage[d].concat(g[d])}}l.parsedData=wdi_front.parseLighboxData(l);for(d=0;d<g.length;d++){k=k.concat(g[d])}return k};wdi_front.createObject=function(e,h){var j=(e.caption!=null)?e.caption["text"]:"&nbsp";var i="";if(e.type=="video"){i=e.hasOwnProperty("videos")?e.videos[h.feedVideoResolution]["url"]:""}if(typeof e.images[h.feedImageResolution]=="undefined"){var f=wdi_url.plugin_url+"images/missing.png"}else{var f=e.images[h.feedImageResolution].url}var a=h.imageIndex;var b="square";var d=e.images["standard_resolution"]["height"];var g=e.images["standard_resolution"]["width"];if(d>g){b="portrait"}else{if(d<g){b="landscape"}}var c={id:e.id,caption:wdi_front.escape_tags(j),image_url:f,likes:e.likes["count"],comments:e.comments["count"],wdi_index:a,wdi_res_index:h.resIndex,wdi_media_user:e.user["username"],link:e.link,video_url:i,wdi_username:e.user["username"],wdi_shape:b};return c};wdi_front.setPage=function(c){var b=c.feed_row.feed_display_view;var e=c.feed_row.feed_type;if(b!="pagination"){return""}var a=c.imageIndex;if(e=="image_browser"){var d=1}else{var d=Math.abs(c.feed_row.pagination_per_page_number)}c.paginator=Math.ceil((a+1)/d);return c.paginator};wdi_front.getPhotoTemplate=function(g){var e=wdi_front.setPage(g);var j="";var k="";var l="";var d="";var m="fa-arrows-alt";var c="";if(g.feed_row.feed_type=="blog_style"||g.feed_row.feed_type=="image_browser"){m=""}if(e!=""){k='wdi_page="'+e+'"';sourceAttr="src"}else{sourceAttr="src"}if(e!=""&&e!=1){j="wdi_hidden"}if(g.feed_row.show_username_on_thumb=="1"){c='<span class="wdi_media_user">@<%= wdi_username%></span>'}if(g.feed_row.show_full_description==1&&g.feed_row.feed_type=="masonry"){j+=" wdi_full_caption"}var f="";if(g.feed_row.feed_type!=="blog_style"){if(g.feed_row.feed_type=="masonry"){f="wdi_responsive.showMasonryCaption(jQuery(this),"+g.feed_row.wdi_feed_counter+");"}else{f="wdi_responsive.showCaption(jQuery(this),"+g.feed_row.wdi_feed_counter+");"}}switch(g.feed_row.feed_item_onclick){case"lightbox":l="onclick=wdi_feed_"+g.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":l="onclick=\"window.open ('<%= link%>','_blank')\"";d="wdi_hover_off";m="";break;case"custom_redirect":l="onclick=\"window.open ('"+g.feed_row.redirect_url+"','_self')\"";d="wdi_hover_off";m="";break;case"none":l="";d="wdi_cursor_off wdi_hover_off";m=""}var h="<%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>";var b=g.feed_row.wdi_feed_counter;var a='<div class="wdi_feed_item '+j+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+k+' wdi_type="image" id="wdi_'+b+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img '+h+'"><img class="wdi_img" '+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+d+'" >'+c+'<div class="wdi_thumb_icon" '+l+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="fa '+m+'"></i></div></div></div></div></div></div>';if(g.feed_row["show_likes"]==="1"||g.feed_row["show_comments"]==="1"||g.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_meta">';if(g.feed_row["show_likes"]==="1"){a+='<div class="wdi_thumb_likes"><i class="fa fa-heart-o">&nbsp;<%= likes%></i></div>'}if(g.feed_row["show_comments"]==="1"){a+='<div class="wdi_thumb_comments"><i class="fa fa-comment-o">&nbsp;<%= comments%></i></div>'}a+='<div class="wdi_clear"></div>';if(g.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_title" onclick='+f+" ><%=caption%></div>"}a+="</div>"}a+="</div>";var i=_.template(a);return i};wdi_front.getSliderTemplate=function(g){var e=wdi_front.setPage(g);var j="";var k="";var l="";var d="";var m="fa-clone";var c="";if(g.feed_row.feed_type=="blog_style"||g.feed_row.feed_type=="image_browser"){m=""}if(e!=""){k='wdi_page="'+e+'"';sourceAttr="src"}else{sourceAttr="src"}if(e!=""&&e!=1){j="wdi_hidden"}if(g.feed_row.show_username_on_thumb=="1"){c='<span class="wdi_media_user">@<%= wdi_username%></span>'}if(g.feed_row.show_full_description==1&&g.feed_row.feed_type=="masonry"){j+=" wdi_full_caption"}var f="";if(g.feed_row.feed_type!=="blog_style"){if(g.feed_row.feed_type=="masonry"){f="wdi_responsive.showMasonryCaption(jQuery(this),"+g.feed_row.wdi_feed_counter+");"}else{f="wdi_responsive.showCaption(jQuery(this),"+g.feed_row.wdi_feed_counter+");"}}switch(g.feed_row.feed_item_onclick){case"lightbox":l="onclick=wdi_feed_"+g.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":l="onclick=\"window.open ('<%= link%>','_blank')\"";d="wdi_hover_off";m="fa-clone";break;case"custom_redirect":l="onclick=\"window.open ('"+g.feed_row.redirect_url+"','_self')\"";d="wdi_hover_off";m="";break;case"none":l="";d="wdi_cursor_off wdi_hover_off";m=""}var h="<%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>";var b=g.feed_row.wdi_feed_counter;var a='<div class="wdi_feed_item '+j+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+k+' wdi_type="slideshow" id="wdi_'+b+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img '+h+'"><img class="wdi_img" '+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+d+'" >'+c+'<div class="wdi_thumb_icon" '+l+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="fa '+m+'"></i></div></div></div></div></div></div>';if(g.feed_row["show_likes"]==="1"||g.feed_row["show_comments"]==="1"||g.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_meta">';if(g.feed_row["show_likes"]==="1"){a+='<div class="wdi_thumb_likes"><i class="fa fa-heart-o">&nbsp;<%= likes%></i></div>'}if(g.feed_row["show_comments"]==="1"){a+='<div class="wdi_thumb_comments"><i class="fa fa-comment-o">&nbsp;<%= comments%></i></div>'}a+='<div class="wdi_clear"></div>';if(g.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_title" onclick='+f+" ><%=caption%></div>"}a+="</div>"}a+="</div>";var i=_.template(a);return i};wdi_front.replaceToVideo=function(b,a,c){overlayHtml="<video style='width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;' controls=''><source src='"+b+"' type='video/mp4'>Your browser does not support the video tag. </video>";jQuery("#wdi_feed_"+c+' [wdi_index="'+a+'"] .wdi_photo_wrap_inner').html(overlayHtml);jQuery("#wdi_feed_"+c+' [wdi_index="'+a+'"] .wdi_photo_wrap_inner video').get(0).play()};wdi_front.getVideoTemplate=function(h){var f=wdi_front.setPage(h);var k="";var l="";var n="fa-play";var m="";var d="";var e;var c="";if(f!=""){l='wdi_page="'+f+'"';e="src"}else{e="src"}if(f!=""&&f!=1){k="wdi_hidden"}if(h.feed_row.show_username_on_thumb=="1"){c='<span class="wdi_media_user">@<%= wdi_username%></span>'}if(h.feed_row.show_full_description==1&&h.feed_row.feed_type=="masonry"){k+=" wdi_full_caption"}var g="";if(h.feed_row.feed_type!=="blog_style"){if(h.feed_row.feed_type=="masonry"){g="wdi_responsive.showMasonryCaption(jQuery(this),"+h.feed_row.wdi_feed_counter+");"}else{g="wdi_responsive.showCaption(jQuery(this),"+h.feed_row.wdi_feed_counter+");"}}switch(h.feed_row.feed_item_onclick){case"lightbox":m="onclick=wdi_feed_"+h.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":m="onclick=\"window.open ('<%= link%>','_blank')\"";d="wdi_hover_off";n="fa-play";break;case"custom_redirect":m="onclick=\"window.open ('"+h.feed_row.redirect_url+"','_self')\"";d="wdi_hover_off";n="";break;case"none":d="wdi_cursor_off wdi_hover_off";n="";if(h.feed_row.feed_type=="blog_style"||h.feed_row.feed_type=="image_browser"){m="onclick=wdi_front.replaceToVideo('<%= video_url%>','<%= wdi_index%>',"+h.feed_row.wdi_feed_counter+")";d="";n="fa-play"}}var i="<%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>";var b=h.feed_row.wdi_feed_counter;var a='<div class="wdi_feed_item '+k+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+l+' wdi_type="image" id="wdi_'+b+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img '+i+'"><img class="wdi_img" '+e+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+d+'" '+m+">"+c+'<div class="wdi_thumb_icon" style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="fa '+n+'"></i></div></div></div></div></div></div>';if(h.feed_row["show_likes"]==="1"||h.feed_row["show_comments"]==="1"||h.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_meta">';if(h.feed_row["show_likes"]==="1"){a+='<div class="wdi_thumb_likes"><i class="fa fa-heart-o">&nbsp;<%= likes%></i></div>'}if(h.feed_row["show_comments"]==="1"){a+='<div class="wdi_thumb_comments"><i class="fa fa-comment-o">&nbsp;<%= comments%></i></div>'}a+='<div class="wdi_clear"></div>';if(h.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_title" onclick='+g+" ><%=caption%></div>"}a+="</div>"}a+="</div>";var j=_.template(a);return j};wdi_front.bindEvents=function(a){if(jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length==0){return}if(a.feed_row.feed_display_view=="load_more_btn"){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_load_more_container").on(wdi_front.clickOrTouch,function(){wdi_front.loadMore(jQuery(this).find(".wdi_load_more_wrap"))})}if(a.feed_row.feed_display_view=="pagination"){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_next").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorNext(jQuery(this),a)});jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_prev").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorPrev(jQuery(this),a)});jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_last_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationLastPage(jQuery(this),a)});jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_first_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationFirstPage(jQuery(this),a)});a.paginatorNextFlag=false}if(a.feed_row.feed_display_view=="infinite_scroll"){jQuery(window).on("scroll",function(){wdi_front.infiniteScroll(a)});a.infiniteScrollFlag=false}};wdi_front.infiniteScroll=function(a){if((jQuery(window).scrollTop()+jQuery(window).height()-100)>=jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_infinite_scroll").offset().top){if(a.infiniteScrollFlag===false&&a.stopInfiniteScrollFlag==false){a.infiniteScrollFlag=true;wdi_front.loadMore(jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_infinite_scroll"),a)}else{if(a.stopInfiniteScrollFlag){wdi_front.allImagesLoaded(a)}}}};wdi_front.paginationFirstPage=function(b,c){if(c.paginator==1||c.currentPage==1){b.addClass("wdi_disabled");return}var d=c.currentPage;c.currentPage=1;wdi_front.updatePagination(c,"custom",d);var a=b.parent().find("#wdi_last_page");a.removeClass("wdi_disabled");b.addClass("wdi_disabled")};wdi_front.paginationLastPage=function(a,b){if(b.paginator==1||b.currentPage==b.paginator){return}var d=b.currentPage;b.currentPage=b.paginator;wdi_front.updatePagination(b,"custom",d);a.addClass("wdi_disabled");var c=a.parent().find("#wdi_first_page");c.removeClass("wdi_disabled")};wdi_front.paginatorNext=function(b,c){var a=b.parent().find("#wdi_last_page");var d=b.parent().find("#wdi_first_page");c.paginatorNextFlag=true;if(c.paginator==c.currentPage&&!wdi_front.checkFeedFinished(c)){c.currentPage++;var e=c.feed_row.number_of_photos;wdi_front.loadMore(b,c,e);a.addClass("wdi_disabled")}else{if(c.paginator>c.currentPage){c.currentPage++;wdi_front.updatePagination(c,"next");if(c.paginator>c.currentPage){a.removeClass("wdi_disabled")}else{a.addClass("wdi_disabled")}}}d.removeClass("wdi_disabled")};wdi_front.paginatorPrev=function(b,c){var a=b.parent().find("#wdi_last_page");var d=b.parent().find("#wdi_first_page");if(c.currentPage==1){d.addClass("wdi_disabled");return}c.currentPage--;wdi_front.updatePagination(c,"prev");a.removeClass("wdi_disabled");if(c.currentPage==1){d.addClass("wdi_disabled")}};wdi_front.updatePagination=function(b,a,d){var c="#wdi_feed_"+b.feed_row.wdi_feed_counter;jQuery(c+' [wdi_page="'+b.currentPage+'"]').each(function(){jQuery(this).removeClass("wdi_hidden")});switch(a){case"next":var d=b.currentPage-1;jQuery(c+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height());jQuery(c+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"prev":var d=b.currentPage+1;jQuery(c+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height());jQuery(c+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"custom":var d=d;if(d!=b.currentPage){jQuery(c+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height());jQuery(c+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")})}break}b.paginatorNextFlag=false;jQuery(c+" .wdi_feed_wrapper").css("height","auto");jQuery(c+" #wdi_current_page").text(b.currentPage)};wdi_front.loadMore=function(f,k){var b=0;if(f!=""&&typeof f!="undefined"&&f!="initial"&&f!="initial-keep"){var l=window[f.parent().parent().parent().parent().attr("id")]}if(typeof k!="undefined"){var l=k}var n=0,g=0;for(var e=0;e<l.userSortFlags.length;e++){if(l.userSortFlags[e].flag===true){n++;for(var d=0;d<l.usersData.length;d++){if(l.userSortFlags[e]["id"]===l.usersData[d]["user_id"]){if(l.usersData[d]["finished"]==="finished"){g++}}}}}if(n===g&&n!=0){return}if(f===""){l.auto_trigger=true}else{l.auto_trigger=false}wdi_front.ajaxLoader(l);if(l.feed_row.feed_type==="masonry"&&l.feed_row.feed_display_view=="pagination"){jQuery("#wdi_feed_"+wdi_front.feed_counter+" .wdi_full_caption").each(function(){jQuery(this).find(".wdi_photo_title").trigger(wdi_front.clickOrTouch)})}for(var e=0;e<l.usersData.length;e++){if(l.usersData[e]["finished"]==="finished"){b++}}if(b===l.usersData.length){wdi_front.allImagesLoaded(l);jQuery("#wdi_feed_"+l.feed_row["wdi_feed_counter"]+" .wdi_load_more").remove()}var h=l.usersData;l.loadMoreDataCount=l.feed_users.length;for(var e=0;e<h.length;e++){var m=h[e]["pagination"];var c={user_id:h[e]["user_id"],username:h[e]["username"]};if(m.next_url!=""&&m.next_url!=null&&typeof m.next_url!="undefined"){var a=m.next_url;wdi_front.loadMoreRequest(c,a,l,f)}else{if(f=="initial-keep"){l.temproraryUsersData[e]=l.usersData[e]}l.loadMoreDataCount--;wdi_front.checkForLoadMoreDone(l,f);continue}}};wdi_front.loadMoreRequest=function(b,a,e,d){if(!e.mediaRequestsDone){return}var f=e.usersData;var c="";var g=function(h){if(typeof h.meta!="undefined"&&typeof h.meta.error_type!="undefined"){wdi_front.show_alert(false,h,e)}if(h===""||typeof h=="undefined"||h==null){c=wdi_front_messages.network_error;e.loadMoreDataCount--;wdi_front.show_alert(c,h,e);return}if(h.meta["code"]!=200){c=h.meta["error_message"];e.loadMoreDataCount--;wdi_front.show_alert(c,h,e);return}h.user_id=b.user_id;h.username=b.username;for(var j=0;j<e.usersData.length;j++){if(h.user_id===e.usersData[j]["user_id"]){if(h.user_id[0]==="#"){h.data=wdi_front.appendRequestHashtag(h.data,h.user_id)}if(d=="initial-keep"){e.temproraryUsersData[j]=e.usersData[j]}e.usersData[j]=h;e.loadMoreDataCount--}}wdi_front.checkForLoadMoreDone(e,d)};if(b.username[0]!=="#"){e.instagram.requestByUrl(a,{success:g})}else{e.instagram.getTagRecentMedia(b.username,{success:g},a)}};wdi_front.checkForLoadMoreDone=function(c,b){var a=c.feed_row.load_more_number;var e=c.feed_row.number_of_photos;if(c.loadMoreDataCount==0){c.temproraryUsersData=wdi_front.mergeData(c.temproraryUsersData,c.usersData);var d=wdi_front.getArrayContentLength(c.temproraryUsersData,"data");if(b=="initial-keep"){b="initial"}if(b=="initial"){if(d<e&&!wdi_front.userHasNoPhoto(c,c.temproraryUsersData)&&c.instagramRequestCounter<=c.maxConditionalFiltersRequestCount){wdi_front.loadMore("initial",c)}else{c.usersData=c.temproraryUsersData;wdi_front.displayFeed(c);wdi_front.applyFilters(c);c.temproraryUsersData=[]}}else{if(d<a&&!wdi_front.userHasNoPhoto(c,c.temproraryUsersData)&&c.instagramRequestCounter<=c.maxConditionalFiltersRequestCount){wdi_front.loadMore(undefined,c)}else{c.usersData=c.temproraryUsersData;if(!wdi_front.activeUsersCount(c)){return}wdi_front.displayFeed(c,a);wdi_front.applyFilters(c);c.temproraryUsersData=[]}}}};wdi_front.allDataHasFinished=function(b){var d=0;for(var a=0;a<b.dataStorageRaw.length;a++){if(b.dataStorageRaw[a].length()==0&&b.dataStorageRaw[a].locked==true){d++}}return(d==b.dataStorageRaw.length)};wdi_front.mergeData=function(c,b){for(var a=0;a<b.length;a++){if(typeof c[a]!="undefined"){if(b[a]["finished"]=="finished"){continue}if(typeof c[a]["pagination"]["next_max_id"]=="undefined"&&typeof c[a]["pagination"]["next_max_like_id"]=="undefined"){continue}c[a]["data"]=c[a]["data"].concat(b[a]["data"]);c[a]["pagination"]=b[a]["pagination"];c[a]["user_id"]=b[a]["user_id"];c[a]["username"]=b[a]["username"];c[a]["meta"]=b[a]["meta"]}else{c.push(b[a])}}return c};wdi_front.brokenImageHandler=function(a){a.src=wdi_url.plugin_url+"images/missing.png";a.onerror="";return true};wdi_front.ajaxLoader=function(a){var d=a.feed_row.wdi_feed_counter;var c=jQuery("#wdi_feed_"+d);if(a.feed_row.feed_display_view=="load_more_btn"){c.find(".wdi_load_more").addClass("wdi_hidden");c.find(".wdi_spinner").removeClass("wdi_hidden")}if(a.feed_row.feed_display_view=="infinite_scroll"){var b;if(c.find(".wdi_ajax_loading").length==0){b=jQuery('<div class="wdi_ajax_loading"><div><div><img class="wdi_load_more_spinner" src="'+wdi_url.plugin_url+'images/ajax_loader.png"></div></div></div>');c.append(b)}else{b=c.find(".wdi_ajax_loading")}b.removeClass("wdi_hidden")}};wdi_front.allImagesLoaded=function(a){var d=wdi_front.getDataLength(a);if(!a.mediaRequestsDone){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").remove("wdi_nomedia")}if(d==0&&a.mediaRequestsDone&&(a.feed_row.conditional_filters.length==0||a.feed_row.conditional_filter_enable==0)){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").append("<p class='wdi_nomedia'>"+wdi_front_messages.feed_nomedia+"</p>")}var c=a.feed_row.wdi_feed_counter;var b=jQuery("#wdi_feed_"+c);if(a.feed_row.feed_display_view=="load_more_btn"){b.find(".wdi_load_more").removeClass("wdi_hidden");b.find(".wdi_spinner").addClass("wdi_hidden")}if(a.feed_row.feed_display_view=="infinite_scroll"){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_ajax_loading").addClass("wdi_hidden")}b.trigger("wdi_feed_loaded")};wdi_front.show=function(b,c){var e=c.feed_row.wdi_feed_counter;var d=jQuery("#wdi_feed_"+e+" .wdi_feed_container");var g=this;switch(b){case"header":f();break;case"users":a(c);break}function f(){var i={feed_thumb:c.feed_row["feed_thumb"],feed_name:c.feed_row["feed_name"]};var k=wdi_front.getHeaderTemplate(),h=k(i),j=d.find(".wdi_feed_header").html();d.find(".wdi_feed_header").html(j+h)}function a(j){d.find(".wdi_feed_users").html("");var n=j.feed_users;var m=j.feed_row["access_token"];var h=0;j.headerUserinfo=[];k();function k(){if(j.headerUserinfo.length==n.length){l(j.headerUserinfo,j);return}var i=n[j.headerUserinfo.length];if(typeof i==="string"&&i==="self"){j.instagram.getSelfInfo({success:function(o){if(typeof o.meta!="undefined"&&typeof o.meta.error_type!="undefined"){wdi_front.show_alert(false,o,j)}o=g.checkMediaResponse(o,j);if(o!=false&&o.meta["code"]===400&&o.meta["error_type"]==="APINotAllowedError"){var p=null;j.headerUserinfo.push(p);h++;k()}if(o!=false&&o.meta["code"]===200){var p={id:o.data["id"],name:o.data["username"],url:o.data["profile_picture"],bio:wdi_front.escape_tags(o.data["bio"]),counts:o.data["counts"],website:wdi_front.escape_tags(o.data["website"]),full_name:wdi_front.escape_tags(o.data["full_name"])};j.headerUserinfo.push(p);h++;k()}},args:{ignoreFiltering:true}})}else{if(false&&g.getInputType(i.username)=="hashtag"){j.instagram.searchForTagsByName(g.stripHashtag(i.username),{success:function(o){if(typeof o.meta!="undefined"&&typeof o.meta.error_type!="undefined"){wdi_front.show_alert(false,o,j)}o=g.checkMediaResponse(o,j);if(o!=false){if(o.data.length==0){var p="";var q={media:""}}else{var p="";var q={media:o.data[0]["media_count"]}}var r={name:n[h]["username"],url:p,counts:q};h++;j.headerUserinfo.push(r);k()}},args:{ignoreFiltering:true}})}else{if(g.getInputType(i.username)=="user"){j.instagram.getSelfInfo({success:function(o){if(typeof o.meta!="undefined"&&typeof o.meta.error_type!="undefined"){wdi_front.show_alert(false,o,j)}o=g.checkMediaResponse(o,j);if(o!=false&&o.meta["code"]===400&&o.meta["error_type"]==="APINotAllowedError"){var p=null;j.headerUserinfo.push(p);h++;k()}if(o!=false&&o.meta["code"]===200){var p={id:o.data["id"],name:o.data["username"],url:o.data["profile_picture"],bio:wdi_front.escape_tags(o.data["bio"]),counts:o.data["counts"],website:wdi_front.escape_tags(o.data["website"]),full_name:wdi_front.escape_tags(o.data["full_name"])};j.headerUserinfo.push(p);h++;k()}},args:{ignoreFiltering:true}})}}}}function l(i,t){d.find(".wdi_feed_users").html("");for(var q=0;q<i.length;q++){if(i[q]===null){continue}var v={flag:false,id:i[q]["id"],name:i[q]["name"]};var p=(i[q]["name"][0]=="#")?"wdi_header_hashtag":"";var u=wdi_extractHostname(i[q]["website"]);var o={user_index:q,user_img_url:i[q]["url"],counts:i[q]["counts"],feed_counter:t.feed_row.wdi_feed_counter,user_name:i[q]["name"],bio:wdi_front.escape_tags(i[q]["bio"]),website:u,website_url:i[q]["website"],usersCount:t.feed_row.feed_users.length,hashtagClass:p};var x=wdi_front.getUserTemplate(t,i[q]["name"]),r=x(o),s=d.find(".wdi_feed_users").html();d.find(".wdi_feed_users").html(s+r);t.userSortFlags.push(v);var w=jQuery('<div class="wdi_clear"></div>')}d.find(".wdi_feed_users").append(w);wdi_front.updateUsersImages(t)}}};wdi_front.getUserTemplate=function(c,h){var a=c.dataCount,d,f,g;switch(h[0]){case"#":d="//instagram.com/explore/tags/"+h.substr(1,h.length);break;default:d="//instagram.com/"+h;break}g='window.open("'+d+'","_blank")';f="onclick='"+g+"'";var e='<div class="wdi_single_user" user_index="<%=user_index%>"><div class="wdi_header_user_text <%=hashtagClass%>"><div class="wdi_user_img_wrap"><img onerror="wdi_front.brokenImageHandler(this);" src="<%= user_img_url%>">';if(a>1){e+='<div title="'+wdi_front_messages.filter_title+'" class="wdi_filter_overlay"><div class="wdi_filter_icon"><span onclick="wdi_front.addFilter(<%=user_index%>,<%=feed_counter%>);" class="fa fa-filter"></span></div></div>'}e+="</div>";e+="<h3 "+f+"><%= user_name%></h3>";if(h[0]!=="#"){if(c.feed_row.follow_on_instagram_btn=="1"){e+='<div class="wdi_user_controls"><div class="wdi_follow_btn" onclick="window.open(\'//instagram.com/<%= user_name%>\',\'_blank\')"><span> '+wdi_front_messages.follow+"</span></div></div>"}e+='<div class="wdi_media_info"><p class="wdi_posts"><span class="fa fa-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span class="fa fa-user"></span><%= counts.followed_by%></p></div>'}else{e+='<div class="wdi_user_controls"></div><div class="wdi_media_info"><p class="wdi_posts"><span class="fa fa-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span></span></p></div>'}e+='<div class="wdi_clear"></div>';if(a==1&&h[0]!=="#"&&c.feed_row.display_user_info=="1"){e+='<div class="wdi_bio"><%= bio%></div>';e+='<div class="wdi_website"><a target="_blank" href="<%= website_url%>" ><%= website%></a></div>'}e+="</div></div>";var b=_.template(e);return b};wdi_front.getHeaderTemplate=function(){var b='<div class="wdi_header_wrapper"><div class="wdi_header_img_wrap"><img src="<%=feed_thumb%>"></div><div class="wdi_header_text"><%=feed_name%></div><div class="wdi_clear"></div>';var a=_.template(b);return a};wdi_front.addFilter=function(e,g){var f=window["wdi_feed_"+g];var d=f.dataCount;if(d<2){return}if(f.nowLoadingImages!=false){return}else{var c=jQuery("#wdi_feed_"+f.feed_row.wdi_feed_counter+'_users [user_index="'+e+'"]');c.find(".wdi_filter_overlay").toggleClass("wdi_filter_active_bg");c.find(".wdi_header_user_text h3").toggleClass("wdi_filter_active_col");c.find(".wdi_media_info").toggleClass("wdi_filter_active_col");c.find(".wdi_follow_btn").toggleClass("wdi_filter_active_col");f.customFilterChanged=true;if(f.userSortFlags[e]["flag"]==false){f.userSortFlags[e]["flag"]=true}else{f.userSortFlags[e]["flag"]=false}var a=0;for(var b=0;b<f.userSortFlags.length;b++){if(f.userSortFlags[b]["flag"]==true){a++}}if(f.feed_row.feed_display_view=="pagination"){f.resIndex=0}if(a!=0){wdi_front.filterData(f);wdi_front.displayFeed(f)}else{f.customFilteredData=f.dataStorageList;wdi_front.displayFeed(f)}if(f.feed_row.feed_display_view=="pagination"){f.paginator=Math.ceil((f.imageIndex)/parseInt(f.feed_row.pagination_per_page_number));f.currentPage=f.paginator;wdi_front.updatePagination(f,"custom",1);jQuery("#wdi_first_page").removeClass("wdi_disabled");jQuery("#wdi_last_page").addClass("wdi_disabled")}}};wdi_front.filterData=function(c){var d=c.userSortFlags;c.customFilteredData=[];for(var b=0;b<c.dataStorageList.length;b++){for(var a=0;a<d.length;a++){if(((typeof c.dataStorageList[b]["user"]["id"]!="undefined"&&c.dataStorageList[b]["user"]["id"]==d[a]["id"])||c.dataStorageList[b]["wdi_hashtag"]==d[a]["name"])&&d[a]["flag"]==true){c.customFilteredData.push(c.dataStorageList[b])}}}};wdi_front.applyFilters=function(c){for(var b=0;b<c.userSortFlags.length;b++){if(c.userSortFlags[b]["flag"]==true){var a=jQuery("#wdi_feed_"+c.feed_row.wdi_feed_counter+'[user_index="'+b+'"]');wdi_front.addFilter(b,c.feed_row.wdi_feed_counter);wdi_front.addFilter(b,c.feed_row.wdi_feed_counter)}}};wdi_front.getImgCount=function(b){var d=b.dataStorage;var c=0;for(var a=0;a<d.length;a++){c+=d[a].length}return c};wdi_front.parseLighboxData=function(k,m){var g=k.dataStorage;var l=k.feed_row.sort_images_by;var a=k.feed_row.display_order;var h=wdi_front.sortingOperator(l,a);var f=[];var b=[];var e={};if(m==true){f=k.customFilteredData}else{for(var d=0;d<g.length;d++){for(var c=0;c<g[d].length;c++){f.push(g[d][c])}}f.sort(h)}for(d=0;d<f.length;d++){e={alt:"",avg_rating:"",comment_count:f[d]["comments"]["count"],date:wdi_front.convertUnixDate(f[d]["created_time"]),description:wdi_front.getDescription((f[d]["caption"]!==null)?wdi_front.escape_tags(f[d]["caption"]["text"]):""),filename:wdi_front.getFileName(f[d]),filetype:wdi_front.getFileType(f[d]),hit_count:"0",id:f[d]["id"],image_url:f[d]["link"],number:0,rate:"",rate_count:"0",username:f[d]["user"]["username"],profile_picture:f[d]["user"]["profile_picture"],thumb_url:f[d]["link"]+"media/?size=t",comments_data:f[d]["comments"]["data"],images:f[d]["images"],carousel_media:(typeof f[d]["carousel_media"]!=="undefined")?f[d]["carousel_media"]:null};b.push(e)}return b};wdi_front.convertUnixDate=function(b){var c=parseInt(b);var a=new Date(0);a.setUTCSeconds(c);var d=a.getFullYear()+"-"+a.getMonth()+"-"+a.getDate();d+=" "+a.getHours()+":"+a.getMinutes();return d};wdi_front.getDescription=function(a){a=a.replace(/\r?\n|\r/g," ");return a};wdi_front.getFileName=function(d){var c=d.link;var b=d.type;if(b==="video"&&d.hasOwnProperty("videos")){return d.videos["standard_resolution"]["url"]}else{var a=c.split("/");return a[a.length-2]}};wdi_front.getFileType=function(a){if(a.type=="video"&&a.hasOwnProperty("videos")){return"EMBED_OEMBED_INSTAGRAM_VIDEO"}else{return"EMBED_OEMBED_INSTAGRAM_IMAGE"}};wdi_front.array_max=function(d){var a=d[0];var b=0;for(var c=1;c<d.length;c++){if(a<d[c]){a=d[c];b=c}}return{value:a,index:b}};wdi_front.array_min=function(d){var c=d[0];var a=0;for(var b=1;b<d.length;b++){if(c>d[b]){c=d[b];a=b}}return{value:c,index:a}};wdi_front.activeUsersCount=function(c){var a=0;for(var b=0;b<c.usersData.length;b++){if(c.usersData[b].finished!="finished"){a++}}return a};wdi_front.checkMediaResponse=function(a,b){if(a!=""&&typeof a!="undefined"&&a!=null&&a.meta["code"]===400&&a.meta["error_type"]==="APINotAllowedError"){return a}if(a==""||typeof a=="undefined"||a==null){errorMessage=wdi_front_messages.connection_error;wdi_front.show_alert(errorMessage,a,b);return false}if(a.meta["code"]!=200){errorMessage=a.meta["error_message"];wdi_front.show_alert(errorMessage,a,b);return false}return a};wdi_front.stripHashtag=function(a){switch(a[0]){case"#":return a.substr(1,a.length);break;default:return a;break}};wdi_front.getInputType=function(a){switch(a[0]){case"#":return"hashtag";break;case"%":return"location";break;default:return"user";break}};wdi_front.regexpTestCaption=function(h,e){var d=false,b=false,f=[],g=e.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&"),c=new RegExp("(?:^|\\s)"+g+"(?:^|\\s)"),a=new RegExp("(?:^|\\s)"+g,"g");if(c.exec(h)!=null){d=true}while((match=a.exec(h))!=null){if(match.index==h.length-e.length-1){b=true}}if(d==true||b==true){return true}else{return false}};wdi_front.replaceNewLines=function(c){var b="vUkCJvN2ps3t",a=[],g;c=c.replace(/\r?\n|\r/g,b);g=new RegExp(b,"g");while((match=g.exec(c))!=null){a.push(match.index)}var f=c.split(b);var e=0;for(var d=0;d<f.length;d++){if(f[d]==""){e++}else{e=0}if(e>0){f.splice(d,1);e--;d--}}c=f.join(" ");return c};wdi_front.isEmptyObject=function(a){for(var b in a){if(a.hasOwnProperty(b)){return false}}return true};var WDIFeed=function(a){this["data"]=a.data;this["dataCount"]=a.dataCount;this["feed_row"]=a.feed_row;this["usersData"]=a.usersData;_this=this;this.set_images_loading_flag=function(b){window.addEventListener("load",function(){b.nowLoadingImages=false})};this.set_images_loading_flag(_this)};WDIFeed.prototype.conditionalFilter=function(a,c){var d=this,b=d.feed_row.conditional_filter_type,e=d.feed_row.conditional_filters;if(c.ignoreFiltering==true){}else{a=this.avoidDuplicateMedia(a)}if(!wdi_front.isJsonString(e)){return a}else{e=JSON.parse(e);if(e.length==0){return a}}if(d.feed_row.conditional_filter_enable=="0"){return a}d.instagramRequestCounter++;switch(b){case"AND":a=this.applyANDLogic(a,e,d);break;case"OR":a=this.applyORLogic(a,e,d);break;case"NOR":a=this.applyNORLogic(a,e,d);break;default:break}return a};WDIFeed.prototype.applyANDLogic=function(a,d){var c=this;for(var b=0;b<d.length;b++){a=this.filterResponse(a,d[b])}return a};WDIFeed.prototype.applyORLogic=function(d,c){var h=this;var a=[],g,j=[],f,b;for(var e=0;e<c.length;e++){g=this.filterResponse(d,c[e]);a=a.concat(g.data);g={}}for(e=0;e<a.length;e++){b=a[e];if(!this.mediaExists(b,j)&&!this.mediaExists(b,h.dataStorageList)){j.push(b)}}f={data:j,meta:d.meta,pagination:d.pagination};return f};WDIFeed.prototype.applyNORLogic=function(c,h){var f=c,g=this,b=this.applyORLogic(c,h,g),d=[],a;for(var e=0;e<f.data.length;e++){if(!this.mediaExists(f.data[e],b.data)){d.push(f.data[e])}}a={data:d,meta:f.meta,pagination:f.pagination};return a};WDIFeed.prototype.mediaExists=function(b,c){for(var a=0;a<c.length;a++){if(b.id==c[a]["id"]){return true}}return false};WDIFeed.prototype.filterResponse=function(a,b){switch(b.filter_type){case"hashtag":return this.filterByHashtag(a,b);break;case"username":return this.filterByUsername(a,b);break;case"mention":return this.filterByMention(a,b);break;case"description":return this.filterByDescription(a,b);break;case"location":return this.filterByLocation(a,b);break;case"url":return this.filterByUrl(a,b);break}};WDIFeed.prototype.filterByHashtag=function(b,g){var d=[],f,h,a;for(var e=0;e<b.data.length;e++){h=b.data[e];for(var c=0;c<h.tags.length;c++){tag=h.tags[c];if(tag.toLowerCase()==g.filter_by.toLowerCase()){d.push(h)}}}a={data:d,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.filterByUsername=function(b,e){var c=[],f,a;for(var d=0;d<b.data.length;d++){f=b.data[d];if(f.user.username.toLowerCase()==e.filter_by.toLowerCase()){c.push(f)}}a={data:c,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.filterByMention=function(b,e){var c=[],f,g,a;for(var d=0;d<b.data.length;d++){f=b.data[d];if(f.caption!==null){g=f.caption["text"].toLowerCase();if(g.indexOf("@"+e.filter_by.toLowerCase())!=-1){c.push(f)}}}a={data:c,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.filterByDescription=function(c,f){var d=[],g,h,b;for(var e=0;e<c.data.length;e++){g=c.data[e];if(g.caption!==null){h=g.caption["text"].toLowerCase();h=wdi_front.replaceNewLines(h);var a=f.filter_by.toLowerCase();if(wdi_front.regexpTestCaption(h,a)){d.push(g)}}}b={data:d,meta:c.meta,pagination:c.pagination};return b};WDIFeed.prototype.filterByLocation=function(b,f){var c=[],g,e,a;for(var d=0;d<b.data.length;d++){g=b.data[d];if(g.location!==null){e=g.location["id"];if(e==f.filter_by){c.push(g)}}}a={data:c,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.filterByUrl=function(b,e){var c=[],g,h,a,f;e.filter_by=this.getIdFromUrl(e.filter_by);for(var d=0;d<b.data.length;d++){g=b.data[d];if(g.link!==null){h=this.getIdFromUrl(g.link);if(h==e.filter_by){c.push(g)}}}a={data:c,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.getIdFromUrl=function(a){var c=a.split("/"),d=false;for(var b=0;b<c.length;b++){if(c[b]=="p"){if(typeof c[b+1]!="undefined"){d=c[b+1];break}}}return d};WDIFeed.prototype.avoidDuplicateMedia=function(b){var e=b.data,d=[],a={};if(typeof e=="undefined"){e=[]}for(var c=0;c<e.length;c++){if(!this.mediaExists(e[c],this.dataStorageList)&&!this.mediaExists(e[c],d)&&!this.mediaExists(e[c],this.conditionalFilterBuffer)){d.push(e[c])}}this.conditionalFilterBuffer=this.conditionalFilterBuffer.concat(d);a={data:d,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.storeRawData=function(c,a){var e=this;if(typeof this[a]=="object"&&typeof this[a].length=="number"){for(var b=0;b<c.length;b++){var d="";if(wdi_front.isHashtag(c[b].user_id)){if(typeof c[b].pagination.cursors!=="undefined"){d=c[b].pagination.cursors.after}}else{if(e.feed_row.liked_feed=="liked"){d=c[b].pagination.next_max_like_id;if(typeof d=="undefined"){d=""}}else{if(c[b].pagination==null){c[b].pagination=[]}d=c[b].pagination.next_max_id;if(typeof d=="undefined"){d=""}}}if(typeof this[a][b]=="undefined"){this[a].push({data:c[b].data,index:0,locked:false,hash_id:d,usersDataFinished:false,userId:c[b].user_id,length:function(){return this.data.length-this.index},getData:function(g){var h=this.data.slice(this.index,this.index+g);this.index+=Math.min(g,this.length());if(this.index==this.data.length&&this.locked==true&&this.usersDataFinished==false){for(var f=0;f<e.usersData.length;f++){if(e.usersData[f]["user_id"]==this.userId){e.usersData[f].finished="finished";this.usersDataFinished=true;break}}}return h}})}else{if(this[a][b].locked==false){if(d!=this[a][b].hash_id){this[a][b].data=this[a][b].data.concat(c[b].data);this[a][b].hash_id=d}else{this[a][b].locked=true}}}}}};wdi_front.updateUsersIfNecessary=function(c){var d=c.feed_users;var a=false;for(var b=0;b<d.length;b++){if("#"==d[b].username.substr(0,1)){d[b].id=d[b].username;continue}if(""==d[b].id||"username"==d[b].id){a=true;c.instagram.searchForUsersByName(d[b].username,{success:function(i){if(typeof i.meta!="undefined"&&typeof i.meta.error_type!="undefined"){wdi_front.show_alert(false,i,c)}if(i.meta.code==200&&i.data.length>0){var l=false;for(var g=0;g<i.data.length;g++){if(i.data[g].username==i.args.username){l=true;break}}if(l){for(var h=0;h<d.length;h++){if(i.data[g].username==d[h].username){d[h].id=i.data[g].id}}}}var f=false;for(var e=0;e<d.length;e++){if(d[e].id==""||d[e].id=="username"){f=true;break}}if(!f){c.feed_row.feed_users=JSON.stringify(d);wdi_front.init(c)}},username:d[b].username})}}return a};if(typeof wdi_ajax.ajax_response!="undefined"){jQuery(document).one("ajaxStop",function(){if(wdi_front.type!="not_declared"){wdi_front.clickOrTouch=wdi_front.detectEvent();wdi_front.globalInit()}else{return}})}else{jQuery(document).ready(function(){if(wdi_front.type!="not_declared"){wdi_front.clickOrTouch=wdi_front.detectEvent();wdi_front.globalInit()}else{return}})}jQuery(document).ready(function(){setTimeout(function(){if(wdi_front_messages.show_alerts==="1"&&jQuery(".wdi_check_fontawesome .fa-instagram").prop("tagName")!=="I"){console.log("Font Awesome is not loaded properly. Please ask for support https://wordpress.org/support/plugin/wd-instagram-feed/")}},2000)});function wdi_extractHostname(b){if(typeof b==="undefined"||b===""){return""}var a=b.replace(/(^\w+:|^)\/\//,"");return a};
js/wdi_instagram.js CHANGED
@@ -125,6 +125,26 @@ function WDIInstagram(args)
125
  return access_tokens[index];
126
  }
127
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  /**
129
  * Adds access token to this.access_tokens array
130
  * non string values are not allowed
@@ -171,8 +191,15 @@ function WDIInstagram(args)
171
  *
172
  * @return object of founded media
173
  */
174
- this.getTagRecentMedia = function (tagname, args)
175
  {
 
 
 
 
 
 
 
176
  var instagram = this,
177
  noArgument = false,
178
  successFlag = false,
@@ -181,7 +208,7 @@ function WDIInstagram(args)
181
  argFlag = false,
182
  filter = this.getFilter('getTagRecentMedia'),
183
 
184
- baseUrl = 'https://api.instagram.com/v1/tags/' + tagname + '/media/recent?access_token=' + getAccessToken();
185
 
186
 
187
  if (typeof args == 'undefined' || args.length === 0) {
@@ -213,7 +240,7 @@ function WDIInstagram(args)
213
  args.count = 33;
214
  }
215
 
216
- baseUrl += '&count=' + args.count;
217
 
218
  if ('min_tag_id' in args) {
219
  baseUrl += '&min_tag_id=' + args.min_tag_id;
@@ -222,14 +249,24 @@ function WDIInstagram(args)
222
  if ('max_tag_id' in args) {
223
  baseUrl += '&max_tag_id=' + args.max_tag_id;
224
  }
 
 
 
225
  }
 
 
 
226
  var wdi_callback = function (cache_data) {
227
  if(cache_data === false) {
 
228
  jQuery.ajax({
229
  type: 'POST',
230
  url: baseUrl,
231
  dataType: 'jsonp',
232
  success: function (response) {
 
 
 
233
  _this.setDataToCache(baseUrl,response);
234
  success(response)
235
  },
@@ -250,6 +287,8 @@ function WDIInstagram(args)
250
  },
251
  statusCode: statusCode
252
  });
 
 
253
  }
254
  else{
255
  success(cache_data)
@@ -283,13 +322,273 @@ function WDIInstagram(args)
283
  }
284
  }
285
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
286
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
287
  _this.getDataFromCache(wdi_callback, baseUrl);
288
 
 
 
 
 
 
289
 
290
 
291
  }
292
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
293
 
294
  /**
295
  * Search for tags by name.
@@ -1560,10 +1859,15 @@ function WDIInstagram(args)
1560
 
1561
 
1562
 
1563
- this.getDataFromCache = function (callback, cache_name) {
 
 
 
 
 
1564
  jQuery.ajax({
1565
  type: "POST",
1566
- async: true,
1567
  url: wdi_ajax.ajax_url,
1568
  dataType:"json",
1569
  data: {
125
  return access_tokens[index];
126
  }
127
 
128
+ function getGraphAcessToken() {
129
+ if (typeof wdi_options !== "undefined") {
130
+ return wdi_options.fb_token;
131
+ } else if (typeof wdi_ajax !== "undefined") {
132
+ return wdi_ajax.fb_token;
133
+ } else {
134
+ return "";
135
+ }
136
+ }
137
+
138
+ function getBusinessAccountId() {
139
+ if (typeof wdi_options !== "undefined") {
140
+ return wdi_options.business_account_id;
141
+ } else if (typeof wdi_ajax !== "undefined") {
142
+ return wdi_ajax.business_account_id;
143
+ } else {
144
+ return "";
145
+ }
146
+ }
147
+
148
  /**
149
  * Adds access token to this.access_tokens array
150
  * non string values are not allowed
191
  *
192
  * @return object of founded media
193
  */
194
+ this.getTagRecentMedia = function (tagname, args, next_url)
195
  {
196
+
197
+ var hastag_data_url = 'https://graph.facebook.com/ig_hashtag_search/';
198
+ hastag_data_url += '?user_id=' + getBusinessAccountId();
199
+ hastag_data_url += '&q=' + tagname;
200
+ hastag_data_url += '&access_token=' + getGraphAcessToken();
201
+
202
+
203
  var instagram = this,
204
  noArgument = false,
205
  successFlag = false,
208
  argFlag = false,
209
  filter = this.getFilter('getTagRecentMedia'),
210
 
211
+ baseUrl = 'https://graph.facebook.com/{tagid}/recent_media/?fields=media_url,caption,id,media_type,comments_count,like_count,permalink,children{media_url,id,media_type,permalink}';
212
 
213
 
214
  if (typeof args == 'undefined' || args.length === 0) {
240
  args.count = 33;
241
  }
242
 
243
+ baseUrl += '&limit=' + args.count;
244
 
245
  if ('min_tag_id' in args) {
246
  baseUrl += '&min_tag_id=' + args.min_tag_id;
249
  if ('max_tag_id' in args) {
250
  baseUrl += '&max_tag_id=' + args.max_tag_id;
251
  }
252
+
253
+ baseUrl += "&access_token=" + getGraphAcessToken();
254
+ baseUrl += "&user_id=" + getBusinessAccountId();
255
  }
256
+
257
+ var wdiTagId = this.getTagId(tagname);
258
+
259
  var wdi_callback = function (cache_data) {
260
  if(cache_data === false) {
261
+
262
  jQuery.ajax({
263
  type: 'POST',
264
  url: baseUrl,
265
  dataType: 'jsonp',
266
  success: function (response) {
267
+ response = _this.convertHashtagData(response);
268
+ response.meta = {"code": 200};
269
+ response.tag_id = wdiTagId;
270
  _this.setDataToCache(baseUrl,response);
271
  success(response)
272
  },
287
  },
288
  statusCode: statusCode
289
  });
290
+
291
+
292
  }
293
  else{
294
  success(cache_data)
322
  }
323
  }
324
  }
325
+ };
326
+
327
+ if (wdiTagId === false) {
328
+ jQuery.ajax({
329
+ type: 'GET',
330
+ url: hastag_data_url,
331
+ dataType: 'jsonp',
332
+ }).done(function (response) {
333
+
334
+
335
+ if (typeof response.error === 'undefined') {
336
+ wdiTagId = response.data[0].id;
337
+ } else {
338
+ alert(response.error.message);
339
+ return;
340
  }
341
+
342
+ if (typeof next_url === "undefined") {
343
+ baseUrl = baseUrl.replace('{tagid}', wdiTagId);
344
+ } else {
345
+ baseUrl = next_url;
346
+ }
347
+
348
+ var all_tags = [];
349
+ if(typeof window['wdi_all_tags'] !== "undefined"){
350
+ all_tags = window['wdi_all_tags'];
351
+ }
352
+
353
+ all_tags[wdiTagId] = {
354
+ id: "#" + tagname,
355
+ username: "#" + tagname,
356
+ tag_id: wdiTagId
357
+ };
358
+
359
+ window['wdi_all_tags'] = all_tags;
360
+
361
+ _this.getDataFromCache(wdi_callback, baseUrl);
362
+
363
+ });
364
+ } else {
365
+
366
+ if (typeof next_url === "undefined") {
367
+ baseUrl = baseUrl.replace('{tagid}', wdiTagId);
368
+ } else {
369
+ baseUrl = next_url;
370
+ }
371
+
372
  _this.getDataFromCache(wdi_callback, baseUrl);
373
 
374
+ }
375
+
376
+
377
+
378
+
379
 
380
 
381
  }
382
 
383
+ this.getTagId = function (tagname) {
384
+ var feed_users = [];
385
+
386
+ if (typeof wdi_controller !== "undefined") {
387
+ feed_users = wdi_controller.feed_users;
388
+ if (feed_users.length === 0) {
389
+ var json = jQuery('#WDI_feed_users').val();
390
+ feed_users = JSON.parse(json);
391
+ }
392
+ }else if(typeof window['wdi_all_tags'] !== "undefined"){
393
+ feed_users = window['wdi_all_tags'];
394
+ }
395
+
396
+
397
+ for (var i in feed_users) {
398
+
399
+ if (tagname === feed_users[i].username || "#" + tagname === feed_users[i].username) {
400
+
401
+ if (typeof feed_users[i].tag_id !== "undefined") {
402
+ return feed_users[i].tag_id;
403
+ }
404
+ return false;
405
+
406
+ }
407
+
408
+ }
409
+
410
+ return false;
411
+ };
412
+
413
+ this.convertHashtagData = function (data) {
414
+ var converted_data = {
415
+ data: [],
416
+ pagination: {}
417
+ };
418
+ if (typeof data.paging !== "undefined") {
419
+ converted_data.pagination = {
420
+ cursors: {after: data.paging.cursors.after},
421
+ next_url: data.paging.next
422
+ }
423
+ }
424
+
425
+ for (var i in data.data) {
426
+ var media = data.data[i];
427
+
428
+ var media_type;
429
+ if (media.media_type === "IMAGE") {
430
+ media_type = "image";
431
+ } else if (media.media_type === "VIDEO") {
432
+ media_type = "video";
433
+ } else {
434
+ media_type = "carousel";
435
+ }
436
+
437
+ var converted = {
438
+ "id": media.id,
439
+ "user": {
440
+ "id": "",
441
+ "full_name": "",
442
+ "profile_picture": "",
443
+ "username": ""
444
+ },
445
+ "images": {
446
+ "thumbnail": {
447
+ "width": 150,
448
+ "height": 150,
449
+ "url": media.permalink + "media?size=t"
450
+ },
451
+ "low_resolution": {
452
+ "width": 320,
453
+ "height": 320,
454
+ "url": media.permalink + "media?size=m"
455
+ },
456
+ "standard_resolution": {
457
+ "width": 640,
458
+ "height": 640,
459
+ "url": media.permalink + "media?size=m"
460
+ }
461
+ },
462
+ "created_time": "1543398649",
463
+ "caption": {
464
+ "id": "",
465
+ "text": media.caption,
466
+ "created_time": "",
467
+ "from": {
468
+ "id": "",
469
+ "full_name": "",
470
+ "profile_picture": "",
471
+ "username": ""
472
+ }
473
+ },
474
+ "user_has_liked": (media.like_count > 0),
475
+ "likes": {
476
+ "count": media.like_count
477
+ },
478
+ "tags": [],
479
+ "filter": "Normal",
480
+ "comments": {
481
+ "count": media.comments_count
482
+ },
483
+ "type": media_type,
484
+ "link": media.permalink,
485
+ "location": null,
486
+ "attribution": null,
487
+ "users_in_photo": []
488
+ };
489
+
490
+ if (media.media_type === "IMAGE" || media.media_type === "CAROUSEL_ALBUM") {
491
+ converted.images = {
492
+ "thumbnail": {
493
+ "width": 150,
494
+ "height": 150,
495
+ "url": media.permalink + "media?size=t"
496
+ },
497
+ "low_resolution": {
498
+ "width": 320,
499
+ "height": 320,
500
+ "url": media.permalink + "media?size=m"
501
+ },
502
+ "standard_resolution": {
503
+ "width": 640,
504
+ "height": 640,
505
+ "url": media.permalink + "media?size=m"
506
+ }
507
+ };
508
+ } else if (media.media_type === "VIDEO") {
509
+ converted.videos = {
510
+ "standard_resolution": {
511
+ "width": 640,
512
+ "height": 800,
513
+ "url": media.media_url,
514
+ },
515
+ "low_bandwidth": {
516
+ "width": 480,
517
+ "height": 600,
518
+ "url": media.media_url,
519
+ },
520
+ "low_resolution": {
521
+ "width": 480,
522
+ "height": 600,
523
+ "url": media.media_url,
524
+ }
525
+ };
526
+ }
527
+
528
+ if (media.media_type === "CAROUSEL_ALBUM") {
529
+ converted.carousel_media = [];
530
+
531
+ for (var j in media.children.data) {
532
+ if (media.children.data[j].media_type === "IMAGE") {
533
+ var child = {
534
+ "images": {
535
+ "thumbnail": {
536
+ "width": 150,
537
+ "height": 150,
538
+ "url": media.children.data[j].media_url + "media?size=t"
539
+ },
540
+ "low_resolution": {
541
+ "width": 320,
542
+ "height": 320,
543
+ "url": media.children.data[j].permalink + "media?size=m"
544
+ },
545
+ "standard_resolution": {
546
+ "width": 640,
547
+ "height": 640,
548
+ "url": media.children.data[j].media_url
549
+ }
550
+ },
551
+ "users_in_photo": [],
552
+ "type": "image"
553
+ };
554
+ } else {
555
+ var child = {
556
+ "videos": {
557
+ "standard_resolution": {
558
+ "width": 640,
559
+ "height": 800,
560
+ "url": media.children.data[j].media_url,
561
+ "id": media.children.data[j].id
562
+ },
563
+ "low_bandwidth": {
564
+ "width": 480,
565
+ "height": 600,
566
+ "url": media.children.data[j].media_url,
567
+ "id": media.children.data[j].id
568
+ },
569
+ "low_resolution": {
570
+ "width": 480,
571
+ "height": 600,
572
+ "url": media.children.data[j].media_url,
573
+ "id": media.children.data[j].id
574
+ }
575
+ },
576
+ "users_in_photo": [],
577
+ "type": "video"
578
+ };
579
+ }
580
+
581
+ converted.carousel_media.push(child);
582
+
583
+ }
584
+
585
+ }
586
+
587
+ converted_data.data.push(converted);
588
+ }
589
+
590
+ return converted_data;
591
+ };
592
 
593
  /**
594
  * Search for tags by name.
1859
 
1860
 
1861
 
1862
+ this.getDataFromCache = function (callback, cache_name, async) {
1863
+
1864
+ if(typeof async === "undefined"){
1865
+ async = true;
1866
+ }
1867
+
1868
  jQuery.ajax({
1869
  type: "POST",
1870
+ async: async,
1871
  url: wdi_ajax.ajax_url,
1872
  dataType:"json",
1873
  data: {
js/wdi_instagram.min.js CHANGED
@@ -1 +1 @@
1
- function WDIInstagram(a){this.access_tokens=[];this.filters=[];if(typeof a!="undefined"){if(typeof a.access_tokens!="undefined"){this.access_tokens=a.access_tokens}if(typeof a.filters!="undefined"){this.filters=a.filters}}var c=this;this.statusCode={429:function(){console.log(" 429: Too many requests. Try after one hour")}};this.getFilter=function(d){var f=c.filters;if(typeof f=="undefined"){return false}for(var e=0;e<f.length;e++){if(f[e].where==d){if(typeof f[e].what=="object"&&f[e].what.length==2){if(typeof window[f[e].what[0]]!="undefined"){if(typeof window[f[e].what[0]][f[e].what[1]]=="function"){return window[f[e].what[0]][f[e].what[1]]}}}else{if(typeof f[e].what=="string"){if(typeof window[f[e].what]=="function"){return window[f[e].what]}}else{if(typeof f[e].what=="function"){return f[e].what}else{return false}}}}}return false};function b(){var d=c.access_tokens,e=parseInt(Math.random(0,1)*d.length);return d[e]}this.addToken=function(d){if(typeof d=="string"){c.access_tokens.push(d)}};this.resetTokens=function(){c.access_tokens=[]};this.getTagRecentMedia=function(m,k){var l=this,n=false,e=false,h=this.statusCode,f=false,j=false,d=this.getFilter("getTagRecentMedia"),i="https://api.instagram.com/v1/tags/"+m+"/media/recent?access_token="+b();if(typeof k=="undefined"||k.length===0){n=true}else{if("success" in k){e=true}if("statusCode" in k){h=k.statusCode}if("error" in k){f=true}if("args" in k){j=true}else{k.args={}}if("count" in k){k.count=parseInt(k.count);if(!Number.isInteger(k.count)||k.count<=0){k.count=33}}else{k.count=33}i+="&count="+k.count;if("min_tag_id" in k){i+="&min_tag_id="+k.min_tag_id}if("max_tag_id" in k){i+="&max_tag_id="+k.max_tag_id}}var g=function(o){if(o===false){jQuery.ajax({type:"POST",url:i,dataType:"jsonp",success:function(q){c.setDataToCache(i,q);p(q)},error:function(q){if(f){if(typeof k.error=="object"&&k.error.length==2){if(typeof window[k.error[0]][k.error[1]]=="function"){window[k.error[0]][k.error[1]](q)}}else{if(typeof k.error=="string"){if(typeof window[k.error]=="function"){window[k.error](q)}}else{if(typeof k.error=="function"){k.error(q)}}}}},statusCode:h})}else{p(o)}function p(q){if(typeof q.data==="undefined"){q.data=[]}if(e){if(typeof k.success=="object"&&k.success.length==2){if(typeof window[k.success[0]]!="undefined"){if(typeof window[k.success[0]][k.success[1]]=="function"){if(d){q=d(q,l.filterArguments,k.args)}window[k.success[0]][k.success[1]](q)}}}else{if(typeof k.success=="string"){if(typeof window[k.success]=="function"){if(d){q=d(q,l.filterArguments,k.args)}window[k.success](q)}}else{if(typeof k.success=="function"){if(d){q=d(q,l.filterArguments,k.args)}k.success(q)}}}}}};c.getDataFromCache(g,i)};this.searchForTagsByName=function(k,i){var j=this,l=false,d=false,h=this.statusCode,e=false;filter=this.getFilter("searchForTagsByName");if(typeof i=="undefined"||i.length===0){l=true}else{if("success" in i){d=true}if("error" in i){e=true}if("statusCode" in i){h=i.statusCode}}var f="https://api.instagram.com/v1/tags/search?q="+k+"&access_token="+b();var g=function(m){if(m===false){jQuery.ajax({type:"POST",url:f,dataType:"jsonp",success:function(o){c.setDataToCache(f,o);n(o)},error:function(o){if(e){if(typeof i.error=="object"&&i.error.length==2){if(typeof window[i.error[0]][i.error[1]]=="function"){window[i.error[0]][i.error[1]](o)}}else{if(typeof i.error=="string"){if(typeof window[i.error]=="function"){window[i.error](o)}}else{if(typeof i.error=="function"){i.error(o)}}}}},statusCode:h})}else{n(m)}function n(o){if(d){if(typeof i.success=="object"&&i.success.length==2){if(typeof window[i.success[0]]!="undefined"){if(typeof window[i.success[0]][i.success[1]]=="function"){if(filter){o=filter(o,j.filterArguments)}window[i.success[0]][i.success[1]](o)}}}else{if(typeof i.success=="string"){if(typeof window[i.success]=="function"){if(filter){o=filter(o,j.filterArguments)}window[i.success](o)}}else{if(typeof i.success=="function"){if(filter){o=filter(o,j.filterArguments)}i.success(o)}}}}}};c.getDataFromCache(g,f)};this.searchForUsersByName=function(k,g){var d=this,j=false,e=false,i=this.statusCode,f=false,h=this.getFilter("searchForUsersByName");if(typeof g=="undefined"||g.length===0){j=true}else{if("success" in g){e=true}if("error" in g){f=true}if("statusCode" in g){i=g.statusCode}}jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/search?q="+k+"&access_token="+b(),success:function(l){if(e){if(typeof g.success=="object"&&g.success.length==2){if(typeof window[g.success[0]]!="undefined"){if(typeof window[g.success[0]][g.success[1]]=="function"){if(h){l=h(l,d.filterArguments)}l.args=g;window[g.success[0]][g.success[1]](l)}}}else{if(typeof g.success=="string"){if(typeof window[g.success]=="function"){if(h){l=h(l,d.filterArguments)}l.args=g;window[g.success](l)}}else{if(typeof g.success=="function"){if(h){l=h(l,d.filterArguments)}l.args=g;g.success(l)}}}}},error:function(l){if(f){if(typeof g.error=="object"&&g.error.length==2){if(typeof window[g.error[0]][g.error[1]]=="function"){window[g.error[0]][g.error[1]](l)}}else{if(typeof g.error=="string"){if(typeof window[g.error]=="function"){window[g.error](l)}}else{if(typeof g.error=="function"){g.error(l)}}}}},statusCode:this.statusCode})};this.getRecentLikedMedia=function(g){var d=this,k=false,e=false,i=this.statusCode,f=false,h=this.getFilter("getRecentLikedMedia"),j="https://api.instagram.com/v1/users/self/media/liked?access_token="+b();if(typeof g=="undefined"||g.length===0){k=true}else{if("success" in g){e=true}if("error" in g){f=true}if("statusCode" in g){i=g.statusCode}if("args" in g){argFlag=true}else{g.args={}}if("count" in g){g.count=parseInt(g.count);if(!Number.isInteger(g.count)||g.count<=0){g.count=20}}else{g.count=20}j+="&count="+g.count;if("next_max_like_id" in g){j+="&next_max_like_id="+g.next_max_like_id}}jQuery.ajax({type:"POST",dataType:"jsonp",url:j,success:function(l){if(e){if(typeof g.success=="object"&&g.success.length==2){if(typeof window[g.success[0]]!="undefined"){if(typeof window[g.success[0]][g.success[1]]=="function"){if(h){l=h(l,d.filterArguments,g.args)}window[g.success[0]][g.success[1]](l)}}}else{if(typeof g.success=="string"){if(typeof window[g.success]=="function"){if(h){l=h(l,d.filterArguments,g.args)}window[g.success](l)}}else{if(typeof g.success=="function"){if(h){l=h(l,d.filterArguments,g.args)}g.success(l)}}}}},error:function(l){if(f){if(typeof g.error=="object"&&g.error.length==2){if(typeof window[g.error[0]][g.error[1]]=="function"){window[g.error[0]][g.error[1]](l)}}else{if(typeof g.error=="string"){if(typeof window[g.error]=="function"){window[g.error](l)}}else{if(typeof g.error=="function"){g.error(l)}}}}},statusCode:i})};this.getUserRecentMedia=function(l,j){var k=this,m=false,e=false,i=false,g=this.statusCode,f=false,d=this.getFilter("getUserRecentMedia"),h="https://api.instagram.com/v1/users/"+l+"/media/recent/?access_token="+b();if(typeof j=="undefined"||j.length===0){m=true}else{if("success" in j){e=true}if("statusCode" in j){g=j.statusCode}if("args" in j){i=true}else{j.args={}}if("error" in j){f=true}if("count" in j){j.count=parseInt(j.count);if(!Number.isInteger(j.count)||j.count<=0){j.count=33}}else{j.count=33}h+="&count="+j.count;if("min_id" in j){h+="&min_id="+j.min_id}if("max_id" in j){h+="&max_id="+j.max_id}}jQuery.ajax({type:"POST",dataType:"jsonp",url:h,success:function(n){if(typeof n.data==="undefined"){n.data=[]}if(e){if(typeof j.success=="object"&&j.success.length==2){if(typeof window[j.success[0]]!="undefined"){if(typeof window[j.success[0]][j.success[1]]=="function"){if(d){n=d(n,k.filterArguments,j.args)}window[j.success[0]][j.success[1]](n)}}}else{if(typeof j.success=="string"){if(typeof window[j.success]=="function"){if(d){n=d(n,k.filterArguments,j.args)}window[j.success](n)}}else{if(typeof j.success=="function"){if(d){n=d(n,k.filterArguments,j.args)}j.success(n)}}}}},error:function(n){if(f){if(typeof j.error=="object"&&j.error.length==2){if(typeof window[j.error[0]][j.error[1]]=="function"){window[j.error[0]][j.error[1]](n)}}else{if(typeof j.error=="string"){if(typeof window[j.error]=="function"){window[j.error](n)}}else{if(typeof j.error=="function"){j.error(n)}}}}},statusCode:g})};this.getSelfRecentMedia=function(k){var l=this,m=false,e=false,h=this.statusCode,f=false,j=false,d=this.getFilter("getSelfRecentMedia"),i="https://api.instagram.com/v1/users/self/media/recent/?access_token="+b();if(typeof k=="undefined"||k.length===0){m=true}else{if("success" in k){e=true}if("error" in k){f=true}if("statusCode" in k){h=k.statusCode}if("args" in k){j=true}else{k.args={}}if("count" in k){k.count=parseInt(k.count);if(!Number.isInteger(k.count)||k.count<=0){k.count=20}}else{k.count=20}i+="&count="+k.count;if("min_id" in k){i+="&min_id="+k.min_id}if("max_id" in k){i+="&max_id="+k.max_id}}var g=function(n){if(n===false){jQuery.ajax({type:"POST",dataType:"jsonp",url:i,success:function(p){c.setDataToCache(i,p);o(p)},error:function(p){if(f){if(typeof k.error=="object"&&k.error.length==2){if(typeof window[k.error[0]][k.error[1]]=="function"){window[k.error[0]][k.error[1]](p)}}else{if(typeof k.error=="string"){if(typeof window[k.error]=="function"){window[k.error](p)}}else{if(typeof k.error=="function"){k.error(p)}}}}},statusCode:h})}else{o(n)}function o(p){if(e){if(typeof k.success=="object"&&k.success.length==2){if(typeof window[k.success[0]]!="undefined"){if(typeof window[k.success[0]][k.success[1]]=="function"){if(d){p=d(p,l.filterArguments,k)}window[k.success[0]][k.success[1]](p)}}}else{if(typeof k.success=="string"){if(typeof window[k.success]=="function"){if(d){p=d(p,l.filterArguments,k)}window[k.success](p)}}else{if(typeof k.success=="function"){if(d){p=d(p,l.filterArguments,k)}k.success(p)}}}}}};c.getDataFromCache(g,i)};this.getUserInfo=function(e,h){var d=this,k=false,f=false,j=this.statusCode,g=false,i=this.getFilter("getUserInfo");if(typeof h=="undefined"||h.length===0){k=true}else{if("success" in h){f=true}if("error" in h){g=true}if("statusCode" in h){j=h.statusCode}}jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/"+e+"/?access_token="+b(),success:function(l){if(f){if(typeof h.success=="object"&&h.success.length==2){if(typeof window[h.success[0]]!="undefined"){if(typeof window[h.success[0]][h.success[1]]=="function"){if(i){l=i(l,d.filterArguments)}window[h.success[0]][h.success[1]](l)}}}else{if(typeof h.success=="string"){if(typeof window[h.success]=="function"){if(i){l=i(l,d.filterArguments)}window[h.success](l)}}else{if(typeof h.success=="function"){if(i){l=i(l,d.filterArguments)}h.success(l)}}}}},error:function(l){if(g){if(typeof h.error=="object"&&h.error.length==2){if(typeof window[h.error[0]][h.error[1]]=="function"){window[h.error[0]][h.error[1]](l)}}else{if(typeof h.error=="string"){if(typeof window[h.error]=="function"){window[h.error](l)}}else{if(typeof h.error=="function"){h.error(l)}}}}},statusCode:j})};this.getSelfInfo=function(j){var k=this,l=false,e=false,i=this.statusCode,f=false,d=this.getFilter("getSelfInfo");if(typeof j=="undefined"||j.length===0){l=true}else{if("success" in j){e=true}if("error" in j){f=true}if("statusCode" in j){i=j.statusCode}}var g="https://api.instagram.com/v1/users/self/?access_token="+b();var h=function(m){if(m===false){jQuery.ajax({type:"POST",dataType:"jsonp",url:g,success:function(o){c.setDataToCache(g,o);if(e){if(typeof j.success=="object"&&j.success.length==2){if(typeof window[j.success[0]]!="undefined"){if(typeof window[j.success[0]][j.success[1]]=="function"){if(d){o=d(o,k.filterArguments)}window[j.success[0]][j.success[1]](o)}}}else{if(typeof j.success=="string"){if(typeof window[j.success]=="function"){if(d){o=d(o,k.filterArguments)}window[j.success](o)}}else{if(typeof j.success=="function"){if(d){o=d(o,k.filterArguments)}j.success(o)}}}}},error:function(o){if(f){if(typeof j.error=="object"&&j.error.length==2){if(typeof window[j.error[0]][j.error[1]]=="function"){window[j.error[0]][j.error[1]](o)}}else{if(typeof j.error=="string"){if(typeof window[j.error]=="function"){window[j.error](o)}}else{if(typeof j.error=="function"){j.error(o)}}}}},statusCode:i})}else{n(m)}function n(o){if(e){if(typeof j.success=="object"&&j.success.length==2){if(typeof window[j.success[0]]!="undefined"){if(typeof window[j.success[0]][j.success[1]]=="function"){if(d){o=d(o,k.filterArguments)}window[j.success[0]][j.success[1]](o)}}}else{if(typeof j.success=="string"){if(typeof window[j.success]=="function"){if(d){o=d(o,k.filterArguments)}window[j.success](o)}}else{if(typeof j.success=="function"){if(d){o=d(o,k.filterArguments)}j.success(o)}}}}}};c.getDataFromCache(h,g)};this.getRecentMediaComments=function(f,k){var l=this,m=false,e=false,j=this.statusCode,h=false,d=this.getFilter("getRecentMediaComments");if(typeof k=="undefined"||k.length===0){m=true}else{if("success" in k){e=true}if("error" in k){h=true}if("statusCode" in k){j=k.statusCode}}var g="https://api.instagram.com/v1/media/"+f+"/comments?access_token="+b();var i=function(n){if(n===false){jQuery.ajax({type:"POST",dataType:"jsonp",url:g,success:function(p){c.setDataToCache(g,p);o(p)},error:function(p){if(h){if(typeof k.error=="object"&&k.error.length==2){if(typeof window[k.error[0]][k.error[1]]=="function"){window[k.error[0]][k.error[1]](p)}}else{if(typeof k.error=="string"){if(typeof window[k.error]=="function"){window[k.error](p)}}else{if(typeof k.error=="function"){k.error(p)}}}}},statusCode:j})}else{o(n)}function o(p){if(e){if(typeof k.success=="object"&&k.success.length==2){if(typeof window[k.success[0]]!="undefined"){if(typeof window[k.success[0]][k.success[1]]=="function"){if(d){p=d(p,l.filterArguments)}window[k.success[0]][k.success[1]](p)}}}else{if(typeof k.success=="string"){if(typeof window[k.success]=="function"){if(d){p=d(p,l.filterArguments)}window[k.success](p)}}else{if(typeof k.success=="function"){if(d){p=d(p,l.filterArguments)}k.success(p)}}}}}};c.getDataFromCache(i,g)};this.getRecentMediaLikes=function(j,g){var d=this,k=false,e=false,i=this.statusCode,f=false,h=this.getFilter("getRecentMediaLikes");if(typeof g=="undefined"||g.length===0){k=true}else{if("success" in g){e=true}if("error" in g){f=true}if("statusCode" in g){i=g.statusCode}}jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/media/"+j+"/likes?access_token="+b(),success:function(l){if(e){if(typeof g.success=="object"&&g.success.length==2){if(typeof window[g.success[0]]!="undefined"){if(typeof window[g.success[0]][g.success[1]]=="function"){if(h){l=h(l,d.filterArguments)}window[g.success[0]][g.success[1]](l)}}}else{if(typeof g.success=="string"){if(typeof window[g.success]=="function"){if(h){l=h(l,d.filterArguments)}window[g.success](l)}}else{if(typeof g.success=="function"){if(h){l=h(l,d.filterArguments)}g.success(l)}}}}},error:function(l){if(f){if(typeof g.error=="object"&&g.error.length==2){if(typeof window[g.error[0]][g.error[1]]=="function"){window[g.error[0]][g.error[1]](l)}}else{if(typeof g.error=="string"){if(typeof window[g.error]=="function"){window[g.error](l)}}else{if(typeof g.error=="function"){g.error(l)}}}}},statusCode:i})};this.requestByUrl=function(o,n){var p=this,q=false,f=false,g=false,m=false,k=this.statusCode,e=this.getFilter("requestByUrl"),d,l;d=o.split("?")[1].split("&");for(var j=0;j<d.length;j++){d[j]=d[j].split("=");if(d[j][0]=="access_token"){d[j][1]=b()}d[j]=d[j].join("=")}d=d.join("&");o=o.split("?")[0]+"?"+d;if(typeof n=="undefined"||n.length===0){q=true}else{if("success" in n){f=true}if("args" in n){m=true}else{n.args={}}if("error" in n){g=true}if("statusCode" in n){k=n.statusCode}}var h=function(i){if(i===false){jQuery.ajax({type:"POST",dataType:"jsonp",url:o,success:function(s){c.setDataToCache(o,s);if(f){if(typeof n.success=="object"&&n.success.length==2){if(typeof window[n.success[0]]!="undefined"){if(typeof window[n.success[0]][n.success[1]]=="function"){if(e){s=e(s,p.filterArguments,n.args)}window[n.success[0]][n.success[1]](s)}}}else{if(typeof n.success=="string"){if(typeof window[n.success]=="function"){if(e){s=e(s,p.filterArguments,n.args)}window[n.success](s)}}else{if(typeof n.success=="function"){if(e){s=e(s,p.filterArguments,n.args)}n.success(s)}}}}},error:function(s){if(g){if(typeof n.error=="object"&&n.error.length==2){if(typeof window[n.error[0]][n.error[1]]=="function"){window[n.error[0]][n.error[1]](s)}}else{if(typeof n.error=="string"){if(typeof window[n.error]=="function"){window[n.error](s)}}else{if(typeof n.error=="function"){n.error(s)}}}}},statusCode:k})}else{r(i)}function r(s){if(f){if(typeof n.success=="object"&&n.success.length==2){if(typeof window[n.success[0]]!="undefined"){if(typeof window[n.success[0]][n.success[1]]=="function"){if(e){s=e(s,p.filterArguments,n.args)}window[n.success[0]][n.success[1]](s)}}}else{if(typeof n.success=="string"){if(typeof window[n.success]=="function"){if(e){s=e(s,p.filterArguments,n.args)}window[n.success](s)}}else{if(typeof n.success=="function"){if(e){s=e(s,p.filterArguments,n.args)}n.success(s)}}}}}};c.getDataFromCache(h,o)};this.getDataFromCache=function(e,d){jQuery.ajax({type:"POST",async:true,url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_cache_name:d,wdi_nonce:wdi_ajax.wdi_nonce,WDI_MINIFY:wdi_ajax.WDI_MINIFY,action:"wdi_get_cache_data"},success:function(g){if(g.wdi_debugging){console.log(g.wdi_debugging_data)}if(g.success){if(typeof g.cache_data!=="undefined"&&g.cache_data!==null){var f=JSON.parse(g.cache_data);e(f)}else{e(false)}}else{e(false)}}})};this.setDataToCache=function(e,d){jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_cache_name:e,wdi_cache_response:JSON.stringify(d),wdi_nonce:wdi_ajax.wdi_nonce,action:"wdi_set_cache_data"},success:function(f){}})}};
1
+ function WDIInstagram(b){this.access_tokens=[];this.filters=[];if(typeof b!="undefined"){if(typeof b.access_tokens!="undefined"){this.access_tokens=b.access_tokens}if(typeof b.filters!="undefined"){this.filters=b.filters}}var e=this;this.statusCode={429:function(){console.log(" 429: Too many requests. Try after one hour")}};this.getFilter=function(f){var h=e.filters;if(typeof h=="undefined"){return false}for(var g=0;g<h.length;g++){if(h[g].where==f){if(typeof h[g].what=="object"&&h[g].what.length==2){if(typeof window[h[g].what[0]]!="undefined"){if(typeof window[h[g].what[0]][h[g].what[1]]=="function"){return window[h[g].what[0]][h[g].what[1]]}}}else{if(typeof h[g].what=="string"){if(typeof window[h[g].what]=="function"){return window[h[g].what]}}else{if(typeof h[g].what=="function"){return h[g].what}else{return false}}}}}return false};function c(){var f=e.access_tokens,g=parseInt(Math.random(0,1)*f.length);return f[g]}function d(){if(typeof wdi_options!=="undefined"){return wdi_options.fb_token}else{if(typeof wdi_ajax!=="undefined"){return wdi_ajax.fb_token}else{return""}}}function a(){if(typeof wdi_options!=="undefined"){return wdi_options.business_account_id}else{if(typeof wdi_ajax!=="undefined"){return wdi_ajax.business_account_id}else{return""}}}this.addToken=function(f){if(typeof f=="string"){e.access_tokens.push(f)}};this.resetTokens=function(){e.access_tokens=[]};this.getTagRecentMedia=function(r,o,f){var p="https://graph.facebook.com/ig_hashtag_search/";p+="?user_id="+a();p+="&q="+r;p+="&access_token="+d();var q=this,s=false,h=false,l=this.statusCode,j=false,n=false,g=this.getFilter("getTagRecentMedia"),m="https://graph.facebook.com/{tagid}/recent_media/?fields=media_url,caption,id,media_type,comments_count,like_count,permalink,children{media_url,id,media_type,permalink}";if(typeof o=="undefined"||o.length===0){s=true}else{if("success" in o){h=true}if("statusCode" in o){l=o.statusCode}if("error" in o){j=true}if("args" in o){n=true}else{o.args={}}if("count" in o){o.count=parseInt(o.count);if(!Number.isInteger(o.count)||o.count<=0){o.count=33}}else{o.count=33}m+="&limit="+o.count;if("min_tag_id" in o){m+="&min_tag_id="+o.min_tag_id}if("max_tag_id" in o){m+="&max_tag_id="+o.max_tag_id}m+="&access_token="+d();m+="&user_id="+a()}var i=this.getTagId(r);var k=function(t){if(t===false){jQuery.ajax({type:"POST",url:m,dataType:"jsonp",success:function(v){v=e.convertHashtagData(v);v.meta={code:200};v.tag_id=i;e.setDataToCache(m,v);u(v)},error:function(v){if(j){if(typeof o.error=="object"&&o.error.length==2){if(typeof window[o.error[0]][o.error[1]]=="function"){window[o.error[0]][o.error[1]](v)}}else{if(typeof o.error=="string"){if(typeof window[o.error]=="function"){window[o.error](v)}}else{if(typeof o.error=="function"){o.error(v)}}}}},statusCode:l})}else{u(t)}function u(v){if(typeof v.data==="undefined"){v.data=[]}if(h){if(typeof o.success=="object"&&o.success.length==2){if(typeof window[o.success[0]]!="undefined"){if(typeof window[o.success[0]][o.success[1]]=="function"){if(g){v=g(v,q.filterArguments,o.args)}window[o.success[0]][o.success[1]](v)}}}else{if(typeof o.success=="string"){if(typeof window[o.success]=="function"){if(g){v=g(v,q.filterArguments,o.args)}window[o.success](v)}}else{if(typeof o.success=="function"){if(g){v=g(v,q.filterArguments,o.args)}o.success(v)}}}}}};if(i===false){jQuery.ajax({type:"GET",url:p,dataType:"jsonp"}).done(function(t){if(typeof t.error==="undefined"){i=t.data[0].id}else{alert(t.error.message);return}if(typeof f==="undefined"){m=m.replace("{tagid}",i)}else{m=f}var u=[];if(typeof window.wdi_all_tags!=="undefined"){u=window.wdi_all_tags}u[i]={id:"#"+r,username:"#"+r,tag_id:i};window.wdi_all_tags=u;e.getDataFromCache(k,m)})}else{if(typeof f==="undefined"){m=m.replace("{tagid}",i)}else{m=f}e.getDataFromCache(k,m)}};this.getTagId=function(j){var f=[];if(typeof wdi_controller!=="undefined"){f=wdi_controller.feed_users;if(f.length===0){var h=jQuery("#WDI_feed_users").val();f=JSON.parse(h)}}else{if(typeof window.wdi_all_tags!=="undefined"){f=window.wdi_all_tags}}for(var g in f){if(j===f[g].username||"#"+j===f[g].username){if(typeof f[g].tag_id!=="undefined"){return f[g].tag_id}return false}}return false};this.convertHashtagData=function(k){var h={data:[],pagination:{}};if(typeof k.paging!=="undefined"){h.pagination={cursors:{after:k.paging.cursors.after},next_url:k.paging.next}}for(var g in k.data){var m=k.data[g];var o;if(m.media_type==="IMAGE"){o="image"}else{if(m.media_type==="VIDEO"){o="video"}else{o="carousel"}}var l={id:m.id,user:{id:"",full_name:"",profile_picture:"",username:""},images:{thumbnail:{width:150,height:150,url:m.permalink+"media?size=t"},low_resolution:{width:320,height:320,url:m.permalink+"media?size=m"},standard_resolution:{width:640,height:640,url:m.permalink+"media?size=m"}},created_time:"1543398649",caption:{id:"",text:m.caption,created_time:"",from:{id:"",full_name:"",profile_picture:"",username:""}},user_has_liked:(m.like_count>0),likes:{count:m.like_count},tags:[],filter:"Normal",comments:{count:m.comments_count},type:o,link:m.permalink,location:null,attribution:null,users_in_photo:[]};if(m.media_type==="IMAGE"||m.media_type==="CAROUSEL_ALBUM"){l.images={thumbnail:{width:150,height:150,url:m.permalink+"media?size=t"},low_resolution:{width:320,height:320,url:m.permalink+"media?size=m"},standard_resolution:{width:640,height:640,url:m.permalink+"media?size=m"}}}else{if(m.media_type==="VIDEO"){l.videos={standard_resolution:{width:640,height:800,url:m.media_url},low_bandwidth:{width:480,height:600,url:m.media_url},low_resolution:{width:480,height:600,url:m.media_url}}}}if(m.media_type==="CAROUSEL_ALBUM"){l.carousel_media=[];for(var f in m.children.data){if(m.children.data[f].media_type==="IMAGE"){var n={images:{thumbnail:{width:150,height:150,url:m.children.data[f].media_url+"media?size=t"},low_resolution:{width:320,height:320,url:m.children.data[f].permalink+"media?size=m"},standard_resolution:{width:640,height:640,url:m.children.data[f].media_url}},users_in_photo:[],type:"image"}}else{var n={videos:{standard_resolution:{width:640,height:800,url:m.children.data[f].media_url,id:m.children.data[f].id},low_bandwidth:{width:480,height:600,url:m.children.data[f].media_url,id:m.children.data[f].id},low_resolution:{width:480,height:600,url:m.children.data[f].media_url,id:m.children.data[f].id}},users_in_photo:[],type:"video"}}l.carousel_media.push(n)}}h.data.push(l)}return h};this.searchForTagsByName=function(m,k){var l=this,n=false,f=false,j=this.statusCode,g=false;filter=this.getFilter("searchForTagsByName");if(typeof k=="undefined"||k.length===0){n=true}else{if("success" in k){f=true}if("error" in k){g=true}if("statusCode" in k){j=k.statusCode}}var h="https://api.instagram.com/v1/tags/search?q="+m+"&access_token="+c();var i=function(o){if(o===false){jQuery.ajax({type:"POST",url:h,dataType:"jsonp",success:function(q){e.setDataToCache(h,q);p(q)},error:function(q){if(g){if(typeof k.error=="object"&&k.error.length==2){if(typeof window[k.error[0]][k.error[1]]=="function"){window[k.error[0]][k.error[1]](q)}}else{if(typeof k.error=="string"){if(typeof window[k.error]=="function"){window[k.error](q)}}else{if(typeof k.error=="function"){k.error(q)}}}}},statusCode:j})}else{p(o)}function p(q){if(f){if(typeof k.success=="object"&&k.success.length==2){if(typeof window[k.success[0]]!="undefined"){if(typeof window[k.success[0]][k.success[1]]=="function"){if(filter){q=filter(q,l.filterArguments)}window[k.success[0]][k.success[1]](q)}}}else{if(typeof k.success=="string"){if(typeof window[k.success]=="function"){if(filter){q=filter(q,l.filterArguments)}window[k.success](q)}}else{if(typeof k.success=="function"){if(filter){q=filter(q,l.filterArguments)}k.success(q)}}}}}};e.getDataFromCache(i,h)};this.searchForUsersByName=function(m,i){var f=this,l=false,g=false,k=this.statusCode,h=false,j=this.getFilter("searchForUsersByName");if(typeof i=="undefined"||i.length===0){l=true}else{if("success" in i){g=true}if("error" in i){h=true}if("statusCode" in i){k=i.statusCode}}jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/search?q="+m+"&access_token="+c(),success:function(n){if(g){if(typeof i.success=="object"&&i.success.length==2){if(typeof window[i.success[0]]!="undefined"){if(typeof window[i.success[0]][i.success[1]]=="function"){if(j){n=j(n,f.filterArguments)}n.args=i;window[i.success[0]][i.success[1]](n)}}}else{if(typeof i.success=="string"){if(typeof window[i.success]=="function"){if(j){n=j(n,f.filterArguments)}n.args=i;window[i.success](n)}}else{if(typeof i.success=="function"){if(j){n=j(n,f.filterArguments)}n.args=i;i.success(n)}}}}},error:function(n){if(h){if(typeof i.error=="object"&&i.error.length==2){if(typeof window[i.error[0]][i.error[1]]=="function"){window[i.error[0]][i.error[1]](n)}}else{if(typeof i.error=="string"){if(typeof window[i.error]=="function"){window[i.error](n)}}else{if(typeof i.error=="function"){i.error(n)}}}}},statusCode:this.statusCode})};this.getRecentLikedMedia=function(i){var f=this,m=false,g=false,k=this.statusCode,h=false,j=this.getFilter("getRecentLikedMedia"),l="https://api.instagram.com/v1/users/self/media/liked?access_token="+c();if(typeof i=="undefined"||i.length===0){m=true}else{if("success" in i){g=true}if("error" in i){h=true}if("statusCode" in i){k=i.statusCode}if("args" in i){argFlag=true}else{i.args={}}if("count" in i){i.count=parseInt(i.count);if(!Number.isInteger(i.count)||i.count<=0){i.count=20}}else{i.count=20}l+="&count="+i.count;if("next_max_like_id" in i){l+="&next_max_like_id="+i.next_max_like_id}}jQuery.ajax({type:"POST",dataType:"jsonp",url:l,success:function(n){if(g){if(typeof i.success=="object"&&i.success.length==2){if(typeof window[i.success[0]]!="undefined"){if(typeof window[i.success[0]][i.success[1]]=="function"){if(j){n=j(n,f.filterArguments,i.args)}window[i.success[0]][i.success[1]](n)}}}else{if(typeof i.success=="string"){if(typeof window[i.success]=="function"){if(j){n=j(n,f.filterArguments,i.args)}window[i.success](n)}}else{if(typeof i.success=="function"){if(j){n=j(n,f.filterArguments,i.args)}i.success(n)}}}}},error:function(n){if(h){if(typeof i.error=="object"&&i.error.length==2){if(typeof window[i.error[0]][i.error[1]]=="function"){window[i.error[0]][i.error[1]](n)}}else{if(typeof i.error=="string"){if(typeof window[i.error]=="function"){window[i.error](n)}}else{if(typeof i.error=="function"){i.error(n)}}}}},statusCode:k})};this.getUserRecentMedia=function(n,l){var m=this,o=false,g=false,k=false,i=this.statusCode,h=false,f=this.getFilter("getUserRecentMedia"),j="https://api.instagram.com/v1/users/"+n+"/media/recent/?access_token="+c();if(typeof l=="undefined"||l.length===0){o=true}else{if("success" in l){g=true}if("statusCode" in l){i=l.statusCode}if("args" in l){k=true}else{l.args={}}if("error" in l){h=true}if("count" in l){l.count=parseInt(l.count);if(!Number.isInteger(l.count)||l.count<=0){l.count=33}}else{l.count=33}j+="&count="+l.count;if("min_id" in l){j+="&min_id="+l.min_id}if("max_id" in l){j+="&max_id="+l.max_id}}jQuery.ajax({type:"POST",dataType:"jsonp",url:j,success:function(p){if(typeof p.data==="undefined"){p.data=[]}if(g){if(typeof l.success=="object"&&l.success.length==2){if(typeof window[l.success[0]]!="undefined"){if(typeof window[l.success[0]][l.success[1]]=="function"){if(f){p=f(p,m.filterArguments,l.args)}window[l.success[0]][l.success[1]](p)}}}else{if(typeof l.success=="string"){if(typeof window[l.success]=="function"){if(f){p=f(p,m.filterArguments,l.args)}window[l.success](p)}}else{if(typeof l.success=="function"){if(f){p=f(p,m.filterArguments,l.args)}l.success(p)}}}}},error:function(p){if(h){if(typeof l.error=="object"&&l.error.length==2){if(typeof window[l.error[0]][l.error[1]]=="function"){window[l.error[0]][l.error[1]](p)}}else{if(typeof l.error=="string"){if(typeof window[l.error]=="function"){window[l.error](p)}}else{if(typeof l.error=="function"){l.error(p)}}}}},statusCode:i})};this.getSelfRecentMedia=function(m){var n=this,o=false,g=false,j=this.statusCode,h=false,l=false,f=this.getFilter("getSelfRecentMedia"),k="https://api.instagram.com/v1/users/self/media/recent/?access_token="+c();if(typeof m=="undefined"||m.length===0){o=true}else{if("success" in m){g=true}if("error" in m){h=true}if("statusCode" in m){j=m.statusCode}if("args" in m){l=true}else{m.args={}}if("count" in m){m.count=parseInt(m.count);if(!Number.isInteger(m.count)||m.count<=0){m.count=20}}else{m.count=20}k+="&count="+m.count;if("min_id" in m){k+="&min_id="+m.min_id}if("max_id" in m){k+="&max_id="+m.max_id}}var i=function(p){if(p===false){jQuery.ajax({type:"POST",dataType:"jsonp",url:k,success:function(r){e.setDataToCache(k,r);q(r)},error:function(r){if(h){if(typeof m.error=="object"&&m.error.length==2){if(typeof window[m.error[0]][m.error[1]]=="function"){window[m.error[0]][m.error[1]](r)}}else{if(typeof m.error=="string"){if(typeof window[m.error]=="function"){window[m.error](r)}}else{if(typeof m.error=="function"){m.error(r)}}}}},statusCode:j})}else{q(p)}function q(r){if(g){if(typeof m.success=="object"&&m.success.length==2){if(typeof window[m.success[0]]!="undefined"){if(typeof window[m.success[0]][m.success[1]]=="function"){if(f){r=f(r,n.filterArguments,m)}window[m.success[0]][m.success[1]](r)}}}else{if(typeof m.success=="string"){if(typeof window[m.success]=="function"){if(f){r=f(r,n.filterArguments,m)}window[m.success](r)}}else{if(typeof m.success=="function"){if(f){r=f(r,n.filterArguments,m)}m.success(r)}}}}}};e.getDataFromCache(i,k)};this.getUserInfo=function(g,j){var f=this,m=false,h=false,l=this.statusCode,i=false,k=this.getFilter("getUserInfo");if(typeof j=="undefined"||j.length===0){m=true}else{if("success" in j){h=true}if("error" in j){i=true}if("statusCode" in j){l=j.statusCode}}jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/"+g+"/?access_token="+c(),success:function(n){if(h){if(typeof j.success=="object"&&j.success.length==2){if(typeof window[j.success[0]]!="undefined"){if(typeof window[j.success[0]][j.success[1]]=="function"){if(k){n=k(n,f.filterArguments)}window[j.success[0]][j.success[1]](n)}}}else{if(typeof j.success=="string"){if(typeof window[j.success]=="function"){if(k){n=k(n,f.filterArguments)}window[j.success](n)}}else{if(typeof j.success=="function"){if(k){n=k(n,f.filterArguments)}j.success(n)}}}}},error:function(n){if(i){if(typeof j.error=="object"&&j.error.length==2){if(typeof window[j.error[0]][j.error[1]]=="function"){window[j.error[0]][j.error[1]](n)}}else{if(typeof j.error=="string"){if(typeof window[j.error]=="function"){window[j.error](n)}}else{if(typeof j.error=="function"){j.error(n)}}}}},statusCode:l})};this.getSelfInfo=function(l){var m=this,n=false,g=false,k=this.statusCode,h=false,f=this.getFilter("getSelfInfo");if(typeof l=="undefined"||l.length===0){n=true}else{if("success" in l){g=true}if("error" in l){h=true}if("statusCode" in l){k=l.statusCode}}var i="https://api.instagram.com/v1/users/self/?access_token="+c();var j=function(o){if(o===false){jQuery.ajax({type:"POST",dataType:"jsonp",url:i,success:function(q){e.setDataToCache(i,q);if(g){if(typeof l.success=="object"&&l.success.length==2){if(typeof window[l.success[0]]!="undefined"){if(typeof window[l.success[0]][l.success[1]]=="function"){if(f){q=f(q,m.filterArguments)}window[l.success[0]][l.success[1]](q)}}}else{if(typeof l.success=="string"){if(typeof window[l.success]=="function"){if(f){q=f(q,m.filterArguments)}window[l.success](q)}}else{if(typeof l.success=="function"){if(f){q=f(q,m.filterArguments)}l.success(q)}}}}},error:function(q){if(h){if(typeof l.error=="object"&&l.error.length==2){if(typeof window[l.error[0]][l.error[1]]=="function"){window[l.error[0]][l.error[1]](q)}}else{if(typeof l.error=="string"){if(typeof window[l.error]=="function"){window[l.error](q)}}else{if(typeof l.error=="function"){l.error(q)}}}}},statusCode:k})}else{p(o)}function p(q){if(g){if(typeof l.success=="object"&&l.success.length==2){if(typeof window[l.success[0]]!="undefined"){if(typeof window[l.success[0]][l.success[1]]=="function"){if(f){q=f(q,m.filterArguments)}window[l.success[0]][l.success[1]](q)}}}else{if(typeof l.success=="string"){if(typeof window[l.success]=="function"){if(f){q=f(q,m.filterArguments)}window[l.success](q)}}else{if(typeof l.success=="function"){if(f){q=f(q,m.filterArguments)}l.success(q)}}}}}};e.getDataFromCache(j,i)};this.getRecentMediaComments=function(h,m){var n=this,o=false,g=false,l=this.statusCode,j=false,f=this.getFilter("getRecentMediaComments");if(typeof m=="undefined"||m.length===0){o=true}else{if("success" in m){g=true}if("error" in m){j=true}if("statusCode" in m){l=m.statusCode}}var i="https://api.instagram.com/v1/media/"+h+"/comments?access_token="+c();var k=function(p){if(p===false){jQuery.ajax({type:"POST",dataType:"jsonp",url:i,success:function(r){e.setDataToCache(i,r);q(r)},error:function(r){if(j){if(typeof m.error=="object"&&m.error.length==2){if(typeof window[m.error[0]][m.error[1]]=="function"){window[m.error[0]][m.error[1]](r)}}else{if(typeof m.error=="string"){if(typeof window[m.error]=="function"){window[m.error](r)}}else{if(typeof m.error=="function"){m.error(r)}}}}},statusCode:l})}else{q(p)}function q(r){if(g){if(typeof m.success=="object"&&m.success.length==2){if(typeof window[m.success[0]]!="undefined"){if(typeof window[m.success[0]][m.success[1]]=="function"){if(f){r=f(r,n.filterArguments)}window[m.success[0]][m.success[1]](r)}}}else{if(typeof m.success=="string"){if(typeof window[m.success]=="function"){if(f){r=f(r,n.filterArguments)}window[m.success](r)}}else{if(typeof m.success=="function"){if(f){r=f(r,n.filterArguments)}m.success(r)}}}}}};e.getDataFromCache(k,i)};this.getRecentMediaLikes=function(l,i){var f=this,m=false,g=false,k=this.statusCode,h=false,j=this.getFilter("getRecentMediaLikes");if(typeof i=="undefined"||i.length===0){m=true}else{if("success" in i){g=true}if("error" in i){h=true}if("statusCode" in i){k=i.statusCode}}jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/media/"+l+"/likes?access_token="+c(),success:function(n){if(g){if(typeof i.success=="object"&&i.success.length==2){if(typeof window[i.success[0]]!="undefined"){if(typeof window[i.success[0]][i.success[1]]=="function"){if(j){n=j(n,f.filterArguments)}window[i.success[0]][i.success[1]](n)}}}else{if(typeof i.success=="string"){if(typeof window[i.success]=="function"){if(j){n=j(n,f.filterArguments)}window[i.success](n)}}else{if(typeof i.success=="function"){if(j){n=j(n,f.filterArguments)}i.success(n)}}}}},error:function(n){if(h){if(typeof i.error=="object"&&i.error.length==2){if(typeof window[i.error[0]][i.error[1]]=="function"){window[i.error[0]][i.error[1]](n)}}else{if(typeof i.error=="string"){if(typeof window[i.error]=="function"){window[i.error](n)}}else{if(typeof i.error=="function"){i.error(n)}}}}},statusCode:k})};this.requestByUrl=function(q,p){var r=this,s=false,h=false,j=false,o=false,m=this.statusCode,g=this.getFilter("requestByUrl"),f,n;f=q.split("?")[1].split("&");for(var l=0;l<f.length;l++){f[l]=f[l].split("=");if(f[l][0]=="access_token"){f[l][1]=c()}f[l]=f[l].join("=")}f=f.join("&");q=q.split("?")[0]+"?"+f;if(typeof p=="undefined"||p.length===0){s=true}else{if("success" in p){h=true}if("args" in p){o=true}else{p.args={}}if("error" in p){j=true}if("statusCode" in p){m=p.statusCode}}var k=function(i){if(i===false){jQuery.ajax({type:"POST",dataType:"jsonp",url:q,success:function(u){e.setDataToCache(q,u);if(h){if(typeof p.success=="object"&&p.success.length==2){if(typeof window[p.success[0]]!="undefined"){if(typeof window[p.success[0]][p.success[1]]=="function"){if(g){u=g(u,r.filterArguments,p.args)}window[p.success[0]][p.success[1]](u)}}}else{if(typeof p.success=="string"){if(typeof window[p.success]=="function"){if(g){u=g(u,r.filterArguments,p.args)}window[p.success](u)}}else{if(typeof p.success=="function"){if(g){u=g(u,r.filterArguments,p.args)}p.success(u)}}}}},error:function(u){if(j){if(typeof p.error=="object"&&p.error.length==2){if(typeof window[p.error[0]][p.error[1]]=="function"){window[p.error[0]][p.error[1]](u)}}else{if(typeof p.error=="string"){if(typeof window[p.error]=="function"){window[p.error](u)}}else{if(typeof p.error=="function"){p.error(u)}}}}},statusCode:m})}else{t(i)}function t(u){if(h){if(typeof p.success=="object"&&p.success.length==2){if(typeof window[p.success[0]]!="undefined"){if(typeof window[p.success[0]][p.success[1]]=="function"){if(g){u=g(u,r.filterArguments,p.args)}window[p.success[0]][p.success[1]](u)}}}else{if(typeof p.success=="string"){if(typeof window[p.success]=="function"){if(g){u=g(u,r.filterArguments,p.args)}window[p.success](u)}}else{if(typeof p.success=="function"){if(g){u=g(u,r.filterArguments,p.args)}p.success(u)}}}}}};e.getDataFromCache(k,q)};this.getDataFromCache=function(h,g,f){if(typeof f==="undefined"){f=true}jQuery.ajax({type:"POST",async:f,url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_cache_name:g,wdi_nonce:wdi_ajax.wdi_nonce,WDI_MINIFY:wdi_ajax.WDI_MINIFY,action:"wdi_get_cache_data"},success:function(j){if(j.wdi_debugging){console.log(j.wdi_debugging_data)}if(j.success){if(typeof j.cache_data!=="undefined"&&j.cache_data!==null){var i=JSON.parse(j.cache_data);h(i)}else{h(false)}}else{h(false)}}})};this.setDataToCache=function(g,f){jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_cache_name:g,wdi_cache_response:JSON.stringify(f),wdi_nonce:wdi_ajax.wdi_nonce,action:"wdi_set_cache_data"},success:function(h){}})}};
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.0
7
- Stable tag: 1.3.10
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -502,6 +502,9 @@ Please make sure you don't have any important information before you proceed.
502
 
503
  == Changelog ==
504
 
 
 
 
505
  = 1.3.10 =
506
  Fixed: Gutenberg compatibility
507
  Fixed: Duplicate media when several filters are applied (Premium)
4
  Requires at least: 3.9
5
  Requires PHP: 5.2
6
  Tested up to: 5.0
7
+ Stable tag: 1.3.11
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
502
 
503
  == Changelog ==
504
 
505
+ = 1.3.11 =
506
+ New: Create hashtag feeds for business profiles using Instagram Graph API
507
+
508
  = 1.3.10 =
509
  Fixed: Gutenberg compatibility
510
  Fixed: Duplicate media when several filters are applied (Premium)
wd-instagram-feed.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Instagram Feed by 10Web
4
  Plugin URI: https://10web.io/plugins/wordpress-instagram-feed/
5
  Description: Instagram Feed by 10Web is a user-friendly tool for displaying user or hashtag-based feeds on your website. You can create feeds with one of the available layouts. It allows displaying image metadata, open up images in lightbox, download them and even share in social networking websites.
6
- Version: 1.3.10
7
  Author: 10Web
8
  Author URI: https://10Web.io
9
  License: GPLv2 or later
@@ -20,7 +20,7 @@ define("WDI_META", "_".WDI_VAR."_meta");
20
  //define("wdi",'wdi');
21
  define('WDI_FEED_TABLE','wdi_feeds');
22
  define('WDI_THEME_TABLE','wdi_themes');
23
- define('WDI_VERSION','1.3.10');
24
  define('WDI_IS_PRO','false');
25
  $wdi_minify = ((isset($_GET['wdi_no_minify']) && $_GET['wdi_no_minify'] == "true") ? false : true);
26
  define('WDI_MINIFY', $wdi_minify);
@@ -49,6 +49,49 @@ else {
49
  }
50
  //////////////////////////////////////////////////////////////////
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
  add_action('wp_ajax_wdi_get_cache_data', 'wdi_get_cache_data');
54
  add_action('wp_ajax_nopriv_wdi_get_cache_data', 'wdi_get_cache_data');
@@ -384,7 +427,9 @@ function WDI_instagram_menu() {
384
  if(isset($wdi_uninstall_success["wdi_plugin_uninstalled"]) && $wdi_uninstall_success["wdi_plugin_uninstalled"]==="true"){
385
  $wdi_uninstall = false;
386
  }
387
- if((!isset($wdi_options['wdi_access_token']) || empty($wdi_options['wdi_access_token'])) && $wdi_uninstall) {
 
 
388
  if( get_option( "wdi_subscribe_done" ) == 1 ) {
389
  $parent_slug = "wdi_feeds";
390
  $settings_page = add_menu_page(__('Instagram Feed', "wd-instagram-feed"), 'Instagram Feed', $min_feeds_capability, 'wdi_settings', 'WDI_instagram_settings_page', $menu_icon);
3
  Plugin Name: Instagram Feed by 10Web
4
  Plugin URI: https://10web.io/plugins/wordpress-instagram-feed/
5
  Description: Instagram Feed by 10Web is a user-friendly tool for displaying user or hashtag-based feeds on your website. You can create feeds with one of the available layouts. It allows displaying image metadata, open up images in lightbox, download them and even share in social networking websites.
6
+ Version: 1.3.11
7
  Author: 10Web
8
  Author URI: https://10Web.io
9
  License: GPLv2 or later
20
  //define("wdi",'wdi');
21
  define('WDI_FEED_TABLE','wdi_feeds');
22
  define('WDI_THEME_TABLE','wdi_themes');
23
+ define('WDI_VERSION','1.3.11');
24
  define('WDI_IS_PRO','false');
25
  $wdi_minify = ((isset($_GET['wdi_no_minify']) && $_GET['wdi_no_minify'] == "true") ? false : true);
26
  define('WDI_MINIFY', $wdi_minify);
49
  }
50
  //////////////////////////////////////////////////////////////////
51
 
52
+ if(!empty($_GET['wdi_code'])) {
53
+ add_action('plugins_loaded', 'wdi_save_user_access_token');
54
+ }
55
+
56
+ function wdi_save_user_access_token(){
57
+ $options = wdi_get_options();
58
+
59
+ $token = $_GET['wdi_code'];
60
+
61
+
62
+ $url = "https://graph.facebook.com/me/accounts?fields=instagram_business_account&limit=500&access_token=" . $token;
63
+ $accounts = @file_get_contents($url);
64
+ $accounts = json_decode($accounts, true);
65
+
66
+ if(!is_array($accounts)) {
67
+ //invalid access token
68
+ return;
69
+ }
70
+
71
+ $business_accounts = [];
72
+
73
+ foreach($accounts['data'] as $accounts_data) {
74
+
75
+ foreach($accounts_data as $key => $data) {
76
+ if($key === "instagram_business_account") {
77
+ $business_accounts[] = $data['id'];
78
+ }
79
+ }
80
+
81
+ }
82
+
83
+ if(empty($business_accounts)) {
84
+ //no business accounts
85
+ return;
86
+ }
87
+
88
+ $key = array_rand($business_accounts, 1);
89
+
90
+ $options['fb_token'] = $token;
91
+ $options['business_account_id'] = $business_accounts[$key];
92
+ update_option(WDI_OPT, $options);
93
+ echo "<script>window.location.href='admin.php?page=wdi_settings';</script>";
94
+ }
95
 
96
  add_action('wp_ajax_wdi_get_cache_data', 'wdi_get_cache_data');
97
  add_action('wp_ajax_nopriv_wdi_get_cache_data', 'wdi_get_cache_data');
427
  if(isset($wdi_uninstall_success["wdi_plugin_uninstalled"]) && $wdi_uninstall_success["wdi_plugin_uninstalled"]==="true"){
428
  $wdi_uninstall = false;
429
  }
430
+
431
+ $has_token = (!isset($wdi_options['wdi_access_token']) || empty($wdi_options['wdi_access_token'])) && empty($wdi_options['fb_token']);
432
+ if($has_token && $wdi_uninstall) {
433
  if( get_option( "wdi_subscribe_done" ) == 1 ) {
434
  $parent_slug = "wdi_feeds";
435
  $settings_page = add_menu_page(__('Instagram Feed', "wd-instagram-feed"), 'Instagram Feed', $min_feeds_capability, 'wdi_settings', 'WDI_instagram_settings_page', $menu_icon);