WD Instagram Feed – Instagram Gallery - Version 1.4.14

Version Description

Fixed: Removing feed. Fixed: Deactivation after uninstall. Fixed: Duplicated images in filmstrip. Fixed: Load more.

Download this release

Release Info

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

Code changes from version 1.4.13 to 1.4.14

config.php CHANGED
@@ -3,12 +3,13 @@ if ( !defined('ABSPATH') ) {
3
  exit;
4
  }
5
 
6
- define('WDI_VERSION', '1.4.13');
7
  define('WDI_IS_FREE', TRUE);
8
  define('WDI_PREFIX', 'wdi');
9
  define('WDI_DIR', WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__)));
10
  define('WDI_URL', plugins_url(plugin_basename(dirname(__FILE__))));
11
- define('WDI_MAIN_FILE', plugin_basename(__FILE__));
 
12
  define('WDI_META', '_wdi_instagram_meta');
13
  define('WDI_OPT', 'wdi_instagram_options');
14
  define('WDI_FSN', 'wdi_feed_settings');
3
  exit;
4
  }
5
 
6
+ define('WDI_VERSION', '1.4.14');
7
  define('WDI_IS_FREE', TRUE);
8
  define('WDI_PREFIX', 'wdi');
9
  define('WDI_DIR', WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__)));
10
  define('WDI_URL', plugins_url(plugin_basename(dirname(__FILE__))));
11
+ $WDI_MAIN_FILE = str_replace( 'config.php', 'wd-instagram-feed.php', plugin_basename(__FILE__) );
12
+ define('WDI_MAIN_FILE', $WDI_MAIN_FILE);
13
  define('WDI_META', '_wdi_instagram_meta');
14
  define('WDI_OPT', 'wdi_instagram_options');
15
  define('WDI_FSN', 'wdi_feed_settings');
frontend/shortcode.php CHANGED
@@ -198,6 +198,9 @@ function wdi_feed($atts, $widget_params = '') {
198
  }
199
 
200
  }
 
 
 
201
  if ( isset($wdi_options['wdi_custom_css']) ) {
202
  ?>
203
  <style><?php echo $wdi_options['wdi_custom_css'];?></style>
198
  }
199
 
200
  }
