Version Description
Fixed: Ordering for hashtag.
Download this release
Release Info
Developer | 10web |
Plugin | WD Instagram Feed – Instagram Gallery |
Version | 1.4.12 |
Comparing to | |
See all releases |
Code changes from version 1.4.11 to 1.4.12
- admin/controllers/feeds.php +1 -11
- admin/models/feeds.php +1 -1
- admin/views/feeds.php +31 -2
- config.php +18 -0
- framework/WDI_form_builder.php +24 -27
- frontend/views/thumbnails.php +0 -2
- js/wdi_frontend.js +41 -116
- js/wdi_frontend.min.js +1 -1
- js/wdi_instagram.js +6 -3
- js/wdi_instagram.min.js +1 -1
- readme.txt +4 -1
- wd-instagram-feed.php +2 -15
admin/controllers/feeds.php
CHANGED
@@ -215,20 +215,10 @@ class Feeds_controller_wdi {
|
|
215 |
require_once (WDI_DIR."/framework/WDIInstagram.php");
|
216 |
$WDIInstagram = new WDIInstagram();
|
217 |
$WDIInstagram->wdi_preload_cache(json_decode(stripslashes($posts["feed_users"]), TRUE));
|
218 |
-
if ( !empty($wdi_options['wdi_authenticated_users_list']) ) {
|
219 |
-
$authenticated_users = json_decode($wdi_options['wdi_authenticated_users_list'], TRUE);
|
220 |
-
if ( !empty($authenticated_users[$posts['user_name']]) ) {
|
221 |
-
$user = $authenticated_users[$posts['user_name']];
|
222 |
-
if ( $user['type'] == 'personal' ) {
|
223 |
-
$settings['display_user_post_follow_number'] = 0;
|
224 |
-
$settings['display_user_info'] = 0;
|
225 |
-
}
|
226 |
-
}
|
227 |
-
}
|
228 |
|
229 |
$message_id = 23;
|
230 |
if ( $action == '' ) {
|
231 |
-
|
232 |
$wpdb->insert($wpdb->prefix . WDI_FEED_TABLE, $settings, $this->dataFormat);
|
233 |
if ( $wpdb->insert_id == FALSE ) {
|
234 |
$message_id = 24;
|
215 |
require_once (WDI_DIR."/framework/WDIInstagram.php");
|
216 |
$WDIInstagram = new WDIInstagram();
|
217 |
$WDIInstagram->wdi_preload_cache(json_decode(stripslashes($posts["feed_users"]), TRUE));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
|
219 |
$message_id = 23;
|
220 |
if ( $action == '' ) {
|
221 |
+
$settings["feed_name"] = $model->get_unique_title($settings["feed_name"]);
|
222 |
$wpdb->insert($wpdb->prefix . WDI_FEED_TABLE, $settings, $this->dataFormat);
|
223 |
if ( $wpdb->insert_id == FALSE ) {
|
224 |
$message_id = 24;
|
admin/models/feeds.php
CHANGED
@@ -136,7 +136,7 @@ class Feeds_model_wdi {
|
|
136 |
'mobile_breakpoint' => '640',
|
137 |
'redirect_url' => '',
|
138 |
'feed_resolution' => 'optimal',
|
139 |
-
'hashtag_top_recent' => '
|
140 |
);
|
141 |
if(WDI_IS_FREE){
|
142 |
$settings["show_description"] = "0";
|
136 |
'mobile_breakpoint' => '640',
|
137 |
'redirect_url' => '',
|
138 |
'feed_resolution' => 'optimal',
|
139 |
+
'hashtag_top_recent' => '0',
|
140 |
);
|
141 |
if(WDI_IS_FREE){
|
142 |
$settings["show_description"] = "0";
|
admin/views/feeds.php
CHANGED
@@ -420,7 +420,22 @@ class Feeds_view_wdi {
|
|
420 |
)
|
421 |
)
|
422 |
),
|
423 |
-
'display_user_info' => array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
424 |
'follow_on_instagram_btn' => array(
|
425 |
'name' => 'follow_on_instagram_btn',
|
426 |
'title' => __('Show "Follow On Instagram" button', 'wd-instagram-feed'),
|
@@ -438,7 +453,21 @@ class Feeds_view_wdi {
|
|
438 |
),
|
439 |
'show_description' => array('name' => 'show_description', 'title' => __('Show Media Caption', 'wd-instagram-feed'), 'type' => 'checkbox', 'tooltip' => '','hide_ids'=>array('show_full_description'), 'attr' => array(array('name' => 'tab', 'value' => 'feed_settings'), array('name' => 'section', 'value' => 'thumbnails,masonry,blog_style,image_browser'))),
|
440 |
'show_full_description' => array('name' => 'show_full_description', 'title' => __('Show Full Description', 'wd-instagram-feed'), 'type' => 'checkbox', 'tooltip' => __('Discription will be shown no matter how long it is', 'wd-instagram-feed'), 'attr' => array(array('name' => 'tab', 'value' => 'feed_settings'), array('name' => 'section', 'value' => 'masonry'))),
|
441 |
-
'show_likes' => array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
442 |
'show_comments' => array('name' => 'show_comments', 'title' => __('Show Number of Comments', 'wd-instagram-feed'), 'type' => 'checkbox', 'tooltip' => '', 'attr' => array(array('name' => 'tab', 'value' => 'feed_settings'), array('name' => 'section', 'value' => 'thumbnails,masonry,blog_style,image_browser'))),
|
443 |
'show_username_on_thumb' => array('name' => 'show_username_on_thumb', 'title' => __('Show Username On Image Thumb', 'wd-instagram-feed'), 'type' => 'checkbox', 'tooltip' => '', 'attr' => array(array('name' => 'tab', 'value' => 'feed_settings'), array('name' => 'section', 'value' => 'thumbnails,masonry'))),
|
444 |
),
|
420 |
)
|
421 |
)
|
422 |
),
|
423 |
+
'display_user_info' => array(
|
424 |
+
'name' => 'display_user_info',
|
425 |
+
'title' => __('Show User Bio and Website', 'wd-instagram-feed'),
|
426 |
+
'type' => 'checkbox',
|
427 |
+
'tooltip' => __('User bio will be displayed if feed has only one user', 'wd-instagram-feed'),
|
428 |
+
'attr' => array(
|
429 |
+
array(
|
430 |
+
'name' => 'tab',
|
431 |
+
'value' => 'feed_settings'
|
432 |
+
),
|
433 |
+
array(
|
434 |
+
'name' => 'section',
|
435 |
+
'value' => 'thumbnails,masonry,blog_style,image_browser'
|
436 |
+
)
|
437 |
+
)
|
438 |
+
),
|
439 |
'follow_on_instagram_btn' => array(
|
440 |
'name' => 'follow_on_instagram_btn',
|
441 |
'title' => __('Show "Follow On Instagram" button', 'wd-instagram-feed'),
|
453 |
),
|
454 |
'show_description' => array('name' => 'show_description', 'title' => __('Show Media Caption', 'wd-instagram-feed'), 'type' => 'checkbox', 'tooltip' => '','hide_ids'=>array('show_full_description'), 'attr' => array(array('name' => 'tab', 'value' => 'feed_settings'), array('name' => 'section', 'value' => 'thumbnails,masonry,blog_style,image_browser'))),
|
455 |
'show_full_description' => array('name' => 'show_full_description', 'title' => __('Show Full Description', 'wd-instagram-feed'), 'type' => 'checkbox', 'tooltip' => __('Discription will be shown no matter how long it is', 'wd-instagram-feed'), 'attr' => array(array('name' => 'tab', 'value' => 'feed_settings'), array('name' => 'section', 'value' => 'masonry'))),
|
456 |
+
'show_likes' => array(
|
457 |
+
'name' => 'show_likes',
|
458 |
+
'title' => __('Show Number of Likes', 'wd-instagram-feed'),
|
459 |
+
'type' => 'checkbox',
|
460 |
+
'tooltip' => '',
|
461 |
+
'attr' => array(
|
462 |
+
array(
|
463 |
+
'name' => 'tab',
|
464 |
+
'value' => 'feed_settings'
|
465 |
+
),
|
466 |
+
array(
|
467 |
+
'name' => 'section',
|
468 |
+
'value' => 'thumbnails,masonry,blog_style,image_browser')
|
469 |
+
)
|
470 |
+
),
|
471 |
'show_comments' => array('name' => 'show_comments', 'title' => __('Show Number of Comments', 'wd-instagram-feed'), 'type' => 'checkbox', 'tooltip' => '', 'attr' => array(array('name' => 'tab', 'value' => 'feed_settings'), array('name' => 'section', 'value' => 'thumbnails,masonry,blog_style,image_browser'))),
|
472 |
'show_username_on_thumb' => array('name' => 'show_username_on_thumb', 'title' => __('Show Username On Image Thumb', 'wd-instagram-feed'), 'type' => 'checkbox', 'tooltip' => '', 'attr' => array(array('name' => 'tab', 'value' => 'feed_settings'), array('name' => 'section', 'value' => 'thumbnails,masonry'))),
|
473 |
),
|
config.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( !defined('ABSPATH') ) {
|
3 |
+
exit;
|
4 |
+
}
|
5 |
+
|
6 |
+
define('WDI_VERSION', '1.4.12');
|
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');
|
15 |
+
define('WDI_TSN', 'wdi_theme_settings');
|
16 |
+
define('WDI_FEED_TABLE', 'wdi_feeds');
|
17 |
+
define('WDI_THEME_TABLE', 'wdi_themes');
|
18 |
+
define('WDI_MINIFY', TRUE);
|
framework/WDI_form_builder.php
CHANGED
@@ -358,15 +358,13 @@ public function __construct() {
|
|
358 |
<div class="wdwt_param" id="WDI_wrap_<?php echo $element['name'];?>">
|
359 |
<div class="block">
|
360 |
<div class="optioninput">
|
361 |
-
<?php
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
}
|
369 |
-
|
370 |
foreach ( $options as $key => $option ) {
|
371 |
$disable = '';
|
372 |
$disable_text = '';
|
@@ -414,8 +412,7 @@ public function __construct() {
|
|
414 |
for (var opt in <?php echo $id.'_hide_ids'?>){
|
415 |
if(opt == selected){
|
416 |
var ids = <?php echo $id.'_hide_ids'?>[opt].split(',');
|
417 |
-
for (var i in ids){
|
418 |
-
|
419 |
jQuery('#WDI_wrap_'+ids[i]).parent().parent().addClass("<?php echo $id.'_hide_ids_hidden';?>");
|
420 |
}
|
421 |
}
|
@@ -505,22 +502,22 @@ public function __construct() {
|
|
505 |
<div class="block margin">
|
506 |
<div class="optioninput checkbox">
|
507 |
<?php
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
</div>
|
525 |
</div>
|
526 |
</div>
|
358 |
<div class="wdwt_param" id="WDI_wrap_<?php echo $element['name'];?>">
|
359 |
<div class="block">
|
360 |
<div class="optioninput">
|
361 |
+
<?php
|
362 |
+
if($label!='' && $label['place']=='before'){
|
363 |
+
?>
|
364 |
+
<label for="<?php echo $id; ?>"><?php echo $label['text']; ?></label>
|
365 |
+
<?php echo isset($label['br']) ? '<br/>' : ''?>
|
366 |
+
<?php
|
367 |
+
}
|
|
|
|
|
368 |
foreach ( $options as $key => $option ) {
|
369 |
$disable = '';
|
370 |
$disable_text = '';
|
412 |
for (var opt in <?php echo $id.'_hide_ids'?>){
|
413 |
if(opt == selected){
|
414 |
var ids = <?php echo $id.'_hide_ids'?>[opt].split(',');
|
415 |
+
for ( var i in ids ) {
|
|
|
416 |
jQuery('#WDI_wrap_'+ids[i]).parent().parent().addClass("<?php echo $id.'_hide_ids_hidden';?>");
|
417 |
}
|
418 |
}
|
502 |
<div class="block margin">
|
503 |
<div class="optioninput checkbox">
|
504 |
<?php
|
505 |
+
if($label!='' && $label['place']=='before'){
|
506 |
+
?>
|
507 |
+
<label class="<?php echo isset($label['class']) ? $label['class'] : '' ?>" for="<?php echo $id; ?>"><?php echo $label['text']; ?></label>
|
508 |
+
<?php echo isset($label['br'])? '<br/>' : ''?>
|
509 |
+
<?php
|
510 |
+
}
|
511 |
+
?>
|
512 |
+
<input <?php echo $disable; ?> type="checkbox" class="checkbox" name="<?php echo $name; ?>" id="<?php echo $id ?>" <?php echo $attr;?> <?php checked(1,$opt_value)?> value="1">
|
513 |
+
<?php
|
514 |
+
if($label!='' && $label['place']=='after'){
|
515 |
+
?>
|
516 |
+
<?php echo isset($label['br'])? '<br/>' : ''?>
|
517 |
+
<label class="<?php echo isset($label['class']) ? $label['class'] : '' ?>" for="<?php echo $id; ?>"><?php echo $label['text']; ?></label>
|
518 |
+
<?php
|
519 |
+
}
|
520 |
+
?>
|
521 |
</div>
|
522 |
</div>
|
523 |
</div>
|
frontend/views/thumbnails.php
CHANGED
@@ -184,9 +184,7 @@ class WDI_Thumbnails_view {
|
|
184 |
#wdi_feed_<?php echo $wdi_feed_counter?> .wdi_feed_header {
|
185 |
display: <?php echo ($feed_row['display_header']=='1')? 'block' : 'none'?>; /*if display-header is true display:block*/
|
186 |
}
|
187 |
-
|
188 |
<?php
|
189 |
-
|
190 |
if($feed_row['display_user_post_follow_number'] == '1'){
|
191 |
$header_text_padding =(intval($style['user_img_width']) - intval($style['users_text_font_size']))/4;
|
192 |
}else{
|
184 |
#wdi_feed_<?php echo $wdi_feed_counter?> .wdi_feed_header {
|
185 |
display: <?php echo ($feed_row['display_header']=='1')? 'block' : 'none'?>; /*if display-header is true display:block*/
|
186 |
}
|
|
|
187 |
<?php
|
|
|
188 |
if($feed_row['display_user_post_follow_number'] == '1'){
|
189 |
$header_text_padding =(intval($style['user_img_width']) - intval($style['users_text_font_size']))/4;
|
190 |
}else{
|
js/wdi_frontend.js
CHANGED
@@ -53,12 +53,14 @@ wdi_front.show_alert = function ( message, response, wdi_current_feed ) {
|
|
53 |
});
|
54 |
}
|
55 |
}
|
56 |
-
else {
|
|
|
57 |
wdi_current_feed.find('.wdi_single_user').remove();
|
58 |
wdi_js_error.removeClass('wdi_js_error');
|
59 |
wdi_js_error.addClass('wdi_js_error_no_animate');
|
60 |
jQuery('.wdi_js_error_no_animate').show();
|
61 |
}
|
|
|
62 |
if ( wdi_front_messages.show_alerts ) {
|
63 |
// alert(message);
|
64 |
}
|
@@ -346,14 +348,14 @@ wdi_front.instagramRequest = function (id, currentFeed) {
|
|
346 |
if ( this.getInputType(feed_users[id]['username']) == 'hashtag' ) {
|
347 |
currentFeed.instagram.getTagRecentMedia(this.stripHashtag(feed_users[id]['username']), {
|
348 |
success: function (response) {
|
349 |
-
if ( typeof response.meta != 'undefined' && response.meta.error == true ) {
|
350 |
wdi_front.show_alert(false, response, currentFeed);
|
351 |
return false;
|
352 |
}
|
353 |
currentFeed.mediaRequestsDone = true;
|
354 |
response = _this.checkMediaResponse(response, currentFeed);
|
355 |
if ( response != false ) {
|
356 |
-
|
357 |
}
|
358 |
}
|
359 |
}, null, currentFeed.feed_row.hashtag_top_recent);
|
@@ -408,7 +410,6 @@ wdi_front.saveUserData = function (data, user, currentFeed) {
|
|
408 |
currentFeed.currentResponseLength = wdi_front.getArrayContentLength(currentFeed.usersData, 'data');
|
409 |
currentFeed.allResponseLength += currentFeed.currentResponseLength;
|
410 |
if (currentFeed.dataCount == currentFeed.usersData.length) {
|
411 |
-
|
412 |
//if getted objects is not enough then recuest new ones
|
413 |
if (currentFeed.currentResponseLength < currentFeed.feed_row.number_of_photos && !wdi_front.userHasNoPhoto(currentFeed)) {
|
414 |
/*here we are calling loadMore function out of recursion cycle, after this initial-keep call
|
@@ -422,7 +423,7 @@ wdi_front.saveUserData = function (data, user, currentFeed) {
|
|
422 |
//when all data us properly displayed check for any active filters and then apply them
|
423 |
wdi_front.applyFilters(currentFeed);
|
424 |
/*removing load more button of feed has finished*/
|
425 |
-
if (!wdi_front.activeUsersCount(currentFeed)) {
|
426 |
if (currentFeed.feed_row.feed_display_view == 'load_more_btn') {
|
427 |
var feed_container = jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter);
|
428 |
feed_container.find('.wdi_load_more').addClass('wdi_hidden');
|
@@ -524,7 +525,7 @@ wdi_front.appendRequestHashtag = function (data, hashtag) {
|
|
524 |
wdi_front.displayFeed = function (currentFeed, load_more_number) {
|
525 |
if (currentFeed.customFilterChanged == false) {
|
526 |
// sorting data...
|
527 |
-
|
528 |
}
|
529 |
|
530 |
//becomes true when user clicks in frontend filter
|
@@ -572,12 +573,12 @@ wdi_front.displayFeed = function (currentFeed, load_more_number) {
|
|
572 |
var mustLoadedCount = parseInt(currentFeed.feed_row.number_of_photos)+parseInt(currentFeed.feed_row.load_more_number*currentFeed.currentPageLoadMore);
|
573 |
if (dataLength < mustLoadedCount && !frontendCustomFilterClicked && currentFeed.instagramRequestCounter <= currentFeed.maxConditionalFiltersRequestCount && !wdi_front.allDataHasFinished(currentFeed)) {
|
574 |
wdi_front.loadMore('', currentFeed);
|
575 |
-
}
|
|
|
576 |
currentFeed.currentPageLoadMore++;
|
577 |
wdi_front.allImagesLoaded(currentFeed);
|
578 |
}
|
579 |
|
580 |
-
|
581 |
/**
|
582 |
* if maximum number of requests are reached then stop laoding more images and show images which are available
|
583 |
* @param {Number} currentFeed.instagramRequestCounter > currentFeed.maxConditionalFiltersRequestCount [description]
|
@@ -600,7 +601,6 @@ wdi_front.displayFeed = function (currentFeed, load_more_number) {
|
|
600 |
jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter).find('#wdi_last_page').removeClass('wdi_disabled');
|
601 |
}
|
602 |
|
603 |
-
|
604 |
// reset instagram request counter to zero for next set of requests
|
605 |
currentFeed.instagramRequestCounter = 0;
|
606 |
|
@@ -637,8 +637,6 @@ wdi_front.updateUsersImages = function (currentFeed) {
|
|
637 |
if (currentFeed.feed_row.liked_feed == 'liked') {
|
638 |
return;
|
639 |
}
|
640 |
-
|
641 |
-
|
642 |
for (var j = 0; j < currentFeed.usersData.length; j++) {
|
643 |
if (currentFeed.usersData[j]['username'] == jQuery(this).parent().parent().find('h3').text()) {
|
644 |
if (currentFeed.usersData[j]['data'].length != 0) {
|
@@ -945,13 +943,10 @@ wdi_front.displayFeedItems = function (data, currentFeed) {
|
|
945 |
//calls wdi_responsive.columnControl() which calculates column number on page
|
946 |
//and gives feed_wrapper proper column class
|
947 |
if (columnFlag === false) {
|
948 |
-
|
949 |
-
|
950 |
wdi_responsive.columnControl(currentFeed, 1);
|
951 |
columnFlag = true;
|
952 |
}
|
953 |
|
954 |
-
|
955 |
// //Binds caption opening and closing event to each image photo_title/mmmmmm
|
956 |
// if (currentFeed.feed_row.feed_type != 'blog_style') {
|
957 |
// wdi_responsive.bindCaptionEvent(jQuery(this).parent().parent().parent().parent().find('.wdi_photo_title'), currentFeed);
|
@@ -1091,17 +1086,14 @@ wdi_front.sortingOperator = function (sortImagesBy, sortOrder) {
|
|
1091 |
* Calls smart picker method and then after receiving data it sorts data based on user choice
|
1092 |
*/
|
1093 |
wdi_front.feedSort = function (currentFeed, load_more_number) {
|
1094 |
-
|
1095 |
var sortImagesBy = currentFeed.feed_row['sort_images_by'];
|
1096 |
var sortOrder = currentFeed.feed_row['display_order'];
|
1097 |
-
|
1098 |
if (currentFeed.feed_row['resort_after_load_more'] === '1') {
|
1099 |
-
|
1100 |
-
}
|
1101 |
-
|
|
|
1102 |
}
|
1103 |
-
|
1104 |
-
|
1105 |
var operator = wdi_front.sortingOperator(sortImagesBy, sortOrder);
|
1106 |
currentFeed['data'].sort(operator);
|
1107 |
return currentFeed['data'];
|
@@ -1112,51 +1104,41 @@ wdi_front.feedSort = function (currentFeed, load_more_number) {
|
|
1112 |
* and stops picking when it reaches number_of_photos limit
|
1113 |
*/
|
1114 |
wdi_front.smartPicker = function (currentFeed, load_more_number) {
|
1115 |
-
|
1116 |
var dataStorage = [];
|
1117 |
var dataLength = 0;
|
1118 |
var readyData = [];
|
1119 |
-
var perUser = Math.ceil(currentFeed['feed_row']['number_of_photos'] / currentFeed['usersData'].length);
|
1120 |
var number_of_photos = parseInt(currentFeed['feed_row']['number_of_photos']);
|
|
|
1121 |
var remainder = 0;
|
1122 |
-
|
1123 |
-
//check if loadmore was clicked
|
1124 |
if (load_more_number != '' && typeof load_more_number != 'undefined' && load_more_number != null) {
|
1125 |
number_of_photos = parseInt(load_more_number);
|
1126 |
perUser = Math.ceil(number_of_photos / wdi_front.activeUsersCount(currentFeed));
|
1127 |
}
|
1128 |
|
1129 |
-
|
1130 |
-
var sortOperator = function (a, b)
|
1131 |
-
{
|
1132 |
return (a['data'].length > b['data'].length) ? 1 : -1;
|
1133 |
}
|
1134 |
|
1135 |
-
var sortOperator1 = function (a, b)
|
1136 |
-
{
|
1137 |
return (a.length() > b.length()) ? 1 : -1;
|
1138 |
}
|
1139 |
|
1140 |
-
|
1141 |
// storing user data in global dataStoreageRaw variable
|
1142 |
currentFeed.storeRawData(currentFeed.usersData, 'dataStorageRaw');
|
1143 |
|
1144 |
-
//dataStorageRaw
|
1145 |
var dataStorageRaw = currentFeed['dataStorageRaw'].sort(sortOperator1);
|
1146 |
|
1147 |
//sorts user data desc
|
1148 |
var usersData = currentFeed['usersData'].sort(sortOperator);
|
1149 |
-
|
1150 |
-
|
1151 |
//picks data from users and updates pagination in request json
|
1152 |
-
//for next time call
|
1153 |
-
for (var i = 0; i < usersData.length; i++) {
|
1154 |
|
|
|
|
|
1155 |
remainder += perUser;
|
1156 |
-
|
1157 |
/* if data is less then amount for each user then pick all data */
|
1158 |
if (dataStorageRaw[i].length() <= remainder) {
|
1159 |
-
|
1160 |
/* update remainder */
|
1161 |
remainder -= dataStorageRaw[i].length();
|
1162 |
|
@@ -1164,101 +1146,45 @@ wdi_front.smartPicker = function (currentFeed, load_more_number) {
|
|
1164 |
dataStorage.push(dataStorageRaw[i].getData(dataStorageRaw[i].length()));
|
1165 |
/* update data length */
|
1166 |
dataLength += dataStorage[dataStorage.length - 1].length;
|
1167 |
-
|
1168 |
-
|
1169 |
-
} else {
|
1170 |
if (dataLength + remainder > number_of_photos) {
|
1171 |
remainder = number_of_photos - dataLength;
|
1172 |
}
|
1173 |
|
1174 |
var pickedData = [];
|
1175 |
-
|
1176 |
-
|
1177 |
if (currentFeed['auto_trigger'] === false) {
|
1178 |
pickedData = pickedData.concat(dataStorageRaw[i].getData(remainder));
|
1179 |
-
}
|
|
|
1180 |
if (pickedData.length + wdi_front.getDataLength(currentFeed) + wdi_front.getDataLength(currentFeed, dataStorage) < currentFeed['feed_row']['number_of_photos']) {
|
1181 |
pickedData = pickedData.concat(dataStorageRaw[i].getData(remainder));
|
1182 |
}
|
1183 |
}
|
1184 |
|
1185 |
remainder = 0;
|
1186 |
-
|
1187 |
dataLength += pickedData.length;
|
1188 |
dataStorage.push(pickedData);
|
1189 |
}
|
1190 |
-
|
1191 |
-
|
1192 |
-
/*if (usersData[i]['data'].length <= remainder) {
|
1193 |
-
|
1194 |
-
var pagination = usersData[i]['pagination']['next_url'];
|
1195 |
-
if (usersData[i]['finished'] === undefined) {
|
1196 |
-
dataStorage.push(usersData[i]['data']);
|
1197 |
-
remainder -= usersData[i]['data'].length;
|
1198 |
-
dataLength += usersData[i]['data'].length;
|
1199 |
-
}
|
1200 |
-
|
1201 |
-
if (usersData[i]['finished'] === undefined) {
|
1202 |
-
if (pagination === undefined || pagination === '' || pagination === null) {
|
1203 |
-
usersData[i]['finished'] = 'finished';
|
1204 |
-
}
|
1205 |
-
}
|
1206 |
-
} else {
|
1207 |
-
if ((dataLength + remainder) > number_of_photos) {
|
1208 |
-
remainder = number_of_photos - dataLength;
|
1209 |
-
}
|
1210 |
-
var pickedData = [];
|
1211 |
-
var indexPuller = 0;
|
1212 |
-
for (var j = 0; j < remainder; j++) {
|
1213 |
-
if (currentFeed['auto_trigger'] === false) {
|
1214 |
-
if (usersData[i]['finished'] === undefined) {
|
1215 |
-
pickedData.push(usersData[i]['data'][j]);
|
1216 |
-
}
|
1217 |
-
} else {
|
1218 |
-
if (pickedData.length + wdi_front.getDataLength(currentFeed) + wdi_front.getDataLength(currentFeed, dataStorage) < currentFeed['feed_row']['number_of_photos']) {
|
1219 |
-
if (usersData[i]['finished'] === undefined) {
|
1220 |
-
pickedData.push(usersData[i]['data'][j]);
|
1221 |
-
}
|
1222 |
-
} else {
|
1223 |
-
indexPuller++;
|
1224 |
-
}
|
1225 |
-
}
|
1226 |
-
|
1227 |
-
}
|
1228 |
-
j -= indexPuller;
|
1229 |
-
|
1230 |
-
remainder = 0;
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
//updating pagination
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
//pushes picked data into local storage
|
1239 |
-
dataLength += pickedData.length;
|
1240 |
-
dataStorage.push(pickedData);
|
1241 |
-
|
1242 |
-
}*/
|
1243 |
}
|
1244 |
//checks if in golbal storage user already exisit then it adds new data to user old data
|
1245 |
//else it simple puches new user with it's data to global storage
|
1246 |
for (i = 0; i < dataStorage.length; i++) {
|
1247 |
if (typeof currentFeed.dataStorage[i] === 'undefined') {
|
1248 |
currentFeed.dataStorage.push(dataStorage[i]);
|
1249 |
-
}
|
|
|
1250 |
currentFeed.dataStorage[i] = currentFeed.dataStorage[i].concat(dataStorage[i]);
|
1251 |
}
|
1252 |
}
|
1253 |
|
1254 |
-
//parsing data for lightbox
|
1255 |
-
|
1256 |
|
1257 |
-
//combines together all avialable data in global storage and returns it
|
1258 |
for (i = 0; i < dataStorage.length; i++) {
|
1259 |
readyData = readyData.concat(dataStorage[i]);
|
1260 |
}
|
1261 |
-
|
1262 |
return readyData;
|
1263 |
}
|
1264 |
|
@@ -1952,7 +1878,6 @@ wdi_front.loadMore = function (button, _currentFeed) {
|
|
1952 |
});
|
1953 |
}
|
1954 |
|
1955 |
-
|
1956 |
//check if all data loaded then remove ajaxLoader
|
1957 |
// To do Arsho
|
1958 |
for (var i = 0; i < currentFeed.usersData.length; i++) {
|
@@ -1981,12 +1906,14 @@ wdi_front.loadMore = function (button, _currentFeed) {
|
|
1981 |
if (pagination['next_url'] != '' && pagination['next_url'] != null && typeof pagination['next_url'] != 'undefined') {
|
1982 |
var next_url = pagination['next_url'];
|
1983 |
wdi_front.loadMoreRequest(user, next_url, currentFeed, button);
|
1984 |
-
}
|
1985 |
-
|
1986 |
if (button == 'initial-keep') {
|
1987 |
currentFeed.temproraryUsersData[i] = currentFeed.usersData[i];
|
1988 |
}
|
1989 |
-
currentFeed.loadMoreDataCount
|
|
|
|
|
1990 |
wdi_front.checkForLoadMoreDone(currentFeed, button);
|
1991 |
continue;
|
1992 |
}
|
@@ -2087,8 +2014,8 @@ wdi_front.checkForLoadMoreDone = function (currentFeed, button) {
|
|
2087 |
displayFeed()*/
|
2088 |
if (gettedDataLength < number_of_photos && !wdi_front.userHasNoPhoto(currentFeed, currentFeed.temproraryUsersData) && currentFeed.instagramRequestCounter <= currentFeed.maxConditionalFiltersRequestCount) {
|
2089 |
wdi_front.loadMore('initial', currentFeed);
|
2090 |
-
}
|
2091 |
-
|
2092 |
currentFeed.usersData = currentFeed.temproraryUsersData;
|
2093 |
|
2094 |
wdi_front.displayFeed(currentFeed);
|
@@ -2097,18 +2024,16 @@ wdi_front.checkForLoadMoreDone = function (currentFeed, button) {
|
|
2097 |
|
2098 |
//resetting temprorary users data array for the next loadmoer call
|
2099 |
currentFeed.temproraryUsersData = [];
|
2100 |
-
|
2101 |
-
|
2102 |
}
|
2103 |
-
|
2104 |
-
|
2105 |
//else load load_more_number photos
|
2106 |
//if existing data length is smaller then load_more_number then get more objects until desired number is reached
|
2107 |
|
2108 |
if (gettedDataLength < load_more_number && !wdi_front.userHasNoPhoto(currentFeed, currentFeed.temproraryUsersData) && currentFeed.instagramRequestCounter <= currentFeed.maxConditionalFiltersRequestCount) {
|
2109 |
wdi_front.loadMore(undefined, currentFeed);
|
2110 |
-
}
|
2111 |
-
|
2112 |
currentFeed.usersData = currentFeed.temproraryUsersData;
|
2113 |
|
2114 |
if (!wdi_front.activeUsersCount(currentFeed)) {
|
@@ -2680,7 +2605,6 @@ wdi_front.convertUnixDate = function (date) {
|
|
2680 |
wdi_front.getDescription = function (desc) {
|
2681 |
desc = desc.replace(/\r?\n|\r/g, ' ');
|
2682 |
|
2683 |
-
|
2684 |
return desc;
|
2685 |
}
|
2686 |
|
@@ -2758,6 +2682,7 @@ wdi_front.activeUsersCount = function (currentFeed) {
|
|
2758 |
counter++;
|
2759 |
}
|
2760 |
}
|
|
|
2761 |
return counter;
|
2762 |
}
|
2763 |
|
53 |
});
|
54 |
}
|
55 |
}
|
56 |
+
else if ( typeof response.error !== 'undefined' && typeof response.error.message !== 'undefined') {
|
57 |
+
wdi_js_error.html(response.error.message);
|
58 |
wdi_current_feed.find('.wdi_single_user').remove();
|
59 |
wdi_js_error.removeClass('wdi_js_error');
|
60 |
wdi_js_error.addClass('wdi_js_error_no_animate');
|
61 |
jQuery('.wdi_js_error_no_animate').show();
|
62 |
}
|
63 |
+
|
64 |
if ( wdi_front_messages.show_alerts ) {
|
65 |
// alert(message);
|
66 |
}
|
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);
|
410 |
currentFeed.currentResponseLength = wdi_front.getArrayContentLength(currentFeed.usersData, 'data');
|
411 |
currentFeed.allResponseLength += currentFeed.currentResponseLength;
|
412 |
if (currentFeed.dataCount == currentFeed.usersData.length) {
|
|
|
413 |
//if getted objects is not enough then recuest new ones
|
414 |
if (currentFeed.currentResponseLength < currentFeed.feed_row.number_of_photos && !wdi_front.userHasNoPhoto(currentFeed)) {
|
415 |
/*here we are calling loadMore function out of recursion cycle, after this initial-keep call
|
423 |
//when all data us properly displayed check for any active filters and then apply them
|
424 |
wdi_front.applyFilters(currentFeed);
|
425 |
/*removing load more button of feed has finished*/
|
426 |
+
if ( !wdi_front.activeUsersCount(currentFeed) ) {
|
427 |
if (currentFeed.feed_row.feed_display_view == 'load_more_btn') {
|
428 |
var feed_container = jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter);
|
429 |
feed_container.find('.wdi_load_more').addClass('wdi_hidden');
|
525 |
wdi_front.displayFeed = function (currentFeed, load_more_number) {
|
526 |
if (currentFeed.customFilterChanged == false) {
|
527 |
// sorting data...
|
528 |
+
var data = wdi_front.feedSort(currentFeed, load_more_number);
|
529 |
}
|
530 |
|
531 |
//becomes true when user clicks in frontend filter
|
573 |
var mustLoadedCount = parseInt(currentFeed.feed_row.number_of_photos)+parseInt(currentFeed.feed_row.load_more_number*currentFeed.currentPageLoadMore);
|
574 |
if (dataLength < mustLoadedCount && !frontendCustomFilterClicked && currentFeed.instagramRequestCounter <= currentFeed.maxConditionalFiltersRequestCount && !wdi_front.allDataHasFinished(currentFeed)) {
|
575 |
wdi_front.loadMore('', currentFeed);
|
576 |
+
}
|
577 |
+
else {
|
578 |
currentFeed.currentPageLoadMore++;
|
579 |
wdi_front.allImagesLoaded(currentFeed);
|
580 |
}
|
581 |
|
|
|
582 |
/**
|
583 |
* if maximum number of requests are reached then stop laoding more images and show images which are available
|
584 |
* @param {Number} currentFeed.instagramRequestCounter > currentFeed.maxConditionalFiltersRequestCount [description]
|
601 |
jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter).find('#wdi_last_page').removeClass('wdi_disabled');
|
602 |
}
|
603 |
|
|
|
604 |
// reset instagram request counter to zero for next set of requests
|
605 |
currentFeed.instagramRequestCounter = 0;
|
606 |
|
637 |
if (currentFeed.feed_row.liked_feed == 'liked') {
|
638 |
return;
|
639 |
}
|
|
|
|
|
640 |
for (var j = 0; j < currentFeed.usersData.length; j++) {
|
641 |
if (currentFeed.usersData[j]['username'] == jQuery(this).parent().parent().find('h3').text()) {
|
642 |
if (currentFeed.usersData[j]['data'].length != 0) {
|
943 |
//calls wdi_responsive.columnControl() which calculates column number on page
|
944 |
//and gives feed_wrapper proper column class
|
945 |
if (columnFlag === false) {
|
|
|
|
|
946 |
wdi_responsive.columnControl(currentFeed, 1);
|
947 |
columnFlag = true;
|
948 |
}
|
949 |
|
|
|
950 |
// //Binds caption opening and closing event to each image photo_title/mmmmmm
|
951 |
// if (currentFeed.feed_row.feed_type != 'blog_style') {
|
952 |
// wdi_responsive.bindCaptionEvent(jQuery(this).parent().parent().parent().parent().find('.wdi_photo_title'), currentFeed);
|
1086 |
* Calls smart picker method and then after receiving data it sorts data based on user choice
|
1087 |
*/
|
1088 |
wdi_front.feedSort = function (currentFeed, load_more_number) {
|
|
|
1089 |
var sortImagesBy = currentFeed.feed_row['sort_images_by'];
|
1090 |
var sortOrder = currentFeed.feed_row['display_order'];
|
|
|
1091 |
if (currentFeed.feed_row['resort_after_load_more'] === '1') {
|
1092 |
+
currentFeed['data'] = currentFeed['data'].concat(wdi_front.smartPicker(currentFeed, load_more_number));
|
1093 |
+
}
|
1094 |
+
else {
|
1095 |
+
currentFeed['data'] = wdi_front.smartPicker(currentFeed, load_more_number);
|
1096 |
}
|
|
|
|
|
1097 |
var operator = wdi_front.sortingOperator(sortImagesBy, sortOrder);
|
1098 |
currentFeed['data'].sort(operator);
|
1099 |
return currentFeed['data'];
|
1104 |
* and stops picking when it reaches number_of_photos limit
|
1105 |
*/
|
1106 |
wdi_front.smartPicker = function (currentFeed, load_more_number) {
|
|
|
1107 |
var dataStorage = [];
|
1108 |
var dataLength = 0;
|
1109 |
var readyData = [];
|
|
|
1110 |
var number_of_photos = parseInt(currentFeed['feed_row']['number_of_photos']);
|
1111 |
+
var perUser = Math.ceil(number_of_photos / currentFeed['usersData'].length);
|
1112 |
var remainder = 0;
|
1113 |
+
// check if loadmore was clicked
|
|
|
1114 |
if (load_more_number != '' && typeof load_more_number != 'undefined' && load_more_number != null) {
|
1115 |
number_of_photos = parseInt(load_more_number);
|
1116 |
perUser = Math.ceil(number_of_photos / wdi_front.activeUsersCount(currentFeed));
|
1117 |
}
|
1118 |
|
1119 |
+
var sortOperator = function (a, b){
|
|
|
|
|
1120 |
return (a['data'].length > b['data'].length) ? 1 : -1;
|
1121 |
}
|
1122 |
|
1123 |
+
var sortOperator1 = function (a, b) {
|
|
|
1124 |
return (a.length() > b.length()) ? 1 : -1;
|
1125 |
}
|
1126 |
|
|
|
1127 |
// storing user data in global dataStoreageRaw variable
|
1128 |
currentFeed.storeRawData(currentFeed.usersData, 'dataStorageRaw');
|
1129 |
|
1130 |
+
// dataStorageRaw
|
1131 |
var dataStorageRaw = currentFeed['dataStorageRaw'].sort(sortOperator1);
|
1132 |
|
1133 |
//sorts user data desc
|
1134 |
var usersData = currentFeed['usersData'].sort(sortOperator);
|
|
|
|
|
1135 |
//picks data from users and updates pagination in request json
|
|
|
|
|
1136 |
|
1137 |
+
//for next time call
|
1138 |
+
for ( var i = 0; i < usersData.length; i++ ) {
|
1139 |
remainder += perUser;
|
|
|
1140 |
/* if data is less then amount for each user then pick all data */
|
1141 |
if (dataStorageRaw[i].length() <= remainder) {
|
|
|
1142 |
/* update remainder */
|
1143 |
remainder -= dataStorageRaw[i].length();
|
1144 |
|
1146 |
dataStorage.push(dataStorageRaw[i].getData(dataStorageRaw[i].length()));
|
1147 |
/* update data length */
|
1148 |
dataLength += dataStorage[dataStorage.length - 1].length;
|
1149 |
+
}
|
1150 |
+
else {
|
|
|
1151 |
if (dataLength + remainder > number_of_photos) {
|
1152 |
remainder = number_of_photos - dataLength;
|
1153 |
}
|
1154 |
|
1155 |
var pickedData = [];
|
|
|
|
|
1156 |
if (currentFeed['auto_trigger'] === false) {
|
1157 |
pickedData = pickedData.concat(dataStorageRaw[i].getData(remainder));
|
1158 |
+
}
|
1159 |
+
else {
|
1160 |
if (pickedData.length + wdi_front.getDataLength(currentFeed) + wdi_front.getDataLength(currentFeed, dataStorage) < currentFeed['feed_row']['number_of_photos']) {
|
1161 |
pickedData = pickedData.concat(dataStorageRaw[i].getData(remainder));
|
1162 |
}
|
1163 |
}
|
1164 |
|
1165 |
remainder = 0;
|
|
|
1166 |
dataLength += pickedData.length;
|
1167 |
dataStorage.push(pickedData);
|
1168 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1169 |
}
|
1170 |
//checks if in golbal storage user already exisit then it adds new data to user old data
|
1171 |
//else it simple puches new user with it's data to global storage
|
1172 |
for (i = 0; i < dataStorage.length; i++) {
|
1173 |
if (typeof currentFeed.dataStorage[i] === 'undefined') {
|
1174 |
currentFeed.dataStorage.push(dataStorage[i]);
|
1175 |
+
}
|
1176 |
+
else {
|
1177 |
currentFeed.dataStorage[i] = currentFeed.dataStorage[i].concat(dataStorage[i]);
|
1178 |
}
|
1179 |
}
|
1180 |
|
1181 |
+
// parsing data for lightbox
|
1182 |
+
currentFeed.parsedData = wdi_front.parseLighboxData(currentFeed);
|
1183 |
|
1184 |
+
// combines together all avialable data in global storage and returns it
|
1185 |
for (i = 0; i < dataStorage.length; i++) {
|
1186 |
readyData = readyData.concat(dataStorage[i]);
|
1187 |
}
|
|
|
1188 |
return readyData;
|
1189 |
}
|
1190 |
|
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++) {
|
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 |
}
|
2014 |
displayFeed()*/
|
2015 |
if (gettedDataLength < number_of_photos && !wdi_front.userHasNoPhoto(currentFeed, currentFeed.temproraryUsersData) && currentFeed.instagramRequestCounter <= currentFeed.maxConditionalFiltersRequestCount) {
|
2016 |
wdi_front.loadMore('initial', currentFeed);
|
2017 |
+
}
|
2018 |
+
else {
|
2019 |
currentFeed.usersData = currentFeed.temproraryUsersData;
|
2020 |
|
2021 |
wdi_front.displayFeed(currentFeed);
|
2024 |
|
2025 |
//resetting temprorary users data array for the next loadmoer call
|
2026 |
currentFeed.temproraryUsersData = [];
|
|
|
|
|
2027 |
}
|
2028 |
+
}
|
2029 |
+
else {
|
2030 |
//else load load_more_number photos
|
2031 |
//if existing data length is smaller then load_more_number then get more objects until desired number is reached
|
2032 |
|
2033 |
if (gettedDataLength < load_more_number && !wdi_front.userHasNoPhoto(currentFeed, currentFeed.temproraryUsersData) && currentFeed.instagramRequestCounter <= currentFeed.maxConditionalFiltersRequestCount) {
|
2034 |
wdi_front.loadMore(undefined, currentFeed);
|
2035 |
+
}
|
2036 |
+
else {
|
2037 |
currentFeed.usersData = currentFeed.temproraryUsersData;
|
2038 |
|
2039 |
if (!wdi_front.activeUsersCount(currentFeed)) {
|
2605 |
wdi_front.getDescription = function (desc) {
|
2606 |
desc = desc.replace(/\r?\n|\r/g, ' ');
|
2607 |
|
|
|
2608 |
return desc;
|
2609 |
}
|
2610 |
|
2682 |
counter++;
|
2683 |
}
|
2684 |
}
|
2685 |
+
|
2686 |
return counter;
|
2687 |
}
|
2688 |
|
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,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")},wdi_front.show_alert=function(e,i,r){var t,a;void 0!==(r=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter))&&(wdi_error_show=!0,r.find(".wdi_spinner").remove(),t=r.find(".wdi_js_error"),a=r.find(".wdi_token_error"),0!=i&&(void 0!==i.meta&&1==i.meta.error&&"OAuthException"===i.meta.error_type||void 0!==i.error&&"OAuthException"===i.error.type)?(r.find(".wdi_single_user").remove(),a.removeClass("wdi_hidden"),"1"!=wdi_front_messages.wdi_token_error_flag&&jQuery.ajax({type:"POST",url:wdi_url.ajax_url,dataType:"json",data:{action:"wdi_token_flag",wdi_token_flag_nonce:wdi_front_messages.wdi_token_flag_nonce},success:function(e){}})):(r.find(".wdi_single_user").remove(),t.removeClass("wdi_js_error"),t.addClass("wdi_js_error_no_animate"),jQuery(".wdi_js_error_no_animate").show()),wdi_front_messages.show_alerts||console.log("%c"+e,"color:#cc0000;")),wdi_error_show=!0},wdi_front.globalInit=function(){var e=wdi_front.feed_counter,i=0;void 0!==wdi_ajax.ajax_response&&(i=wdi_feed_counter_init.wdi_feed_counter_init);for(var r,t=i;t<=e;t++)0!==jQuery("#wdi_feed_"+t).length&&((r=new WDIFeed(window["wdi_feed_"+t])).instagram=new WDIInstagram,r.instagram.filterArguments={feed:r},r.instagram.addToken(r.feed_row.access_token),wdi_front.access_token=r.feed_row.access_token,r.dataStorageRaw=[],r.dataStorage=[],r.dataStorageList=[],r.allResponseLength=0,r.currentResponseLength=0,r.temproraryUsersData=[],r.removedUsers=0,r.nowLoadingImages=!0,r.imageIndex=0,r.resIndex=0,r.currentPage=1,r.currentPageLoadMore=0,r.userSortFlags=[],r.customFilterChanged=!1,r.maxConditionalFiltersRequestCount=10,r.instagramRequestCounter=0,r.mediaRequestsDone=!1,r.conditionalFilterBuffer=[],r.stopInfiniteScrollFlag=!1,"masonry"==r.feed_row.feed_type&&(r.displayedData=[]),"pagination"==r.feed_row.feed_display_view?(r.feed_row.resort_after_load_more=0,"image_browser"!=r.feed_row.feed_type?(r.feed_row.load_more_number=parseInt(r.feed_row.pagination_per_page_number),r.feed_row.number_of_photos=(1+parseInt(r.feed_row.pagination_preload_number))*r.feed_row.load_more_number):(r.feed_row.number_of_photos=1+parseInt(r.feed_row.image_browser_preload_number),r.feed_row.load_more_number=parseInt(r.feed_row.image_browser_load_number)),r.freeSpaces=(Math.floor(r.feed_row.pagination_per_page_number/r.feed_row.number_of_columns)+1)*r.feed_row.number_of_columns-r.feed_row.pagination_per_page_number):r.freeSpaces=0,r.galleryBox=function(e){wdi_spider_createpopup(wdi_url.ajax_url+"?gallery_id="+this.feed_row.id+"&image_id="+e,this.feed_row.wdi_feed_counter,this.feed_row.lightbox_width,this.feed_row.lightbox_height,1,"testpopup",5,this,e)},wdi_responsive.columnControl(r),"masonry"==r.feed_row.feed_type&&jQuery(window).trigger("resize"),wdi_front.bindEvents(r),window["wdi_feed_"+t]=r,wdi_front.init(r))},wdi_front.init=function(e){if(jQuery(".wdi_js_error").hide(),e.photoCounter=e.feed_row.number_of_photos,"liked"==e.feed_row.liked_feed)e.feed_users=["self"];else{if(!wdi_front.isJsonString(e.feed_row.feed_users))return void wdi_front.show_alert(wdi_front_messages.invalid_users_format,!1,e);e.feed_users=JSON.parse(e.feed_row.feed_users)}var i=[],r=[],t=[];void 0!==window.wdi_all_tags&&(i=window.wdi_all_tags);for(var a=0;a<e.feed_users.length;a++)"#"===e.feed_users[a].username[0]&&void 0!==e.feed_users[a].tag_id?(i[e.feed_users[a].tag_id]=e.feed_users[a],t[a]=e.feed_users[a]):r[0]=e.feed_users[a];window.wdi_all_tags=i,e.feed_users=void 0===t||wdi_front.isEmpty(t)?r:t;var d=wdi_front.getFeedItemResolution(e);e.feedImageResolution=d.image,e.feedVideoResolution=d.video,e.dataCount=e.feed_users.length;for(var o=0;o<e.dataCount;o++)wdi_front.instagramRequest(o,e);0<e.feed_row.number_of_photos&&wdi_front.ajaxLoader(e),"1"===e.feed_row.display_header&&wdi_front.show("header",e),"1"===e.feed_row.show_usernames&&wdi_front.show("users",e)},wdi_front.getFeedItemResolution=function(e){var i={image:"standard_resolution",video:"standard_resolution"};if("thumbnail"===e.feed_row.feed_resolution)return{image:"thumbnail",video:"low_bandwidth"};if("low"===e.feed_row.feed_resolution)return{image:"low_resolution",video:"low_resolution"};if("standard"===e.feed_row.feed_resolution)return{image:"standard_resolution",video:"standard_resolution"};var r=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter).find(".wdi_feed_wrapper");r.append('<div class="wdi_feed_item" id="wdi_feed_item_example"></div>'),wdi_responsive.columnControl(e,1);e=r.attr("wdi-res").split("wdi_col_");if(r.find("#wdi_feed_item_example").remove(),2!==e.length)return i;e=parseInt(e[1]);if(e<=0)return i;e=r.width()/e-10;return e<=150?(i.image="thumbnail",i.video="low_bandwidth"):150<e&&e<=320?(i.image="low_resolution",i.video="low_resolution"):(i.image="standard_resolution",i.video="standard_resolution"),i},wdi_front.isJsonString=function(e){try{JSON.parse(e)}catch(e){return!1}return!0},wdi_front.instagramRequest=function(i,r){var t=this,e=r.feed_users;"string"==typeof e[i]&&"self"===e[i]?r.instagram.getRecentLikedMedia({success:function(e){void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,r),r.mediaRequestsDone=!0,0!=(e=t.checkMediaResponse(e,r))&&t.saveSelfUserData(e,r)}}):"hashtag"==this.getInputType(e[i].username)?r.instagram.getTagRecentMedia(this.stripHashtag(e[i].username),{success:function(e){if(void 0!==e.meta&&1==e.meta.error)return wdi_front.show_alert(!1,e,r),!1;r.mediaRequestsDone=!0,0!=(e=t.checkMediaResponse(e,r))&&t.saveUserData(e,r.feed_users[i],r)}},null,r.feed_row.hashtag_top_recent):"user"==this.getInputType(e[i].username)&&r.instagram.getUserMedia({user_id:e[i].id,success:function(e){if(void 0!==e.meta&&1==typeof e.meta.error)return wdi_front.show_alert(!1,e,r),!1;r.mediaRequestsDone=!0,0!=(e=t.checkMediaResponse(e,r))&&t.saveUserData(e,r.feed_users[i],r)}})},wdi_front.isHashtag=function(e){return"#"===e[0]},wdi_front.saveUserData=function(e,i,r){e.user_id=i.id,e.username=i.username,"#"===e.user_id[0]&&(e.data=wdi_front.appendRequestHashtag(e.data,e.user_id)),r.usersData.push(e),r.currentResponseLength=wdi_front.getArrayContentLength(r.usersData,"data"),r.allResponseLength+=r.currentResponseLength,r.dataCount==r.usersData.length&&(r.currentResponseLength<r.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(r)?wdi_front.loadMore("initial-keep",r):(wdi_front.displayFeed(r),wdi_front.applyFilters(r),wdi_front.activeUsersCount(r)||"load_more_btn"==r.feed_row.feed_display_view&&((r=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter)).find(".wdi_load_more").addClass("wdi_hidden"),r.find(".wdi_spinner").addClass("wdi_hidden"))))},wdi_front.saveSelfUserData=function(e,i){e.user_id="",e.username="",i.usersData.push(e),i.currentResponseLength=wdi_front.getArrayContentLength(i.usersData,"data"),i.allResponseLength+=i.currentResponseLength,i.dataCount==i.usersData.length&&(i.currentResponseLength<i.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(i)?wdi_front.loadMore("initial-keep",i):(wdi_front.displayFeed(i),wdi_front.applyFilters(i),wdi_front.activeUsersCount(i)||"load_more_btn"==i.feed_row.feed_display_view&&((i=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter)).find(".wdi_load_more").addClass("wdi_hidden"),i.find(".wdi_spinner").addClass("wdi_hidden"))))},wdi_front.userHasNoPhoto=function(e,i){var r=0,t=e.usersData;void 0!==i&&(t=i);for(var a=0;a<t.length;a++)void 0===t[a].pagination&&(t[a].pagination=[]),"liked"===e.feed_row.liked_feed?void 0===t[a].pagination.next_max_like_id&&r++:void 0===t[a].pagination.next_max_id&&r++;return r==t.length?1:0},wdi_front.appendRequestHashtag=function(e,i){for(var r=0;r<e.length;r++)e[r].wdi_hashtag=i;return e},wdi_front.displayFeed=function(e,i){0==e.customFilterChanged&&(r=wdi_front.feedSort(e,i));var r,i=e.customFilterChanged;1==e.customFilterChanged&&(r=e.customFilteredData,e.parsedData=wdi_front.parseLighboxData(e,!0)),"1"!=e.feed_row.resort_after_load_more?0==e.customFilterChanged&&(e.dataStorageList=e.dataStorageList.concat(r)):0==e.customFilterChanged&&(e.dataStorageList=r),"masonry"==e.feed_row.feed_type&&wdi_front.masonryDisplayFeedItems(r,e),"thumbnails"!=e.feed_row.feed_type&&"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||wdi_front.displayFeedItems(r,e),wdi_front.getDataLength(e)<parseInt(e.feed_row.number_of_photos)+parseInt(e.feed_row.load_more_number*e.currentPageLoadMore)&&!i&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount&&!wdi_front.allDataHasFinished(e)?wdi_front.loadMore("",e):(e.currentPageLoadMore++,wdi_front.allImagesLoaded(e)),e.instagramRequestCounter>e.maxConditionalFiltersRequestCount&&(wdi_front.allImagesLoaded(e),0==r.length&&(e.stopInfiniteScrollFlag=!0)),"pagination"==e.feed_row.feed_display_view&&e.currentPage<e.paginator&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter).find("#wdi_last_page").removeClass("wdi_disabled"),e.instagramRequestCounter=0,e.conditionalFilterBuffer=[],wdi_front.updateUsersImages(e)},wdi_front.updateUsersImages=function(i){jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter).find(".wdi_single_user .wdi_user_img_wrap img").each(function(){if((jQuery(this).attr("src")==wdi_url.plugin_url+"images/missing.png"||""==jQuery(this).attr("src"))&&"liked"!=i.feed_row.liked_feed)for(var e=0;e<i.usersData.length;e++)i.usersData[e].username==jQuery(this).parent().parent().find("h3").text()&&0!=i.usersData[e].data.length&&jQuery(this).attr("src",i.usersData[e].data[0].images.thumbnail.url)})},wdi_front.masonryDisplayFeedItems=function(e,i){var r=[],t=[];if(0!=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length){jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_masonry_column").each(function(){1==i.feed_row.resort_after_load_more&&(jQuery(this).html(""),i.imageIndex=0),1==i.customFilterChanged&&(jQuery(this).html(""),i.imageIndex=0),"pagination"==i.feed_row.feed_display_view?r.push(0):r.push(jQuery(this).height()),t.push(jQuery(this))}),1==i.customFilterChanged&&(i.customFilterChanged=!1);for(var a,d,o,n=0;n<e.length;n++)"object"==typeof e[n].videos&&null==e[n].videos.standard_resolution||(i.displayedData.push(e[n]),a="",void 0!==e[n].wdi_hashtag&&(a=e[n].wdi_hashtag),d="image"==e[n].type?wdi_front.getPhotoTemplate(i,a):e[n].hasOwnProperty("videos")||"video"==e[n].type?wdi_front.getVideoTemplate(i,a):wdi_front.getSliderTemplate(i,a),o=e[n],a=d(wdi_front.createObject(o,i)),d=wdi_front.array_min(r),o=wdi_front.getImageResolution(e[n]),t[d.index].html(t[d.index].html()+a),r[d.index]+=t[d.index].width()*o,i.imageIndex++,"pagination"==i.feed_row.feed_display_view&&((n+1)%i.feed_row.pagination_per_page_number==0?i.resIndex+=i.freeSpaces+1:i.resIndex++));i.wdi_loadedImages=0;var s=!1;i.wdi_load_count=n;var _=i.feed_row.wdi_feed_counter;jQuery("#wdi_feed_"+_+" img.wdi_img").on("load",function(){i.wdi_loadedImages++,w(),!1===s&&(wdi_responsive.columnControl(i,1),s=!0)});w(),1==i.paginatorNextFlag&&wdi_front.updatePagination(i,"next"),i.infiniteScrollFlag=!1}function w(){i.wdi_load_count===i.wdi_loadedImages&&0!=i.wdi_loadedImages&&(i.loadedImages=0,i.wdi_load_count=0,wdi_front.allImagesLoaded(i))}},wdi_front.getImageResolution=function(e){var i=e.images.standard_resolution.width;return e.images.standard_resolution.height/i},wdi_front.getDataLength=function(e,i){var r=0;if(void 0===i)for(var t=0;t<e.dataStorage.length;t++)r+=e.dataStorage[t].length;else for(t=0;t<i.length;t++)r+=i[t].length;return r},wdi_front.getArrayContentLength=function(e,i){for(var r=0,t=0;t<e.length;t++)"finished"!=e[t].finished&&void 0===e[t].error&&(r+=e[t][i].length);return r},wdi_front.displayFeedItems=function(e,i){if(0!=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length){var r=i.feed_row.wdi_feed_counter,t=jQuery("#wdi_feed_"+r+" .wdi_feed_wrapper");"1"===i.feed_row.resort_after_load_more&&(t.html(""),i.imageIndex=0),1==i.customFilterChanged&&(t.html(""),i.imageIndex=0,i.customFilterChanged=!1);var a;wdi_front.getImgCount(i),e.length;"pagination"==i.feed_row.feed_display_view&&(a=i.feed_row.load_more_number,"image_browser"==i.feed_row.feed_type&&(a=1),(jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+' [wdi_page="'+(i.currentPage-1)+'"]').length<a||0==e.length)&&(i.currentPage=--i.currentPage<=1?1:i.currentPage));for(var d,o,n=0;n<e.length;n++){if(void 0===e[n])return;"object"==typeof e[n].videos&&null==e[n].videos.standard_resolution||(o="",void 0!==e[n].wdi_hashtag&&(o=e[n].wdi_hashtag),d="image"==e[n].type?wdi_front.getPhotoTemplate(i,o):e[n].hasOwnProperty("videos")?wdi_front.getVideoTemplate(i,o):wdi_front.getSliderTemplate(i,o),o=e[n],o=d(wdi_front.createObject(o,i)),t.html(t.html()+o),i.imageIndex++,"pagination"==i.feed_row.feed_display_view&&((n+1)%i.feed_row.pagination_per_page_number==0?i.resIndex+=i.freeSpaces+1:i.resIndex++))}i.wdi_loadedImages=0;var s=!1;i.wdi_load_count=n;r=i.feed_row.wdi_feed_counter,t=jQuery("#wdi_feed_"+r+" img.wdi_img").on("load",function(){i.wdi_loadedImages++,i.wdi_load_count===i.wdi_loadedImages&&0!=i.wdi_loadedImages&&(i.loadedImages=0,i.wdi_load_count=0,wdi_front.allImagesLoaded(i)),!1===s&&(wdi_responsive.columnControl(i,1),s=!0)});1==i.paginatorNextFlag&&wdi_front.updatePagination(i,"next"),i.infiniteScrollFlag=!1}},wdi_front.checkFeedFinished=function(e){for(var i=0;i<e.usersData.length;i++)if(void 0===e.usersData[i].finished)return!1;return!0},wdi_front.sortingOperator=function(e,i){var r;switch(e){case"date":switch(i){case"asc":r=function(e,i){return e.created_time>i.created_time?1:-1};break;case"desc":r=function(e,i){return e.created_time>i.created_time?-1:1}}break;case"likes":switch(i){case"asc":r=function(e,i){return e.likes.count<i.likes.count?-1:1};break;case"desc":r=function(e,i){return e.likes.count<i.likes.count?1:-1}}break;case"comments":switch(i){case"asc":r=function(e,i){return e.comments.count<i.comments.count?-1:1};break;case"desc":r=function(e,i){return e.comments.count<i.comments.count?1:-1}}break;case"random":r=function(e,i){return.5<Math.random()?1:-1}}return r},wdi_front.feedSort=function(e,i){var r=e.feed_row.sort_images_by,t=e.feed_row.display_order;"1"===e.feed_row.resort_after_load_more?e.data=e.data.concat(wdi_front.smartPicker(e,i)):e.data=wdi_front.smartPicker(e,i);t=wdi_front.sortingOperator(r,t);return e.data.sort(t),e.data},wdi_front.smartPicker=function(e,i){var r=[],t=0,a=[],d=Math.ceil(e.feed_row.number_of_photos/e.usersData.length),o=parseInt(e.feed_row.number_of_photos),n=0;""!=i&&void 0!==i&&null!=i&&(o=parseInt(i),d=Math.ceil(o/wdi_front.activeUsersCount(e)));e.storeRawData(e.usersData,"dataStorageRaw");for(var s,_=e.dataStorageRaw.sort(function(e,i){return e.length()>i.length()?1:-1}),w=e.usersData.sort(function(e,i){return e.data.length>i.data.length?1:-1}),l=0;l<w.length;l++)n+=d,_[l].length()<=n?(n-=_[l].length(),r.push(_[l].getData(_[l].length())),t+=r[r.length-1].length):(o<t+n&&(n=o-t),(!(s=[])===e.auto_trigger||s.length+wdi_front.getDataLength(e)+wdi_front.getDataLength(e,r)<e.feed_row.number_of_photos)&&(s=s.concat(_[l].getData(n))),n=0,t+=s.length,r.push(s));for(l=0;l<r.length;l++)void 0===e.dataStorage[l]?e.dataStorage.push(r[l]):e.dataStorage[l]=e.dataStorage[l].concat(r[l]);for(e.parsedData=wdi_front.parseLighboxData(e),l=0;l<r.length;l++)a=a.concat(r[l]);return a},wdi_front.createObject=function(e,i){var r=null!=e.caption?e.caption.text:" ";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"> <%= 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"> <%= 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"> <%= 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"> <%= 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"> <%= 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"> <%= comments%></i></div>'),w+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(w+='<div class="wdi_photo_title" onclick='+r+" ><%=caption%></div>"),w+="</div>"),w+="</div>",_.template(w)},wdi_front.bindEvents=function(e){0!=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length&&("load_more_btn"==e.feed_row.feed_display_view&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_load_more_container").on(wdi_front.clickOrTouch,function(){wdi_front.loadMore(jQuery(this).find(".wdi_load_more_wrap"))}),"pagination"==e.feed_row.feed_display_view&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_next").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorNext(jQuery(this),e)}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_prev").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorPrev(jQuery(this),e)}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_last_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationLastPage(jQuery(this),e)}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_first_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationFirstPage(jQuery(this),e)}),e.paginatorNextFlag=!1),"infinite_scroll"==e.feed_row.feed_display_view&&(jQuery(window).on("scroll",function(){wdi_front.infiniteScroll(e)}),e.infiniteScrollFlag=!1))},wdi_front.infiniteScroll=function(e){jQuery(window).scrollTop()+jQuery(window).height()-100>=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_infinite_scroll").offset().top&&(!1===e.infiniteScrollFlag&&0==e.stopInfiniteScrollFlag?(e.infiniteScrollFlag=!0,wdi_front.loadMore(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_infinite_scroll"),e)):e.stopInfiniteScrollFlag&&wdi_front.allImagesLoaded(e))},wdi_front.paginationFirstPage=function(e,i){var r;1!=i.paginator&&1!=i.currentPage&&(r=i.currentPage,i.currentPage=1,wdi_front.updatePagination(i,"custom",r),e.parent().find("#wdi_last_page").removeClass("wdi_disabled")),e.addClass("wdi_disabled")},wdi_front.paginationLastPage=function(e,i){var r;1!=i.paginator&&i.currentPage!=i.paginator&&(r=i.currentPage,i.currentPage=i.paginator,wdi_front.updatePagination(i,"custom",r),e.addClass("wdi_disabled"),e.parent().find("#wdi_first_page").removeClass("wdi_disabled"))},wdi_front.paginatorNext=function(e,i){var r,t=e.parent().find("#wdi_last_page"),a=e.parent().find("#wdi_first_page");i.paginatorNextFlag=!0,i.paginator!=i.currentPage||wdi_front.checkFeedFinished(i)?i.paginator>i.currentPage&&(i.currentPage++,wdi_front.updatePagination(i,"next"),i.paginator>i.currentPage?t.removeClass("wdi_disabled"):t.addClass("wdi_disabled")):(i.currentPage++,r=i.feed_row.number_of_photos,wdi_front.loadMore(e,i,r),t.addClass("wdi_disabled")),a.removeClass("wdi_disabled")},wdi_front.paginatorPrev=function(e,i){var r=e.parent().find("#wdi_last_page"),e=e.parent().find("#wdi_first_page");1!=i.currentPage?(i.currentPage--,wdi_front.updatePagination(i,"prev"),r.removeClass("wdi_disabled"),1==i.currentPage&&e.addClass("wdi_disabled")):e.addClass("wdi_disabled")},wdi_front.updatePagination=function(e,i,r){var t="#wdi_feed_"+e.feed_row.wdi_feed_counter;switch(jQuery(t+' [wdi_page="'+e.currentPage+'"]').each(function(){jQuery(this).removeClass("wdi_hidden")}),i){case"next":var r=e.currentPage-1;jQuery(t+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(t+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"prev":r=e.currentPage+1;jQuery(t+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(t+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"custom":(r=r)!=e.currentPage&&(jQuery(t+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(t+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")}))}e.paginatorNextFlag=!1,jQuery(t+" .wdi_feed_wrapper").css("height","auto"),jQuery(t+" #wdi_current_page").text(e.currentPage)},wdi_front.loadMore=function(e,i){var r,t=0;""!=e&&void 0!==e&&"initial"!=e&&"initial-keep"!=e&&(r=window[e.parent().parent().parent().parent().attr("id")]),void 0!==i&&(r=i);for(var a=0,d=0,o=0;o<r.userSortFlags.length;o++)if(!0===r.userSortFlags[o].flag){a++;for(var n=0;n<r.usersData.length;n++)r.userSortFlags[o].id===r.usersData[n].user_id&&"finished"===r.usersData[n].finished&&d++}if(a!==d||0==a){r.auto_trigger=""===e,wdi_front.ajaxLoader(r),"masonry"===r.feed_row.feed_type&&"pagination"==r.feed_row.feed_display_view&&jQuery("#wdi_feed_"+wdi_front.feed_counter+" .wdi_full_caption").each(function(){jQuery(this).find(".wdi_photo_title").trigger(wdi_front.clickOrTouch)});for(o=0;o<r.usersData.length;o++)"finished"===r.usersData[o].finished&&t++;t===r.usersData.length&&(wdi_front.allImagesLoaded(r),jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter+" .wdi_load_more").remove());var s=r.usersData;r.loadMoreDataCount=r.feed_users.length;for(o=0;o<s.length;o++){var _=s[o].pagination,w={user_id:s[o].user_id,username:s[o].username};""!=_.next_url&&null!=_.next_url&&void 0!==_.next_url?(_=_.next_url,wdi_front.loadMoreRequest(w,_,r,e)):("initial-keep"==e&&(r.temproraryUsersData[o]=r.usersData[o]),r.loadMoreDataCount--,wdi_front.checkForLoadMoreDone(r,e))}}},wdi_front.loadMoreRequest=function(r,e,t,a){var d,i;t.mediaRequestsDone&&(t.usersData,d="",i=function(e){if(""===e||void 0===e||null==e)return d=wdi_front_messages.network_error,t.loadMoreDataCount--,void wdi_front.show_alert(d,e,t);if(void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,t),void 0!==e.meta&&void 0!==e.meta.code&&200!=e.meta.code)return d=e.meta.error_message,t.loadMoreDataCount--,void wdi_front.show_alert(d,e,t);e.user_id=r.user_id,e.username=r.username;for(var i=0;i<t.usersData.length;i++)e.user_id===t.usersData[i].user_id&&("#"===e.user_id[0]&&(e.data=wdi_front.appendRequestHashtag(e.data,e.user_id)),"initial-keep"==a&&(t.temproraryUsersData[i]=t.usersData[i]),t.usersData[i]=e,void 0===t.dataStorageRaw[i]?t.dataStorageRaw[i]={data:e.data}:t.dataStorageRaw[i].data=t.dataStorageRaw[i].data.concat(e.data),t.loadMoreDataCount--);wdi_front.checkForLoadMoreDone(t,a)},"#"!==r.username[0]?t.instagram.getUserMedia({user_id:r.username[0].id,success:i},e):t.instagram.getTagRecentMedia(r.username,{success:i},e,t.feed_row.hashtag_top_recent))},wdi_front.checkForLoadMoreDone=function(e,i){var r,t=e.feed_row.load_more_number,a=e.feed_row.number_of_photos;0==e.loadMoreDataCount&&(e.temproraryUsersData=wdi_front.mergeData(e.temproraryUsersData,e.usersData),r=wdi_front.getArrayContentLength(e.temproraryUsersData,"data"),"initial-keep"==i&&(i="initial"),"initial"==i?r<a&&!wdi_front.userHasNoPhoto(e,e.temproraryUsersData)&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount?wdi_front.loadMore("initial",e):(e.usersData=e.temproraryUsersData,wdi_front.displayFeed(e),wdi_front.applyFilters(e),e.temproraryUsersData=[]):r<t&&!wdi_front.userHasNoPhoto(e,e.temproraryUsersData)&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount?wdi_front.loadMore(void 0,e):(e.usersData=e.temproraryUsersData,wdi_front.activeUsersCount(e)&&(wdi_front.displayFeed(e,t),wdi_front.applyFilters(e),e.temproraryUsersData=[])))},wdi_front.allDataHasFinished=function(e){for(var i=0,r=0;r<e.dataStorageRaw.length;r++)""==e.usersData[r].pagination.next_url&&(i++,e.usersData[r].finished="finished");return i==e.dataStorageRaw.length&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_load_more").remove(),!0)},wdi_front.mergeData=function(e,i){for(var r=0;r<i.length;r++)void 0!==e[r]?"finished"!=i[r].finished&&(void 0===e[r].pagination.next_max_id&&void 0===e[r].pagination.next_max_like_id||(e[r].data=e[r].data.concat(i[r].data),e[r].pagination=i[r].pagination,e[r].user_id=i[r].user_id,e[r].username=i[r].username,e[r].meta=i[r].meta)):e.push(i[r]);return e},wdi_front.brokenImageHandler=function(e){return!0},wdi_front.ajaxLoader=function(e){var i,r=e.feed_row.wdi_feed_counter,r=jQuery("#wdi_feed_"+r);"load_more_btn"==e.feed_row.feed_display_view&&(r.find(".wdi_load_more").addClass("wdi_hidden"),r.find(".wdi_spinner").removeClass("wdi_hidden")),"infinite_scroll"==e.feed_row.feed_display_view&&(0==r.find(".wdi_ajax_loading").length?(i=jQuery('<div class="wdi_ajax_loading"><div><div><img class="wdi_load_more_spinner" src="'+wdi_url.plugin_url+'images/ajax_loader.png"></div></div></div>'),r.append(i)):i=r.find(".wdi_ajax_loading"),i.removeClass("wdi_hidden"))},wdi_front.allImagesLoaded=function(e){var i=wdi_front.getDataLength(e);e.mediaRequestsDone||jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").remove("wdi_nomedia"),0!=i||!e.mediaRequestsDone||0!=e.feed_row.conditional_filters.length&&0!=e.feed_row.conditional_filter_enable||jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").append("<p class='wdi_nomedia'>"+wdi_front_messages.feed_nomedia+"</p>");i=e.feed_row.wdi_feed_counter,i=jQuery("#wdi_feed_"+i);"load_more_btn"==e.feed_row.feed_display_view&&(i.find(".wdi_load_more").removeClass("wdi_hidden"),i.find(".wdi_spinner").addClass("wdi_hidden")),"infinite_scroll"==e.feed_row.feed_display_view&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_ajax_loading").addClass("wdi_hidden")},wdi_front.show=function(e,i){var r,t,a=i.feed_row.wdi_feed_counter,d=jQuery("#wdi_feed_"+a+" .wdi_feed_container");"header"===e&&(r={feed_thumb:i.feed_row.feed_thumb,feed_name:i.feed_row.feed_name},t=wdi_front.getHeaderTemplate()(r),r=d.find(".wdi_feed_header").html(),d.find(".wdi_feed_header").html(r+t))},wdi_front.getUserTemplate=function(e,i){var r=e.dataCount,t="#"===i[0]?"//instagram.com/explore/tags/"+i.substr(1,i.length):"//instagram.com/"+i,a="onclick='"+('window.open("'+t+'","_blank")')+"'",t='<div class="wdi_single_user" user_index="<%=user_index%>"><div class="wdi_header_user_text <%=hashtagClass%>"><div class="wdi_user_img_wrap"><img onerror="wdi_front.brokenImageHandler(this);" src="<%= user_img_url%>">';return 1<r&&(t+='<div title="'+wdi_front_messages.filter_title+'" class="wdi_filter_overlay"><div class="wdi_filter_icon"><span onclick="wdi_front.addFilter(<%=user_index%>,<%=feed_counter%>);" class="tenweb-i tenweb-i-filter"></span></div></div>'),t+="</div>",t+="<h3 "+a+"><%= user_name%></h3>","#"!==i[0]?("1"==e.feed_row.follow_on_instagram_btn&&(t+='<div class="wdi_user_controls"><div class="wdi_follow_btn" onclick="window.open(\'//instagram.com/<%= user_name%>\',\'_blank\')"><span> '+wdi_front_messages.follow+"</span></div></div>"),t+='<div class="wdi_media_info"><p class="wdi_posts"><span class="tenweb-i tenweb-i-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span class="tenweb-i tenweb-i-user"></span><%= counts.followed_by%></p></div>'):t+='<div class="wdi_user_controls"></div><div class="wdi_media_info"><p class="wdi_posts"><span class="tenweb-i tenweb-i-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span></span></p></div>',t+='<div class="wdi_clear"></div>',1==r&&"#"!==i[0]&&"1"==e.feed_row.display_user_info&&(t+='<div class="wdi_bio"><%= bio%></div>',t+='<div class="wdi_website"><a target="_blank" href="<%= website_url%>" ><%= website%></a></div>'),t+="</div></div>",_.template(t)},wdi_front.getHeaderTemplate=function(){return _.template('<div class="wdi_header_wrapper"><div class="wdi_header_img_wrap"><img src="<%=feed_thumb%>"></div><div class="wdi_header_text"><%=feed_name%></div><div class="wdi_clear"></div>')},wdi_front.addFilter=function(e,i){var r=window["wdi_feed_"+i],i=r.dataCount;if(!(i<2)&&0==r.nowLoadingImages){i=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter+'_users [user_index="'+e+'"]');i.find(".wdi_filter_overlay").toggleClass("wdi_filter_active_bg"),i.find(".wdi_header_user_text h3").toggleClass("wdi_filter_active_col"),i.find(".wdi_media_info").toggleClass("wdi_filter_active_col"),i.find(".wdi_follow_btn").toggleClass("wdi_filter_active_col"),r.customFilterChanged=!0,0==r.userSortFlags[e].flag?r.userSortFlags[e].flag=!0:r.userSortFlags[e].flag=!1;for(var t=0,a=0;a<r.userSortFlags.length;a++)1==r.userSortFlags[a].flag&&t++;"pagination"==r.feed_row.feed_display_view&&(r.resIndex=0),0!=t?wdi_front.filterData(r):r.customFilteredData=r.dataStorageList,wdi_front.displayFeed(r),"pagination"==r.feed_row.feed_display_view&&(r.paginator=Math.ceil(r.imageIndex/parseInt(r.feed_row.pagination_per_page_number)),r.currentPage=r.paginator,wdi_front.updatePagination(r,"custom",1),jQuery("#wdi_first_page").removeClass("wdi_disabled"),jQuery("#wdi_last_page").addClass("wdi_disabled"))}},wdi_front.filterData=function(e){var i=e.userSortFlags;e.customFilteredData=[];for(var r=0;r<e.dataStorageList.length;r++)for(var t=0;t<i.length;t++)(void 0!==e.dataStorageList[r].user.id&&e.dataStorageList[r].user.id==i[t].id||e.dataStorageList[r].wdi_hashtag==i[t].name)&&1==i[t].flag&&e.customFilteredData.push(e.dataStorageList[r])},wdi_front.applyFilters=function(e){for(var i=0;i<e.userSortFlags.length;i++)1==e.userSortFlags[i].flag&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+'[user_index="'+i+'"]'),wdi_front.addFilter(i,e.feed_row.wdi_feed_counter),wdi_front.addFilter(i,e.feed_row.wdi_feed_counter))},wdi_front.getImgCount=function(e){for(var i=e.dataStorage,r=0,t=0;t<i.length;t++)r+=i[t].length;return r},wdi_front.parseLighboxData=function(e,i){var r,t,a,d=e.dataStorage,o=e.feed_row.sort_images_by,n=e.feed_row.display_order,n=wdi_front.sortingOperator(o,n),s=[],_=[];if(1==i)s=e.customFilteredData;else{for(var w=0;w<d.length;w++)for(var l=0;l<d[w].length;l++)s.push(d[w][l]);s.sort(n)}for(w=0;w<s.length;w++)void 0!==s[w]&&(t=void 0!==s[w]&&void 0!==s[w].media_url?s[w].media_url:wdi_url.plugin_url+"images/video_missing.png",void 0!==s[w]&&void 0===s[w].media_url&&"carousel"===s[w].type&&(void 0!==(a=s[w].carousel_media[0])&&void 0!==a.images?t=a.images.standard_resolution.url:void 0!==a&&void 0!==a.videos&&(t=a.videos.standard_resolution.url)),void(a=0)!==s[w]&&void 0!==s[w].comments&&(a=s[w].comments.count),r={alt:"",avg_rating:"",comment_count:a,date:wdi_front.convertUnixDate(s[w].created_time),description:wdi_front.getDescription(void 0!==s[w].caption&&null!==s[w].caption?wdi_front.escape_tags(s[w].caption.text):""),filename:wdi_front.getFileName(s[w]),filetype:wdi_front.getFileType(s[w]),hit_count:"0",id:s[w].id,image_url:s[w].link,number:0,rate:"",rate_count:"0",username:void 0!==s[w].user?s[w].user.username:"",profile_picture:void 0!==s[w].user?s[w].user.profile_picture:"",thumb_url:t,comments_data:void 0!==s[w].comments?s[w].comments.data:"",images:s[w].images,carousel_media:void 0!==s[w].carousel_media?s[w].carousel_media:null},_.push(r));return _},wdi_front.convertUnixDate=function(e){var i=new Date(e).getTime()/1e3,e=new Date(0);e.setUTCSeconds(i);i=e.getFullYear()+"-"+(e.getMonth()+1)+"-"+e.getDate();return i+=" "+e.getHours()+":"+e.getMinutes()},wdi_front.getDescription=function(e){return e=e.replace(/\r?\n|\r/g," ")},wdi_front.getFileName=function(e){if(void 0!==e){var i=e.link;if("video"===e.type&&e.hasOwnProperty("videos")&&null!=e.videos.standard_resolution)return e.videos.standard_resolution.url;if(void 0===i)return"";i=i.split("/");return i[i.length-2]}},wdi_front.getFileType=function(e){return"video"==e.type&&e.hasOwnProperty("videos")?"EMBED_OEMBED_INSTAGRAM_VIDEO":"carousel"==e.type&&e.hasOwnProperty("carousel_media")?"EMBED_OEMBED_INSTAGRAM_CAROUSEL":"EMBED_OEMBED_INSTAGRAM_IMAGE"},wdi_front.array_max=function(e){for(var i=e[0],r=0,t=1;t<e.length;t++)i<e[t]&&(i=e[t],r=t);return{value:i,index:r}},wdi_front.array_min=function(e){for(var i=e[0],r=0,t=1;t<e.length;t++)i>e[t]&&(i=e[t],r=t);return{value:i,index:r}},wdi_front.activeUsersCount=function(e){for(var i=0,r=0;r<e.usersData.length;r++)"finished"!=e.usersData[r].finished&&i++;return i},wdi_front.checkMediaResponse=function(e,i){return""==e||void 0===e||null==e||void 0!==e.error?(errorMessage=wdi_front_messages.connection_error,wdi_front.show_alert(errorMessage,e,i),!1):""!=e&&void 0!==e&&null!=e&&200!=e.meta.code?(errorMessage=e.meta.error_message,wdi_front.show_alert(errorMessage,e,i),!1):e},wdi_front.stripHashtag=function(e){return"#"!==e[0]?e:e.substr(1,e.length)},wdi_front.getInputType=function(e){switch(e[0]){case"#":return"hashtag";case"%":return"location";default:return"user"}},wdi_front.regexpTestCaption=function(e,i){var r=!1,t=!1,a=i.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&"),i=new RegExp("(?:^|\\s)"+a+"(?:^|\\s)"),d=new RegExp("(?:^|\\s)"+a,"g");for(null!=i.exec(e)&&(r=!0);null!=(match=d.exec(e));)t=!0;return 1==r||1==t},wdi_front.replaceNewLines=function(e){var i,r="vUkCJvN2ps3t",t=[];for(e=e.replace(/\r?\n|\r/g,r),i=new RegExp(r,"g");null!=(match=i.exec(e));)t.push(match.index);for(var a=e.split(r),d=0,o=0;o<a.length;o++)""==a[o]?d++:d=0,0<d&&(a.splice(o,1),d--,o--);return e=a.join(" ")},wdi_front.isEmptyObject=function(e){for(var i in e)if(e.hasOwnProperty(i))return!1;return!0},wdi_front.isEmpty=function(e){return!e||0===e.length};var WDIFeed=function(e){this.data=e.data,this.dataCount=e.dataCount,this.feed_row=e.feed_row,this.usersData=e.usersData,(_this=this).set_images_loading_flag=function(e){window.addEventListener("load",function(){e.nowLoadingImages=!1})},this.set_images_loading_flag(_this)};function wdi_extractHostname(e){return void 0===e||""===e?"":e.replace(/(^\w+:|^)\/\//,"")}WDIFeed.prototype.mediaExists=function(e,i){for(var r=0;r<i.length;r++)if(e.id==i[r].id)return!0;return!1},WDIFeed.prototype.getIdFromUrl=function(e){for(var i=e.split("/"),r=!1,t=0;t<i.length;t++)if("p"==i[t]&&void 0!==i[t+1]){r=i[t+1];break}return r},WDIFeed.prototype.avoidDuplicateMedia=function(e){var i=e.data,r=[];void 0===i&&(i=[]);for(var t=0;t<i.length;t++)this.mediaExists(i[t],this.dataStorageList)||this.mediaExists(i[t],r)||this.mediaExists(i[t],this.conditionalFilterBuffer)||r.push(i[t]);return this.conditionalFilterBuffer=this.conditionalFilterBuffer.concat(r),{data:r,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.storeRawData=function(e,i){var t=this;if("object"==typeof this[i]&&"number"==typeof this[i].length)for(var r=0;r<e.length;r++){var a="";wdi_front.isHashtag(e[r].user_id)?void 0!==e[r].pagination.cursors&&(a=e[r].pagination.cursors.after):"liked"==t.feed_row.liked_feed?void 0===(a=e[r].pagination.next_max_like_id)&&(a=""):(null==e[r].pagination&&(e[r].pagination=[]),void 0===(a=e[r].pagination.next_max_id)&&(a="")),void 0===this[i][r]?this[i].push({data:e[r].data,index:0,locked:!1,hash_id:a,usersDataFinished:!1,userId:e[r].user_id,length:function(){return this.data.length-this.index},getData:function(e){var i=this.data.slice(this.index,this.index+e);if(this.index+=Math.min(e,this.length()),this.index==this.data.length&&1==this.locked&&0==this.usersDataFinished)for(var r=0;r<t.usersData.length;r++)if(t.usersData[r].user_id==this.userId){this.usersDataFinished=!0;break}return i}}):0==this[i][r].locked&&(a!=this[i][r].hash_id?(this[i][r].data=this[i][r].data.concat(e[r].data),this[i][r].hash_id=a):this[i][r].locked=!0)}},wdi_front.updateUsersIfNecessary=function(o){for(var n=o.feed_users,e=!1,i=0;i<n.length;i++)"#"!=n[i].username.substr(0,1)?""!=n[i].id&&"username"!=n[i].id||(e=!0,o.instagram.searchForUsersByName(n[i].username,{success:function(e){if(void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,o),200==e.meta.code&&0<e.data.length){for(var i=!1,r=0;r<e.data.length;r++)if(e.data[r].username==e.args.username){i=!0;break}if(i)for(var t=0;t<n.length;t++)e.data[r].username==n[t].username&&(n[t].id=e.data[r].id)}for(var a=!1,d=0;d<n.length;d++)if(""==n[d].id||"username"==n[d].id){a=!0;break}a||(o.feed_row.feed_users=JSON.stringify(n),wdi_front.init(o))},username:n[i].username})):n[i].id=n[i].username;return e},void 0!==wdi_ajax.ajax_response?jQuery(document).one("ajaxStop",function(){"not_declared"!=wdi_front.type&&(wdi_front.clickOrTouch=wdi_front.detectEvent(),wdi_front.globalInit())}):jQuery(document).ready(function(){"not_declared"!=wdi_front.type&&(wdi_front.clickOrTouch=wdi_front.detectEvent(),wdi_front.globalInit())}),jQuery(document).ready(function(){setTimeout(function(){"1"===wdi_front_messages.show_alerts&&"I"!==jQuery(".wdi_check_fontawesome .tenweb-i-instagram").prop("tagName")&&console.log("Font Awesome is not loaded properly. Please ask for support https://wordpress.org/support/plugin/wd-instagram-feed/")},2e3)});
|
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,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")},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:" ";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"> <%= 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"> <%= 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"> <%= 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"> <%= 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"> <%= 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"> <%= 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)});
|
js/wdi_instagram.js
CHANGED
@@ -206,7 +206,6 @@ function WDIInstagram(args) {
|
|
206 |
filter = this.getFilter('getTagRecentMedia');
|
207 |
|
208 |
endpoint = (parseInt(endpoint) === 0) ? "top_media" : "recent_media";
|
209 |
-
|
210 |
if (typeof args == 'undefined' || args.length === 0) {
|
211 |
noArgument = true;
|
212 |
}
|
@@ -257,12 +256,16 @@ function WDIInstagram(args) {
|
|
257 |
error = true;
|
258 |
error_type = response.error.type;
|
259 |
}
|
260 |
-
if ( typeof response.error !== 'undefined' && response.error.type
|
|
|
|
|
|
|
|
|
261 |
/* counter for break cycle */
|
262 |
errorItercount++;
|
263 |
_this.getTagRecentMedia(tagname, args, next_url, endpoint, iter)
|
264 |
}
|
265 |
-
else if ( typeof response.response !== 'undefined' && typeof response.response.iter !== 'undefined' && filterResponse.data.length < parseInt(wdi_ajax.number_of_photos) && iter < 10 && response.response.paging.next != '' ) {
|
266 |
next_url = response.response.paging.next;
|
267 |
filterResponse.data = filterResponse.data.concat(response.response.data);
|
268 |
filterResponse.paging = response.response.paging;
|
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 |
}
|
256 |
error = true;
|
257 |
error_type = response.error.type;
|
258 |
}
|
259 |
+
if ( typeof response.error !== 'undefined' && response.error.type === 'HashtagNotFound' ) {
|
260 |
+
errorItercount = 5;
|
261 |
+
success(response);
|
262 |
+
}
|
263 |
+
else if ( typeof response.error !== 'undefined' && response.error.type !== 'OAuthException' && errorItercount < 5 ) {
|
264 |
/* counter for break cycle */
|
265 |
errorItercount++;
|
266 |
_this.getTagRecentMedia(tagname, args, next_url, endpoint, iter)
|
267 |
}
|
268 |
+
else if ( typeof response.response !== 'undefined' && typeof response.response.iter !== 'undefined' && filterResponse.data.length < parseInt(wdi_ajax.number_of_photos) && iter < 10 && typeof response.response.paging !== 'undefined' && response.response.paging.next != '' ) {
|
269 |
next_url = response.response.paging.next;
|
270 |
filterResponse.data = filterResponse.data.concat(response.response.data);
|
271 |
filterResponse.paging = response.response.paging;
|
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 l(){return void 0!==w.user&&void 0!==w.user.user_name?w.user.user_name:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user?wdi_object.user.user_name:""}function u(){return void 0!==w.user&&void 0!==w.user.access_token?w.user.access_token:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user&&void 0!==wdi_object.user.access_token?wdi_object.user.access_token:""}this.statusCode={429:function(){console.log(" 429: Too many requests. Try after one hour")}},this.getFilter=function(e){var t=w.filters;if(void 0===t)return!1;for(var s=0;s<t.length;s++)if(t[s].where==e)if("object"==typeof t[s].what&&2==t[s].what.length){if(void 0!==window[t[s].what[0]]&&"function"==typeof window[t[s].what[0]][t[s].what[1]])return window[t[s].what[0]][t[s].what[1]]}else{if("string"!=typeof t[s].what)return"function"==typeof t[s].what&&t[s].what;if("function"==typeof window[t[s].what])return window[t[s].what]}return!1},this.addToken=function(e){"string"==typeof e&&w.access_tokens.push(e)},this.resetTokens=function(){w.access_tokens=[]};var g=0,p={data:new Array,paging:{}};this.getTagRecentMedia=function(i,n,c,a,u){u=void 0===u||"number"!=typeof u?0:u;var d=!1,e=this.statusCode,t=!1;this.getFilter("getTagRecentMedia");a=0===parseInt(a)?"top_media":"recent_media",void 0===n||0===n.length||("success"in n&&(d=!0),"statusCode"in n&&(e=n.statusCode),"error"in n&&(t=!0),"args"in n||(n.args={}),"count"in n?(n.count=parseInt(n.count),(!Number.isInteger(n.count)||n.count<=0)&&(n.count=33)):n.count=33);var f=this.getTagId(i);jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{iter:u,tagname:i,endpoint:a,wdi_nonce:wdi_ajax.wdi_nonce,wdiTagId:f,next_url:c,user_name:l(),action:"wdi_getTagRecentMedia",feed_id:wdi_ajax.feed_id},success:function(e){var t,s,o=!1,r="";void 0!==e.error&&(o=!0,r=e.error.type),void 0!==e.error&&"OAuthException"!==e.error.type&&g<5?(g++,w.getTagRecentMedia(i,n,c,a,u)):void 0!==e.response&&void 0!==e.response.iter&&p.data.length<parseInt(wdi_ajax.number_of_photos)&&u<10&&""!=e.response.paging.next?(c=e.response.paging.next,p.data=p.data.concat(e.response.data),p.paging=e.response.paging,w.getTagRecentMedia(i,n,c,a,e.response.iter)):(0!=p.data.length&&(e.response=p),!1===f&&(f=""),void 0!==e.tag_data&&(void 0!==(t=e.tag_data).tag_id&&(f=t.tag_id),s=[],void 0!==window.wdi_all_tags&&(s=window.wdi_all_tags),s[t.tag_id]=t,window.wdi_all_tags=s),e=e.response,(e=w.convertHashtagData(e)).meta={code:200,error:o,error_type:r},e.tag_id=f,function(e){void 0===e.data&&(e.data=[]);d&&("object"==typeof n.success&&2==n.success.length?void 0!==window[n.success[0]]&&"function"==typeof window[n.success[0]][n.success[1]]&&window[n.success[0]][n.success[1]](e):"string"==typeof n.success?"function"==typeof window[n.success]&&window[n.success](e):"function"==typeof n.success&&n.success(e))}(e))},error:function(e){t&&("object"==typeof n.error&&2==n.error.length?"function"==typeof window[n.error[0]][n.error[1]]&&window[n.error[0]][n.error[1]](e):"string"==typeof n.error?"function"==typeof window[n.error]&&window[n.error](e):"function"==typeof n.error&&n.error(e))},statusCode:e})},this.getTagId=function(e){var t,s,o=[];for(s in"undefined"!=typeof wdi_controller?0!==(o=wdi_controller.feed_users).length||void 0!==(t=jQuery("#WDI_feed_users").val())&&""!==t&&(o=JSON.parse(t)):void 0!==window.wdi_all_tags&&(o=window.wdi_all_tags),o)if(e===o[s].username||"#"+e===o[s].username)return void 0!==o[s].tag_id&&o[s].tag_id;return!1},this.convertHashtagData=function(e){var t={data:[],pagination:{}};if(void 0!==e&&void 0!==e.paging&&(t.pagination={cursors:{after:e.paging.cursors.after},next_url:e.paging.next}),void 0!==e&&void 0!==e.data)for(var s in e.data){var o,r=e.data[s],i="IMAGE"===r.media_type?"image":"VIDEO"===r.media_type?"video":"carousel",n={id:r.id,user:{id:"",full_name:"",profile_picture:"",username:""},images:{thumbnail:{width:150,height:150,url:r.media_url},low_resolution:{width:320,height:320,url:r.media_url},standard_resolution:{width:1080,height:1080,url:r.media_url}},created_time:r.timestamp,caption:{id:"",text:r.caption,created_time:"",from:{id:"",full_name:"",profile_picture:"",username:""}},user_has_liked:0<r.like_count,likes:{count:r.like_count},tags:[],filter:"Normal",comments:{count:r.comments_count},type:i,link:r.permalink,location:null,attribution:null,users_in_photo:[]};if("IMAGE"===r.media_type||"CAROUSEL_ALBUM"===r.media_type?n.images={thumbnail:{width:150,height:150,url:r.media_url},low_resolution:{width:320,height:320,url:r.media_url},standard_resolution:{width:1080,height:1080,url:r.media_url}}:"VIDEO"===r.media_type&&(n.videos={standard_resolution:{width:640,height:800,url:r.media_url},low_bandwidth:{width:480,height:600,url:r.media_url},low_resolution:{width:480,height:600,url:r.media_url}}),"CAROUSEL_ALBUM"===r.media_type)for(var c in n.carousel_media=[],r.children.data)o="IMAGE"===r.children.data[c].media_type?{images:{thumbnail:{width:150,height:150,url:r.children.data[c].media_url},low_resolution:{width:320,height:320,url:r.children.data[c].media_url},standard_resolution:{width:640,height:640,url:r.children.data[c].media_url}},users_in_photo:[],type:"image"}:{videos:{standard_resolution:{width:640,height:800,url:r.children.data[c].media_url,id:r.children.data[c].id},low_bandwidth:{width:480,height:600,url:r.children.data[c].media_url,id:r.children.data[c].id},low_resolution:{width:480,height:600,url:r.children.data[c].media_url,id:r.children.data[c].id}},users_in_photo:[],type:"video"},n.carousel_media.push(o);t.data.push(n)}return t},this.searchForTagsByName=function(e,s){var o=this,r=!1,i=this.statusCode,n=!1;filter=this.getFilter("searchForTagsByName"),void 0===s||0===s.length||("success"in s&&(r=!0),"error"in s&&(n=!0),"statusCode"in s&&(i=s.statusCode));var c="https://api.instagram.com/v1/tags/search?q="+e+"&access_token="+u();w.getDataFromCache(function(e){function t(e){r&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(filter&&(e=filter(e,o.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(filter&&(e=filter(e,o.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(filter&&(e=filter(e,o.filterArguments)),s.success(e)))}!1===e?jQuery.ajax({type:"POST",url:c,dataType:"jsonp",success:function(e){w.setDataToCache(c,e),t(e)},error:function(e){n&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:i}):t(e)},c)},this.searchForUsersByName=function(e,t){var s=this,o=!1,r=(this.statusCode,!1),i=this.getFilter("searchForUsersByName");void 0===t||0===t.length||("success"in t&&(o=!0),"error"in t&&(r=!0),"statusCode"in t&&t.statusCode),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/search?q="+e+"&access_token="+u(),success:function(e){o&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(i&&(e=i(e,s.filterArguments)),e.args=t,window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(i&&(e=i(e,s.filterArguments)),e.args=t,window[t.success](e)):"function"==typeof t.success&&(i&&(e=i(e,s.filterArguments)),(e.args=t).success(e)))},error:function(e){r&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:this.statusCode})},this.getRecentLikedMedia=function(t){var s=this,o=!1,e=this.statusCode,r=!1,i=this.getFilter("getRecentLikedMedia"),n="https://api.instagram.com/v1/users/self/media/liked?access_token="+u();void 0===t||0===t.length||("success"in t&&(o=!0),"error"in t&&(r=!0),"statusCode"in t&&(e=t.statusCode),"args"in t?argFlag=!0:t.args={},"count"in t?(t.count=parseInt(t.count),(!Number.isInteger(t.count)||t.count<=0)&&(t.count=20)):t.count=20,n+="&count="+t.count,"next_max_like_id"in t&&(n+="&next_max_like_id="+t.next_max_like_id)),jQuery.ajax({type:"POST",dataType:"jsonp",url:n,success:function(e){o&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(i&&(e=i(e,s.filterArguments,t.args)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(i&&(e=i(e,s.filterArguments,t.args)),window[t.success](e)):"function"==typeof t.success&&(i&&(e=i(e,s.filterArguments,t.args)),t.success(e)))},error:function(e){r&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:e})},this.getUserRecentMedia=function(e,t){var s=this,o=!1,r=this.statusCode,i=!1,n=this.getFilter("getUserRecentMedia"),e="https://api.instagram.com/v1/users/"+e+"/media/recent/?access_token="+u();void 0===t||0===t.length||("success"in t&&(o=!0),"statusCode"in t&&(r=t.statusCode),"args"in t||(t.args={}),"error"in t&&(i=!0),"count"in t?(t.count=parseInt(t.count),(!Number.isInteger(t.count)||t.count<=0)&&(t.count=33)):t.count=33,e+="&count="+t.count,"min_id"in t&&(e+="&min_id="+t.min_id),"max_id"in t&&(e+="&max_id="+t.max_id)),jQuery.ajax({type:"POST",dataType:"jsonp",url:e,success:function(e){void 0===e.data&&(e.data=[]),o&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(n&&(e=n(e,s.filterArguments,t.args)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(n&&(e=n(e,s.filterArguments,t.args)),window[t.success](e)):"function"==typeof t.success&&(n&&(e=n(e,s.filterArguments,t.args)),t.success(e)))},error:function(e){i&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:r})},this.getUserMedia=function(o,r,i){r=void 0===r?"":r,i=void 0===i||"number"!=typeof i?0:i;var n=this,c=!1,e=this.statusCode,t=!1,a=this.getFilter("getUserMedia");void 0===o||0===o.length||("success"in o&&(c=!0),"error"in o&&(t=!0),"statusCode"in o&&(e=o.statusCode),"args"in o||(o.args={}),"count"in o?(o.count=parseInt(o.count),(!Number.isInteger(o.count)||o.count<=0)&&(o.count=20)):o.count=20),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,action:"wdi_getUserMedia",user_name:l(),feed_id:wdi_ajax.feed_id,next_url:r,iter:i},success:function(e){var t=!1,s="";if(void 0!==e.error&&(t=!0,s=e.error.type),void 0!==e.error&&"OAuthException"!==e.error.type&&g<5)return g++,void w.getUserMedia(o,r,e.iter);void 0!==e.iter&&p.data.length<parseInt(wdi_ajax.number_of_photos)&&i<20&&""!=e.pagination.next_url?(r=e.pagination.next_url,p.data=p.data.concat(e.data),p.pagination=e.pagination,w.getUserMedia(o,r,e.iter)):(0!=p.data.length&&(e=p),e.meta={code:200,error:t,error_type:s},c&&("object"==typeof o.success&&2==o.success.length?void 0!==window[o.success[0]]&&"function"==typeof window[o.success[0]][o.success[1]]&&(a&&(e=w.addTags(e),e=a(e,n.filterArguments,o)),window[o.success[0]][o.success[1]](e)):"string"==typeof o.success?"function"==typeof window[o.success]&&(a&&(e=w.addTags(e),e=a(e,n.filterArguments,o)),window[o.success](e)):"function"==typeof o.success&&o.success(e)))},error:function(e){t&&("object"==typeof o.error&&2==o.error.length?"function"==typeof window[o.error[0]][o.error[1]]&&window[o.error[0]][o.error[1]](e):"string"==typeof o.error?"function"==typeof window[o.error]&&window[o.error](e):"function"==typeof o.error&&o.error(e))},statusCode:e})},this.getUserInfo=function(e,t){var s=this,o=!1,r=this.statusCode,i=!1,n=this.getFilter("getUserInfo");void 0===t||0===t.length||("success"in t&&(o=!0),"error"in t&&(i=!0),"statusCode"in t&&(r=t.statusCode)),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/"+e+"/?access_token="+u(),success:function(e){o&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(n&&(e=n(e,s.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(n&&(e=n(e,s.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(n&&(e=n(e,s.filterArguments)),t.success(e)))},error:function(e){i&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:r})},this.getSelfInfo=function(s){var o=this,r=!1,i=this.statusCode,n=!1,c=this.getFilter("getSelfInfo");void 0===s||0===s.length||("success"in s&&(r=!0),"error"in s&&(n=!0),"statusCode"in s&&(i=s.statusCode));var a="https://graph.facebook.com/v3.2/"+(void 0!==w.user&&void 0!==w.user.user_id?w.user.user_id:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user?wdi_object.user.user_id:"")+"?fields=id,ig_id,username,name,biography,profile_picture_url,followers_count,follows_count,media_count,website&access_token="+u();w.getDataFromCache(function(e){var t;!1===e?jQuery.ajax({type:"POST",dataType:"jsonp",url:a,statusCode:i,success:function(e){w.setDataToCache(a,e),r&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(c&&(e.meta={code:200},e=c(e,o.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(c&&(e.meta={code:200},e=c(e,o.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(c&&(e.meta={code:200},e=c(e,o.filterArguments)),s.success(e)))},error:function(e){n&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))}}):(t=e,r&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(c&&(t=c(t,o.filterArguments)),window[s.success[0]][s.success[1]](t)):"string"==typeof s.success?"function"==typeof window[s.success]&&(c&&(t=c(t,o.filterArguments)),window[s.success](t)):"function"==typeof s.success&&(c&&(t=c(t,o.filterArguments)),s.success(t))))},a)},this.getRecentMediaComments=function(e,t,s){var o=this,r=!1,i=this.statusCode,n=!1,c=this.getFilter("getRecentMediaComments");void 0===t||0===t.length||("success"in t&&(r=!0),"error"in t&&(n=!0),"statusCode"in t&&(i=t.statusCode)),jQuery(".wdi_comment_container #ajax_loading #opacity_div").css("display","block"),jQuery(".wdi_comment_container #ajax_loading #loading_div").css("display","block"),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,action:"wdi_getRecentMediaComments",user_name:l(),media_id:e,next:s},success:function(e){e=e,r&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(c&&(e=c(e,o.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(c&&(e=c(e,o.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(c&&(e=c(e,o.filterArguments)),t.success(e)))},complete:function(){jQuery(".wdi_comment_container #ajax_loading #opacity_div").css("display","none"),jQuery(".wdi_comment_container #ajax_loading #loading_div").css("display","none")},error:function(e){n&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:i})},this.getRecentMediaLikes=function(e,t){var s=this,o=!1,r=this.statusCode,i=!1,n=this.getFilter("getRecentMediaLikes");void 0===t||0===t.length||("success"in t&&(o=!0),"error"in t&&(i=!0),"statusCode"in t&&(r=t.statusCode)),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/media/"+e+"/likes?access_token="+u(),success:function(e){o&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(n&&(e=n(e,s.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(n&&(e=n(e,s.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(n&&(e=n(e,s.filterArguments)),t.success(e)))},error:function(e){i&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:r})},this.getDataFromCache=function(t,e,s){void 0===s&&(s=!0),jQuery.ajax({type:"POST",async:s,url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_cache_name:e,wdi_nonce:wdi_ajax.wdi_nonce,WDI_MINIFY:wdi_ajax.WDI_MINIFY,task:"get",action:"wdi_cache"},success:function(e){e.success&&void 0!==e.cache_data&&null!==e.cache_data?(e=JSON.parse(e.cache_data),t(e)):t(!1)}})},this.setDataToCache=function(e,t){jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_cache_name:e,wdi_cache_response:JSON.stringify(t),wdi_nonce:wdi_ajax.wdi_nonce,task:"set",action:"wdi_cache"},success:function(e){}})}}
|
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){}})}}
|
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.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -505,6 +505,9 @@ 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.11 =
|
509 |
Fixed: Adding the Instagram Feed to the Elementor.
|
510 |
Fixed: Feed preview.
|
4 |
Requires at least: 3.9
|
5 |
Requires PHP: 5.2
|
6 |
Tested up to: 5.6
|
7 |
+
Stable tag: 1.4.12
|
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.12 =
|
509 |
+
Fixed: Ordering for hashtag.
|
510 |
+
|
511 |
= 1.4.11 =
|
512 |
Fixed: Adding the Instagram Feed to the Elementor.
|
513 |
Fixed: Feed preview.
|
wd-instagram-feed.php
CHANGED
@@ -3,26 +3,13 @@
|
|
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.
|
7 |
* Author: 10Web
|
8 |
* Author URI: https://10Web.io/plugins/?utm_source=instagram_feed&utm_medium=free_plugin
|
9 |
* License: GPLv2 or later
|
10 |
*/
|
11 |
|
12 |
-
|
13 |
-
define('WDI_IS_FREE', TRUE);
|
14 |
-
define('WDI_PREFIX', 'wdi');
|
15 |
-
define('WDI_DIR', WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__)));
|
16 |
-
define('WDI_URL', plugins_url(plugin_basename(dirname(__FILE__))));
|
17 |
-
define('WDI_MAIN_FILE', plugin_basename(__FILE__));
|
18 |
-
define('WDI_META', '_wdi_instagram_meta');
|
19 |
-
define('WDI_OPT', 'wdi_instagram_options');
|
20 |
-
define('WDI_FSN', 'wdi_feed_settings');
|
21 |
-
define('WDI_TSN', 'wdi_theme_settings');
|
22 |
-
define('WDI_FEED_TABLE', 'wdi_feeds');
|
23 |
-
define('WDI_THEME_TABLE', 'wdi_themes');
|
24 |
-
define('WDI_MINIFY', TRUE);
|
25 |
-
|
26 |
add_action('wp_ajax_wdi_cache', 'wdi_cache');
|
27 |
add_action('wp_ajax_nopriv_wdi_cache', 'wdi_cache');
|
28 |
add_action('wp_ajax_wdi_getUserMedia', 'wdi_getUserMedia');
|
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.12
|
7 |
* Author: 10Web
|
8 |
* Author URI: https://10Web.io/plugins/?utm_source=instagram_feed&utm_medium=free_plugin
|
9 |
* License: GPLv2 or later
|
10 |
*/
|
11 |
|
12 |
+
include_once 'config.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
add_action('wp_ajax_wdi_cache', 'wdi_cache');
|
14 |
add_action('wp_ajax_nopriv_wdi_cache', 'wdi_cache');
|
15 |
add_action('wp_ajax_wdi_getUserMedia', 'wdi_getUserMedia');
|