201
+ // @TODO. All views pass_feed_data_to_js(), add_theme_styles(), generate_feed_styles() functions can be moved here�
202
+ // model and $feed_row - available here
203
+
204
  if ( isset($wdi_options['wdi_custom_css']) ) {
205
  ?>
206
  <style><?php echo $wdi_options['wdi_custom_css'];?></style>
frontend/views/imagebrowser.php CHANGED
@@ -12,15 +12,14 @@ class WDI_ImageBrowser_view {
12
  global $user_feed_header_args;
13
  $this->pass_feed_data_to_js();
14
  $feed_row = $this->model->get_feed_row();
15
- $wdi_feed_counter = $this->model->wdi_feed_counter;
16
  $this->add_theme_styles();
17
  $this->generate_feed_styles($feed_row);
18
  $style = $this->model->theme_row;
 
19
  $container_class = 'wdi_feed_theme_' . $style['id'] . ' wdi_feed_browser_' . $style['id'];
20
  $wdi_data_ajax = defined('DOING_AJAX') && DOING_AJAX ? 'data-wdi_ajax=1' : '';
21
  ?>
22
- <div id="wdi_feed_<?php echo $wdi_feed_counter ?>"
23
- class="wdi_feed_main_container wdi_layout_ib <?php echo $container_class; ?>" <?php echo $wdi_data_ajax; ?> >
24
  <?php wdi_feed_frontend_messages();?>
25
  <div id="wdi_spider_popup_loading_<?php echo $wdi_feed_counter ?>" class="wdi_spider_popup_loading"></div>
26
  <div id="wdi_spider_popup_overlay_<?php echo $wdi_feed_counter ?>" class="wdi_spider_popup_overlay"
12
  global $user_feed_header_args;
13
  $this->pass_feed_data_to_js();
14
  $feed_row = $this->model->get_feed_row();
 
15
  $this->add_theme_styles();
16
  $this->generate_feed_styles($feed_row);
17
  $style = $this->model->theme_row;
18
+ $wdi_feed_counter = $this->model->wdi_feed_counter;
19
  $container_class = 'wdi_feed_theme_' . $style['id'] . ' wdi_feed_browser_' . $style['id'];
20
  $wdi_data_ajax = defined('DOING_AJAX') && DOING_AJAX ? 'data-wdi_ajax=1' : '';
21
  ?>
22
+ <div id="wdi_feed_<?php echo $wdi_feed_counter ?>" class="wdi_feed_main_container wdi_layout_ib <?php echo $container_class; ?>" <?php echo $wdi_data_ajax; ?> >
 
23
  <?php wdi_feed_frontend_messages();?>
24
  <div id="wdi_spider_popup_loading_<?php echo $wdi_feed_counter ?>" class="wdi_spider_popup_loading"></div>
25
  <div id="wdi_spider_popup_overlay_<?php echo $wdi_feed_counter ?>" class="wdi_spider_popup_overlay"
frontend/views/thumbnails.php CHANGED
@@ -10,12 +10,12 @@ class WDI_Thumbnails_view {
10
 
11
  public function display() {
12
  global $user_feed_header_args;
13
- $this->pass_feed_data_to_js();
14
- $feed_row = $this->model->get_feed_row();
15
- $wdi_feed_counter = $this->model->wdi_feed_counter;
16
- $this->add_theme_styles();
17
- $this->generate_feed_styles($feed_row);
18
  $style = $this->model->theme_row;
 
19
  $container_class = 'wdi_feed_theme_' . $style['id'] . ' wdi_feed_thumbnail_' . $style['id'];
20
  $wdi_data_ajax = defined('DOING_AJAX') && DOING_AJAX ? 'data-wdi_ajax=1' : '';
21
  ?>
10
 
11
  public function display() {
12
  global $user_feed_header_args;
13
+ $this->pass_feed_data_to_js(); // @TODO. should be moved to shortcode.php
14
+ $feed_row = $this->model->get_feed_row(); // @TODO. should be moved to shortcode.php
15
+ $this->add_theme_styles(); // @TODO. should be moved to shortcode.php
16
+ $this->generate_feed_styles($feed_row); // @TODO. should be moved to shortcode.php
 
17
  $style = $this->model->theme_row;
18
+ $wdi_feed_counter = $this->model->wdi_feed_counter;
19
  $container_class = 'wdi_feed_theme_' . $style['id'] . ' wdi_feed_thumbnail_' . $style['id'];
20
  $wdi_data_ajax = defined('DOING_AJAX') && DOING_AJAX ? 'data-wdi_ajax=1' : '';
21
  ?>
js/wdi_frontend.js CHANGED
@@ -201,29 +201,31 @@ wdi_front.init = function (currentFeed) {
201
  currentFeed.feed_users = ['self'];
202
  // do nothing,
203
  }
204
- else
205
- if (wdi_front.isJsonString(currentFeed.feed_row.feed_users)) {
206
- /**
207
- * Contains username and user_id of each user
208
- * @type {[Array}
209
- */
210
- currentFeed.feed_users = JSON.parse(currentFeed.feed_row.feed_users);
211
-
212
- /**
213
- * Check if feed user has no id for some reason then update user
214
- * and after updating them initialize feed
215
- */
216
- } else {
217
- wdi_front.show_alert(wdi_front_messages.invalid_users_format, false ,currentFeed);
218
- return;
 
 
219
  }
220
-
221
  var all_tags = [];
222
  var feed_user = [];
223
  var feed_user_tags = [];
224
  if (typeof window["wdi_all_tags"] !== "undefined") {
225
  all_tags = window["wdi_all_tags"];
226
  }
 
227
  for (var k =0; k < currentFeed.feed_users.length; k++) {
228
  if (currentFeed.feed_users[k].username[0] === "#" && typeof currentFeed.feed_users[k].tag_id !== "undefined") {
229
  all_tags[currentFeed.feed_users[k].tag_id] = currentFeed.feed_users[k];
@@ -240,7 +242,6 @@ wdi_front.init = function (currentFeed) {
240
  currentFeed.feedImageResolution = feedResolution.image;
241
  currentFeed.feedVideoResolution = feedResolution.video;
242
  currentFeed.dataCount = currentFeed.feed_users.length; // 1 in case of self feed
243
-
244
  for ( var i = 0; i < currentFeed.dataCount; i++ ) {
245
  wdi_front.instagramRequest(i, currentFeed);
246
  }
@@ -329,7 +330,6 @@ wdi_front.isJsonString = function (str) {
329
  wdi_front.instagramRequest = function (id, currentFeed) {
330
  var _this = this,
331
  feed_users = currentFeed.feed_users;
332
-
333
  if (typeof feed_users[id] === 'string' && feed_users[id] === 'self') { // self liked media
334
  currentFeed.instagram.getRecentLikedMedia({
335
  success: function (response) {
@@ -346,24 +346,41 @@ wdi_front.instagramRequest = function (id, currentFeed) {
346
  }
347
  else {
348
  if ( this.getInputType(feed_users[id]['username']) == 'hashtag' ) {
349
- currentFeed.instagram.getTagRecentMedia(this.stripHashtag(feed_users[id]['username']), {
350
- success: function (response) {
351
- if ( ( typeof response.error != 'undefined' && response.error.type != 'undefined' ) || ( typeof response.meta != 'undefined' && response.meta.error == true ) ) {
352
- wdi_front.show_alert(false, response, currentFeed);
353
- return false;
354
- }
355
- currentFeed.mediaRequestsDone = true;
356
- response = _this.checkMediaResponse(response, currentFeed);
357
- if ( response != false ) {
358
- _this.saveUserData(response, currentFeed.feed_users[id], currentFeed);
359
  }
360
  }
361
- }, null, currentFeed.feed_row.hashtag_top_recent);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
362
  }
363
  else {
364
  if ( this.getInputType( feed_users[id]['username']) == 'user' ) {
365
  currentFeed.instagram.getUserMedia({
 
366
  user_id: feed_users[id].id,
 
367
  success: function (response) {
368
  if ( typeof response.meta != 'undefined' && typeof response.meta.error == true ) {
369
  wdi_front.show_alert(false, response, currentFeed);
@@ -1650,8 +1667,7 @@ wdi_front.bindEvents = function (currentFeed) {
1650
  }
1651
  if (currentFeed.feed_row.feed_display_view == 'load_more_btn') {
1652
  //binding load more event
1653
- jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' .wdi_load_more_container').on(wdi_front.clickOrTouch, function ()
1654
- {
1655
  //do the actual load more operation
1656
  wdi_front.loadMore(jQuery(this).find('.wdi_load_more_wrap'));
1657
  });
@@ -1835,97 +1851,105 @@ wdi_front.loadMore = function (button, _currentFeed) {
1835
  if (button != '' && typeof button != 'undefined' && button != 'initial' && button != 'initial-keep') {
1836
  var currentFeed = window[button.parent().parent().parent().parent().attr('id')];
1837
  }
1838
- if (typeof _currentFeed != 'undefined') {
1839
  var currentFeed = _currentFeed;
1840
  }
1841
- //check if any filter is enabled and filter user images has finished
1842
- //then stop any load more action
1843
- var activeFilter = 0,
1844
- finishedFilter = 0;
1845
- for (var i = 0; i < currentFeed.userSortFlags.length; i++) {
1846
- if (currentFeed.userSortFlags[i].flag === true) {
1847
- activeFilter++;
1848
- for (var j = 0; j < currentFeed.usersData.length; j++) {
1849
- if (currentFeed.userSortFlags[i]['id'] === currentFeed.usersData[j]['user_id']) {
1850
- if (currentFeed.usersData[j]['finished'] === 'finished') {
1851
- finishedFilter++;
1852
- }
1853
- }
1854
- }
1855
- }
1856
- }
1857
- if (activeFilter === finishedFilter && activeFilter != 0) {
1858
- return;
1859
- }
1860
-
1861
-
1862
- //if button is not provided than it enables auto_tiggering and recursively loads images
1863
- if (button === '') {
1864
- currentFeed['auto_trigger'] = true;
1865
- } else {
1866
- currentFeed['auto_trigger'] = false;
1867
- }
1868
- //ading ajax loading
1869
- wdi_front.ajaxLoader(currentFeed);
1870
-
1871
-
1872
- //check if masonry view is on and and feed display type is pagination then
1873
- //close all captions before loading more pages for porper pagination rendering
1874
- if (currentFeed.feed_row.feed_type === 'masonry' && currentFeed.feed_row.feed_display_view == 'pagination') {
1875
- jQuery('#wdi_feed_' + wdi_front.feed_counter + ' .wdi_full_caption').each(function ()
1876
- {
1877
- jQuery(this).find('.wdi_photo_title').trigger(wdi_front.clickOrTouch);
1878
- });
1879
- }
1880
-
1881
- //check if all data loaded then remove ajaxLoader
1882
- // To do Arsho
1883
- for (var i = 0; i < currentFeed.usersData.length; i++) {
1884
- if (currentFeed.usersData[i]['finished'] === 'finished') {
1885
- dataCounter++;
1886
- }
1887
- }
1888
- if (dataCounter === currentFeed.usersData.length) {
1889
- wdi_front.allImagesLoaded(currentFeed);
1890
- jQuery('#wdi_feed_' + currentFeed['feed_row']['wdi_feed_counter'] + ' .wdi_load_more').remove();
1891
-
1892
- }
1893
-
1894
- var usersData = currentFeed['usersData'];
1895
-
 
1896
  currentFeed.loadMoreDataCount = currentFeed.feed_users.length;
1897
 
1898
- for (var i = 0; i < usersData.length; i++) {
1899
-
1900
- var pagination = usersData[i]['pagination'];
1901
- var user = {
1902
- user_id: usersData[i]['user_id'],
1903
- username: usersData[i]['username']
1904
- }
1905
- //checking if pagination url exists then load images, else skip
1906
- if (pagination['next_url'] != '' && pagination['next_url'] != null && typeof pagination['next_url'] != 'undefined') {
1907
- var next_url = pagination['next_url'];
1908
- wdi_front.loadMoreRequest(user, next_url, currentFeed, button);
1909
- }
1910
- else {
1911
- if (button == 'initial-keep') {
1912
- currentFeed.temproraryUsersData[i] = currentFeed.usersData[i];
1913
- }
1914
- if ( currentFeed.loadMoreDataCount > 1 ) {
1915
- currentFeed.loadMoreDataCount--
1916
- }
1917
- wdi_front.checkForLoadMoreDone(currentFeed, button);
1918
- continue;
1919
- }
1920
- }
 
 
 
 
 
 
 
1921
  }
1922
 
1923
  /*
1924
- * Requests images based on provided pagination url
1925
- */
1926
  wdi_front.loadMoreRequest = function (user, next_url, currentFeed, button) {
1927
  /*if there was no initial request, do not allow loadmore request */
1928
- if (!currentFeed.mediaRequestsDone) {
1929
  return;
1930
  }
1931
  var usersData = currentFeed['usersData'];
@@ -1947,10 +1971,16 @@ wdi_front.loadMoreRequest = function (user, next_url, currentFeed, button) {
1947
  wdi_front.show_alert(errorMessage, response, currentFeed);
1948
  return;
1949
  }
1950
- response['user_id'] = user.user_id;
1951
- response['username'] = user.username;
 
 
 
 
 
 
1952
  for (var i = 0; i < currentFeed['usersData'].length; i++) {
1953
- if (response['user_id'] === currentFeed['usersData'][i]['user_id']) {
1954
  ///mmm!!!
1955
  if (response['user_id'][0] === '#') {
1956
  response['data'] = wdi_front.appendRequestHashtag(response['data'], response['user_id']);
@@ -1975,19 +2005,27 @@ wdi_front.loadMoreRequest = function (user, next_url, currentFeed, button) {
1975
  }
1976
  wdi_front.checkForLoadMoreDone(currentFeed, button);
1977
  };
1978
- if (user.username[0] !== "#") {
 
1979
  currentFeed.instagram.getUserMedia({
1980
- user_id: user.username[0].id,
1981
- success: success_function
1982
- }, next_url);
 
 
 
 
1983
  }
1984
  else {
1985
- currentFeed.instagram.getTagRecentMedia(user.username, {
1986
- success: success_function
1987
- },
1988
- next_url,
1989
- currentFeed.feed_row.hashtag_top_recent
1990
- )
 
 
 
1991
  }
1992
  }
1993
 
@@ -3101,4 +3139,4 @@ function wdi_extractHostname(url) {
3101
  var result = url.replace(/(^\w+:|^)\/\//, '');
3102
 
3103
  return result;
3104
- }
201
  currentFeed.feed_users = ['self'];
202
  // do nothing,
203
  }
204
+ else {
205
+ if (wdi_front.isJsonString(currentFeed.feed_row.feed_users)) {
206
+ /**
207
+ * Contains username and user_id of each user
208
+ * @type {[Array}
209
+ */
210
+ currentFeed.feed_users = JSON.parse(currentFeed.feed_row.feed_users);
211
+
212
+ /**
213
+ * Check if feed user has no id for some reason then update user
214
+ * and after updating them initialize feed
215
+ */
216
+ }
217
+ else {
218
+ wdi_front.show_alert(wdi_front_messages.invalid_users_format, false ,currentFeed);
219
+ return;
220
+ }
221
  }
 
222
  var all_tags = [];
223
  var feed_user = [];
224
  var feed_user_tags = [];
225
  if (typeof window["wdi_all_tags"] !== "undefined") {
226
  all_tags = window["wdi_all_tags"];
227
  }
228
+
229
  for (var k =0; k < currentFeed.feed_users.length; k++) {
230
  if (currentFeed.feed_users[k].username[0] === "#" && typeof currentFeed.feed_users[k].tag_id !== "undefined") {
231
  all_tags[currentFeed.feed_users[k].tag_id] = currentFeed.feed_users[k];
242
  currentFeed.feedImageResolution = feedResolution.image;
243
  currentFeed.feedVideoResolution = feedResolution.video;
244
  currentFeed.dataCount = currentFeed.feed_users.length; // 1 in case of self feed
 
245
  for ( var i = 0; i < currentFeed.dataCount; i++ ) {
246
  wdi_front.instagramRequest(i, currentFeed);
247
  }
330
  wdi_front.instagramRequest = function (id, currentFeed) {
331
  var _this = this,
332
  feed_users = currentFeed.feed_users;
 
333
  if (typeof feed_users[id] === 'string' && feed_users[id] === 'self') { // self liked media
334
  currentFeed.instagram.getRecentLikedMedia({
335
  success: function (response) {
346
  }
347
  else {
348
  if ( this.getInputType(feed_users[id]['username']) == 'hashtag' ) {
349
+ if ( this.isJsonString(currentFeed.feed_row.feed_users) ) {
350
+ json_feed_users = JSON.parse(currentFeed.feed_row.feed_users);
351
+ for ( var i in json_feed_users ) {
352
+ if ( json_feed_users[i].username.charAt(0) !== '#' ) {
353
+ user = json_feed_users[i];
354
+ }
 
 
 
 
355
  }
356
  }
357
+
358
+ currentFeed.instagram.getTagRecentMedia(this.stripHashtag(feed_users[id]['username']), {
359
+ feed_id: currentFeed.feed_row.id,
360
+ user_id: user.id,
361
+ user_name: user.username,
362
+ success: function (response) {
363
+ if ( ( typeof response.error != 'undefined' && response.error.type != 'undefined' ) || ( typeof response.meta != 'undefined' && response.meta.error == true ) ) {
364
+ wdi_front.show_alert(false, response, currentFeed);
365
+ return false;
366
+ }
367
+ currentFeed.mediaRequestsDone = true;
368
+ response = _this.checkMediaResponse(response, currentFeed);
369
+ if ( response != false ) {
370
+ _this.saveUserData(response, currentFeed.feed_users[id], currentFeed);
371
+ }
372
+ }
373
+ },
374
+ null,
375
+ currentFeed.feed_row.hashtag_top_recent
376
+ );
377
  }
378
  else {
379
  if ( this.getInputType( feed_users[id]['username']) == 'user' ) {
380
  currentFeed.instagram.getUserMedia({
381
+ feed_id: currentFeed.feed_row.id,
382
  user_id: feed_users[id].id,
383
+ user_name: feed_users[id].username,
384
  success: function (response) {
385
  if ( typeof response.meta != 'undefined' && typeof response.meta.error == true ) {
386
  wdi_front.show_alert(false, response, currentFeed);
1667
  }
1668
  if (currentFeed.feed_row.feed_display_view == 'load_more_btn') {
1669
  //binding load more event
1670
+ jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' .wdi_load_more_container').on(wdi_front.clickOrTouch, function () {
 
1671
  //do the actual load more operation
1672
  wdi_front.loadMore(jQuery(this).find('.wdi_load_more_wrap'));
1673
  });
1851
  if (button != '' && typeof button != 'undefined' && button != 'initial' && button != 'initial-keep') {
1852
  var currentFeed = window[button.parent().parent().parent().parent().attr('id')];
1853
  }
1854
+ if ( typeof _currentFeed != 'undefined' ) {
1855
  var currentFeed = _currentFeed;
1856
  }
1857
+ if ( this.isJsonString(currentFeed.feed_row.feed_users) ) {
1858
+ json_feed_users = JSON.parse(currentFeed.feed_row.feed_users);
1859
+ for ( var i in json_feed_users ) {
1860
+ iuser = json_feed_users[i];
1861
+ if ( json_feed_users[i].username.charAt(0) !== '#' ) {
1862
+ iuser = json_feed_users[i];
1863
+ }
1864
+ }
1865
+ }
1866
+ //check if any filter is enabled and filter user images has finished
1867
+ //then stop any load more action
1868
+ var activeFilter = 0,
1869
+ finishedFilter = 0;
1870
+ for (var i = 0; i < currentFeed.userSortFlags.length; i++) {
1871
+ if (currentFeed.userSortFlags[i].flag === true) {
1872
+ activeFilter++;
1873
+ for (var j = 0; j < currentFeed.usersData.length; j++) {
1874
+ if (currentFeed.userSortFlags[i]['id'] === currentFeed.usersData[j]['user_id']) {
1875
+ if (currentFeed.usersData[j]['finished'] === 'finished') {
1876
+ finishedFilter++;
1877
+ }
1878
+ }
1879
+ }
1880
+ }
1881
+ }
1882
+ if (activeFilter === finishedFilter && activeFilter != 0) {
1883
+ return;
1884
+ }
1885
+ // if button is not provided than it enables auto_tiggering and recursively loads images
1886
+ currentFeed['auto_trigger'] = false;
1887
+ if (button === '') {
1888
+ currentFeed['auto_trigger'] = true;
1889
+ }
1890
+ // ading ajax loading
1891
+ wdi_front.ajaxLoader(currentFeed);
1892
+
1893
+ //check if masonry view is on and and feed display type is pagination then
1894
+ //close all captions before loading more pages for porper pagination rendering
1895
+ if (currentFeed.feed_row.feed_type === 'masonry' && currentFeed.feed_row.feed_display_view == 'pagination') {
1896
+ jQuery('#wdi_feed_' + wdi_front.feed_counter + ' .wdi_full_caption').each(function () {
1897
+ jQuery(this).find('.wdi_photo_title').trigger(wdi_front.clickOrTouch);
1898
+ });
1899
+ }
1900
+
1901
+ // check if all data loaded then remove ajaxLoader
1902
+ // To do Arsho
1903
+ for (var i = 0; i < currentFeed.usersData.length; i++) {
1904
+ if (currentFeed.usersData[i]['finished'] === 'finished') {
1905
+ dataCounter++;
1906
+ }
1907
+ }
1908
+ if (dataCounter === currentFeed.usersData.length) {
1909
+ wdi_front.allImagesLoaded(currentFeed);
1910
+ jQuery('#wdi_feed_' + currentFeed['feed_row']['wdi_feed_counter'] + ' .wdi_load_more').remove();
1911
+ }
1912
+ var usersData = currentFeed['usersData'];
1913
  currentFeed.loadMoreDataCount = currentFeed.feed_users.length;
1914
 
1915
+ for (var i = 0; i < usersData.length; i++) {
1916
+ var pagination = usersData[i]['pagination'];
1917
+ var hashtag_id = (typeof usersData[i]['tag_id'] !== 'undefined') ? usersData[i]['tag_id'] : '';
1918
+ var hashtag = (typeof usersData[i]['username'] !== 'undefined' && hashtag_id) ? usersData[i]['username'] : '';
1919
+
1920
+ var user = {
1921
+ old_user_id: usersData[i]['user_id'],
1922
+ odl_username: usersData[i]['username'],
1923
+ user_id: iuser.id,
1924
+ username: iuser.username,
1925
+ hashtag: hashtag,
1926
+ hashtag_id: hashtag_id
1927
+ };
1928
+
1929
+ //checking if pagination url exists then load images, else skip
1930
+ if (pagination['next_url'] != '' && pagination['next_url'] != null && typeof pagination['next_url'] != 'undefined') {
1931
+ var next_url = pagination['next_url'];
1932
+ wdi_front.loadMoreRequest(user, next_url, currentFeed, button);
1933
+ }
1934
+ else {
1935
+ if (button == 'initial-keep') {
1936
+ currentFeed.temproraryUsersData[i] = currentFeed.usersData[i];
1937
+ }
1938
+ if ( currentFeed.loadMoreDataCount > 0 ) {
1939
+ currentFeed.loadMoreDataCount--
1940
+ }
1941
+ wdi_front.checkForLoadMoreDone(currentFeed, button);
1942
+ continue;
1943
+ }
1944
+ }
1945
  }
1946
 
1947
  /*
1948
+ * Requests images based on provided pagination url
1949
+ */
1950
  wdi_front.loadMoreRequest = function (user, next_url, currentFeed, button) {
1951
  /*if there was no initial request, do not allow loadmore request */
1952
+ if (!currentFeed.mediaRequestsDone || next_url == "") {
1953
  return;
1954
  }
1955
  var usersData = currentFeed['usersData'];
1971
  wdi_front.show_alert(errorMessage, response, currentFeed);
1972
  return;
1973
  }
1974
+ if (user['hashtag']) {
1975
+ response['user_id'] = user.hashtag_id;
1976
+ response['username'] = user.hashtag;
1977
+ } else {
1978
+ response['user_id'] = user.user_id;
1979
+ response['username'] = user.username;
1980
+ }
1981
+
1982
  for (var i = 0; i < currentFeed['usersData'].length; i++) {
1983
+ if (response['user_id'] === currentFeed['usersData'][i]['user_id'] || response['tag_id'] === currentFeed['usersData'][i]['tag_id']) {
1984
  ///mmm!!!
1985
  if (response['user_id'][0] === '#') {
1986
  response['data'] = wdi_front.appendRequestHashtag(response['data'], response['user_id']);
2005
  }
2006
  wdi_front.checkForLoadMoreDone(currentFeed, button);
2007
  };
2008
+
2009
+ if ( ! user.hashtag && ! user.hashtag_id ) {
2010
  currentFeed.instagram.getUserMedia({
2011
+ feed_id: currentFeed.feed_row.id,
2012
+ user_id: user.user_id,
2013
+ user_name: user.username,
2014
+ success: success_function
2015
+ },
2016
+ next_url
2017
+ );
2018
  }
2019
  else {
2020
+ currentFeed.instagram.getTagRecentMedia(this.stripHashtag(user.hashtag), {
2021
+ feed_id: currentFeed.feed_row.id,
2022
+ user_id: user.hashtag_id,
2023
+ user_name: user.hashtag,
2024
+ success: success_function
2025
+ },
2026
+ next_url,
2027
+ currentFeed.feed_row.hashtag_top_recent
2028
+ );
2029
  }
2030
  }
2031
 
3139
  var result = url.replace(/(^\w+:|^)\/\//, '');
3140
 
3141
  return result;
3142
+ }
js/wdi_frontend.min.js CHANGED
@@ -1 +1 @@
1
- "undefined"==typeof wdi_front&&(wdi_front={type:"not_declared"});var wdi_error_show=!(wdi_front.detectEvent=function(){var e="click";return/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())&&(e="touchend"),e}),wdi_error_init=!1;function wdi_baseName(e){var i=e.substr(e.lastIndexOf("/"));return e.replace(i,"")}wdi_front.escape_tags=function(e){return void 0===e&&(e=""),e=e.toString().replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&#34;")},wdi_front.show_alert=function(e,i,r){var t,a;void 0!==(r=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter))&&(wdi_error_show=!0,r.find(".wdi_spinner").remove(),t=r.find(".wdi_js_error"),a=r.find(".wdi_token_error"),0!=i&&(void 0!==i.meta&&1==i.meta.error&&"OAuthException"===i.meta.error_type||void 0!==i.error&&"OAuthException"===i.error.type)?(r.find(".wdi_single_user").remove(),a.removeClass("wdi_hidden"),"1"!=wdi_front_messages.wdi_token_error_flag&&jQuery.ajax({type:"POST",url:wdi_url.ajax_url,dataType:"json",data:{action:"wdi_token_flag",wdi_token_flag_nonce:wdi_front_messages.wdi_token_flag_nonce},success:function(e){}})):void 0!==i.error&&void 0!==i.error.message&&(t.html(i.error.message),r.find(".wdi_single_user").remove(),t.removeClass("wdi_js_error"),t.addClass("wdi_js_error_no_animate"),jQuery(".wdi_js_error_no_animate").show()),wdi_front_messages.show_alerts||console.log("%c"+e,"color:#cc0000;")),wdi_error_show=!0},wdi_front.globalInit=function(){var e=wdi_front.feed_counter,i=0;void 0!==wdi_ajax.ajax_response&&(i=wdi_feed_counter_init.wdi_feed_counter_init);for(var r,t=i;t<=e;t++)0!==jQuery("#wdi_feed_"+t).length&&((r=new WDIFeed(window["wdi_feed_"+t])).instagram=new WDIInstagram,r.instagram.filterArguments={feed:r},r.instagram.addToken(r.feed_row.access_token),wdi_front.access_token=r.feed_row.access_token,r.dataStorageRaw=[],r.dataStorage=[],r.dataStorageList=[],r.allResponseLength=0,r.currentResponseLength=0,r.temproraryUsersData=[],r.removedUsers=0,r.nowLoadingImages=!0,r.imageIndex=0,r.resIndex=0,r.currentPage=1,r.currentPageLoadMore=0,r.userSortFlags=[],r.customFilterChanged=!1,r.maxConditionalFiltersRequestCount=10,r.instagramRequestCounter=0,r.mediaRequestsDone=!1,r.conditionalFilterBuffer=[],r.stopInfiniteScrollFlag=!1,"masonry"==r.feed_row.feed_type&&(r.displayedData=[]),"pagination"==r.feed_row.feed_display_view?(r.feed_row.resort_after_load_more=0,"image_browser"!=r.feed_row.feed_type?(r.feed_row.load_more_number=parseInt(r.feed_row.pagination_per_page_number),r.feed_row.number_of_photos=(1+parseInt(r.feed_row.pagination_preload_number))*r.feed_row.load_more_number):(r.feed_row.number_of_photos=1+parseInt(r.feed_row.image_browser_preload_number),r.feed_row.load_more_number=parseInt(r.feed_row.image_browser_load_number)),r.freeSpaces=(Math.floor(r.feed_row.pagination_per_page_number/r.feed_row.number_of_columns)+1)*r.feed_row.number_of_columns-r.feed_row.pagination_per_page_number):r.freeSpaces=0,r.galleryBox=function(e){wdi_spider_createpopup(wdi_url.ajax_url+"?gallery_id="+this.feed_row.id+"&image_id="+e,this.feed_row.wdi_feed_counter,this.feed_row.lightbox_width,this.feed_row.lightbox_height,1,"testpopup",5,this,e)},wdi_responsive.columnControl(r),"masonry"==r.feed_row.feed_type&&jQuery(window).trigger("resize"),wdi_front.bindEvents(r),window["wdi_feed_"+t]=r,wdi_front.init(r))},wdi_front.init=function(e){if(jQuery(".wdi_js_error").hide(),e.photoCounter=e.feed_row.number_of_photos,"liked"==e.feed_row.liked_feed)e.feed_users=["self"];else{if(!wdi_front.isJsonString(e.feed_row.feed_users))return void wdi_front.show_alert(wdi_front_messages.invalid_users_format,!1,e);e.feed_users=JSON.parse(e.feed_row.feed_users)}var i=[],r=[],t=[];void 0!==window.wdi_all_tags&&(i=window.wdi_all_tags);for(var a=0;a<e.feed_users.length;a++)"#"===e.feed_users[a].username[0]&&void 0!==e.feed_users[a].tag_id?(i[e.feed_users[a].tag_id]=e.feed_users[a],t[a]=e.feed_users[a]):r[0]=e.feed_users[a];window.wdi_all_tags=i,e.feed_users=void 0===t||wdi_front.isEmpty(t)?r:t;var d=wdi_front.getFeedItemResolution(e);e.feedImageResolution=d.image,e.feedVideoResolution=d.video,e.dataCount=e.feed_users.length;for(var o=0;o<e.dataCount;o++)wdi_front.instagramRequest(o,e);0<e.feed_row.number_of_photos&&wdi_front.ajaxLoader(e),"1"===e.feed_row.display_header&&wdi_front.show("header",e),"1"===e.feed_row.show_usernames&&wdi_front.show("users",e)},wdi_front.getFeedItemResolution=function(e){var i={image:"standard_resolution",video:"standard_resolution"};if("thumbnail"===e.feed_row.feed_resolution)return{image:"thumbnail",video:"low_bandwidth"};if("low"===e.feed_row.feed_resolution)return{image:"low_resolution",video:"low_resolution"};if("standard"===e.feed_row.feed_resolution)return{image:"standard_resolution",video:"standard_resolution"};var r=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter).find(".wdi_feed_wrapper");r.append('<div class="wdi_feed_item" id="wdi_feed_item_example"></div>'),wdi_responsive.columnControl(e,1);e=r.attr("wdi-res").split("wdi_col_");if(r.find("#wdi_feed_item_example").remove(),2!==e.length)return i;e=parseInt(e[1]);if(e<=0)return i;e=r.width()/e-10;return e<=150?(i.image="thumbnail",i.video="low_bandwidth"):150<e&&e<=320?(i.image="low_resolution",i.video="low_resolution"):(i.image="standard_resolution",i.video="standard_resolution"),i},wdi_front.isJsonString=function(e){try{JSON.parse(e)}catch(e){return!1}return!0},wdi_front.instagramRequest=function(i,r){var t=this,e=r.feed_users;"string"==typeof e[i]&&"self"===e[i]?r.instagram.getRecentLikedMedia({success:function(e){void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,r),r.mediaRequestsDone=!0,0!=(e=t.checkMediaResponse(e,r))&&t.saveSelfUserData(e,r)}}):"hashtag"==this.getInputType(e[i].username)?r.instagram.getTagRecentMedia(this.stripHashtag(e[i].username),{success:function(e){if(void 0!==e.error&&"undefined"!=e.error.type||void 0!==e.meta&&1==e.meta.error)return wdi_front.show_alert(!1,e,r),!1;r.mediaRequestsDone=!0,0!=(e=t.checkMediaResponse(e,r))&&t.saveUserData(e,r.feed_users[i],r)}},null,r.feed_row.hashtag_top_recent):"user"==this.getInputType(e[i].username)&&r.instagram.getUserMedia({user_id:e[i].id,success:function(e){if(void 0!==e.meta&&1==typeof e.meta.error)return wdi_front.show_alert(!1,e,r),!1;r.mediaRequestsDone=!0,0!=(e=t.checkMediaResponse(e,r))&&t.saveUserData(e,r.feed_users[i],r)}})},wdi_front.isHashtag=function(e){return"#"===e[0]},wdi_front.saveUserData=function(e,i,r){e.user_id=i.id,e.username=i.username,"#"===e.user_id[0]&&(e.data=wdi_front.appendRequestHashtag(e.data,e.user_id)),r.usersData.push(e),r.currentResponseLength=wdi_front.getArrayContentLength(r.usersData,"data"),r.allResponseLength+=r.currentResponseLength,r.dataCount==r.usersData.length&&(r.currentResponseLength<r.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(r)?wdi_front.loadMore("initial-keep",r):(wdi_front.displayFeed(r),wdi_front.applyFilters(r),wdi_front.activeUsersCount(r)||"load_more_btn"==r.feed_row.feed_display_view&&((r=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter)).find(".wdi_load_more").addClass("wdi_hidden"),r.find(".wdi_spinner").addClass("wdi_hidden"))))},wdi_front.saveSelfUserData=function(e,i){e.user_id="",e.username="",i.usersData.push(e),i.currentResponseLength=wdi_front.getArrayContentLength(i.usersData,"data"),i.allResponseLength+=i.currentResponseLength,i.dataCount==i.usersData.length&&(i.currentResponseLength<i.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(i)?wdi_front.loadMore("initial-keep",i):(wdi_front.displayFeed(i),wdi_front.applyFilters(i),wdi_front.activeUsersCount(i)||"load_more_btn"==i.feed_row.feed_display_view&&((i=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter)).find(".wdi_load_more").addClass("wdi_hidden"),i.find(".wdi_spinner").addClass("wdi_hidden"))))},wdi_front.userHasNoPhoto=function(e,i){var r=0,t=e.usersData;void 0!==i&&(t=i);for(var a=0;a<t.length;a++)void 0===t[a].pagination&&(t[a].pagination=[]),"liked"===e.feed_row.liked_feed?void 0===t[a].pagination.next_max_like_id&&r++:void 0===t[a].pagination.next_max_id&&r++;return r==t.length?1:0},wdi_front.appendRequestHashtag=function(e,i){for(var r=0;r<e.length;r++)e[r].wdi_hashtag=i;return e},wdi_front.displayFeed=function(e,i){0==e.customFilterChanged&&(r=wdi_front.feedSort(e,i));var r,i=e.customFilterChanged;1==e.customFilterChanged&&(r=e.customFilteredData,e.parsedData=wdi_front.parseLighboxData(e,!0)),"1"!=e.feed_row.resort_after_load_more?0==e.customFilterChanged&&(e.dataStorageList=e.dataStorageList.concat(r)):0==e.customFilterChanged&&(e.dataStorageList=r),"masonry"==e.feed_row.feed_type&&wdi_front.masonryDisplayFeedItems(r,e),"thumbnails"!=e.feed_row.feed_type&&"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||wdi_front.displayFeedItems(r,e),wdi_front.getDataLength(e)<parseInt(e.feed_row.number_of_photos)+parseInt(e.feed_row.load_more_number*e.currentPageLoadMore)&&!i&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount&&!wdi_front.allDataHasFinished(e)?wdi_front.loadMore("",e):(e.currentPageLoadMore++,wdi_front.allImagesLoaded(e)),e.instagramRequestCounter>e.maxConditionalFiltersRequestCount&&(wdi_front.allImagesLoaded(e),0==r.length&&(e.stopInfiniteScrollFlag=!0)),"pagination"==e.feed_row.feed_display_view&&e.currentPage<e.paginator&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter).find("#wdi_last_page").removeClass("wdi_disabled"),e.instagramRequestCounter=0,e.conditionalFilterBuffer=[],wdi_front.updateUsersImages(e)},wdi_front.updateUsersImages=function(i){jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter).find(".wdi_single_user .wdi_user_img_wrap img").each(function(){if((jQuery(this).attr("src")==wdi_url.plugin_url+"images/missing.png"||""==jQuery(this).attr("src"))&&"liked"!=i.feed_row.liked_feed)for(var e=0;e<i.usersData.length;e++)i.usersData[e].username==jQuery(this).parent().parent().find("h3").text()&&0!=i.usersData[e].data.length&&jQuery(this).attr("src",i.usersData[e].data[0].images.thumbnail.url)})},wdi_front.masonryDisplayFeedItems=function(e,i){var r=[],t=[];if(0!=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length){jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_masonry_column").each(function(){1==i.feed_row.resort_after_load_more&&(jQuery(this).html(""),i.imageIndex=0),1==i.customFilterChanged&&(jQuery(this).html(""),i.imageIndex=0),"pagination"==i.feed_row.feed_display_view?r.push(0):r.push(jQuery(this).height()),t.push(jQuery(this))}),1==i.customFilterChanged&&(i.customFilterChanged=!1);for(var a,d,o,n=0;n<e.length;n++)"object"==typeof e[n].videos&&null==e[n].videos.standard_resolution||(i.displayedData.push(e[n]),a="",void 0!==e[n].wdi_hashtag&&(a=e[n].wdi_hashtag),d="image"==e[n].type?wdi_front.getPhotoTemplate(i,a):e[n].hasOwnProperty("videos")||"video"==e[n].type?wdi_front.getVideoTemplate(i,a):wdi_front.getSliderTemplate(i,a),o=e[n],a=d(wdi_front.createObject(o,i)),d=wdi_front.array_min(r),o=wdi_front.getImageResolution(e[n]),t[d.index].html(t[d.index].html()+a),r[d.index]+=t[d.index].width()*o,i.imageIndex++,"pagination"==i.feed_row.feed_display_view&&((n+1)%i.feed_row.pagination_per_page_number==0?i.resIndex+=i.freeSpaces+1:i.resIndex++));i.wdi_loadedImages=0;var s=!1;i.wdi_load_count=n;var _=i.feed_row.wdi_feed_counter;jQuery("#wdi_feed_"+_+" img.wdi_img").on("load",function(){i.wdi_loadedImages++,w(),!1===s&&(wdi_responsive.columnControl(i,1),s=!0)});w(),1==i.paginatorNextFlag&&wdi_front.updatePagination(i,"next"),i.infiniteScrollFlag=!1}function w(){i.wdi_load_count===i.wdi_loadedImages&&0!=i.wdi_loadedImages&&(i.loadedImages=0,i.wdi_load_count=0,wdi_front.allImagesLoaded(i))}},wdi_front.getImageResolution=function(e){var i=e.images.standard_resolution.width;return e.images.standard_resolution.height/i},wdi_front.getDataLength=function(e,i){var r=0;if(void 0===i)for(var t=0;t<e.dataStorage.length;t++)r+=e.dataStorage[t].length;else for(t=0;t<i.length;t++)r+=i[t].length;return r},wdi_front.getArrayContentLength=function(e,i){for(var r=0,t=0;t<e.length;t++)"finished"!=e[t].finished&&void 0===e[t].error&&(r+=e[t][i].length);return r},wdi_front.displayFeedItems=function(e,i){if(0!=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length){var r=i.feed_row.wdi_feed_counter,t=jQuery("#wdi_feed_"+r+" .wdi_feed_wrapper");"1"===i.feed_row.resort_after_load_more&&(t.html(""),i.imageIndex=0),1==i.customFilterChanged&&(t.html(""),i.imageIndex=0,i.customFilterChanged=!1);var a;wdi_front.getImgCount(i),e.length;"pagination"==i.feed_row.feed_display_view&&(a=i.feed_row.load_more_number,"image_browser"==i.feed_row.feed_type&&(a=1),(jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+' [wdi_page="'+(i.currentPage-1)+'"]').length<a||0==e.length)&&(i.currentPage=--i.currentPage<=1?1:i.currentPage));for(var d,o,n=0;n<e.length;n++){if(void 0===e[n])return;"object"==typeof e[n].videos&&null==e[n].videos.standard_resolution||(o="",void 0!==e[n].wdi_hashtag&&(o=e[n].wdi_hashtag),d="image"==e[n].type?wdi_front.getPhotoTemplate(i,o):e[n].hasOwnProperty("videos")?wdi_front.getVideoTemplate(i,o):wdi_front.getSliderTemplate(i,o),o=e[n],o=d(wdi_front.createObject(o,i)),t.html(t.html()+o),i.imageIndex++,"pagination"==i.feed_row.feed_display_view&&((n+1)%i.feed_row.pagination_per_page_number==0?i.resIndex+=i.freeSpaces+1:i.resIndex++))}i.wdi_loadedImages=0;var s=!1;i.wdi_load_count=n;r=i.feed_row.wdi_feed_counter,t=jQuery("#wdi_feed_"+r+" img.wdi_img").on("load",function(){i.wdi_loadedImages++,i.wdi_load_count===i.wdi_loadedImages&&0!=i.wdi_loadedImages&&(i.loadedImages=0,i.wdi_load_count=0,wdi_front.allImagesLoaded(i)),!1===s&&(wdi_responsive.columnControl(i,1),s=!0)});1==i.paginatorNextFlag&&wdi_front.updatePagination(i,"next"),i.infiniteScrollFlag=!1}},wdi_front.checkFeedFinished=function(e){for(var i=0;i<e.usersData.length;i++)if(void 0===e.usersData[i].finished)return!1;return!0},wdi_front.sortingOperator=function(e,i){var r;switch(e){case"date":switch(i){case"asc":r=function(e,i){return e.created_time>i.created_time?1:-1};break;case"desc":r=function(e,i){return e.created_time>i.created_time?-1:1}}break;case"likes":switch(i){case"asc":r=function(e,i){return e.likes.count<i.likes.count?-1:1};break;case"desc":r=function(e,i){return e.likes.count<i.likes.count?1:-1}}break;case"comments":switch(i){case"asc":r=function(e,i){return e.comments.count<i.comments.count?-1:1};break;case"desc":r=function(e,i){return e.comments.count<i.comments.count?1:-1}}break;case"random":r=function(e,i){return.5<Math.random()?1:-1}}return r},wdi_front.feedSort=function(e,i){var r=e.feed_row.sort_images_by,t=e.feed_row.display_order;"1"===e.feed_row.resort_after_load_more?e.data=e.data.concat(wdi_front.smartPicker(e,i)):e.data=wdi_front.smartPicker(e,i);t=wdi_front.sortingOperator(r,t);return e.data.sort(t),e.data},wdi_front.smartPicker=function(e,i){var r=[],t=0,a=[],d=parseInt(e.feed_row.number_of_photos),o=Math.ceil(d/e.usersData.length),n=0;""!=i&&void 0!==i&&null!=i&&(d=parseInt(i),o=Math.ceil(d/wdi_front.activeUsersCount(e)));e.storeRawData(e.usersData,"dataStorageRaw");for(var s,_=e.dataStorageRaw.sort(function(e,i){return e.length()>i.length()?1:-1}),w=e.usersData.sort(function(e,i){return e.data.length>i.data.length?1:-1}),l=0;l<w.length;l++)n+=o,_[l].length()<=n?(n-=_[l].length(),r.push(_[l].getData(_[l].length())),t+=r[r.length-1].length):(d<t+n&&(n=d-t),(!(s=[])===e.auto_trigger||s.length+wdi_front.getDataLength(e)+wdi_front.getDataLength(e,r)<e.feed_row.number_of_photos)&&(s=s.concat(_[l].getData(n))),n=0,t+=s.length,r.push(s));for(l=0;l<r.length;l++)void 0===e.dataStorage[l]?e.dataStorage.push(r[l]):e.dataStorage[l]=e.dataStorage[l].concat(r[l]);for(e.parsedData=wdi_front.parseLighboxData(e),l=0;l<r.length;l++)a=a.concat(r[l]);return a},wdi_front.createObject=function(e,i){var r=null!=e.caption?e.caption.text:"&nbsp";switch(e.type){case"image":var t=e.images[i.feedImageResolution].url,a=void 0,d="image";break;case"video":t=void 0,a=e.hasOwnProperty("videos")?e.videos[i.feedVideoResolution].url:wdi_url.plugin_url+"images/video_missing.png",d="video";break;case"carousel":switch(e.carousel_media[0].type){case"image":t=e.carousel_media[0].images[i.feedImageResolution].url,a=void 0,d="image";break;case"video":t=void 0,a=e.carousel_media[0].videos[i.feedVideoResolution].url,d="video";break;default:t=wdi_url.plugin_url+"images/missing.png",a=wdi_url.plugin_url+"images/video_missing.png",d="image"}break;default:t=wdi_url.plugin_url+"images/missing.png",a=wdi_url.plugin_url+"images/video_missing.png",d="image"}var o=i.imageIndex,n="square",s=e.images.standard_resolution.height,_=e.images.standard_resolution.width;_<s?n="portrait":s<_&&(n="landscape");_=e.user.username;return""===_&&(_="no_user"),{id:e.id,thumbType:d,caption:wdi_front.escape_tags(r),image_url:t,likes:e.likes.count,comments:e.comments.count,wdi_index:o,wdi_res_index:i.resIndex,wdi_media_user:_,link:e.link,video_url:a,wdi_username:_,wdi_shape:n}},wdi_front.setPage=function(e){var i=e.feed_row.feed_display_view,r=e.feed_row.feed_type;if("pagination"!=i)return"";i=e.imageIndex;return r="image_browser"==r?1:Math.abs(e.feed_row.pagination_per_page_number),e.paginator=Math.ceil((i+1)/r),e.paginator},wdi_front.getPhotoTemplate=function(e,i){var r=wdi_front.setPage(e),t="",a="",d="",o="",n="tenweb-i-arrows-out",s="";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(n=""),sourceAttr=(""!=r&&(a='wdi_page="'+r+'"'),"src"),""!=r&&1!=r&&(t="wdi_hidden"),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(s='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(t+=" wdi_full_caption");r="";switch("blog_style"!==e.feed_row.feed_type&&(r="masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":d="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":d="onclick=\"window.open ('<%= link%>','_blank')\"",o="wdi_hover_off",n="";break;case"custom_redirect":d="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",o="wdi_hover_off",n="";break;case"none":o="wdi_cursor_off wdi_hover_off",n=d=""}a='<div class="wdi_feed_item '+t+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+a+' wdi_type="image" id="wdi_'+e.feed_row.wdi_feed_counter+"_<%=id%>\"><div class=\"wdi_photo_wrap\"><div class=\"wdi_photo_wrap_inner\"><div class=\"wdi_photo_img <%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>\"><img class=\"wdi_img\" "+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+o+'" >'+s+'<div class="wdi_thumb_icon" '+d+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+n+'"></i></div></div></div></div></div></div>',s=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(a+='<div class="wdi_photo_meta">',"1"===e.feed_row.show_likes&&0!=e.dataStorageList[s].likes.count&&(a+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"1"===e.feed_row.show_comments&&0!=e.dataStorageList[s].comments.count&&(a+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),a+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(a+='<div class="wdi_photo_title" onclick='+r+" ><%=caption%></div>"),a+="</div>"),a+="</div>",_.template(a)},wdi_front.getSliderTemplate=function(e,i){var r=wdi_front.setPage(e),t="",a="",d="",o="",n="tenweb-i-clone",s="";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(n=""),sourceAttr=(""!=r&&(a='wdi_page="'+r+'"'),"src"),""!=r&&1!=r&&(t="wdi_hidden"),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(s='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(t+=" wdi_full_caption");r="";switch("blog_style"!==e.feed_row.feed_type&&(r="masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":d="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":d="onclick=\"window.open ('<%= link%>','_blank')\"",o="wdi_hover_off",n="tenweb-i-clone";break;case"custom_redirect":d="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",o="wdi_hover_off",n="";break;case"none":o="wdi_cursor_off wdi_hover_off",n=d=""}a='<div class="wdi_feed_item '+t+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+a+' wdi_type="slideshow" id="wdi_'+e.feed_row.wdi_feed_counter+"_<%=id%>\"><div class=\"wdi_photo_wrap\"><div class=\"wdi_photo_wrap_inner\"><div class=\"wdi_photo_img <%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>\"><% if (thumbType === 'video') { %><video class=\"wdi_img\" "+sourceAttr+'="<%=video_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"></video><% } else {%><img class="wdi_img" '+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><% }%><div class="wdi_photo_overlay '+o+'" >'+s+'<div class="wdi_thumb_icon" '+d+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+n+'"></i></div></div></div></div></div></div>',s=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(a+='<div class="wdi_photo_meta">',"1"===e.feed_row.show_likes&&0!=e.dataStorageList[s].likes.count&&(a+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"1"===e.feed_row.show_comments&&0!=e.dataStorageList[s].comments.count&&(a+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),a+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(a+='<div class="wdi_photo_title" onclick='+r+" ><%=caption%></div>"),a+="</div>"),a+="</div>",_.template(a)},wdi_front.replaceToVideo=function(e,i,r){overlayHtml="<video style='width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;' controls=''><source src='"+e+"' type='video/mp4'>Your browser does not support the video tag. </video>",jQuery("#wdi_feed_"+r+' [wdi_index="'+i+'"] .wdi_photo_wrap_inner').html(overlayHtml),jQuery("#wdi_feed_"+r+' [wdi_index="'+i+'"] .wdi_photo_wrap_inner video').get(0).play()},wdi_front.getVideoTemplate=function(e,i){var r=wdi_front.setPage(e),t="",a="",d="tenweb-i-play",o="",n="",s="",w=(""!=r&&(a='wdi_page="'+r+'"'),"src");""!=r&&1!=r&&(t="wdi_hidden"),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(s='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(t+=" wdi_full_caption");r="";switch("blog_style"!==e.feed_row.feed_type&&(r="masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":o="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":o="onclick=\"window.open ('<%= link%>','_blank')\"",n="wdi_hover_off",d="tenweb-i-play";break;case"custom_redirect":o="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",n="wdi_hover_off",d="";break;case"none":n="wdi_cursor_off wdi_hover_off",d="","blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(o="onclick=wdi_front.replaceToVideo('<%= video_url%>','<%= wdi_index%>',"+e.feed_row.wdi_feed_counter+")",n="",d="tenweb-i-play")}w='<div class="wdi_feed_item '+t+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+a+' wdi_type="image" id="wdi_'+e.feed_row.wdi_feed_counter+"_<%=id%>\"><div class=\"wdi_photo_wrap\"><div class=\"wdi_photo_wrap_inner\"><div class=\"wdi_photo_img <%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>\"><video class=\"wdi_img\" "+w+'="<%=video_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"></video><div class="wdi_photo_overlay '+n+'" '+o+">"+s+'<div class="wdi_thumb_icon" style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+d+'"></i></div></div></div></div></div></div>',s=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(w+='<div class="wdi_photo_meta">',"1"===e.feed_row.show_likes&&0!=e.dataStorageList[s].likes.count&&(w+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"1"===e.feed_row.show_comments&&0!=e.dataStorageList[s].comments.count&&(w+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),w+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(w+='<div class="wdi_photo_title" onclick='+r+" ><%=caption%></div>"),w+="</div>"),w+="</div>",_.template(w)},wdi_front.bindEvents=function(e){0!=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length&&("load_more_btn"==e.feed_row.feed_display_view&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_load_more_container").on(wdi_front.clickOrTouch,function(){wdi_front.loadMore(jQuery(this).find(".wdi_load_more_wrap"))}),"pagination"==e.feed_row.feed_display_view&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_next").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorNext(jQuery(this),e)}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_prev").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorPrev(jQuery(this),e)}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_last_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationLastPage(jQuery(this),e)}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_first_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationFirstPage(jQuery(this),e)}),e.paginatorNextFlag=!1),"infinite_scroll"==e.feed_row.feed_display_view&&(jQuery(window).on("scroll",function(){wdi_front.infiniteScroll(e)}),e.infiniteScrollFlag=!1))},wdi_front.infiniteScroll=function(e){jQuery(window).scrollTop()+jQuery(window).height()-100>=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_infinite_scroll").offset().top&&(!1===e.infiniteScrollFlag&&0==e.stopInfiniteScrollFlag?(e.infiniteScrollFlag=!0,wdi_front.loadMore(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_infinite_scroll"),e)):e.stopInfiniteScrollFlag&&wdi_front.allImagesLoaded(e))},wdi_front.paginationFirstPage=function(e,i){var r;1!=i.paginator&&1!=i.currentPage&&(r=i.currentPage,i.currentPage=1,wdi_front.updatePagination(i,"custom",r),e.parent().find("#wdi_last_page").removeClass("wdi_disabled")),e.addClass("wdi_disabled")},wdi_front.paginationLastPage=function(e,i){var r;1!=i.paginator&&i.currentPage!=i.paginator&&(r=i.currentPage,i.currentPage=i.paginator,wdi_front.updatePagination(i,"custom",r),e.addClass("wdi_disabled"),e.parent().find("#wdi_first_page").removeClass("wdi_disabled"))},wdi_front.paginatorNext=function(e,i){var r,t=e.parent().find("#wdi_last_page"),a=e.parent().find("#wdi_first_page");i.paginatorNextFlag=!0,i.paginator!=i.currentPage||wdi_front.checkFeedFinished(i)?i.paginator>i.currentPage&&(i.currentPage++,wdi_front.updatePagination(i,"next"),i.paginator>i.currentPage?t.removeClass("wdi_disabled"):t.addClass("wdi_disabled")):(i.currentPage++,r=i.feed_row.number_of_photos,wdi_front.loadMore(e,i,r),t.addClass("wdi_disabled")),a.removeClass("wdi_disabled")},wdi_front.paginatorPrev=function(e,i){var r=e.parent().find("#wdi_last_page"),e=e.parent().find("#wdi_first_page");1!=i.currentPage?(i.currentPage--,wdi_front.updatePagination(i,"prev"),r.removeClass("wdi_disabled"),1==i.currentPage&&e.addClass("wdi_disabled")):e.addClass("wdi_disabled")},wdi_front.updatePagination=function(e,i,r){var t="#wdi_feed_"+e.feed_row.wdi_feed_counter;switch(jQuery(t+' [wdi_page="'+e.currentPage+'"]').each(function(){jQuery(this).removeClass("wdi_hidden")}),i){case"next":var r=e.currentPage-1;jQuery(t+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(t+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"prev":r=e.currentPage+1;jQuery(t+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(t+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"custom":(r=r)!=e.currentPage&&(jQuery(t+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(t+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")}))}e.paginatorNextFlag=!1,jQuery(t+" .wdi_feed_wrapper").css("height","auto"),jQuery(t+" #wdi_current_page").text(e.currentPage)},wdi_front.loadMore=function(e,i){var r,t=0;""!=e&&void 0!==e&&"initial"!=e&&"initial-keep"!=e&&(r=window[e.parent().parent().parent().parent().attr("id")]),void 0!==i&&(r=i);for(var a=0,d=0,o=0;o<r.userSortFlags.length;o++)if(!0===r.userSortFlags[o].flag){a++;for(var n=0;n<r.usersData.length;n++)r.userSortFlags[o].id===r.usersData[n].user_id&&"finished"===r.usersData[n].finished&&d++}if(a!==d||0==a){r.auto_trigger=""===e,wdi_front.ajaxLoader(r),"masonry"===r.feed_row.feed_type&&"pagination"==r.feed_row.feed_display_view&&jQuery("#wdi_feed_"+wdi_front.feed_counter+" .wdi_full_caption").each(function(){jQuery(this).find(".wdi_photo_title").trigger(wdi_front.clickOrTouch)});for(o=0;o<r.usersData.length;o++)"finished"===r.usersData[o].finished&&t++;t===r.usersData.length&&(wdi_front.allImagesLoaded(r),jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter+" .wdi_load_more").remove());var s=r.usersData;r.loadMoreDataCount=r.feed_users.length;for(o=0;o<s.length;o++){var _=s[o].pagination,w={user_id:s[o].user_id,username:s[o].username};""!=_.next_url&&null!=_.next_url&&void 0!==_.next_url?(_=_.next_url,wdi_front.loadMoreRequest(w,_,r,e)):("initial-keep"==e&&(r.temproraryUsersData[o]=r.usersData[o]),1<r.loadMoreDataCount&&r.loadMoreDataCount--,wdi_front.checkForLoadMoreDone(r,e))}}},wdi_front.loadMoreRequest=function(r,e,t,a){var d,i;t.mediaRequestsDone&&(t.usersData,d="",i=function(e){if(""===e||void 0===e||null==e)return d=wdi_front_messages.network_error,t.loadMoreDataCount--,void wdi_front.show_alert(d,e,t);if(void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,t),void 0!==e.meta&&void 0!==e.meta.code&&200!=e.meta.code)return d=e.meta.error_message,t.loadMoreDataCount--,void wdi_front.show_alert(d,e,t);e.user_id=r.user_id,e.username=r.username;for(var i=0;i<t.usersData.length;i++)e.user_id===t.usersData[i].user_id&&("#"===e.user_id[0]&&(e.data=wdi_front.appendRequestHashtag(e.data,e.user_id)),"initial-keep"==a&&(t.temproraryUsersData[i]=t.usersData[i]),t.usersData[i]=e,void 0===t.dataStorageRaw[i]?t.dataStorageRaw[i]={data:e.data}:t.dataStorageRaw[i].data=t.dataStorageRaw[i].data.concat(e.data),t.loadMoreDataCount--);wdi_front.checkForLoadMoreDone(t,a)},"#"!==r.username[0]?t.instagram.getUserMedia({user_id:r.username[0].id,success:i},e):t.instagram.getTagRecentMedia(r.username,{success:i},e,t.feed_row.hashtag_top_recent))},wdi_front.checkForLoadMoreDone=function(e,i){var r,t=e.feed_row.load_more_number,a=e.feed_row.number_of_photos;0==e.loadMoreDataCount&&(e.temproraryUsersData=wdi_front.mergeData(e.temproraryUsersData,e.usersData),r=wdi_front.getArrayContentLength(e.temproraryUsersData,"data"),"initial-keep"==i&&(i="initial"),"initial"==i?r<a&&!wdi_front.userHasNoPhoto(e,e.temproraryUsersData)&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount?wdi_front.loadMore("initial",e):(e.usersData=e.temproraryUsersData,wdi_front.displayFeed(e),wdi_front.applyFilters(e),e.temproraryUsersData=[]):r<t&&!wdi_front.userHasNoPhoto(e,e.temproraryUsersData)&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount?wdi_front.loadMore(void 0,e):(e.usersData=e.temproraryUsersData,wdi_front.activeUsersCount(e)&&(wdi_front.displayFeed(e,t),wdi_front.applyFilters(e),e.temproraryUsersData=[])))},wdi_front.allDataHasFinished=function(e){for(var i=0,r=0;r<e.dataStorageRaw.length;r++)""==e.usersData[r].pagination.next_url&&(i++,e.usersData[r].finished="finished");return i==e.dataStorageRaw.length&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_load_more").remove(),!0)},wdi_front.mergeData=function(e,i){for(var r=0;r<i.length;r++)void 0!==e[r]?"finished"!=i[r].finished&&(void 0===e[r].pagination.next_max_id&&void 0===e[r].pagination.next_max_like_id||(e[r].data=e[r].data.concat(i[r].data),e[r].pagination=i[r].pagination,e[r].user_id=i[r].user_id,e[r].username=i[r].username,e[r].meta=i[r].meta)):e.push(i[r]);return e},wdi_front.brokenImageHandler=function(e){return!0},wdi_front.ajaxLoader=function(e){var i,r=e.feed_row.wdi_feed_counter,r=jQuery("#wdi_feed_"+r);"load_more_btn"==e.feed_row.feed_display_view&&(r.find(".wdi_load_more").addClass("wdi_hidden"),r.find(".wdi_spinner").removeClass("wdi_hidden")),"infinite_scroll"==e.feed_row.feed_display_view&&(0==r.find(".wdi_ajax_loading").length?(i=jQuery('<div class="wdi_ajax_loading"><div><div><img class="wdi_load_more_spinner" src="'+wdi_url.plugin_url+'images/ajax_loader.png"></div></div></div>'),r.append(i)):i=r.find(".wdi_ajax_loading"),i.removeClass("wdi_hidden"))},wdi_front.allImagesLoaded=function(e){var i=wdi_front.getDataLength(e);e.mediaRequestsDone||jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").remove("wdi_nomedia"),0!=i||!e.mediaRequestsDone||0!=e.feed_row.conditional_filters.length&&0!=e.feed_row.conditional_filter_enable||jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").append("<p class='wdi_nomedia'>"+wdi_front_messages.feed_nomedia+"</p>");i=e.feed_row.wdi_feed_counter,i=jQuery("#wdi_feed_"+i);"load_more_btn"==e.feed_row.feed_display_view&&(i.find(".wdi_load_more").removeClass("wdi_hidden"),i.find(".wdi_spinner").addClass("wdi_hidden")),"infinite_scroll"==e.feed_row.feed_display_view&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_ajax_loading").addClass("wdi_hidden")},wdi_front.show=function(e,i){var r,t,a=i.feed_row.wdi_feed_counter,d=jQuery("#wdi_feed_"+a+" .wdi_feed_container");"header"===e&&(r={feed_thumb:i.feed_row.feed_thumb,feed_name:i.feed_row.feed_name},t=wdi_front.getHeaderTemplate()(r),r=d.find(".wdi_feed_header").html(),d.find(".wdi_feed_header").html(r+t))},wdi_front.getUserTemplate=function(e,i){var r=e.dataCount,t="#"===i[0]?"//instagram.com/explore/tags/"+i.substr(1,i.length):"//instagram.com/"+i,a="onclick='"+('window.open("'+t+'","_blank")')+"'",t='<div class="wdi_single_user" user_index="<%=user_index%>"><div class="wdi_header_user_text <%=hashtagClass%>"><div class="wdi_user_img_wrap"><img onerror="wdi_front.brokenImageHandler(this);" src="<%= user_img_url%>">';return 1<r&&(t+='<div title="'+wdi_front_messages.filter_title+'" class="wdi_filter_overlay"><div class="wdi_filter_icon"><span onclick="wdi_front.addFilter(<%=user_index%>,<%=feed_counter%>);" class="tenweb-i tenweb-i-filter"></span></div></div>'),t+="</div>",t+="<h3 "+a+"><%= user_name%></h3>","#"!==i[0]?("1"==e.feed_row.follow_on_instagram_btn&&(t+='<div class="wdi_user_controls"><div class="wdi_follow_btn" onclick="window.open(\'//instagram.com/<%= user_name%>\',\'_blank\')"><span> '+wdi_front_messages.follow+"</span></div></div>"),t+='<div class="wdi_media_info"><p class="wdi_posts"><span class="tenweb-i tenweb-i-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span class="tenweb-i tenweb-i-user"></span><%= counts.followed_by%></p></div>'):t+='<div class="wdi_user_controls"></div><div class="wdi_media_info"><p class="wdi_posts"><span class="tenweb-i tenweb-i-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span></span></p></div>',t+='<div class="wdi_clear"></div>',1==r&&"#"!==i[0]&&"1"==e.feed_row.display_user_info&&(t+='<div class="wdi_bio"><%= bio%></div>',t+='<div class="wdi_website"><a target="_blank" href="<%= website_url%>" ><%= website%></a></div>'),t+="</div></div>",_.template(t)},wdi_front.getHeaderTemplate=function(){return _.template('<div class="wdi_header_wrapper"><div class="wdi_header_img_wrap"><img src="<%=feed_thumb%>"></div><div class="wdi_header_text"><%=feed_name%></div><div class="wdi_clear"></div>')},wdi_front.addFilter=function(e,i){var r=window["wdi_feed_"+i],i=r.dataCount;if(!(i<2)&&0==r.nowLoadingImages){i=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter+'_users [user_index="'+e+'"]');i.find(".wdi_filter_overlay").toggleClass("wdi_filter_active_bg"),i.find(".wdi_header_user_text h3").toggleClass("wdi_filter_active_col"),i.find(".wdi_media_info").toggleClass("wdi_filter_active_col"),i.find(".wdi_follow_btn").toggleClass("wdi_filter_active_col"),r.customFilterChanged=!0,0==r.userSortFlags[e].flag?r.userSortFlags[e].flag=!0:r.userSortFlags[e].flag=!1;for(var t=0,a=0;a<r.userSortFlags.length;a++)1==r.userSortFlags[a].flag&&t++;"pagination"==r.feed_row.feed_display_view&&(r.resIndex=0),0!=t?wdi_front.filterData(r):r.customFilteredData=r.dataStorageList,wdi_front.displayFeed(r),"pagination"==r.feed_row.feed_display_view&&(r.paginator=Math.ceil(r.imageIndex/parseInt(r.feed_row.pagination_per_page_number)),r.currentPage=r.paginator,wdi_front.updatePagination(r,"custom",1),jQuery("#wdi_first_page").removeClass("wdi_disabled"),jQuery("#wdi_last_page").addClass("wdi_disabled"))}},wdi_front.filterData=function(e){var i=e.userSortFlags;e.customFilteredData=[];for(var r=0;r<e.dataStorageList.length;r++)for(var t=0;t<i.length;t++)(void 0!==e.dataStorageList[r].user.id&&e.dataStorageList[r].user.id==i[t].id||e.dataStorageList[r].wdi_hashtag==i[t].name)&&1==i[t].flag&&e.customFilteredData.push(e.dataStorageList[r])},wdi_front.applyFilters=function(e){for(var i=0;i<e.userSortFlags.length;i++)1==e.userSortFlags[i].flag&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+'[user_index="'+i+'"]'),wdi_front.addFilter(i,e.feed_row.wdi_feed_counter),wdi_front.addFilter(i,e.feed_row.wdi_feed_counter))},wdi_front.getImgCount=function(e){for(var i=e.dataStorage,r=0,t=0;t<i.length;t++)r+=i[t].length;return r},wdi_front.parseLighboxData=function(e,i){var r,t,a,d=e.dataStorage,o=e.feed_row.sort_images_by,n=e.feed_row.display_order,n=wdi_front.sortingOperator(o,n),s=[],_=[];if(1==i)s=e.customFilteredData;else{for(var w=0;w<d.length;w++)for(var l=0;l<d[w].length;l++)s.push(d[w][l]);s.sort(n)}for(w=0;w<s.length;w++)void 0!==s[w]&&(t=void 0!==s[w]&&void 0!==s[w].media_url?s[w].media_url:wdi_url.plugin_url+"images/video_missing.png",void 0!==s[w]&&void 0===s[w].media_url&&"carousel"===s[w].type&&(void 0!==(a=s[w].carousel_media[0])&&void 0!==a.images?t=a.images.standard_resolution.url:void 0!==a&&void 0!==a.videos&&(t=a.videos.standard_resolution.url)),void(a=0)!==s[w]&&void 0!==s[w].comments&&(a=s[w].comments.count),r={alt:"",avg_rating:"",comment_count:a,date:wdi_front.convertUnixDate(s[w].created_time),description:wdi_front.getDescription(void 0!==s[w].caption&&null!==s[w].caption?wdi_front.escape_tags(s[w].caption.text):""),filename:wdi_front.getFileName(s[w]),filetype:wdi_front.getFileType(s[w]),hit_count:"0",id:s[w].id,image_url:s[w].link,number:0,rate:"",rate_count:"0",username:void 0!==s[w].user?s[w].user.username:"",profile_picture:void 0!==s[w].user?s[w].user.profile_picture:"",thumb_url:t,comments_data:void 0!==s[w].comments?s[w].comments.data:"",images:s[w].images,carousel_media:void 0!==s[w].carousel_media?s[w].carousel_media:null},_.push(r));return _},wdi_front.convertUnixDate=function(e){var i=new Date(e).getTime()/1e3,e=new Date(0);e.setUTCSeconds(i);i=e.getFullYear()+"-"+(e.getMonth()+1)+"-"+e.getDate();return i+=" "+e.getHours()+":"+e.getMinutes()},wdi_front.getDescription=function(e){return e=e.replace(/\r?\n|\r/g," ")},wdi_front.getFileName=function(e){if(void 0!==e){var i=e.link;if("video"===e.type&&e.hasOwnProperty("videos")&&null!=e.videos.standard_resolution)return e.videos.standard_resolution.url;if(void 0===i)return"";i=i.split("/");return i[i.length-2]}},wdi_front.getFileType=function(e){return"video"==e.type&&e.hasOwnProperty("videos")?"EMBED_OEMBED_INSTAGRAM_VIDEO":"carousel"==e.type&&e.hasOwnProperty("carousel_media")?"EMBED_OEMBED_INSTAGRAM_CAROUSEL":"EMBED_OEMBED_INSTAGRAM_IMAGE"},wdi_front.array_max=function(e){for(var i=e[0],r=0,t=1;t<e.length;t++)i<e[t]&&(i=e[t],r=t);return{value:i,index:r}},wdi_front.array_min=function(e){for(var i=e[0],r=0,t=1;t<e.length;t++)i>e[t]&&(i=e[t],r=t);return{value:i,index:r}},wdi_front.activeUsersCount=function(e){for(var i=0,r=0;r<e.usersData.length;r++)"finished"!=e.usersData[r].finished&&i++;return i},wdi_front.checkMediaResponse=function(e,i){return""==e||void 0===e||null==e||void 0!==e.error?(errorMessage=wdi_front_messages.connection_error,wdi_front.show_alert(errorMessage,e,i),!1):""!=e&&void 0!==e&&null!=e&&200!=e.meta.code?(errorMessage=e.meta.error_message,wdi_front.show_alert(errorMessage,e,i),!1):e},wdi_front.stripHashtag=function(e){return"#"!==e[0]?e:e.substr(1,e.length)},wdi_front.getInputType=function(e){switch(e[0]){case"#":return"hashtag";case"%":return"location";default:return"user"}},wdi_front.regexpTestCaption=function(e,i){var r=!1,t=!1,a=i.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&"),i=new RegExp("(?:^|\\s)"+a+"(?:^|\\s)"),d=new RegExp("(?:^|\\s)"+a,"g");for(null!=i.exec(e)&&(r=!0);null!=(match=d.exec(e));)t=!0;return 1==r||1==t},wdi_front.replaceNewLines=function(e){var i,r="vUkCJvN2ps3t",t=[];for(e=e.replace(/\r?\n|\r/g,r),i=new RegExp(r,"g");null!=(match=i.exec(e));)t.push(match.index);for(var a=e.split(r),d=0,o=0;o<a.length;o++)""==a[o]?d++:d=0,0<d&&(a.splice(o,1),d--,o--);return e=a.join(" ")},wdi_front.isEmptyObject=function(e){for(var i in e)if(e.hasOwnProperty(i))return!1;return!0},wdi_front.isEmpty=function(e){return!e||0===e.length};var WDIFeed=function(e){this.data=e.data,this.dataCount=e.dataCount,this.feed_row=e.feed_row,this.usersData=e.usersData,(_this=this).set_images_loading_flag=function(e){window.addEventListener("load",function(){e.nowLoadingImages=!1})},this.set_images_loading_flag(_this)};function wdi_extractHostname(e){return void 0===e||""===e?"":e.replace(/(^\w+:|^)\/\//,"")}WDIFeed.prototype.mediaExists=function(e,i){for(var r=0;r<i.length;r++)if(e.id==i[r].id)return!0;return!1},WDIFeed.prototype.getIdFromUrl=function(e){for(var i=e.split("/"),r=!1,t=0;t<i.length;t++)if("p"==i[t]&&void 0!==i[t+1]){r=i[t+1];break}return r},WDIFeed.prototype.avoidDuplicateMedia=function(e){var i=e.data,r=[];void 0===i&&(i=[]);for(var t=0;t<i.length;t++)this.mediaExists(i[t],this.dataStorageList)||this.mediaExists(i[t],r)||this.mediaExists(i[t],this.conditionalFilterBuffer)||r.push(i[t]);return this.conditionalFilterBuffer=this.conditionalFilterBuffer.concat(r),{data:r,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.storeRawData=function(e,i){var t=this;if("object"==typeof this[i]&&"number"==typeof this[i].length)for(var r=0;r<e.length;r++){var a="";wdi_front.isHashtag(e[r].user_id)?void 0!==e[r].pagination.cursors&&(a=e[r].pagination.cursors.after):"liked"==t.feed_row.liked_feed?void 0===(a=e[r].pagination.next_max_like_id)&&(a=""):(null==e[r].pagination&&(e[r].pagination=[]),void 0===(a=e[r].pagination.next_max_id)&&(a="")),void 0===this[i][r]?this[i].push({data:e[r].data,index:0,locked:!1,hash_id:a,usersDataFinished:!1,userId:e[r].user_id,length:function(){return this.data.length-this.index},getData:function(e){var i=this.data.slice(this.index,this.index+e);if(this.index+=Math.min(e,this.length()),this.index==this.data.length&&1==this.locked&&0==this.usersDataFinished)for(var r=0;r<t.usersData.length;r++)if(t.usersData[r].user_id==this.userId){this.usersDataFinished=!0;break}return i}}):0==this[i][r].locked&&(a!=this[i][r].hash_id?(this[i][r].data=this[i][r].data.concat(e[r].data),this[i][r].hash_id=a):this[i][r].locked=!0)}},wdi_front.updateUsersIfNecessary=function(o){for(var n=o.feed_users,e=!1,i=0;i<n.length;i++)"#"!=n[i].username.substr(0,1)?""!=n[i].id&&"username"!=n[i].id||(e=!0,o.instagram.searchForUsersByName(n[i].username,{success:function(e){if(void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,o),200==e.meta.code&&0<e.data.length){for(var i=!1,r=0;r<e.data.length;r++)if(e.data[r].username==e.args.username){i=!0;break}if(i)for(var t=0;t<n.length;t++)e.data[r].username==n[t].username&&(n[t].id=e.data[r].id)}for(var a=!1,d=0;d<n.length;d++)if(""==n[d].id||"username"==n[d].id){a=!0;break}a||(o.feed_row.feed_users=JSON.stringify(n),wdi_front.init(o))},username:n[i].username})):n[i].id=n[i].username;return e},void 0!==wdi_ajax.ajax_response?jQuery(document).one("ajaxStop",function(){"not_declared"!=wdi_front.type&&(wdi_front.clickOrTouch=wdi_front.detectEvent(),wdi_front.globalInit())}):jQuery(document).ready(function(){"not_declared"!=wdi_front.type&&(wdi_front.clickOrTouch=wdi_front.detectEvent(),wdi_front.globalInit())}),jQuery(document).ready(function(){setTimeout(function(){"1"===wdi_front_messages.show_alerts&&"I"!==jQuery(".wdi_check_fontawesome .tenweb-i-instagram").prop("tagName")&&console.log("Font Awesome is not loaded properly. Please ask for support https://wordpress.org/support/plugin/wd-instagram-feed/")},2e3)});
1
+ "undefined"==typeof wdi_front&&(wdi_front={type:"not_declared"});var wdi_error_show=!(wdi_front.detectEvent=function(){var e="click";return/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())&&(e="touchend"),e}),wdi_error_init=!1;function wdi_baseName(e){var i=e.substr(e.lastIndexOf("/"));return e.replace(i,"")}wdi_front.escape_tags=function(e){return void 0===e&&(e=""),e=e.toString().replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#39;").replace(/"/g,"&#34;")},wdi_front.show_alert=function(e,i,r){var t,d;void 0!==(r=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter))&&(wdi_error_show=!0,r.find(".wdi_spinner").remove(),t=r.find(".wdi_js_error"),d=r.find(".wdi_token_error"),0!=i&&(void 0!==i.meta&&1==i.meta.error&&"OAuthException"===i.meta.error_type||void 0!==i.error&&"OAuthException"===i.error.type)?(r.find(".wdi_single_user").remove(),d.removeClass("wdi_hidden"),"1"!=wdi_front_messages.wdi_token_error_flag&&jQuery.ajax({type:"POST",url:wdi_url.ajax_url,dataType:"json",data:{action:"wdi_token_flag",wdi_token_flag_nonce:wdi_front_messages.wdi_token_flag_nonce},success:function(e){}})):void 0!==i.error&&void 0!==i.error.message&&(t.html(i.error.message),r.find(".wdi_single_user").remove(),t.removeClass("wdi_js_error"),t.addClass("wdi_js_error_no_animate"),jQuery(".wdi_js_error_no_animate").show()),wdi_front_messages.show_alerts||console.log("%c"+e,"color:#cc0000;")),wdi_error_show=!0},wdi_front.globalInit=function(){var e=wdi_front.feed_counter,i=0;void 0!==wdi_ajax.ajax_response&&(i=wdi_feed_counter_init.wdi_feed_counter_init);for(var r,t=i;t<=e;t++)0!==jQuery("#wdi_feed_"+t).length&&((r=new WDIFeed(window["wdi_feed_"+t])).instagram=new WDIInstagram,r.instagram.filterArguments={feed:r},r.instagram.addToken(r.feed_row.access_token),wdi_front.access_token=r.feed_row.access_token,r.dataStorageRaw=[],r.dataStorage=[],r.dataStorageList=[],r.allResponseLength=0,r.currentResponseLength=0,r.temproraryUsersData=[],r.removedUsers=0,r.nowLoadingImages=!0,r.imageIndex=0,r.resIndex=0,r.currentPage=1,r.currentPageLoadMore=0,r.userSortFlags=[],r.customFilterChanged=!1,r.maxConditionalFiltersRequestCount=10,r.instagramRequestCounter=0,r.mediaRequestsDone=!1,r.conditionalFilterBuffer=[],r.stopInfiniteScrollFlag=!1,"masonry"==r.feed_row.feed_type&&(r.displayedData=[]),"pagination"==r.feed_row.feed_display_view?(r.feed_row.resort_after_load_more=0,"image_browser"!=r.feed_row.feed_type?(r.feed_row.load_more_number=parseInt(r.feed_row.pagination_per_page_number),r.feed_row.number_of_photos=(1+parseInt(r.feed_row.pagination_preload_number))*r.feed_row.load_more_number):(r.feed_row.number_of_photos=1+parseInt(r.feed_row.image_browser_preload_number),r.feed_row.load_more_number=parseInt(r.feed_row.image_browser_load_number)),r.freeSpaces=(Math.floor(r.feed_row.pagination_per_page_number/r.feed_row.number_of_columns)+1)*r.feed_row.number_of_columns-r.feed_row.pagination_per_page_number):r.freeSpaces=0,r.galleryBox=function(e){wdi_spider_createpopup(wdi_url.ajax_url+"?gallery_id="+this.feed_row.id+"&image_id="+e,this.feed_row.wdi_feed_counter,this.feed_row.lightbox_width,this.feed_row.lightbox_height,1,"testpopup",5,this,e)},wdi_responsive.columnControl(r),"masonry"==r.feed_row.feed_type&&jQuery(window).trigger("resize"),wdi_front.bindEvents(r),window["wdi_feed_"+t]=r,wdi_front.init(r))},wdi_front.init=function(e){if(jQuery(".wdi_js_error").hide(),e.photoCounter=e.feed_row.number_of_photos,"liked"==e.feed_row.liked_feed)e.feed_users=["self"];else{if(!wdi_front.isJsonString(e.feed_row.feed_users))return void wdi_front.show_alert(wdi_front_messages.invalid_users_format,!1,e);e.feed_users=JSON.parse(e.feed_row.feed_users)}var i=[],r=[],t=[];void 0!==window.wdi_all_tags&&(i=window.wdi_all_tags);for(var d=0;d<e.feed_users.length;d++)"#"===e.feed_users[d].username[0]&&void 0!==e.feed_users[d].tag_id?(i[e.feed_users[d].tag_id]=e.feed_users[d],t[d]=e.feed_users[d]):r[0]=e.feed_users[d];window.wdi_all_tags=i,e.feed_users=void 0===t||wdi_front.isEmpty(t)?r:t;var a=wdi_front.getFeedItemResolution(e);e.feedImageResolution=a.image,e.feedVideoResolution=a.video,e.dataCount=e.feed_users.length;for(var o=0;o<e.dataCount;o++)wdi_front.instagramRequest(o,e);0<e.feed_row.number_of_photos&&wdi_front.ajaxLoader(e),"1"===e.feed_row.display_header&&wdi_front.show("header",e),"1"===e.feed_row.show_usernames&&wdi_front.show("users",e)},wdi_front.getFeedItemResolution=function(e){var i={image:"standard_resolution",video:"standard_resolution"};if("thumbnail"===e.feed_row.feed_resolution)return{image:"thumbnail",video:"low_bandwidth"};if("low"===e.feed_row.feed_resolution)return{image:"low_resolution",video:"low_resolution"};if("standard"===e.feed_row.feed_resolution)return{image:"standard_resolution",video:"standard_resolution"};var r=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter).find(".wdi_feed_wrapper");r.append('<div class="wdi_feed_item" id="wdi_feed_item_example"></div>'),wdi_responsive.columnControl(e,1);e=r.attr("wdi-res").split("wdi_col_");if(r.find("#wdi_feed_item_example").remove(),2!==e.length)return i;e=parseInt(e[1]);if(e<=0)return i;e=r.width()/e-10;return e<=150?(i.image="thumbnail",i.video="low_bandwidth"):150<e&&e<=320?(i.image="low_resolution",i.video="low_resolution"):(i.image="standard_resolution",i.video="standard_resolution"),i},wdi_front.isJsonString=function(e){try{JSON.parse(e)}catch(e){return!1}return!0},wdi_front.instagramRequest=function(i,r){var t=this,e=r.feed_users;if("string"==typeof e[i]&&"self"===e[i])r.instagram.getRecentLikedMedia({success:function(e){void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,r),r.mediaRequestsDone=!0,0!=(e=t.checkMediaResponse(e,r))&&t.saveSelfUserData(e,r)}});else if("hashtag"==this.getInputType(e[i].username)){if(this.isJsonString(r.feed_row.feed_users))for(var d in json_feed_users=JSON.parse(r.feed_row.feed_users),json_feed_users)"#"!==json_feed_users[d].username.charAt(0)&&(user=json_feed_users[d]);r.instagram.getTagRecentMedia(this.stripHashtag(e[i].username),{feed_id:r.feed_row.id,user_id:user.id,user_name:user.username,success:function(e){if(void 0!==e.error&&"undefined"!=e.error.type||void 0!==e.meta&&1==e.meta.error)return wdi_front.show_alert(!1,e,r),!1;r.mediaRequestsDone=!0,0!=(e=t.checkMediaResponse(e,r))&&t.saveUserData(e,r.feed_users[i],r)}},null,r.feed_row.hashtag_top_recent)}else"user"==this.getInputType(e[i].username)&&r.instagram.getUserMedia({feed_id:r.feed_row.id,user_id:e[i].id,user_name:e[i].username,success:function(e){if(void 0!==e.meta&&1==typeof e.meta.error)return wdi_front.show_alert(!1,e,r),!1;r.mediaRequestsDone=!0,0!=(e=t.checkMediaResponse(e,r))&&t.saveUserData(e,r.feed_users[i],r)}})},wdi_front.isHashtag=function(e){return"#"===e[0]},wdi_front.saveUserData=function(e,i,r){e.user_id=i.id,e.username=i.username,"#"===e.user_id[0]&&(e.data=wdi_front.appendRequestHashtag(e.data,e.user_id)),r.usersData.push(e),r.currentResponseLength=wdi_front.getArrayContentLength(r.usersData,"data"),r.allResponseLength+=r.currentResponseLength,r.dataCount==r.usersData.length&&(r.currentResponseLength<r.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(r)?wdi_front.loadMore("initial-keep",r):(wdi_front.displayFeed(r),wdi_front.applyFilters(r),wdi_front.activeUsersCount(r)||"load_more_btn"==r.feed_row.feed_display_view&&((r=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter)).find(".wdi_load_more").addClass("wdi_hidden"),r.find(".wdi_spinner").addClass("wdi_hidden"))))},wdi_front.saveSelfUserData=function(e,i){e.user_id="",e.username="",i.usersData.push(e),i.currentResponseLength=wdi_front.getArrayContentLength(i.usersData,"data"),i.allResponseLength+=i.currentResponseLength,i.dataCount==i.usersData.length&&(i.currentResponseLength<i.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(i)?wdi_front.loadMore("initial-keep",i):(wdi_front.displayFeed(i),wdi_front.applyFilters(i),wdi_front.activeUsersCount(i)||"load_more_btn"==i.feed_row.feed_display_view&&((i=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter)).find(".wdi_load_more").addClass("wdi_hidden"),i.find(".wdi_spinner").addClass("wdi_hidden"))))},wdi_front.userHasNoPhoto=function(e,i){var r=0,t=e.usersData;void 0!==i&&(t=i);for(var d=0;d<t.length;d++)void 0===t[d].pagination&&(t[d].pagination=[]),"liked"===e.feed_row.liked_feed?void 0===t[d].pagination.next_max_like_id&&r++:void 0===t[d].pagination.next_max_id&&r++;return r==t.length?1:0},wdi_front.appendRequestHashtag=function(e,i){for(var r=0;r<e.length;r++)e[r].wdi_hashtag=i;return e},wdi_front.displayFeed=function(e,i){0==e.customFilterChanged&&(r=wdi_front.feedSort(e,i));var r,i=e.customFilterChanged;1==e.customFilterChanged&&(r=e.customFilteredData,e.parsedData=wdi_front.parseLighboxData(e,!0)),"1"!=e.feed_row.resort_after_load_more?0==e.customFilterChanged&&(e.dataStorageList=e.dataStorageList.concat(r)):0==e.customFilterChanged&&(e.dataStorageList=r),"masonry"==e.feed_row.feed_type&&wdi_front.masonryDisplayFeedItems(r,e),"thumbnails"!=e.feed_row.feed_type&&"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||wdi_front.displayFeedItems(r,e),wdi_front.getDataLength(e)<parseInt(e.feed_row.number_of_photos)+parseInt(e.feed_row.load_more_number*e.currentPageLoadMore)&&!i&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount&&!wdi_front.allDataHasFinished(e)?wdi_front.loadMore("",e):(e.currentPageLoadMore++,wdi_front.allImagesLoaded(e)),e.instagramRequestCounter>e.maxConditionalFiltersRequestCount&&(wdi_front.allImagesLoaded(e),0==r.length&&(e.stopInfiniteScrollFlag=!0)),"pagination"==e.feed_row.feed_display_view&&e.currentPage<e.paginator&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter).find("#wdi_last_page").removeClass("wdi_disabled"),e.instagramRequestCounter=0,e.conditionalFilterBuffer=[],wdi_front.updateUsersImages(e)},wdi_front.updateUsersImages=function(i){jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter).find(".wdi_single_user .wdi_user_img_wrap img").each(function(){if((jQuery(this).attr("src")==wdi_url.plugin_url+"images/missing.png"||""==jQuery(this).attr("src"))&&"liked"!=i.feed_row.liked_feed)for(var e=0;e<i.usersData.length;e++)i.usersData[e].username==jQuery(this).parent().parent().find("h3").text()&&0!=i.usersData[e].data.length&&jQuery(this).attr("src",i.usersData[e].data[0].images.thumbnail.url)})},wdi_front.masonryDisplayFeedItems=function(e,i){var r=[],t=[];if(0!=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length){jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_masonry_column").each(function(){1==i.feed_row.resort_after_load_more&&(jQuery(this).html(""),i.imageIndex=0),1==i.customFilterChanged&&(jQuery(this).html(""),i.imageIndex=0),"pagination"==i.feed_row.feed_display_view?r.push(0):r.push(jQuery(this).height()),t.push(jQuery(this))}),1==i.customFilterChanged&&(i.customFilterChanged=!1);for(var d,a,o,n=0;n<e.length;n++)"object"==typeof e[n].videos&&null==e[n].videos.standard_resolution||(i.displayedData.push(e[n]),d="",void 0!==e[n].wdi_hashtag&&(d=e[n].wdi_hashtag),a="image"==e[n].type?wdi_front.getPhotoTemplate(i,d):e[n].hasOwnProperty("videos")||"video"==e[n].type?wdi_front.getVideoTemplate(i,d):wdi_front.getSliderTemplate(i,d),o=e[n],d=a(wdi_front.createObject(o,i)),a=wdi_front.array_min(r),o=wdi_front.getImageResolution(e[n]),t[a.index].html(t[a.index].html()+d),r[a.index]+=t[a.index].width()*o,i.imageIndex++,"pagination"==i.feed_row.feed_display_view&&((n+1)%i.feed_row.pagination_per_page_number==0?i.resIndex+=i.freeSpaces+1:i.resIndex++));i.wdi_loadedImages=0;var s=!1;i.wdi_load_count=n;var _=i.feed_row.wdi_feed_counter;jQuery("#wdi_feed_"+_+" img.wdi_img").on("load",function(){i.wdi_loadedImages++,w(),!1===s&&(wdi_responsive.columnControl(i,1),s=!0)});w(),1==i.paginatorNextFlag&&wdi_front.updatePagination(i,"next"),i.infiniteScrollFlag=!1}function w(){i.wdi_load_count===i.wdi_loadedImages&&0!=i.wdi_loadedImages&&(i.loadedImages=0,i.wdi_load_count=0,wdi_front.allImagesLoaded(i))}},wdi_front.getImageResolution=function(e){var i=e.images.standard_resolution.width;return e.images.standard_resolution.height/i},wdi_front.getDataLength=function(e,i){var r=0;if(void 0===i)for(var t=0;t<e.dataStorage.length;t++)r+=e.dataStorage[t].length;else for(t=0;t<i.length;t++)r+=i[t].length;return r},wdi_front.getArrayContentLength=function(e,i){for(var r=0,t=0;t<e.length;t++)"finished"!=e[t].finished&&void 0===e[t].error&&(r+=e[t][i].length);return r},wdi_front.displayFeedItems=function(e,i){if(0!=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length){var r=i.feed_row.wdi_feed_counter,t=jQuery("#wdi_feed_"+r+" .wdi_feed_wrapper");"1"===i.feed_row.resort_after_load_more&&(t.html(""),i.imageIndex=0),1==i.customFilterChanged&&(t.html(""),i.imageIndex=0,i.customFilterChanged=!1);var d;wdi_front.getImgCount(i),e.length;"pagination"==i.feed_row.feed_display_view&&(d=i.feed_row.load_more_number,"image_browser"==i.feed_row.feed_type&&(d=1),(jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+' [wdi_page="'+(i.currentPage-1)+'"]').length<d||0==e.length)&&(i.currentPage=--i.currentPage<=1?1:i.currentPage));for(var a,o,n=0;n<e.length;n++){if(void 0===e[n])return;"object"==typeof e[n].videos&&null==e[n].videos.standard_resolution||(o="",void 0!==e[n].wdi_hashtag&&(o=e[n].wdi_hashtag),a="image"==e[n].type?wdi_front.getPhotoTemplate(i,o):e[n].hasOwnProperty("videos")?wdi_front.getVideoTemplate(i,o):wdi_front.getSliderTemplate(i,o),o=e[n],o=a(wdi_front.createObject(o,i)),t.html(t.html()+o),i.imageIndex++,"pagination"==i.feed_row.feed_display_view&&((n+1)%i.feed_row.pagination_per_page_number==0?i.resIndex+=i.freeSpaces+1:i.resIndex++))}i.wdi_loadedImages=0;var s=!1;i.wdi_load_count=n;r=i.feed_row.wdi_feed_counter,t=jQuery("#wdi_feed_"+r+" img.wdi_img").on("load",function(){i.wdi_loadedImages++,i.wdi_load_count===i.wdi_loadedImages&&0!=i.wdi_loadedImages&&(i.loadedImages=0,i.wdi_load_count=0,wdi_front.allImagesLoaded(i)),!1===s&&(wdi_responsive.columnControl(i,1),s=!0)});1==i.paginatorNextFlag&&wdi_front.updatePagination(i,"next"),i.infiniteScrollFlag=!1}},wdi_front.checkFeedFinished=function(e){for(var i=0;i<e.usersData.length;i++)if(void 0===e.usersData[i].finished)return!1;return!0},wdi_front.sortingOperator=function(e,i){var r;switch(e){case"date":switch(i){case"asc":r=function(e,i){return e.created_time>i.created_time?1:-1};break;case"desc":r=function(e,i){return e.created_time>i.created_time?-1:1}}break;case"likes":switch(i){case"asc":r=function(e,i){return e.likes.count<i.likes.count?-1:1};break;case"desc":r=function(e,i){return e.likes.count<i.likes.count?1:-1}}break;case"comments":switch(i){case"asc":r=function(e,i){return e.comments.count<i.comments.count?-1:1};break;case"desc":r=function(e,i){return e.comments.count<i.comments.count?1:-1}}break;case"random":r=function(e,i){return.5<Math.random()?1:-1}}return r},wdi_front.feedSort=function(e,i){var r=e.feed_row.sort_images_by,t=e.feed_row.display_order;"1"===e.feed_row.resort_after_load_more?e.data=e.data.concat(wdi_front.smartPicker(e,i)):e.data=wdi_front.smartPicker(e,i);t=wdi_front.sortingOperator(r,t);return e.data.sort(t),e.data},wdi_front.smartPicker=function(e,i){var r=[],t=0,d=[],a=parseInt(e.feed_row.number_of_photos),o=Math.ceil(a/e.usersData.length),n=0;""!=i&&void 0!==i&&null!=i&&(a=parseInt(i),o=Math.ceil(a/wdi_front.activeUsersCount(e)));e.storeRawData(e.usersData,"dataStorageRaw");for(var s,_=e.dataStorageRaw.sort(function(e,i){return e.length()>i.length()?1:-1}),w=e.usersData.sort(function(e,i){return e.data.length>i.data.length?1:-1}),f=0;f<w.length;f++)n+=o,_[f].length()<=n?(n-=_[f].length(),r.push(_[f].getData(_[f].length())),t+=r[r.length-1].length):(a<t+n&&(n=a-t),(!(s=[])===e.auto_trigger||s.length+wdi_front.getDataLength(e)+wdi_front.getDataLength(e,r)<e.feed_row.number_of_photos)&&(s=s.concat(_[f].getData(n))),n=0,t+=s.length,r.push(s));for(f=0;f<r.length;f++)void 0===e.dataStorage[f]?e.dataStorage.push(r[f]):e.dataStorage[f]=e.dataStorage[f].concat(r[f]);for(e.parsedData=wdi_front.parseLighboxData(e),f=0;f<r.length;f++)d=d.concat(r[f]);return d},wdi_front.createObject=function(e,i){var r=null!=e.caption?e.caption.text:"&nbsp";switch(e.type){case"image":var t=e.images[i.feedImageResolution].url,d=void 0,a="image";break;case"video":t=void 0,d=e.hasOwnProperty("videos")?e.videos[i.feedVideoResolution].url:wdi_url.plugin_url+"images/video_missing.png",a="video";break;case"carousel":switch(e.carousel_media[0].type){case"image":t=e.carousel_media[0].images[i.feedImageResolution].url,d=void 0,a="image";break;case"video":t=void 0,d=e.carousel_media[0].videos[i.feedVideoResolution].url,a="video";break;default:t=wdi_url.plugin_url+"images/missing.png",d=wdi_url.plugin_url+"images/video_missing.png",a="image"}break;default:t=wdi_url.plugin_url+"images/missing.png",d=wdi_url.plugin_url+"images/video_missing.png",a="image"}var o=i.imageIndex,n="square",s=e.images.standard_resolution.height,_=e.images.standard_resolution.width;_<s?n="portrait":s<_&&(n="landscape");_=e.user.username;return""===_&&(_="no_user"),{id:e.id,thumbType:a,caption:wdi_front.escape_tags(r),image_url:t,likes:e.likes.count,comments:e.comments.count,wdi_index:o,wdi_res_index:i.resIndex,wdi_media_user:_,link:e.link,video_url:d,wdi_username:_,wdi_shape:n}},wdi_front.setPage=function(e){var i=e.feed_row.feed_display_view,r=e.feed_row.feed_type;if("pagination"!=i)return"";i=e.imageIndex;return r="image_browser"==r?1:Math.abs(e.feed_row.pagination_per_page_number),e.paginator=Math.ceil((i+1)/r),e.paginator},wdi_front.getPhotoTemplate=function(e,i){var r=wdi_front.setPage(e),t="",d="",a="",o="",n="tenweb-i-arrows-out",s="";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(n=""),sourceAttr=(""!=r&&(d='wdi_page="'+r+'"'),"src"),""!=r&&1!=r&&(t="wdi_hidden"),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(s='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(t+=" wdi_full_caption");r="";switch("blog_style"!==e.feed_row.feed_type&&(r="masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":a="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":a="onclick=\"window.open ('<%= link%>','_blank')\"",o="wdi_hover_off",n="";break;case"custom_redirect":a="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",o="wdi_hover_off",n="";break;case"none":o="wdi_cursor_off wdi_hover_off",n=a=""}d='<div class="wdi_feed_item '+t+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+d+' wdi_type="image" id="wdi_'+e.feed_row.wdi_feed_counter+"_<%=id%>\"><div class=\"wdi_photo_wrap\"><div class=\"wdi_photo_wrap_inner\"><div class=\"wdi_photo_img <%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>\"><img class=\"wdi_img\" "+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+o+'" >'+s+'<div class="wdi_thumb_icon" '+a+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+n+'"></i></div></div></div></div></div></div>',s=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(d+='<div class="wdi_photo_meta">',"1"===e.feed_row.show_likes&&0!=e.dataStorageList[s].likes.count&&(d+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"1"===e.feed_row.show_comments&&0!=e.dataStorageList[s].comments.count&&(d+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),d+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(d+='<div class="wdi_photo_title" onclick='+r+" ><%=caption%></div>"),d+="</div>"),d+="</div>",_.template(d)},wdi_front.getSliderTemplate=function(e,i){var r=wdi_front.setPage(e),t="",d="",a="",o="",n="tenweb-i-clone",s="";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(n=""),sourceAttr=(""!=r&&(d='wdi_page="'+r+'"'),"src"),""!=r&&1!=r&&(t="wdi_hidden"),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(s='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(t+=" wdi_full_caption");r="";switch("blog_style"!==e.feed_row.feed_type&&(r="masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":a="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":a="onclick=\"window.open ('<%= link%>','_blank')\"",o="wdi_hover_off",n="tenweb-i-clone";break;case"custom_redirect":a="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",o="wdi_hover_off",n="";break;case"none":o="wdi_cursor_off wdi_hover_off",n=a=""}d='<div class="wdi_feed_item '+t+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+d+' wdi_type="slideshow" id="wdi_'+e.feed_row.wdi_feed_counter+"_<%=id%>\"><div class=\"wdi_photo_wrap\"><div class=\"wdi_photo_wrap_inner\"><div class=\"wdi_photo_img <%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>\"><% if (thumbType === 'video') { %><video class=\"wdi_img\" "+sourceAttr+'="<%=video_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"></video><% } else {%><img class="wdi_img" '+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><% }%><div class="wdi_photo_overlay '+o+'" >'+s+'<div class="wdi_thumb_icon" '+a+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+n+'"></i></div></div></div></div></div></div>',s=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(d+='<div class="wdi_photo_meta">',"1"===e.feed_row.show_likes&&0!=e.dataStorageList[s].likes.count&&(d+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"1"===e.feed_row.show_comments&&0!=e.dataStorageList[s].comments.count&&(d+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),d+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(d+='<div class="wdi_photo_title" onclick='+r+" ><%=caption%></div>"),d+="</div>"),d+="</div>",_.template(d)},wdi_front.replaceToVideo=function(e,i,r){overlayHtml="<video style='width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;' controls=''><source src='"+e+"' type='video/mp4'>Your browser does not support the video tag. </video>",jQuery("#wdi_feed_"+r+' [wdi_index="'+i+'"] .wdi_photo_wrap_inner').html(overlayHtml),jQuery("#wdi_feed_"+r+' [wdi_index="'+i+'"] .wdi_photo_wrap_inner video').get(0).play()},wdi_front.getVideoTemplate=function(e,i){var r=wdi_front.setPage(e),t="",d="",a="tenweb-i-play",o="",n="",s="",w=(""!=r&&(d='wdi_page="'+r+'"'),"src");""!=r&&1!=r&&(t="wdi_hidden"),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(s='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(t+=" wdi_full_caption");r="";switch("blog_style"!==e.feed_row.feed_type&&(r="masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":o="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":o="onclick=\"window.open ('<%= link%>','_blank')\"",n="wdi_hover_off",a="tenweb-i-play";break;case"custom_redirect":o="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",n="wdi_hover_off",a="";break;case"none":n="wdi_cursor_off wdi_hover_off",a="","blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(o="onclick=wdi_front.replaceToVideo('<%= video_url%>','<%= wdi_index%>',"+e.feed_row.wdi_feed_counter+")",n="",a="tenweb-i-play")}w='<div class="wdi_feed_item '+t+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+d+' wdi_type="image" id="wdi_'+e.feed_row.wdi_feed_counter+"_<%=id%>\"><div class=\"wdi_photo_wrap\"><div class=\"wdi_photo_wrap_inner\"><div class=\"wdi_photo_img <%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>\"><video class=\"wdi_img\" "+w+'="<%=video_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"></video><div class="wdi_photo_overlay '+n+'" '+o+">"+s+'<div class="wdi_thumb_icon" style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+a+'"></i></div></div></div></div></div></div>',s=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(w+='<div class="wdi_photo_meta">',"1"===e.feed_row.show_likes&&0!=e.dataStorageList[s].likes.count&&(w+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o">&nbsp;<%= likes%></i></div>'),"1"===e.feed_row.show_comments&&0!=e.dataStorageList[s].comments.count&&(w+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square">&nbsp;<%= comments%></i></div>'),w+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(w+='<div class="wdi_photo_title" onclick='+r+" ><%=caption%></div>"),w+="</div>"),w+="</div>",_.template(w)},wdi_front.bindEvents=function(e){0!=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length&&("load_more_btn"==e.feed_row.feed_display_view&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_load_more_container").on(wdi_front.clickOrTouch,function(){wdi_front.loadMore(jQuery(this).find(".wdi_load_more_wrap"))}),"pagination"==e.feed_row.feed_display_view&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_next").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorNext(jQuery(this),e)}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_prev").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorPrev(jQuery(this),e)}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_last_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationLastPage(jQuery(this),e)}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_first_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationFirstPage(jQuery(this),e)}),e.paginatorNextFlag=!1),"infinite_scroll"==e.feed_row.feed_display_view&&(jQuery(window).on("scroll",function(){wdi_front.infiniteScroll(e)}),e.infiniteScrollFlag=!1))},wdi_front.infiniteScroll=function(e){jQuery(window).scrollTop()+jQuery(window).height()-100>=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_infinite_scroll").offset().top&&(!1===e.infiniteScrollFlag&&0==e.stopInfiniteScrollFlag?(e.infiniteScrollFlag=!0,wdi_front.loadMore(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_infinite_scroll"),e)):e.stopInfiniteScrollFlag&&wdi_front.allImagesLoaded(e))},wdi_front.paginationFirstPage=function(e,i){var r;1!=i.paginator&&1!=i.currentPage&&(r=i.currentPage,i.currentPage=1,wdi_front.updatePagination(i,"custom",r),e.parent().find("#wdi_last_page").removeClass("wdi_disabled")),e.addClass("wdi_disabled")},wdi_front.paginationLastPage=function(e,i){var r;1!=i.paginator&&i.currentPage!=i.paginator&&(r=i.currentPage,i.currentPage=i.paginator,wdi_front.updatePagination(i,"custom",r),e.addClass("wdi_disabled"),e.parent().find("#wdi_first_page").removeClass("wdi_disabled"))},wdi_front.paginatorNext=function(e,i){var r,t=e.parent().find("#wdi_last_page"),d=e.parent().find("#wdi_first_page");i.paginatorNextFlag=!0,i.paginator!=i.currentPage||wdi_front.checkFeedFinished(i)?i.paginator>i.currentPage&&(i.currentPage++,wdi_front.updatePagination(i,"next"),i.paginator>i.currentPage?t.removeClass("wdi_disabled"):t.addClass("wdi_disabled")):(i.currentPage++,r=i.feed_row.number_of_photos,wdi_front.loadMore(e,i,r),t.addClass("wdi_disabled")),d.removeClass("wdi_disabled")},wdi_front.paginatorPrev=function(e,i){var r=e.parent().find("#wdi_last_page"),e=e.parent().find("#wdi_first_page");1!=i.currentPage?(i.currentPage--,wdi_front.updatePagination(i,"prev"),r.removeClass("wdi_disabled"),1==i.currentPage&&e.addClass("wdi_disabled")):e.addClass("wdi_disabled")},wdi_front.updatePagination=function(e,i,r){var t="#wdi_feed_"+e.feed_row.wdi_feed_counter;switch(jQuery(t+' [wdi_page="'+e.currentPage+'"]').each(function(){jQuery(this).removeClass("wdi_hidden")}),i){case"next":var r=e.currentPage-1;jQuery(t+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(t+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"prev":r=e.currentPage+1;jQuery(t+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(t+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"custom":(r=r)!=e.currentPage&&(jQuery(t+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(t+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")}))}e.paginatorNextFlag=!1,jQuery(t+" .wdi_feed_wrapper").css("height","auto"),jQuery(t+" #wdi_current_page").text(e.currentPage)},wdi_front.loadMore=function(e,i){var r,t=0;if(""!=e&&void 0!==e&&"initial"!=e&&"initial-keep"!=e&&(r=window[e.parent().parent().parent().parent().attr("id")]),void 0!==i&&(r=i),this.isJsonString(r.feed_row.feed_users))for(var d in json_feed_users=JSON.parse(r.feed_row.feed_users),json_feed_users)iuser=json_feed_users[d],"#"!==json_feed_users[d].username.charAt(0)&&(iuser=json_feed_users[d]);for(var a=0,o=0,d=0;d<r.userSortFlags.length;d++)if(!0===r.userSortFlags[d].flag){a++;for(var n=0;n<r.usersData.length;n++)r.userSortFlags[d].id===r.usersData[n].user_id&&"finished"===r.usersData[n].finished&&o++}if(a!==o||0==a){r.auto_trigger=!1,""===e&&(r.auto_trigger=!0),wdi_front.ajaxLoader(r),"masonry"===r.feed_row.feed_type&&"pagination"==r.feed_row.feed_display_view&&jQuery("#wdi_feed_"+wdi_front.feed_counter+" .wdi_full_caption").each(function(){jQuery(this).find(".wdi_photo_title").trigger(wdi_front.clickOrTouch)});for(d=0;d<r.usersData.length;d++)"finished"===r.usersData[d].finished&&t++;t===r.usersData.length&&(wdi_front.allImagesLoaded(r),jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter+" .wdi_load_more").remove());var s=r.usersData;r.loadMoreDataCount=r.feed_users.length;for(d=0;d<s.length;d++){var _=s[d].pagination,w=void 0!==s[d].tag_id?s[d].tag_id:"",f=void 0!==s[d].username&&w?s[d].username:"",w={old_user_id:s[d].user_id,odl_username:s[d].username,user_id:iuser.id,username:iuser.username,hashtag:f,hashtag_id:w};""!=_.next_url&&null!=_.next_url&&void 0!==_.next_url?(_=_.next_url,wdi_front.loadMoreRequest(w,_,r,e)):("initial-keep"==e&&(r.temproraryUsersData[d]=r.usersData[d]),0<r.loadMoreDataCount&&r.loadMoreDataCount--,wdi_front.checkForLoadMoreDone(r,e))}}},wdi_front.loadMoreRequest=function(r,e,t,d){var a,i;t.mediaRequestsDone&&""!=e&&(t.usersData,a="",i=function(e){if(""===e||void 0===e||null==e)return a=wdi_front_messages.network_error,t.loadMoreDataCount--,void wdi_front.show_alert(a,e,t);if(void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,t),void 0!==e.meta&&void 0!==e.meta.code&&200!=e.meta.code)return a=e.meta.error_message,t.loadMoreDataCount--,void wdi_front.show_alert(a,e,t);r.hashtag?(e.user_id=r.hashtag_id,e.username=r.hashtag):(e.user_id=r.user_id,e.username=r.username);for(var i=0;i<t.usersData.length;i++)e.user_id!==t.usersData[i].user_id&&e.tag_id!==t.usersData[i].tag_id||("#"===e.user_id[0]&&(e.data=wdi_front.appendRequestHashtag(e.data,e.user_id)),"initial-keep"==d&&(t.temproraryUsersData[i]=t.usersData[i]),t.usersData[i]=e,void 0===t.dataStorageRaw[i]?t.dataStorageRaw[i]={data:e.data}:t.dataStorageRaw[i].data=t.dataStorageRaw[i].data.concat(e.data),t.loadMoreDataCount--);wdi_front.checkForLoadMoreDone(t,d)},r.hashtag||r.hashtag_id?t.instagram.getTagRecentMedia(this.stripHashtag(r.hashtag),{feed_id:t.feed_row.id,user_id:r.hashtag_id,user_name:r.hashtag,success:i},e,t.feed_row.hashtag_top_recent):t.instagram.getUserMedia({feed_id:t.feed_row.id,user_id:r.user_id,user_name:r.username,success:i},e))},wdi_front.checkForLoadMoreDone=function(e,i){var r,t=e.feed_row.load_more_number,d=e.feed_row.number_of_photos;0==e.loadMoreDataCount&&(e.temproraryUsersData=wdi_front.mergeData(e.temproraryUsersData,e.usersData),r=wdi_front.getArrayContentLength(e.temproraryUsersData,"data"),"initial-keep"==i&&(i="initial"),"initial"==i?r<d&&!wdi_front.userHasNoPhoto(e,e.temproraryUsersData)&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount?wdi_front.loadMore("initial",e):(e.usersData=e.temproraryUsersData,wdi_front.displayFeed(e),wdi_front.applyFilters(e),e.temproraryUsersData=[]):r<t&&!wdi_front.userHasNoPhoto(e,e.temproraryUsersData)&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount?wdi_front.loadMore(void 0,e):(e.usersData=e.temproraryUsersData,wdi_front.activeUsersCount(e)&&(wdi_front.displayFeed(e,t),wdi_front.applyFilters(e),e.temproraryUsersData=[])))},wdi_front.allDataHasFinished=function(e){for(var i=0,r=0;r<e.dataStorageRaw.length;r++)""==e.usersData[r].pagination.next_url&&(i++,e.usersData[r].finished="finished");return i==e.dataStorageRaw.length&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_load_more").remove(),!0)},wdi_front.mergeData=function(e,i){for(var r=0;r<i.length;r++)void 0!==e[r]?"finished"!=i[r].finished&&(void 0===e[r].pagination.next_max_id&&void 0===e[r].pagination.next_max_like_id||(e[r].data=e[r].data.concat(i[r].data),e[r].pagination=i[r].pagination,e[r].user_id=i[r].user_id,e[r].username=i[r].username,e[r].meta=i[r].meta)):e.push(i[r]);return e},wdi_front.brokenImageHandler=function(e){return!0},wdi_front.ajaxLoader=function(e){var i,r=e.feed_row.wdi_feed_counter,r=jQuery("#wdi_feed_"+r);"load_more_btn"==e.feed_row.feed_display_view&&(r.find(".wdi_load_more").addClass("wdi_hidden"),r.find(".wdi_spinner").removeClass("wdi_hidden")),"infinite_scroll"==e.feed_row.feed_display_view&&(0==r.find(".wdi_ajax_loading").length?(i=jQuery('<div class="wdi_ajax_loading"><div><div><img class="wdi_load_more_spinner" src="'+wdi_url.plugin_url+'images/ajax_loader.png"></div></div></div>'),r.append(i)):i=r.find(".wdi_ajax_loading"),i.removeClass("wdi_hidden"))},wdi_front.allImagesLoaded=function(e){var i=wdi_front.getDataLength(e);e.mediaRequestsDone||jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").remove("wdi_nomedia"),0!=i||!e.mediaRequestsDone||0!=e.feed_row.conditional_filters.length&&0!=e.feed_row.conditional_filter_enable||jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").append("<p class='wdi_nomedia'>"+wdi_front_messages.feed_nomedia+"</p>");i=e.feed_row.wdi_feed_counter,i=jQuery("#wdi_feed_"+i);"load_more_btn"==e.feed_row.feed_display_view&&(i.find(".wdi_load_more").removeClass("wdi_hidden"),i.find(".wdi_spinner").addClass("wdi_hidden")),"infinite_scroll"==e.feed_row.feed_display_view&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_ajax_loading").addClass("wdi_hidden")},wdi_front.show=function(e,i){var r,t,d=i.feed_row.wdi_feed_counter,a=jQuery("#wdi_feed_"+d+" .wdi_feed_container");"header"===e&&(r={feed_thumb:i.feed_row.feed_thumb,feed_name:i.feed_row.feed_name},t=wdi_front.getHeaderTemplate()(r),r=a.find(".wdi_feed_header").html(),a.find(".wdi_feed_header").html(r+t))},wdi_front.getUserTemplate=function(e,i){var r=e.dataCount,t="#"===i[0]?"//instagram.com/explore/tags/"+i.substr(1,i.length):"//instagram.com/"+i,d="onclick='"+('window.open("'+t+'","_blank")')+"'",t='<div class="wdi_single_user" user_index="<%=user_index%>"><div class="wdi_header_user_text <%=hashtagClass%>"><div class="wdi_user_img_wrap"><img onerror="wdi_front.brokenImageHandler(this);" src="<%= user_img_url%>">';return 1<r&&(t+='<div title="'+wdi_front_messages.filter_title+'" class="wdi_filter_overlay"><div class="wdi_filter_icon"><span onclick="wdi_front.addFilter(<%=user_index%>,<%=feed_counter%>);" class="tenweb-i tenweb-i-filter"></span></div></div>'),t+="</div>",t+="<h3 "+d+"><%= user_name%></h3>","#"!==i[0]?("1"==e.feed_row.follow_on_instagram_btn&&(t+='<div class="wdi_user_controls"><div class="wdi_follow_btn" onclick="window.open(\'//instagram.com/<%= user_name%>\',\'_blank\')"><span> '+wdi_front_messages.follow+"</span></div></div>"),t+='<div class="wdi_media_info"><p class="wdi_posts"><span class="tenweb-i tenweb-i-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span class="tenweb-i tenweb-i-user"></span><%= counts.followed_by%></p></div>'):t+='<div class="wdi_user_controls"></div><div class="wdi_media_info"><p class="wdi_posts"><span class="tenweb-i tenweb-i-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span></span></p></div>',t+='<div class="wdi_clear"></div>',1==r&&"#"!==i[0]&&"1"==e.feed_row.display_user_info&&(t+='<div class="wdi_bio"><%= bio%></div>',t+='<div class="wdi_website"><a target="_blank" href="<%= website_url%>" ><%= website%></a></div>'),t+="</div></div>",_.template(t)},wdi_front.getHeaderTemplate=function(){return _.template('<div class="wdi_header_wrapper"><div class="wdi_header_img_wrap"><img src="<%=feed_thumb%>"></div><div class="wdi_header_text"><%=feed_name%></div><div class="wdi_clear"></div>')},wdi_front.addFilter=function(e,i){var r=window["wdi_feed_"+i],i=r.dataCount;if(!(i<2)&&0==r.nowLoadingImages){i=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter+'_users [user_index="'+e+'"]');i.find(".wdi_filter_overlay").toggleClass("wdi_filter_active_bg"),i.find(".wdi_header_user_text h3").toggleClass("wdi_filter_active_col"),i.find(".wdi_media_info").toggleClass("wdi_filter_active_col"),i.find(".wdi_follow_btn").toggleClass("wdi_filter_active_col"),r.customFilterChanged=!0,0==r.userSortFlags[e].flag?r.userSortFlags[e].flag=!0:r.userSortFlags[e].flag=!1;for(var t=0,d=0;d<r.userSortFlags.length;d++)1==r.userSortFlags[d].flag&&t++;"pagination"==r.feed_row.feed_display_view&&(r.resIndex=0),0!=t?wdi_front.filterData(r):r.customFilteredData=r.dataStorageList,wdi_front.displayFeed(r),"pagination"==r.feed_row.feed_display_view&&(r.paginator=Math.ceil(r.imageIndex/parseInt(r.feed_row.pagination_per_page_number)),r.currentPage=r.paginator,wdi_front.updatePagination(r,"custom",1),jQuery("#wdi_first_page").removeClass("wdi_disabled"),jQuery("#wdi_last_page").addClass("wdi_disabled"))}},wdi_front.filterData=function(e){var i=e.userSortFlags;e.customFilteredData=[];for(var r=0;r<e.dataStorageList.length;r++)for(var t=0;t<i.length;t++)(void 0!==e.dataStorageList[r].user.id&&e.dataStorageList[r].user.id==i[t].id||e.dataStorageList[r].wdi_hashtag==i[t].name)&&1==i[t].flag&&e.customFilteredData.push(e.dataStorageList[r])},wdi_front.applyFilters=function(e){for(var i=0;i<e.userSortFlags.length;i++)1==e.userSortFlags[i].flag&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+'[user_index="'+i+'"]'),wdi_front.addFilter(i,e.feed_row.wdi_feed_counter),wdi_front.addFilter(i,e.feed_row.wdi_feed_counter))},wdi_front.getImgCount=function(e){for(var i=e.dataStorage,r=0,t=0;t<i.length;t++)r+=i[t].length;return r},wdi_front.parseLighboxData=function(e,i){var r,t,d,a=e.dataStorage,o=e.feed_row.sort_images_by,n=e.feed_row.display_order,n=wdi_front.sortingOperator(o,n),s=[],_=[];if(1==i)s=e.customFilteredData;else{for(var w=0;w<a.length;w++)for(var f=0;f<a[w].length;f++)s.push(a[w][f]);s.sort(n)}for(w=0;w<s.length;w++)void 0!==s[w]&&(t=void 0!==s[w]&&void 0!==s[w].media_url?s[w].media_url:wdi_url.plugin_url+"images/video_missing.png",void 0!==s[w]&&void 0===s[w].media_url&&"carousel"===s[w].type&&(void 0!==(d=s[w].carousel_media[0])&&void 0!==d.images?t=d.images.standard_resolution.url:void 0!==d&&void 0!==d.videos&&(t=d.videos.standard_resolution.url)),void(d=0)!==s[w]&&void 0!==s[w].comments&&(d=s[w].comments.count),r={alt:"",avg_rating:"",comment_count:d,date:wdi_front.convertUnixDate(s[w].created_time),description:wdi_front.getDescription(void 0!==s[w].caption&&null!==s[w].caption?wdi_front.escape_tags(s[w].caption.text):""),filename:wdi_front.getFileName(s[w]),filetype:wdi_front.getFileType(s[w]),hit_count:"0",id:s[w].id,image_url:s[w].link,number:0,rate:"",rate_count:"0",username:void 0!==s[w].user?s[w].user.username:"",profile_picture:void 0!==s[w].user?s[w].user.profile_picture:"",thumb_url:t,comments_data:void 0!==s[w].comments?s[w].comments.data:"",images:s[w].images,carousel_media:void 0!==s[w].carousel_media?s[w].carousel_media:null},_.push(r));return _},wdi_front.convertUnixDate=function(e){var i=new Date(e).getTime()/1e3,e=new Date(0);e.setUTCSeconds(i);i=e.getFullYear()+"-"+(e.getMonth()+1)+"-"+e.getDate();return i+=" "+e.getHours()+":"+e.getMinutes()},wdi_front.getDescription=function(e){return e=e.replace(/\r?\n|\r/g," ")},wdi_front.getFileName=function(e){if(void 0!==e){var i=e.link;if("video"===e.type&&e.hasOwnProperty("videos")&&null!=e.videos.standard_resolution)return e.videos.standard_resolution.url;if(void 0===i)return"";i=i.split("/");return i[i.length-2]}},wdi_front.getFileType=function(e){return"video"==e.type&&e.hasOwnProperty("videos")?"EMBED_OEMBED_INSTAGRAM_VIDEO":"carousel"==e.type&&e.hasOwnProperty("carousel_media")?"EMBED_OEMBED_INSTAGRAM_CAROUSEL":"EMBED_OEMBED_INSTAGRAM_IMAGE"},wdi_front.array_max=function(e){for(var i=e[0],r=0,t=1;t<e.length;t++)i<e[t]&&(i=e[t],r=t);return{value:i,index:r}},wdi_front.array_min=function(e){for(var i=e[0],r=0,t=1;t<e.length;t++)i>e[t]&&(i=e[t],r=t);return{value:i,index:r}},wdi_front.activeUsersCount=function(e){for(var i=0,r=0;r<e.usersData.length;r++)"finished"!=e.usersData[r].finished&&i++;return i},wdi_front.checkMediaResponse=function(e,i){return""==e||void 0===e||null==e||void 0!==e.error?(errorMessage=wdi_front_messages.connection_error,wdi_front.show_alert(errorMessage,e,i),!1):""!=e&&void 0!==e&&null!=e&&200!=e.meta.code?(errorMessage=e.meta.error_message,wdi_front.show_alert(errorMessage,e,i),!1):e},wdi_front.stripHashtag=function(e){return"#"!==e[0]?e:e.substr(1,e.length)},wdi_front.getInputType=function(e){switch(e[0]){case"#":return"hashtag";case"%":return"location";default:return"user"}},wdi_front.regexpTestCaption=function(e,i){var r=!1,t=!1,d=i.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&"),i=new RegExp("(?:^|\\s)"+d+"(?:^|\\s)"),a=new RegExp("(?:^|\\s)"+d,"g");for(null!=i.exec(e)&&(r=!0);null!=(match=a.exec(e));)t=!0;return 1==r||1==t},wdi_front.replaceNewLines=function(e){var i,r="vUkCJvN2ps3t",t=[];for(e=e.replace(/\r?\n|\r/g,r),i=new RegExp(r,"g");null!=(match=i.exec(e));)t.push(match.index);for(var d=e.split(r),a=0,o=0;o<d.length;o++)""==d[o]?a++:a=0,0<a&&(d.splice(o,1),a--,o--);return e=d.join(" ")},wdi_front.isEmptyObject=function(e){for(var i in e)if(e.hasOwnProperty(i))return!1;return!0},wdi_front.isEmpty=function(e){return!e||0===e.length};var WDIFeed=function(e){this.data=e.data,this.dataCount=e.dataCount,this.feed_row=e.feed_row,this.usersData=e.usersData,(_this=this).set_images_loading_flag=function(e){window.addEventListener("load",function(){e.nowLoadingImages=!1})},this.set_images_loading_flag(_this)};function wdi_extractHostname(e){return void 0===e||""===e?"":e.replace(/(^\w+:|^)\/\//,"")}WDIFeed.prototype.mediaExists=function(e,i){for(var r=0;r<i.length;r++)if(e.id==i[r].id)return!0;return!1},WDIFeed.prototype.getIdFromUrl=function(e){for(var i=e.split("/"),r=!1,t=0;t<i.length;t++)if("p"==i[t]&&void 0!==i[t+1]){r=i[t+1];break}return r},WDIFeed.prototype.avoidDuplicateMedia=function(e){var i=e.data,r=[];void 0===i&&(i=[]);for(var t=0;t<i.length;t++)this.mediaExists(i[t],this.dataStorageList)||this.mediaExists(i[t],r)||this.mediaExists(i[t],this.conditionalFilterBuffer)||r.push(i[t]);return this.conditionalFilterBuffer=this.conditionalFilterBuffer.concat(r),{data:r,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.storeRawData=function(e,i){var t=this;if("object"==typeof this[i]&&"number"==typeof this[i].length)for(var r=0;r<e.length;r++){var d="";wdi_front.isHashtag(e[r].user_id)?void 0!==e[r].pagination.cursors&&(d=e[r].pagination.cursors.after):"liked"==t.feed_row.liked_feed?void 0===(d=e[r].pagination.next_max_like_id)&&(d=""):(null==e[r].pagination&&(e[r].pagination=[]),void 0===(d=e[r].pagination.next_max_id)&&(d="")),void 0===this[i][r]?this[i].push({data:e[r].data,index:0,locked:!1,hash_id:d,usersDataFinished:!1,userId:e[r].user_id,length:function(){return this.data.length-this.index},getData:function(e){var i=this.data.slice(this.index,this.index+e);if(this.index+=Math.min(e,this.length()),this.index==this.data.length&&1==this.locked&&0==this.usersDataFinished)for(var r=0;r<t.usersData.length;r++)if(t.usersData[r].user_id==this.userId){this.usersDataFinished=!0;break}return i}}):0==this[i][r].locked&&(d!=this[i][r].hash_id?(this[i][r].data=this[i][r].data.concat(e[r].data),this[i][r].hash_id=d):this[i][r].locked=!0)}},wdi_front.updateUsersIfNecessary=function(o){for(var n=o.feed_users,e=!1,i=0;i<n.length;i++)"#"!=n[i].username.substr(0,1)?""!=n[i].id&&"username"!=n[i].id||(e=!0,o.instagram.searchForUsersByName(n[i].username,{success:function(e){if(void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,o),200==e.meta.code&&0<e.data.length){for(var i=!1,r=0;r<e.data.length;r++)if(e.data[r].username==e.args.username){i=!0;break}if(i)for(var t=0;t<n.length;t++)e.data[r].username==n[t].username&&(n[t].id=e.data[r].id)}for(var d=!1,a=0;a<n.length;a++)if(""==n[a].id||"username"==n[a].id){d=!0;break}d||(o.feed_row.feed_users=JSON.stringify(n),wdi_front.init(o))},username:n[i].username})):n[i].id=n[i].username;return e},void 0!==wdi_ajax.ajax_response?jQuery(document).one("ajaxStop",function(){"not_declared"!=wdi_front.type&&(wdi_front.clickOrTouch=wdi_front.detectEvent(),wdi_front.globalInit())}):jQuery(document).ready(function(){"not_declared"!=wdi_front.type&&(wdi_front.clickOrTouch=wdi_front.detectEvent(),wdi_front.globalInit())}),jQuery(document).ready(function(){setTimeout(function(){"1"===wdi_front_messages.show_alerts&&"I"!==jQuery(".wdi_check_fontawesome .tenweb-i-instagram").prop("tagName")&&console.log("Font Awesome is not loaded properly. Please ask for support https://wordpress.org/support/plugin/wd-instagram-feed/")},2e3)});
js/wdi_instagram.js CHANGED
@@ -195,7 +195,7 @@ function WDIInstagram(args) {
195
  *
196
  * @return object of founded media
197
  */
198
- this.getTagRecentMedia = function (tagname, args, next_url, endpoint, iter) {
199
  iter = (iter === undefined || typeof iter !== 'number') ? 0 : iter;
200
  var instagram = this,
201
  noArgument = false,
@@ -203,53 +203,62 @@ function WDIInstagram(args) {
203
  statusCode = this.statusCode,
204
  errorFlag = false,
205
  argFlag = false,
206
- filter = this.getFilter('getTagRecentMedia');
207
-
 
208
  endpoint = (parseInt(endpoint) === 0) ? "top_media" : "recent_media";
209
- if (typeof args == 'undefined' || args.length === 0) {
210
  noArgument = true;
211
  }
212
  else {
213
- if ('success' in args) {
214
  successFlag = true;
215
  }
216
- if ('statusCode' in args) {
217
  statusCode = args['statusCode'];
218
  }
219
- if ('error' in args) {
220
  errorFlag = true;
221
  }
222
- if ('args' in args) {
223
  argFlag = true;
224
- } else {
 
225
  args.args = {};
226
  }
227
- if ('count' in args) {
228
  args['count'] = parseInt(args['count']);
229
- if (!Number.isInteger(args['count']) || args['count'] <= 0) {
230
  args.count = 33;
231
  }
232
- } else {
 
233
  args.count = 33;
234
  }
 
 
 
 
 
 
235
  }
236
  var wdiTagId = this.getTagId(tagname);
237
  jQuery.ajax({
238
- type: "POST",
239
  url: wdi_ajax.ajax_url,
240
- dataType:"json",
241
  data: {
242
- iter: iter,
243
- tagname: tagname,
244
- endpoint: endpoint,
245
  wdi_nonce: wdi_ajax.wdi_nonce,
246
- wdiTagId: wdiTagId,
 
247
  next_url: next_url,
248
- user_name: getUserName(),
249
- action: "wdi_getTagRecentMedia",
250
- feed_id: wdi_ajax.feed_id,
 
251
  },
252
- success: function (response) {
253
  var error = false;
254
  var error_type = '';
255
  if ( typeof response.error !== 'undefined' ) {
@@ -275,42 +284,41 @@ function WDIInstagram(args) {
275
  if ( filterResponse.data.length != 0 ) {
276
  response.response = filterResponse;
277
  }
278
- if (wdiTagId === false) {
279
  wdiTagId = "";
280
  }
281
  if ( typeof response.tag_data !== "undefined" ) {
282
  var tag_data = response.tag_data;
283
- if (typeof tag_data.tag_id !== "undefined") {
284
  wdiTagId = tag_data.tag_id;
285
  }
286
  var all_tags = [];
287
- if (typeof window['wdi_all_tags'] !== "undefined") {
288
  all_tags = window['wdi_all_tags'];
289
  }
290
  all_tags[tag_data.tag_id] = tag_data;
291
  window['wdi_all_tags'] = all_tags;
292
  }
293
  response = response.response;
294
-
295
  response = _this.convertHashtagData(response);
296
- response.meta = {'code': 200, 'error': error, 'error_type': error_type};
297
  response.tag_id = wdiTagId;
298
  success(response)
299
  }
300
  },
301
- error: function (response) {
302
- if (errorFlag) {
303
- if (typeof args['error'] == 'object' && args['error'].length == 2) {
304
- if (typeof window[args['error'][0]][args['error'][1]] == 'function') {
305
  window[args['error'][0]][args['error'][1]](response);
306
  }
307
  }
308
- else if (typeof args['error'] == 'string') {
309
- if (typeof window[args['error']] == 'function') {
310
  window[args['error']](response);
311
  }
312
  }
313
- else if (typeof args['error'] == 'function') {
314
  args['error'](response);
315
  }
316
  }
@@ -318,18 +326,19 @@ function WDIInstagram(args) {
318
  statusCode: statusCode
319
  });
320
 
321
- function success(response) {
322
- if ( typeof response["data"] === 'undefined' ) {
323
  response["data"] = [];
324
  }
325
  if ( successFlag ) {
326
- if (typeof args.success == 'object' && args.success.length == 2) {
327
- if (typeof window[args.success[0]] != 'undefined') {
328
- if (typeof window[args.success[0]][args.success[1]] == 'function') {
329
  window[args.success[0]][args.success[1]](response);
330
  }
331
  }
332
- } else if ( typeof args.success == 'string' ) {
 
333
  if ( typeof window[args.success] == 'function' ) {
334
  window[args.success](response);
335
  }
@@ -1063,7 +1072,9 @@ function WDIInstagram(args) {
1063
  statusCode = this.statusCode,
1064
  errorFlag = false,
1065
  argFlag = false,
1066
- filter = this.getFilter('getUserMedia');
 
 
1067
 
1068
  if (typeof args == 'undefined' || args.length === 0) {
1069
  noArgument = true;
@@ -1094,18 +1105,24 @@ function WDIInstagram(args) {
1094
  } else {
1095
  args.count = 20;
1096
  }
1097
- }
1098
 
 
 
 
 
 
 
 
1099
  jQuery.ajax({
1100
- type: "POST",
1101
  url: wdi_ajax.ajax_url,
1102
- dataType:"json",
1103
  data: {
1104
  wdi_nonce:wdi_ajax.wdi_nonce,
1105
- action:"wdi_getUserMedia",
1106
- user_name:getUserName(),
1107
- feed_id: wdi_ajax.feed_id,
1108
- next_url:next_url,
1109
  iter:iter,
1110
  },
1111
  success: function (response) {
@@ -1130,7 +1147,7 @@ function WDIInstagram(args) {
1130
  }
1131
  else {
1132
  if(filterResponse.data.length != 0) {
1133
- response = filterResponse;
1134
  }
1135
  response.meta = {'code': 200, 'error': error, 'error_type': error_type};
1136
 
195
  *
196
  * @return object of founded media
197
  */
198
+ this.getTagRecentMedia = function ( tagname, args, next_url, endpoint, iter ) {
199
  iter = (iter === undefined || typeof iter !== 'number') ? 0 : iter;
200
  var instagram = this,
201
  noArgument = false,
203
  statusCode = this.statusCode,
204
  errorFlag = false,
205
  argFlag = false,
206
+ filter = this.getFilter('getTagRecentMedia'),
207
+ feed_id = wdi_ajax.feed_id,
208
+ user_name = getUserName();
209
  endpoint = (parseInt(endpoint) === 0) ? "top_media" : "recent_media";
210
+ if ( typeof args == 'undefined' || args.length === 0 ) {
211
  noArgument = true;
212
  }
213
  else {
214
+ if ( 'success' in args ) {
215
  successFlag = true;
216
  }
217
+ if ( 'statusCode' in args ) {
218
  statusCode = args['statusCode'];
219
  }
220
+ if ( 'error' in args ) {
221
  errorFlag = true;
222
  }
223
+ if ( 'args' in args ) {
224
  argFlag = true;
225
+ }
226
+ else {
227
  args.args = {};
228
  }
229
+ if ( 'count' in args ) {
230
  args['count'] = parseInt(args['count']);
231
+ if ( !Number.isInteger(args['count']) || args['count'] <= 0 ) {
232
  args.count = 33;
233
  }
234
+ }
235
+ else {
236
  args.count = 33;
237
  }
238
+ if ( 'feed_id' in args ) {
239
+ feed_id = args['feed_id'];
240
+ }
241
+ if ( 'user_name' in args ) {
242
+ user_name = args['user_name'];
243
+ }
244
  }
245
  var wdiTagId = this.getTagId(tagname);
246
  jQuery.ajax({
247
+ type: 'POST',
248
  url: wdi_ajax.ajax_url,
249
+ dataType: 'json',
250
  data: {
251
+ action: 'wdi_getTagRecentMedia',
 
 
252
  wdi_nonce: wdi_ajax.wdi_nonce,
253
+ user_name: user_name,
254
+ feed_id: feed_id,
255
  next_url: next_url,
256
+ tagname: tagname,
257
+ wdiTagId: wdiTagId,
258
+ endpoint: endpoint,
259
+ iter: iter
260
  },
261
+ success: function ( response ) {
262
  var error = false;
263
  var error_type = '';
264
  if ( typeof response.error !== 'undefined' ) {
284
  if ( filterResponse.data.length != 0 ) {
285
  response.response = filterResponse;
286
  }
287
+ if ( wdiTagId === false ) {
288
  wdiTagId = "";
289
  }
290
  if ( typeof response.tag_data !== "undefined" ) {
291
  var tag_data = response.tag_data;
292
+ if ( typeof tag_data.tag_id !== "undefined" ) {
293
  wdiTagId = tag_data.tag_id;
294
  }
295
  var all_tags = [];
296
+ if ( typeof window['wdi_all_tags'] !== "undefined" ) {
297
  all_tags = window['wdi_all_tags'];
298
  }
299
  all_tags[tag_data.tag_id] = tag_data;
300
  window['wdi_all_tags'] = all_tags;
301
  }
302
  response = response.response;
 
303
  response = _this.convertHashtagData(response);
304
+ response.meta = { 'code': 200, 'error': error, 'error_type': error_type };
305
  response.tag_id = wdiTagId;
306
  success(response)
307
  }
308
  },
309
+ error: function ( response ) {
310
+ if ( errorFlag ) {
311
+ if ( typeof args['error'] == 'object' && args['error'].length == 2 ) {
312
+ if ( typeof window[args['error'][0]][args['error'][1]] == 'function' ) {
313
  window[args['error'][0]][args['error'][1]](response);
314
  }
315
  }
316
+ else if ( typeof args['error'] == 'string' ) {
317
+ if ( typeof window[args['error']] == 'function' ) {
318
  window[args['error']](response);
319
  }
320
  }
321
+ else if ( typeof args['error'] == 'function' ) {
322
  args['error'](response);
323
  }
324
  }
326
  statusCode: statusCode
327
  });
328
 
329
+ function success( response ) {
330
+ if ( typeof response["data"] === 'undefined' ) {
331
  response["data"] = [];
332
  }
333
  if ( successFlag ) {
334
+ if ( typeof args.success == 'object' && args.success.length == 2 ) {
335
+ if ( typeof window[args.success[0]] != 'undefined' ) {
336
+ if ( typeof window[args.success[0]][args.success[1]] == 'function' ) {
337
  window[args.success[0]][args.success[1]](response);
338
  }
339
  }
340
+ }
341
+ else if ( typeof args.success == 'string' ) {
342
  if ( typeof window[args.success] == 'function' ) {
343
  window[args.success](response);
344
  }
1072
  statusCode = this.statusCode,
1073
  errorFlag = false,
1074
  argFlag = false,
1075
+ filter = this.getFilter('getUserMedia'),
1076
+ user_name = getUserName(),
1077
+ feed_id = wdi_ajax.feed_id;
1078
 
1079
  if (typeof args == 'undefined' || args.length === 0) {
1080
  noArgument = true;
1105
  } else {
1106
  args.count = 20;
1107
  }
 
1108
 
1109
+ if ('feed_id' in args) {
1110
+ feed_id = args['feed_id'];
1111
+ }
1112
+ if ('user_name' in args) {
1113
+ user_name = args['user_name'];
1114
+ }
1115
+ }
1116
  jQuery.ajax({
1117
+ type: 'POST',
1118
  url: wdi_ajax.ajax_url,
1119
+ dataType: 'json',
1120
  data: {
1121
  wdi_nonce:wdi_ajax.wdi_nonce,
1122
+ action: 'wdi_getUserMedia',
1123
+ user_name: user_name,
1124
+ feed_id: feed_id,
1125
+ next_url: next_url,
1126
  iter:iter,
1127
  },
1128
  success: function (response) {
1147
  }
1148
  else {
1149
  if(filterResponse.data.length != 0) {
1150
+ response.data = filterResponse.data;
1151
  }
1152
  response.meta = {'code': 200, 'error': error, 'error_type': error_type};
1153
 
js/wdi_instagram.min.js CHANGED
@@ -1 +1 @@
1
- function WDIInstagram(e){this.user={},this.access_tokens=[],this.filters=[],void 0!==e&&(void 0!==e.access_tokens&&(this.access_tokens=e.access_tokens),void 0!==e.filters&&(this.filters=e.filters));var w=this;function g(){return void 0!==w.user&&void 0!==w.user.user_name?w.user.user_name:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user?wdi_object.user.user_name:""}function u(){return void 0!==w.user&&void 0!==w.user.access_token?w.user.access_token:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user&&void 0!==wdi_object.user.access_token?wdi_object.user.access_token:""}this.statusCode={429:function(){console.log(" 429: Too many requests. Try after one hour")}},this.getFilter=function(e){var t=w.filters;if(void 0===t)return!1;for(var s=0;s<t.length;s++)if(t[s].where==e)if("object"==typeof t[s].what&&2==t[s].what.length){if(void 0!==window[t[s].what[0]]&&"function"==typeof window[t[s].what[0]][t[s].what[1]])return window[t[s].what[0]][t[s].what[1]]}else{if("string"!=typeof t[s].what)return"function"==typeof t[s].what&&t[s].what;if("function"==typeof window[t[s].what])return window[t[s].what]}return!1},this.addToken=function(e){"string"==typeof e&&w.access_tokens.push(e)},this.resetTokens=function(){w.access_tokens=[]};var l=0,p={data:new Array,paging:{}};this.getTagRecentMedia=function(i,n,c,a,u){u=void 0===u||"number"!=typeof u?0:u;var t=!1,e=this.statusCode,s=!1;this.getFilter("getTagRecentMedia");a=0===parseInt(a)?"top_media":"recent_media",void 0===n||0===n.length||("success"in n&&(t=!0),"statusCode"in n&&(e=n.statusCode),"error"in n&&(s=!0),"args"in n||(n.args={}),"count"in n?(n.count=parseInt(n.count),(!Number.isInteger(n.count)||n.count<=0)&&(n.count=33)):n.count=33);var d=this.getTagId(i);function f(e){void 0===e.data&&(e.data=[]),t&&("object"==typeof n.success&&2==n.success.length?void 0!==window[n.success[0]]&&"function"==typeof window[n.success[0]][n.success[1]]&&window[n.success[0]][n.success[1]](e):"string"==typeof n.success?"function"==typeof window[n.success]&&window[n.success](e):"function"==typeof n.success&&n.success(e))}jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{iter:u,tagname:i,endpoint:a,wdi_nonce:wdi_ajax.wdi_nonce,wdiTagId:d,next_url:c,user_name:g(),action:"wdi_getTagRecentMedia",feed_id:wdi_ajax.feed_id},success:function(e){var t,s,o=!1,r="";void 0!==e.error&&(o=!0,r=e.error.type),void 0!==e.error&&"HashtagNotFound"===e.error.type?(l=5,f(e)):void 0!==e.error&&"OAuthException"!==e.error.type&&l<5?(l++,w.getTagRecentMedia(i,n,c,a,u)):void 0!==e.response&&void 0!==e.response.iter&&p.data.length<parseInt(wdi_ajax.number_of_photos)&&u<10&&void 0!==e.response.paging&&""!=e.response.paging.next?(c=e.response.paging.next,p.data=p.data.concat(e.response.data),p.paging=e.response.paging,w.getTagRecentMedia(i,n,c,a,e.response.iter)):(0!=p.data.length&&(e.response=p),!1===d&&(d=""),void 0!==e.tag_data&&(void 0!==(t=e.tag_data).tag_id&&(d=t.tag_id),s=[],void 0!==window.wdi_all_tags&&(s=window.wdi_all_tags),s[t.tag_id]=t,window.wdi_all_tags=s),e=e.response,(e=w.convertHashtagData(e)).meta={code:200,error:o,error_type:r},e.tag_id=d,f(e))},error:function(e){s&&("object"==typeof n.error&&2==n.error.length?"function"==typeof window[n.error[0]][n.error[1]]&&window[n.error[0]][n.error[1]](e):"string"==typeof n.error?"function"==typeof window[n.error]&&window[n.error](e):"function"==typeof n.error&&n.error(e))},statusCode:e})},this.getTagId=function(e){var t,s,o=[];for(s in"undefined"!=typeof wdi_controller?0!==(o=wdi_controller.feed_users).length||void 0!==(t=jQuery("#WDI_feed_users").val())&&""!==t&&(o=JSON.parse(t)):void 0!==window.wdi_all_tags&&(o=window.wdi_all_tags),o)if(e===o[s].username||"#"+e===o[s].username)return void 0!==o[s].tag_id&&o[s].tag_id;return!1},this.convertHashtagData=function(e){var t={data:[],pagination:{}};if(void 0!==e&&void 0!==e.paging&&(t.pagination={cursors:{after:e.paging.cursors.after},next_url:e.paging.next}),void 0!==e&&void 0!==e.data)for(var s in e.data){var o,r=e.data[s],i="IMAGE"===r.media_type?"image":"VIDEO"===r.media_type?"video":"carousel",n={id:r.id,user:{id:"",full_name:"",profile_picture:"",username:""},images:{thumbnail:{width:150,height:150,url:r.media_url},low_resolution:{width:320,height:320,url:r.media_url},standard_resolution:{width:1080,height:1080,url:r.media_url}},created_time:r.timestamp,caption:{id:"",text:r.caption,created_time:"",from:{id:"",full_name:"",profile_picture:"",username:""}},user_has_liked:0<r.like_count,likes:{count:r.like_count},tags:[],filter:"Normal",comments:{count:r.comments_count},type:i,link:r.permalink,location:null,attribution:null,users_in_photo:[]};if("IMAGE"===r.media_type||"CAROUSEL_ALBUM"===r.media_type?n.images={thumbnail:{width:150,height:150,url:r.media_url},low_resolution:{width:320,height:320,url:r.media_url},standard_resolution:{width:1080,height:1080,url:r.media_url}}:"VIDEO"===r.media_type&&(n.videos={standard_resolution:{width:640,height:800,url:r.media_url},low_bandwidth:{width:480,height:600,url:r.media_url},low_resolution:{width:480,height:600,url:r.media_url}}),"CAROUSEL_ALBUM"===r.media_type)for(var c in n.carousel_media=[],r.children.data)o="IMAGE"===r.children.data[c].media_type?{images:{thumbnail:{width:150,height:150,url:r.children.data[c].media_url},low_resolution:{width:320,height:320,url:r.children.data[c].media_url},standard_resolution:{width:640,height:640,url:r.children.data[c].media_url}},users_in_photo:[],type:"image"}:{videos:{standard_resolution:{width:640,height:800,url:r.children.data[c].media_url,id:r.children.data[c].id},low_bandwidth:{width:480,height:600,url:r.children.data[c].media_url,id:r.children.data[c].id},low_resolution:{width:480,height:600,url:r.children.data[c].media_url,id:r.children.data[c].id}},users_in_photo:[],type:"video"},n.carousel_media.push(o);t.data.push(n)}return t},this.searchForTagsByName=function(e,s){var o=this,r=!1,i=this.statusCode,n=!1;filter=this.getFilter("searchForTagsByName"),void 0===s||0===s.length||("success"in s&&(r=!0),"error"in s&&(n=!0),"statusCode"in s&&(i=s.statusCode));var c="https://api.instagram.com/v1/tags/search?q="+e+"&access_token="+u();w.getDataFromCache(function(e){function t(e){r&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(filter&&(e=filter(e,o.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(filter&&(e=filter(e,o.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(filter&&(e=filter(e,o.filterArguments)),s.success(e)))}!1===e?jQuery.ajax({type:"POST",url:c,dataType:"jsonp",success:function(e){w.setDataToCache(c,e),t(e)},error:function(e){n&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:i}):t(e)},c)},this.searchForUsersByName=function(e,t){var s=this,o=!1,r=(this.statusCode,!1),i=this.getFilter("searchForUsersByName");void 0===t||0===t.length||("success"in t&&(o=!0),"error"in t&&(r=!0),"statusCode"in t&&t.statusCode),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/search?q="+e+"&access_token="+u(),success:function(e){o&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(i&&(e=i(e,s.filterArguments)),e.args=t,window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(i&&(e=i(e,s.filterArguments)),e.args=t,window[t.success](e)):"function"==typeof t.success&&(i&&(e=i(e,s.filterArguments)),(e.args=t).success(e)))},error:function(e){r&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:this.statusCode})},this.getRecentLikedMedia=function(t){var s=this,o=!1,e=this.statusCode,r=!1,i=this.getFilter("getRecentLikedMedia"),n="https://api.instagram.com/v1/users/self/media/liked?access_token="+u();void 0===t||0===t.length||("success"in t&&(o=!0),"error"in t&&(r=!0),"statusCode"in t&&(e=t.statusCode),"args"in t?argFlag=!0:t.args={},"count"in t?(t.count=parseInt(t.count),(!Number.isInteger(t.count)||t.count<=0)&&(t.count=20)):t.count=20,n+="&count="+t.count,"next_max_like_id"in t&&(n+="&next_max_like_id="+t.next_max_like_id)),jQuery.ajax({type:"POST",dataType:"jsonp",url:n,success:function(e){o&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(i&&(e=i(e,s.filterArguments,t.args)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(i&&(e=i(e,s.filterArguments,t.args)),window[t.success](e)):"function"==typeof t.success&&(i&&(e=i(e,s.filterArguments,t.args)),t.success(e)))},error:function(e){r&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:e})},this.getUserRecentMedia=function(e,t){var s=this,o=!1,r=this.statusCode,i=!1,n=this.getFilter("getUserRecentMedia"),e="https://api.instagram.com/v1/users/"+e+"/media/recent/?access_token="+u();void 0===t||0===t.length||("success"in t&&(o=!0),"statusCode"in t&&(r=t.statusCode),"args"in t||(t.args={}),"error"in t&&(i=!0),"count"in t?(t.count=parseInt(t.count),(!Number.isInteger(t.count)||t.count<=0)&&(t.count=33)):t.count=33,e+="&count="+t.count,"min_id"in t&&(e+="&min_id="+t.min_id),"max_id"in t&&(e+="&max_id="+t.max_id)),jQuery.ajax({type:"POST",dataType:"jsonp",url:e,success:function(e){void 0===e.data&&(e.data=[]),o&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(n&&(e=n(e,s.filterArguments,t.args)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(n&&(e=n(e,s.filterArguments,t.args)),window[t.success](e)):"function"==typeof t.success&&(n&&(e=n(e,s.filterArguments,t.args)),t.success(e)))},error:function(e){i&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:r})},this.getUserMedia=function(o,r,i){r=void 0===r?"":r,i=void 0===i||"number"!=typeof i?0:i;var n=this,c=!1,e=this.statusCode,t=!1,a=this.getFilter("getUserMedia");void 0===o||0===o.length||("success"in o&&(c=!0),"error"in o&&(t=!0),"statusCode"in o&&(e=o.statusCode),"args"in o||(o.args={}),"count"in o?(o.count=parseInt(o.count),(!Number.isInteger(o.count)||o.count<=0)&&(o.count=20)):o.count=20),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,action:"wdi_getUserMedia",user_name:g(),feed_id:wdi_ajax.feed_id,next_url:r,iter:i},success:function(e){var t=!1,s="";if(void 0!==e.error&&(t=!0,s=e.error.type),void 0!==e.error&&"OAuthException"!==e.error.type&&l<5)return l++,void w.getUserMedia(o,r,e.iter);void 0!==e.iter&&p.data.length<parseInt(wdi_ajax.number_of_photos)&&i<20&&""!=e.pagination.next_url?(r=e.pagination.next_url,p.data=p.data.concat(e.data),p.pagination=e.pagination,w.getUserMedia(o,r,e.iter)):(0!=p.data.length&&(e=p),e.meta={code:200,error:t,error_type:s},c&&("object"==typeof o.success&&2==o.success.length?void 0!==window[o.success[0]]&&"function"==typeof window[o.success[0]][o.success[1]]&&(a&&(e=w.addTags(e),e=a(e,n.filterArguments,o)),window[o.success[0]][o.success[1]](e)):"string"==typeof o.success?"function"==typeof window[o.success]&&(a&&(e=w.addTags(e),e=a(e,n.filterArguments,o)),window[o.success](e)):"function"==typeof o.success&&o.success(e)))},error:function(e){t&&("object"==typeof o.error&&2==o.error.length?"function"==typeof window[o.error[0]][o.error[1]]&&window[o.error[0]][o.error[1]](e):"string"==typeof o.error?"function"==typeof window[o.error]&&window[o.error](e):"function"==typeof o.error&&o.error(e))},statusCode:e})},this.getUserInfo=function(e,t){var s=this,o=!1,r=this.statusCode,i=!1,n=this.getFilter("getUserInfo");void 0===t||0===t.length||("success"in t&&(o=!0),"error"in t&&(i=!0),"statusCode"in t&&(r=t.statusCode)),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/"+e+"/?access_token="+u(),success:function(e){o&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(n&&(e=n(e,s.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(n&&(e=n(e,s.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(n&&(e=n(e,s.filterArguments)),t.success(e)))},error:function(e){i&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:r})},this.getSelfInfo=function(s){var o=this,r=!1,i=this.statusCode,n=!1,c=this.getFilter("getSelfInfo");void 0===s||0===s.length||("success"in s&&(r=!0),"error"in s&&(n=!0),"statusCode"in s&&(i=s.statusCode));var a="https://graph.facebook.com/v3.2/"+(void 0!==w.user&&void 0!==w.user.user_id?w.user.user_id:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user?wdi_object.user.user_id:"")+"?fields=id,ig_id,username,name,biography,profile_picture_url,followers_count,follows_count,media_count,website&access_token="+u();w.getDataFromCache(function(e){var t;!1===e?jQuery.ajax({type:"POST",dataType:"jsonp",url:a,statusCode:i,success:function(e){w.setDataToCache(a,e),r&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(c&&(e.meta={code:200},e=c(e,o.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(c&&(e.meta={code:200},e=c(e,o.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(c&&(e.meta={code:200},e=c(e,o.filterArguments)),s.success(e)))},error:function(e){n&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))}}):(t=e,r&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(c&&(t=c(t,o.filterArguments)),window[s.success[0]][s.success[1]](t)):"string"==typeof s.success?"function"==typeof window[s.success]&&(c&&(t=c(t,o.filterArguments)),window[s.success](t)):"function"==typeof s.success&&(c&&(t=c(t,o.filterArguments)),s.success(t))))},a)},this.getRecentMediaComments=function(e,t,s){var o=this,r=!1,i=this.statusCode,n=!1,c=this.getFilter("getRecentMediaComments");void 0===t||0===t.length||("success"in t&&(r=!0),"error"in t&&(n=!0),"statusCode"in t&&(i=t.statusCode)),jQuery(".wdi_comment_container #ajax_loading #opacity_div").css("display","block"),jQuery(".wdi_comment_container #ajax_loading #loading_div").css("display","block"),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,action:"wdi_getRecentMediaComments",user_name:g(),media_id:e,next:s},success:function(e){e=e,r&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(c&&(e=c(e,o.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(c&&(e=c(e,o.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(c&&(e=c(e,o.filterArguments)),t.success(e)))},complete:function(){jQuery(".wdi_comment_container #ajax_loading #opacity_div").css("display","none"),jQuery(".wdi_comment_container #ajax_loading #loading_div").css("display","none")},error:function(e){n&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:i})},this.getRecentMediaLikes=function(e,t){var s=this,o=!1,r=this.statusCode,i=!1,n=this.getFilter("getRecentMediaLikes");void 0===t||0===t.length||("success"in t&&(o=!0),"error"in t&&(i=!0),"statusCode"in t&&(r=t.statusCode)),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/media/"+e+"/likes?access_token="+u(),success:function(e){o&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(n&&(e=n(e,s.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(n&&(e=n(e,s.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(n&&(e=n(e,s.filterArguments)),t.success(e)))},error:function(e){i&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:r})},this.getDataFromCache=function(t,e,s){void 0===s&&(s=!0),jQuery.ajax({type:"POST",async:s,url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_cache_name:e,wdi_nonce:wdi_ajax.wdi_nonce,WDI_MINIFY:wdi_ajax.WDI_MINIFY,task:"get",action:"wdi_cache"},success:function(e){e.success&&void 0!==e.cache_data&&null!==e.cache_data?(e=JSON.parse(e.cache_data),t(e)):t(!1)}})},this.setDataToCache=function(e,t){jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_cache_name:e,wdi_cache_response:JSON.stringify(t),wdi_nonce:wdi_ajax.wdi_nonce,task:"set",action:"wdi_cache"},success:function(e){}})}}
1
+ function WDIInstagram(e){this.user={},this.access_tokens=[],this.filters=[],void 0!==e&&(void 0!==e.access_tokens&&(this.access_tokens=e.access_tokens),void 0!==e.filters&&(this.filters=e.filters));var w=this;function g(){return void 0!==w.user&&void 0!==w.user.user_name?w.user.user_name:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user?wdi_object.user.user_name:""}function u(){return void 0!==w.user&&void 0!==w.user.access_token?w.user.access_token:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user&&void 0!==wdi_object.user.access_token?wdi_object.user.access_token:""}this.statusCode={429:function(){console.log(" 429: Too many requests. Try after one hour")}},this.getFilter=function(e){var t=w.filters;if(void 0===t)return!1;for(var s=0;s<t.length;s++)if(t[s].where==e)if("object"==typeof t[s].what&&2==t[s].what.length){if(void 0!==window[t[s].what[0]]&&"function"==typeof window[t[s].what[0]][t[s].what[1]])return window[t[s].what[0]][t[s].what[1]]}else{if("string"!=typeof t[s].what)return"function"==typeof t[s].what&&t[s].what;if("function"==typeof window[t[s].what])return window[t[s].what]}return!1},this.addToken=function(e){"string"==typeof e&&w.access_tokens.push(e)},this.resetTokens=function(){w.access_tokens=[]};var l=0,p={data:new Array,paging:{}};this.getTagRecentMedia=function(i,n,c,a,u){u=void 0===u||"number"!=typeof u?0:u;var t=!1,e=this.statusCode,s=!1,r=(this.getFilter("getTagRecentMedia"),wdi_ajax.feed_id),o=g();a=0===parseInt(a)?"top_media":"recent_media",void 0===n||0===n.length||("success"in n&&(t=!0),"statusCode"in n&&(e=n.statusCode),"error"in n&&(s=!0),"args"in n||(n.args={}),"count"in n?(n.count=parseInt(n.count),(!Number.isInteger(n.count)||n.count<=0)&&(n.count=33)):n.count=33,"feed_id"in n&&(r=n.feed_id),"user_name"in n&&(o=n.user_name));var d=this.getTagId(i);function f(e){void 0===e.data&&(e.data=[]),t&&("object"==typeof n.success&&2==n.success.length?void 0!==window[n.success[0]]&&"function"==typeof window[n.success[0]][n.success[1]]&&window[n.success[0]][n.success[1]](e):"string"==typeof n.success?"function"==typeof window[n.success]&&window[n.success](e):"function"==typeof n.success&&n.success(e))}jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{action:"wdi_getTagRecentMedia",wdi_nonce:wdi_ajax.wdi_nonce,user_name:o,feed_id:r,next_url:c,tagname:i,wdiTagId:d,endpoint:a,iter:u},success:function(e){var t,s,r=!1,o="";void 0!==e.error&&(r=!0,o=e.error.type),void 0!==e.error&&"HashtagNotFound"===e.error.type?(l=5,f(e)):void 0!==e.error&&"OAuthException"!==e.error.type&&l<5?(l++,w.getTagRecentMedia(i,n,c,a,u)):void 0!==e.response&&void 0!==e.response.iter&&p.data.length<parseInt(wdi_ajax.number_of_photos)&&u<10&&void 0!==e.response.paging&&""!=e.response.paging.next?(c=e.response.paging.next,p.data=p.data.concat(e.response.data),p.paging=e.response.paging,w.getTagRecentMedia(i,n,c,a,e.response.iter)):(0!=p.data.length&&(e.response=p),!1===d&&(d=""),void 0!==e.tag_data&&(void 0!==(t=e.tag_data).tag_id&&(d=t.tag_id),s=[],void 0!==window.wdi_all_tags&&(s=window.wdi_all_tags),s[t.tag_id]=t,window.wdi_all_tags=s),e=e.response,(e=w.convertHashtagData(e)).meta={code:200,error:r,error_type:o},e.tag_id=d,f(e))},error:function(e){s&&("object"==typeof n.error&&2==n.error.length?"function"==typeof window[n.error[0]][n.error[1]]&&window[n.error[0]][n.error[1]](e):"string"==typeof n.error?"function"==typeof window[n.error]&&window[n.error](e):"function"==typeof n.error&&n.error(e))},statusCode:e})},this.getTagId=function(e){var t,s,r=[];for(s in"undefined"!=typeof wdi_controller?0!==(r=wdi_controller.feed_users).length||void 0!==(t=jQuery("#WDI_feed_users").val())&&""!==t&&(r=JSON.parse(t)):void 0!==window.wdi_all_tags&&(r=window.wdi_all_tags),r)if(e===r[s].username||"#"+e===r[s].username)return void 0!==r[s].tag_id&&r[s].tag_id;return!1},this.convertHashtagData=function(e){var t={data:[],pagination:{}};if(void 0!==e&&void 0!==e.paging&&(t.pagination={cursors:{after:e.paging.cursors.after},next_url:e.paging.next}),void 0!==e&&void 0!==e.data)for(var s in e.data){var r,o=e.data[s],i="IMAGE"===o.media_type?"image":"VIDEO"===o.media_type?"video":"carousel",n={id:o.id,user:{id:"",full_name:"",profile_picture:"",username:""},images:{thumbnail:{width:150,height:150,url:o.media_url},low_resolution:{width:320,height:320,url:o.media_url},standard_resolution:{width:1080,height:1080,url:o.media_url}},created_time:o.timestamp,caption:{id:"",text:o.caption,created_time:"",from:{id:"",full_name:"",profile_picture:"",username:""}},user_has_liked:0<o.like_count,likes:{count:o.like_count},tags:[],filter:"Normal",comments:{count:o.comments_count},type:i,link:o.permalink,location:null,attribution:null,users_in_photo:[]};if("IMAGE"===o.media_type||"CAROUSEL_ALBUM"===o.media_type?n.images={thumbnail:{width:150,height:150,url:o.media_url},low_resolution:{width:320,height:320,url:o.media_url},standard_resolution:{width:1080,height:1080,url:o.media_url}}:"VIDEO"===o.media_type&&(n.videos={standard_resolution:{width:640,height:800,url:o.media_url},low_bandwidth:{width:480,height:600,url:o.media_url},low_resolution:{width:480,height:600,url:o.media_url}}),"CAROUSEL_ALBUM"===o.media_type)for(var c in n.carousel_media=[],o.children.data)r="IMAGE"===o.children.data[c].media_type?{images:{thumbnail:{width:150,height:150,url:o.children.data[c].media_url},low_resolution:{width:320,height:320,url:o.children.data[c].media_url},standard_resolution:{width:640,height:640,url:o.children.data[c].media_url}},users_in_photo:[],type:"image"}:{videos:{standard_resolution:{width:640,height:800,url:o.children.data[c].media_url,id:o.children.data[c].id},low_bandwidth:{width:480,height:600,url:o.children.data[c].media_url,id:o.children.data[c].id},low_resolution:{width:480,height:600,url:o.children.data[c].media_url,id:o.children.data[c].id}},users_in_photo:[],type:"video"},n.carousel_media.push(r);t.data.push(n)}return t},this.searchForTagsByName=function(e,s){var r=this,o=!1,i=this.statusCode,n=!1;filter=this.getFilter("searchForTagsByName"),void 0===s||0===s.length||("success"in s&&(o=!0),"error"in s&&(n=!0),"statusCode"in s&&(i=s.statusCode));var c="https://api.instagram.com/v1/tags/search?q="+e+"&access_token="+u();w.getDataFromCache(function(e){function t(e){o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(filter&&(e=filter(e,r.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(filter&&(e=filter(e,r.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(filter&&(e=filter(e,r.filterArguments)),s.success(e)))}!1===e?jQuery.ajax({type:"POST",url:c,dataType:"jsonp",success:function(e){w.setDataToCache(c,e),t(e)},error:function(e){n&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:i}):t(e)},c)},this.searchForUsersByName=function(e,t){var s=this,r=!1,o=(this.statusCode,!1),i=this.getFilter("searchForUsersByName");void 0===t||0===t.length||("success"in t&&(r=!0),"error"in t&&(o=!0),"statusCode"in t&&t.statusCode),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/search?q="+e+"&access_token="+u(),success:function(e){r&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(i&&(e=i(e,s.filterArguments)),e.args=t,window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(i&&(e=i(e,s.filterArguments)),e.args=t,window[t.success](e)):"function"==typeof t.success&&(i&&(e=i(e,s.filterArguments)),(e.args=t).success(e)))},error:function(e){o&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:this.statusCode})},this.getRecentLikedMedia=function(t){var s=this,r=!1,e=this.statusCode,o=!1,i=this.getFilter("getRecentLikedMedia"),n="https://api.instagram.com/v1/users/self/media/liked?access_token="+u();void 0===t||0===t.length||("success"in t&&(r=!0),"error"in t&&(o=!0),"statusCode"in t&&(e=t.statusCode),"args"in t?argFlag=!0:t.args={},"count"in t?(t.count=parseInt(t.count),(!Number.isInteger(t.count)||t.count<=0)&&(t.count=20)):t.count=20,n+="&count="+t.count,"next_max_like_id"in t&&(n+="&next_max_like_id="+t.next_max_like_id)),jQuery.ajax({type:"POST",dataType:"jsonp",url:n,success:function(e){r&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(i&&(e=i(e,s.filterArguments,t.args)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(i&&(e=i(e,s.filterArguments,t.args)),window[t.success](e)):"function"==typeof t.success&&(i&&(e=i(e,s.filterArguments,t.args)),t.success(e)))},error:function(e){o&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:e})},this.getUserRecentMedia=function(e,t){var s=this,r=!1,o=this.statusCode,i=!1,n=this.getFilter("getUserRecentMedia"),e="https://api.instagram.com/v1/users/"+e+"/media/recent/?access_token="+u();void 0===t||0===t.length||("success"in t&&(r=!0),"statusCode"in t&&(o=t.statusCode),"args"in t||(t.args={}),"error"in t&&(i=!0),"count"in t?(t.count=parseInt(t.count),(!Number.isInteger(t.count)||t.count<=0)&&(t.count=33)):t.count=33,e+="&count="+t.count,"min_id"in t&&(e+="&min_id="+t.min_id),"max_id"in t&&(e+="&max_id="+t.max_id)),jQuery.ajax({type:"POST",dataType:"jsonp",url:e,success:function(e){void 0===e.data&&(e.data=[]),r&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(n&&(e=n(e,s.filterArguments,t.args)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(n&&(e=n(e,s.filterArguments,t.args)),window[t.success](e)):"function"==typeof t.success&&(n&&(e=n(e,s.filterArguments,t.args)),t.success(e)))},error:function(e){i&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:o})},this.getUserMedia=function(r,o,i){o=void 0===o?"":o,i=void 0===i||"number"!=typeof i?0:i;var n=this,c=!1,e=this.statusCode,t=!1,a=this.getFilter("getUserMedia"),s=g(),u=wdi_ajax.feed_id;void 0===r||0===r.length||("success"in r&&(c=!0),"error"in r&&(t=!0),"statusCode"in r&&(e=r.statusCode),"args"in r||(r.args={}),"count"in r?(r.count=parseInt(r.count),(!Number.isInteger(r.count)||r.count<=0)&&(r.count=20)):r.count=20,"feed_id"in r&&(u=r.feed_id),"user_name"in r&&(s=r.user_name)),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,action:"wdi_getUserMedia",user_name:s,feed_id:u,next_url:o,iter:i},success:function(e){var t=!1,s="";if(void 0!==e.error&&(t=!0,s=e.error.type),void 0!==e.error&&"OAuthException"!==e.error.type&&l<5)return l++,void w.getUserMedia(r,o,e.iter);void 0!==e.iter&&p.data.length<parseInt(wdi_ajax.number_of_photos)&&i<20&&""!=e.pagination.next_url?(o=e.pagination.next_url,p.data=p.data.concat(e.data),p.pagination=e.pagination,w.getUserMedia(r,o,e.iter)):(0!=p.data.length&&(e.data=p.data),e.meta={code:200,error:t,error_type:s},c&&("object"==typeof r.success&&2==r.success.length?void 0!==window[r.success[0]]&&"function"==typeof window[r.success[0]][r.success[1]]&&(a&&(e=w.addTags(e),e=a(e,n.filterArguments,r)),window[r.success[0]][r.success[1]](e)):"string"==typeof r.success?"function"==typeof window[r.success]&&(a&&(e=w.addTags(e),e=a(e,n.filterArguments,r)),window[r.success](e)):"function"==typeof r.success&&r.success(e)))},error:function(e){t&&("object"==typeof r.error&&2==r.error.length?"function"==typeof window[r.error[0]][r.error[1]]&&window[r.error[0]][r.error[1]](e):"string"==typeof r.error?"function"==typeof window[r.error]&&window[r.error](e):"function"==typeof r.error&&r.error(e))},statusCode:e})},this.getUserInfo=function(e,t){var s=this,r=!1,o=this.statusCode,i=!1,n=this.getFilter("getUserInfo");void 0===t||0===t.length||("success"in t&&(r=!0),"error"in t&&(i=!0),"statusCode"in t&&(o=t.statusCode)),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/"+e+"/?access_token="+u(),success:function(e){r&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(n&&(e=n(e,s.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(n&&(e=n(e,s.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(n&&(e=n(e,s.filterArguments)),t.success(e)))},error:function(e){i&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:o})},this.getSelfInfo=function(s){var r=this,o=!1,i=this.statusCode,n=!1,c=this.getFilter("getSelfInfo");void 0===s||0===s.length||("success"in s&&(o=!0),"error"in s&&(n=!0),"statusCode"in s&&(i=s.statusCode));var a="https://graph.facebook.com/v3.2/"+(void 0!==w.user&&void 0!==w.user.user_id?w.user.user_id:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user?wdi_object.user.user_id:"")+"?fields=id,ig_id,username,name,biography,profile_picture_url,followers_count,follows_count,media_count,website&access_token="+u();w.getDataFromCache(function(e){var t;!1===e?jQuery.ajax({type:"POST",dataType:"jsonp",url:a,statusCode:i,success:function(e){w.setDataToCache(a,e),o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(c&&(e.meta={code:200},e=c(e,r.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(c&&(e.meta={code:200},e=c(e,r.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(c&&(e.meta={code:200},e=c(e,r.filterArguments)),s.success(e)))},error:function(e){n&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))}}):(t=e,o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(c&&(t=c(t,r.filterArguments)),window[s.success[0]][s.success[1]](t)):"string"==typeof s.success?"function"==typeof window[s.success]&&(c&&(t=c(t,r.filterArguments)),window[s.success](t)):"function"==typeof s.success&&(c&&(t=c(t,r.filterArguments)),s.success(t))))},a)},this.getRecentMediaComments=function(e,t,s){var r=this,o=!1,i=this.statusCode,n=!1,c=this.getFilter("getRecentMediaComments");void 0===t||0===t.length||("success"in t&&(o=!0),"error"in t&&(n=!0),"statusCode"in t&&(i=t.statusCode)),jQuery(".wdi_comment_container #ajax_loading #opacity_div").css("display","block"),jQuery(".wdi_comment_container #ajax_loading #loading_div").css("display","block"),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,action:"wdi_getRecentMediaComments",user_name:g(),media_id:e,next:s},success:function(e){e=e,o&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(c&&(e=c(e,r.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(c&&(e=c(e,r.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(c&&(e=c(e,r.filterArguments)),t.success(e)))},complete:function(){jQuery(".wdi_comment_container #ajax_loading #opacity_div").css("display","none"),jQuery(".wdi_comment_container #ajax_loading #loading_div").css("display","none")},error:function(e){n&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:i})},this.getRecentMediaLikes=function(e,t){var s=this,r=!1,o=this.statusCode,i=!1,n=this.getFilter("getRecentMediaLikes");void 0===t||0===t.length||("success"in t&&(r=!0),"error"in t&&(i=!0),"statusCode"in t&&(o=t.statusCode)),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/media/"+e+"/likes?access_token="+u(),success:function(e){r&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(n&&(e=n(e,s.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(n&&(e=n(e,s.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(n&&(e=n(e,s.filterArguments)),t.success(e)))},error:function(e){i&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:o})},this.getDataFromCache=function(t,e,s){void 0===s&&(s=!0),jQuery.ajax({type:"POST",async:s,url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_cache_name:e,wdi_nonce:wdi_ajax.wdi_nonce,WDI_MINIFY:wdi_ajax.WDI_MINIFY,task:"get",action:"wdi_cache"},success:function(e){e.success&&void 0!==e.cache_data&&null!==e.cache_data?(e=JSON.parse(e.cache_data),t(e)):t(!1)}})},this.setDataToCache=function(e,t){jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_cache_name:e,wdi_cache_response:JSON.stringify(t),wdi_nonce:wdi_ajax.wdi_nonce,task:"set",action:"wdi_cache"},success:function(e){}})}}
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: custom instagram feed, feed, instagram, hashtag, Instagram feed, instagram
4
  Requires at least: 3.9
5
  Requires PHP: 5.2
6
  Tested up to: 5.6
7
- Stable tag: 1.4.13
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -505,6 +505,12 @@ Please make sure you don't have any important information before you proceed.
505
  10Web Social Photo Feed for Instagram plugin uses Instagram API on website front end. You have to authorize the plugin via sign in to get data from Instagram on your behalf. The plugin does not send any user’s data to Instagram. All the data received from Instagram via API is cached in WordPress database for some short customizable period to provide front end optimization. You can delete or update cached data. Instagram saves some cookies in browsers of website visitors via API data. These cookies are mostly used for security purposes. They are regulated under terms of Instagram’s privacy policy https://instagram.com/legal/privacy. The plugin asks for your consent to collect site administrator’s email address and site URL to offer customer support, deals and discounts on premium products and more.
506
 
507
  == Changelog ==
 
 
 
 
 
 
508
  = 1.4.13 =
509
  Fixed: Preview in Elementor.
510
  Fixed: Issue when "Check for new posts every" option set to 0.
4
  Requires at least: 3.9
5
  Requires PHP: 5.2
6
  Tested up to: 5.6
7
+ Stable tag: 1.4.14
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
505
  10Web Social Photo Feed for Instagram plugin uses Instagram API on website front end. You have to authorize the plugin via sign in to get data from Instagram on your behalf. The plugin does not send any user’s data to Instagram. All the data received from Instagram via API is cached in WordPress database for some short customizable period to provide front end optimization. You can delete or update cached data. Instagram saves some cookies in browsers of website visitors via API data. These cookies are mostly used for security purposes. They are regulated under terms of Instagram’s privacy policy https://instagram.com/legal/privacy. The plugin asks for your consent to collect site administrator’s email address and site URL to offer customer support, deals and discounts on premium products and more.
506
 
507
  == Changelog ==
508
+ = 1.4.14 =
509
+ Fixed: Removing feed.
510
+ Fixed: Deactivation after uninstall.
511
+ Fixed: Duplicated images in filmstrip.
512
+ Fixed: Load more.
513
+
514
  = 1.4.13 =
515
  Fixed: Preview in Elementor.
516
  Fixed: Issue when "Check for new posts every" option set to 0.
wd-instagram-feed.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: 10Web Social Photo Feed
4
  * Plugin URI: https://10web.io/plugins/wordpress-instagram-feed/?utm_source=instagram_feed&utm_medium=free_plugin
5
  * Description: 10Web Social Photo Feed is a user-friendly tool for displaying user or hashtag-based feeds on your website. You can create feeds with one of the available layouts. It allows displaying image metadata, open up images in lightbox, download them and even share in social networking websites.
6
- * Version: 1.4.13
7
  * Author: 10Web
8
  * Author URI: https://10Web.io/plugins/?utm_source=instagram_feed&utm_medium=free_plugin
9
  * License: GPLv2 or later
3
  * Plugin Name: 10Web Social Photo Feed
4
  * Plugin URI: https://10web.io/plugins/wordpress-instagram-feed/?utm_source=instagram_feed&utm_medium=free_plugin
5
  * Description: 10Web Social Photo Feed is a user-friendly tool for displaying user or hashtag-based feeds on your website. You can create feeds with one of the available layouts. It allows displaying image metadata, open up images in lightbox, download them and even share in social networking websites.
6
+ * Version: 1.4.14
7
  * Author: 10Web
8
  * Author URI: https://10Web.io/plugins/?utm_source=instagram_feed&utm_medium=free_plugin
9
  * License: GPLv2 or later