Version Description
Added: Possibility to show IGTV media in the feed. Fixed: Lightbox filmstrip issue. Fixed: Issue on changing account type from business to personal. Fixed: Show caption for posts loaded with load more. Fixed: Logic of cache.
Download this release
Release Info
Developer | 10web |
Plugin | WD Instagram Feed – Instagram Gallery |
Version | 1.4.18 |
Comparing to | |
See all releases |
Code changes from version 1.4.17 to 1.4.18
- admin-functions.php +1 -0
- admin/models/feeds.php +9 -8
- config.php +1 -1
- framework/WDICache.php +12 -2
- framework/WDIInstagram.php +87 -42
- framework/WDILibrary.php +1 -1
- frontend/views/WDIViewGalleryBox.php +11 -14
- js/wdi_admin.js +8 -11
- js/wdi_admin.min.js +1 -1
- js/wdi_frontend.js +0 -1
- js/wdi_frontend.min.js +1 -1
- js/wdi_instagram.js +4 -4
- js/wdi_instagram.min.js +1 -1
- readme.txt +8 -1
- wd-instagram-feed.php +1 -1
admin-functions.php
CHANGED
@@ -715,6 +715,7 @@ function wdi_get_settings() {
|
|
715 |
'type' => 'number',
|
716 |
'section' => 'wdi_customize_section',
|
717 |
'title' => __('Set Maximum Count of Cache Requests', "wd-instagram-feed"),
|
|
|
718 |
),
|
719 |
//'wdi_version' => array('name'=>'wdi_version','field_or_not'=>'no_field','default'=>WDI_VERSION),
|
720 |
//'wdi_first_time'=>array('name'=>'wdi_first_time','field_or_not'=>'no_field','default'=>'1')
|
715 |
'type' => 'number',
|
716 |
'section' => 'wdi_customize_section',
|
717 |
'title' => __('Set Maximum Count of Cache Requests', "wd-instagram-feed"),
|
718 |
+
'default' => '10',
|
719 |
),
|
720 |
//'wdi_version' => array('name'=>'wdi_version','field_or_not'=>'no_field','default'=>WDI_VERSION),
|
721 |
//'wdi_first_time'=>array('name'=>'wdi_first_time','field_or_not'=>'no_field','default'=>'1')
|
admin/models/feeds.php
CHANGED
@@ -306,15 +306,16 @@ class Feeds_model_wdi {
|
|
306 |
$conditional_filter_type = $data['conditional_filter_type'];
|
307 |
$count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(id) FROM ". $wpdb->prefix.WDI_FEED_TABLE. " WHERE id ='%d' AND feed_users='%s' AND conditional_filters='%s' AND conditional_filter_type='%s'", $feed_id, $users, $conditional_filters, $conditional_filter_type));
|
308 |
if ( $count == 0 ) {
|
309 |
-
|
310 |
} else {
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
|
|
318 |
}
|
319 |
}
|
320 |
}
|
306 |
$conditional_filter_type = $data['conditional_filter_type'];
|
307 |
$count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(id) FROM ". $wpdb->prefix.WDI_FEED_TABLE. " WHERE id ='%d' AND feed_users='%s' AND conditional_filters='%s' AND conditional_filter_type='%s'", $feed_id, $users, $conditional_filters, $conditional_filter_type));
|
308 |
if ( $count == 0 ) {
|
309 |
+
return 1;
|
310 |
} else {
|
311 |
+
$transient_key = "wdi_cache_" . md5($feed_id."_0");
|
312 |
+
$cache_data = get_transient($transient_key);
|
313 |
+
$wdi_requests_success = intval(get_option('wdi_cache_success_'.$feed_id, 0));
|
314 |
+
if ( isset($cache_data) && $cache_data != FALSE && isset($cache_data["cache_response"]) && $wdi_requests_success) {
|
315 |
+
return 0;
|
316 |
+
} else {
|
317 |
+
return 1;
|
318 |
+
}
|
319 |
}
|
320 |
}
|
321 |
}
|
config.php
CHANGED
@@ -3,7 +3,7 @@ if ( !defined('ABSPATH') ) {
|
|
3 |
exit;
|
4 |
}
|
5 |
|
6 |
-
define('WDI_VERSION', '1.4.
|
7 |
define('WDI_IS_FREE', TRUE);
|
8 |
define('WDI_PREFIX', 'wdi');
|
9 |
define('WDI_DIR', WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__)));
|
3 |
exit;
|
4 |
}
|
5 |
|
6 |
+
define('WDI_VERSION', '1.4.18');
|
7 |
define('WDI_IS_FREE', TRUE);
|
8 |
define('WDI_PREFIX', 'wdi');
|
9 |
define('WDI_DIR', WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__)));
|
framework/WDICache.php
CHANGED
@@ -118,8 +118,18 @@ class WDICache {
|
|
118 |
*/
|
119 |
public function reset_feed_cache( $feed_id ) {
|
120 |
global $wpdb;
|
121 |
-
$
|
122 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
return $result;
|
124 |
}
|
125 |
}
|
118 |
*/
|
119 |
public function reset_feed_cache( $feed_id ) {
|
120 |
global $wpdb;
|
121 |
+
$like_query = "";
|
122 |
+
$count = isset($this->wdi_options["wdi_cache_request_count"]) ? $this->wdi_options["wdi_cache_request_count"] : 10;
|
123 |
+
for( $i = 0; $i <= $count; $i++) {
|
124 |
+
$transient_key = "wdi_cache_" . md5($feed_id."_".$i);
|
125 |
+
if( $i == $count ) {
|
126 |
+
$like_query .= 'option_name LIKE "%' . $transient_key . '%"';
|
127 |
+
} else {
|
128 |
+
$like_query .= 'option_name LIKE "%' . $transient_key . '%" OR ';
|
129 |
+
}
|
130 |
+
}
|
131 |
+
$result = $wpdb->query('DELETE FROM ' . $wpdb->prefix . 'options WHERE '.$like_query);
|
132 |
+
delete_option('wdi_cache_success_'.$feed_id);
|
133 |
return $result;
|
134 |
}
|
135 |
}
|
framework/WDIInstagram.php
CHANGED
@@ -69,14 +69,14 @@ class WDIInstagram {
|
|
69 |
* @param integer $fee_id
|
70 |
*
|
71 |
* @return string comments data
|
72 |
-
|
73 |
public function getUserMedia( $user_name, $feed_id ) {
|
|
|
74 |
if ( isset($this->wdi_authenticated_users_list) && is_array($this->wdi_authenticated_users_list) && isset($this->wdi_authenticated_users_list[$user_name]) ) {
|
75 |
-
$cache_data = $this->cache->get_cache_data($feed_id);
|
76 |
-
if ( isset($cache_data) && $cache_data["success"] && isset($cache_data["cache_data"]) ) {
|
77 |
-
$
|
78 |
-
$cache_data =
|
79 |
-
$cache_data['data'] = $this->sortData( $feed_id, $cache_data['data']);
|
80 |
return json_encode($cache_data);
|
81 |
} else {
|
82 |
return json_encode(array('data'=>''));
|
@@ -133,9 +133,32 @@ class WDIInstagram {
|
|
133 |
* @return string comments data
|
134 |
*/
|
135 |
public function getRecentMediaComments( $user_name, $media_id ) {
|
136 |
-
|
137 |
-
|
138 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
}
|
140 |
|
141 |
/**
|
@@ -146,18 +169,19 @@ class WDIInstagram {
|
|
146 |
* @return string
|
147 |
*/
|
148 |
public function getTagRecentMedia( $feed_id ) {
|
149 |
-
$cache_data = $this->cache->get_cache_data($feed_id);
|
150 |
-
|
151 |
-
|
152 |
-
|
|
|
153 |
} else {
|
154 |
-
|
155 |
}
|
156 |
}
|
157 |
|
158 |
public function wdi_getHashtagId( $tagname = '', $user_name='' ) {
|
159 |
$this->account_data = $this->wdi_authenticated_users_list[$user_name];
|
160 |
-
$url = 'https://graph.facebook.com/
|
161 |
$args = array();
|
162 |
$response = wp_remote_get($url, $args);
|
163 |
|
@@ -216,23 +240,6 @@ class WDIInstagram {
|
|
216 |
"profile_picture" => "",
|
217 |
"username" => "",
|
218 |
),
|
219 |
-
"images" => array(
|
220 |
-
"thumbnail" => array(
|
221 |
-
"width" => 150,
|
222 |
-
"height" => 150,
|
223 |
-
"url" => (isset($media["media_url"]) ? $media["media_url"] : ""),
|
224 |
-
),
|
225 |
-
"low_resolution" => array(
|
226 |
-
"width" => 320,
|
227 |
-
"height" => 320,
|
228 |
-
"url" => (isset($media["media_url"]) ? $media["media_url"] : ""),
|
229 |
-
),
|
230 |
-
"standard_resolution" => array(
|
231 |
-
"width" => 1080,
|
232 |
-
"height" => 1080,
|
233 |
-
"url" => (isset($media["media_url"]) ? $media["media_url"] : ""),
|
234 |
-
),
|
235 |
-
),
|
236 |
"created_time" => (isset($media["timestamp"]) ? $media["timestamp"] : ""),
|
237 |
"caption" => array(
|
238 |
"id" => "",
|
@@ -347,7 +354,7 @@ class WDIInstagram {
|
|
347 |
$carousel_media = array();
|
348 |
$api_url = 'https://graph.instagram.com/v1.0/';
|
349 |
if ( $this->account_data["type"] === "business" ) {
|
350 |
-
$api_url = 'https://graph.facebook.com/
|
351 |
}
|
352 |
$api_url .= $media_id . '/children?access_token=' . $this->account_data["access_token"];
|
353 |
$fields = 'id,media_type,media_url,permalink,thumbnail_url,username,timestamp';
|
@@ -432,7 +439,7 @@ class WDIInstagram {
|
|
432 |
$api_url = 'https://graph.instagram.com/v1.0/';
|
433 |
$media_fields = 'id,media_type,media_url,permalink,thumbnail_url,username,caption,timestamp';
|
434 |
if ( $this->account_data["type"] === "business" ) {
|
435 |
-
$api_url = 'https://graph.facebook.com/
|
436 |
$media_fields = 'id,media_type,media_url,permalink,thumbnail_url,username,caption,timestamp,ig_id,is_comment_enabled,like_count,comments_count,owner,shortcode';
|
437 |
}
|
438 |
$baseUrl = $api_url . $user_id . '/media/?fields=' . $media_fields . '&limit=100&access_token=' . $access_token;
|
@@ -449,6 +456,42 @@ class WDIInstagram {
|
|
449 |
if ( !isset($response->errors) && is_array($response) && isset($response["body"]) ) {
|
450 |
$data = json_decode($response["body"], TRUE);
|
451 |
if ( !empty($data['data']) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
452 |
if ( !empty($this->conditions) ) {
|
453 |
$temp_data = $data;
|
454 |
$temp_data['data'] = $this->filterUserMedia( $data, $this->conditions['conditional_filters'], $this->conditions['conditional_filter_type'] );
|
@@ -462,27 +505,29 @@ class WDIInstagram {
|
|
462 |
} else {
|
463 |
$current_data = $this->convertPersonalData($data);
|
464 |
}
|
|
|
465 |
/* Remove current feed cache data */
|
466 |
if ( $iter == 0 ) {
|
467 |
$this->cache->reset_feed_cache( $feed_id );
|
468 |
-
} else {
|
469 |
-
$cache_data = $this->cache->get_cache_data($feed_id);
|
470 |
-
if ( isset($cache_data) && $cache_data["success"] && isset($cache_data["cache_data"]) ) {
|
471 |
-
$cache_data = base64_decode($cache_data["cache_data"]);
|
472 |
-
$cache_data = json_decode($cache_data, 1);
|
473 |
-
$current_data['data'] = array_merge( $cache_data['data'], $current_data['data'] );
|
474 |
-
}
|
475 |
}
|
476 |
|
477 |
$current_data = json_encode($current_data);
|
478 |
|
479 |
-
|
|
|
|
|
480 |
$return_data['next_url'] = '';
|
481 |
if ( isset($data['paging']['next']) && $data['paging']['next'] != '' ) {
|
482 |
$return_data['next_url'] = $data['paging']['next'];
|
483 |
$return_data['iter'] = $iter;
|
484 |
}
|
485 |
|
|
|
|
|
|
|
|
|
|
|
|
|
486 |
return json_encode($return_data);
|
487 |
}
|
488 |
else {
|
69 |
* @param integer $fee_id
|
70 |
*
|
71 |
* @return string comments data
|
72 |
+
*/
|
73 |
public function getUserMedia( $user_name, $feed_id ) {
|
74 |
+
$wdi_requests_success = intval(get_option('wdi_cache_success_'.$feed_id, 0));
|
75 |
if ( isset($this->wdi_authenticated_users_list) && is_array($this->wdi_authenticated_users_list) && isset($this->wdi_authenticated_users_list[$user_name]) ) {
|
76 |
+
$cache_data = $this->cache->get_cache_data($feed_id.'_0');
|
77 |
+
if ( isset($cache_data) && $cache_data["success"] && isset($cache_data["cache_data"]) && $wdi_requests_success) {
|
78 |
+
$return_data = $this->join_feed_cache($feed_id);
|
79 |
+
$cache_data['data'] = $this->sortData( $feed_id, $return_data);
|
|
|
80 |
return json_encode($cache_data);
|
81 |
} else {
|
82 |
return json_encode(array('data'=>''));
|
133 |
* @return string comments data
|
134 |
*/
|
135 |
public function getRecentMediaComments( $user_name, $media_id ) {
|
136 |
+
$data['data'] = '';
|
137 |
+
$data['meta']['code'] = 200;
|
138 |
+
|
139 |
+
return json_encode($data);
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Get all cache datas for feed and merge in one array
|
144 |
+
*
|
145 |
+
* @param int $feed_id
|
146 |
+
*
|
147 |
+
* @return array merged data
|
148 |
+
*/
|
149 |
+
public function join_feed_cache($feed_id) {
|
150 |
+
$data = array();
|
151 |
+
for( $i = 0; $i < 50; $i++ ) {
|
152 |
+
$cache_data = $this->cache->get_cache_data($feed_id.'_'.$i);
|
153 |
+
if ( isset($cache_data) && $cache_data["success"] && isset($cache_data["cache_data"]) ) {
|
154 |
+
$cache_data = base64_decode($cache_data["cache_data"]);
|
155 |
+
$cache_data = json_decode($cache_data, 1);
|
156 |
+
$data = array_merge( $cache_data['data'], $data );
|
157 |
+
} else {
|
158 |
+
break;
|
159 |
+
}
|
160 |
+
}
|
161 |
+
return $data;
|
162 |
}
|
163 |
|
164 |
/**
|
169 |
* @return string
|
170 |
*/
|
171 |
public function getTagRecentMedia( $feed_id ) {
|
172 |
+
$cache_data = $this->cache->get_cache_data($feed_id.'_0');
|
173 |
+
$wdi_requests_success = intval(get_option('wdi_cache_success_'.$feed_id, 0));
|
174 |
+
if ( isset($cache_data) && $cache_data["success"] && isset($cache_data["cache_data"]) && $wdi_requests_success ) {
|
175 |
+
$return_data['data'] = $this->join_feed_cache($feed_id);
|
176 |
+
return json_encode($return_data);
|
177 |
} else {
|
178 |
+
return json_encode(array('data'=>''));
|
179 |
}
|
180 |
}
|
181 |
|
182 |
public function wdi_getHashtagId( $tagname = '', $user_name='' ) {
|
183 |
$this->account_data = $this->wdi_authenticated_users_list[$user_name];
|
184 |
+
$url = 'https://graph.facebook.com/v10.0/ig_hashtag_search/?user_id=' . $this->account_data["user_id"] . '&q=' . $tagname . '&access_token=' . $this->account_data["access_token"];
|
185 |
$args = array();
|
186 |
$response = wp_remote_get($url, $args);
|
187 |
|
240 |
"profile_picture" => "",
|
241 |
"username" => "",
|
242 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
"created_time" => (isset($media["timestamp"]) ? $media["timestamp"] : ""),
|
244 |
"caption" => array(
|
245 |
"id" => "",
|
354 |
$carousel_media = array();
|
355 |
$api_url = 'https://graph.instagram.com/v1.0/';
|
356 |
if ( $this->account_data["type"] === "business" ) {
|
357 |
+
$api_url = 'https://graph.facebook.com/v10.0/';
|
358 |
}
|
359 |
$api_url .= $media_id . '/children?access_token=' . $this->account_data["access_token"];
|
360 |
$fields = 'id,media_type,media_url,permalink,thumbnail_url,username,timestamp';
|
439 |
$api_url = 'https://graph.instagram.com/v1.0/';
|
440 |
$media_fields = 'id,media_type,media_url,permalink,thumbnail_url,username,caption,timestamp';
|
441 |
if ( $this->account_data["type"] === "business" ) {
|
442 |
+
$api_url = 'https://graph.facebook.com/v10.0/';
|
443 |
$media_fields = 'id,media_type,media_url,permalink,thumbnail_url,username,caption,timestamp,ig_id,is_comment_enabled,like_count,comments_count,owner,shortcode';
|
444 |
}
|
445 |
$baseUrl = $api_url . $user_id . '/media/?fields=' . $media_fields . '&limit=100&access_token=' . $access_token;
|
456 |
if ( !isset($response->errors) && is_array($response) && isset($response["body"]) ) {
|
457 |
$data = json_decode($response["body"], TRUE);
|
458 |
if ( !empty($data['data']) ) {
|
459 |
+
foreach ($data['data'] as $key => $ig_object) {
|
460 |
+
if ($ig_object['media_type'] === "VIDEO") {
|
461 |
+
$oembedApiUrl = "https://graph.facebook.com/v10.0/instagram_oembed?url=" . $ig_object['permalink'] . "&access_token=" . $this->account_data["access_token"];
|
462 |
+
$oembedData = wp_remote_get($oembedApiUrl, $args);
|
463 |
+
if ( !isset($oembedData->errors) && is_array($oembedData) && isset($oembedData["body"]) ) {
|
464 |
+
$oembedData = json_decode($oembedData["body"], TRUE);
|
465 |
+
if ( !empty($oembedData['thumbnail_url']) ) {
|
466 |
+
if (!array_key_exists('media_url', $ig_object)) { // if no media url(Copyright) change type to image
|
467 |
+
$data['data'][$key]['media_type'] = "IMAGE";
|
468 |
+
$data['data'][$key]['media_url'] = $oembedData['thumbnail_url'];
|
469 |
+
} else { //
|
470 |
+
$data['data'][$key]['thumbnail_url'] = $oembedData['thumbnail_url'];
|
471 |
+
}
|
472 |
+
}
|
473 |
+
}
|
474 |
+
}
|
475 |
+
else if ($ig_object['media_type'] === "CAROUSEL_ALBUM") {
|
476 |
+
foreach ($ig_object['children']['data'] as $carousel_key => $carousel_child) {
|
477 |
+
if ($carousel_child['media_type'] === "VIDEO") {
|
478 |
+
$childOembedApiUrl = "https://graph.facebook.com/v10.0/instagram_oembed?url=" . $carousel_child['permalink'] . "&access_token=" . $this->account_data["access_token"];
|
479 |
+
$childOembedData = wp_remote_get($childOembedApiUrl, $args);
|
480 |
+
if ( !isset($childOembedData->errors) && is_array($childOembedData) && isset($childOembedData["body"]) ) {
|
481 |
+
$childOembedData = json_decode($childOembedData["body"], TRUE);
|
482 |
+
if ( !empty($childOembedData['thumbnail_url']) ) {
|
483 |
+
if (!array_key_exists('media_url', $carousel_child)) { // if no media url(Copyright) change type to image
|
484 |
+
$data['data'][$key]['children']['data'][$carousel_key]['media_type'] = "IMAGE";
|
485 |
+
$data['data'][$key]['children']['data'][$carousel_key]['media_url'] = $childOembedData['thumbnail_url'];
|
486 |
+
} else { // if ok just add thumb url for VIDEO type
|
487 |
+
$data['data'][$key]['children']['data'][$carousel_key]['thumbnail'] = $childOembedData['thumbnail_url'];
|
488 |
+
}
|
489 |
+
}
|
490 |
+
}
|
491 |
+
}
|
492 |
+
}
|
493 |
+
}
|
494 |
+
}
|
495 |
if ( !empty($this->conditions) ) {
|
496 |
$temp_data = $data;
|
497 |
$temp_data['data'] = $this->filterUserMedia( $data, $this->conditions['conditional_filters'], $this->conditions['conditional_filter_type'] );
|
505 |
} else {
|
506 |
$current_data = $this->convertPersonalData($data);
|
507 |
}
|
508 |
+
|
509 |
/* Remove current feed cache data */
|
510 |
if ( $iter == 0 ) {
|
511 |
$this->cache->reset_feed_cache( $feed_id );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
512 |
}
|
513 |
|
514 |
$current_data = json_encode($current_data);
|
515 |
|
516 |
+
|
517 |
+
$this->cache->set_cache_data($feed_id.'_'.$iter, base64_encode($current_data));
|
518 |
+
|
519 |
$return_data['next_url'] = '';
|
520 |
if ( isset($data['paging']['next']) && $data['paging']['next'] != '' ) {
|
521 |
$return_data['next_url'] = $data['paging']['next'];
|
522 |
$return_data['iter'] = $iter;
|
523 |
}
|
524 |
|
525 |
+
$wdi_cache_request_count = isset($this->wdi_options['wdi_cache_request_count']) ? intval($this->wdi_options['wdi_cache_request_count']) : 10;
|
526 |
+
|
527 |
+
/* Check if all requests done or limi of requests exceed keep option 1 */
|
528 |
+
if( $return_data['next_url'] == '' || $iter == ($wdi_cache_request_count-1) ) {
|
529 |
+
update_option('wdi_cache_success_'.$feed_id, 1, 1);
|
530 |
+
}
|
531 |
return json_encode($return_data);
|
532 |
}
|
533 |
else {
|
framework/WDILibrary.php
CHANGED
@@ -1140,7 +1140,7 @@ class WDILibrary {
|
|
1140 |
'basic_app_id' => '734781953985462',
|
1141 |
'graph_authorize_url' => 'https://www.facebook.com/dialog/oauth/',
|
1142 |
'basic_authorize_url' => 'https://api.instagram.com/oauth/authorize/',
|
1143 |
-
'graph_scope' => '
|
1144 |
'basic_scope' => 'user_profile,user_media',
|
1145 |
'basic_response_type' => 'code',
|
1146 |
|
1140 |
'basic_app_id' => '734781953985462',
|
1141 |
'graph_authorize_url' => 'https://www.facebook.com/dialog/oauth/',
|
1142 |
'basic_authorize_url' => 'https://api.instagram.com/oauth/authorize/',
|
1143 |
+
'graph_scope' => 'instagram_basic',
|
1144 |
'basic_scope' => 'user_profile,user_media',
|
1145 |
'basic_response_type' => 'code',
|
1146 |
|
frontend/views/WDIViewGalleryBox.php
CHANGED
@@ -248,9 +248,9 @@ class WDIViewGalleryBox {
|
|
248 |
}
|
249 |
|
250 |
.wdi_filmstrip_thumbnails {
|
251 |
-
height: <?php echo ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : ($image_filmstrip_height + $filmstrip_thumb_margin_hor
|
252 |
<?php echo $left_or_top; ?>: 0px;
|
253 |
-
width: <?php echo ($filmstrip_direction == 'horizontal' ? ($image_filmstrip_width + $filmstrip_thumb_margin_hor
|
254 |
}
|
255 |
|
256 |
.wdi_filmstrip_thumbnail {
|
@@ -1312,9 +1312,11 @@ class WDIViewGalleryBox {
|
|
1312 |
|
1313 |
jQuery(".wdi_filmstrip_right").on(wdi_click, function () {
|
1314 |
jQuery( ".wdi_filmstrip_thumbnails" ).stop(true, false);
|
1315 |
-
if (jQuery(".wdi_filmstrip_thumbnails").position().<?php echo $left_or_top; ?>
|
|
|
1316 |
jQuery(".wdi_filmstrip_left").css({opacity: 1, filter: "Alpha(opacity=100)"});
|
1317 |
-
if (jQuery(".wdi_filmstrip_thumbnails").position().<?php echo $left_or_top; ?>
|
|
|
1318 |
jQuery(".wdi_filmstrip_thumbnails").animate({<?php echo $left_or_top; ?>: -(jQuery(".wdi_filmstrip_thumbnails").<?php echo $width_or_height; ?>() - jQuery(".wdi_filmstrip").<?php echo $width_or_height; ?>())}, 500, 'linear');
|
1319 |
}
|
1320 |
else {
|
@@ -1322,11 +1324,7 @@ class WDIViewGalleryBox {
|
|
1322 |
}
|
1323 |
}
|
1324 |
/* Disable right arrow.*/
|
1325 |
-
|
1326 |
-
if (jQuery(".wdi_filmstrip_thumbnails").position().<?php echo $left_or_top; ?> == -(jQuery(".wdi_filmstrip_thumbnails").<?php echo $width_or_height; ?>() - jQuery(".wdi_filmstrip").<?php echo $width_or_height; ?>())) {
|
1327 |
-
jQuery(".wdi_filmstrip_right").css({opacity: 0.3, filter: "Alpha(opacity=30)"});
|
1328 |
-
}
|
1329 |
-
}, 500);
|
1330 |
});
|
1331 |
|
1332 |
jQuery(".wdi_filmstrip_left").on(wdi_click, function () {
|
@@ -1341,11 +1339,7 @@ class WDIViewGalleryBox {
|
|
1341 |
}
|
1342 |
}
|
1343 |
/* Disable left arrow.*/
|
1344 |
-
|
1345 |
-
if (jQuery(".wdi_filmstrip_thumbnails").position().<?php echo $left_or_top; ?> == 0) {
|
1346 |
-
jQuery(".wdi_filmstrip_left").css({opacity: 0.3, filter: "Alpha(opacity=30)"});
|
1347 |
-
}
|
1348 |
-
}, 500);
|
1349 |
});
|
1350 |
|
1351 |
/* Set filmstrip initial position.*/
|
@@ -1831,6 +1825,9 @@ class WDIViewGalleryBox {
|
|
1831 |
jQuery(window).blur(function() {
|
1832 |
event_stack = [];
|
1833 |
window.clearInterval(wdi_playInterval);
|
|
|
|
|
|
|
1834 |
});
|
1835 |
|
1836 |
</script>
|
248 |
}
|
249 |
|
250 |
.wdi_filmstrip_thumbnails {
|
251 |
+
height: <?php echo ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : ($image_filmstrip_height + $filmstrip_thumb_margin_hor * $theme_row->lightbox_filmstrip_thumb_border_width) * $image_rows_count); ?>px;
|
252 |
<?php echo $left_or_top; ?>: 0px;
|
253 |
+
width: <?php echo ($filmstrip_direction == 'horizontal' ? ($image_filmstrip_width + $filmstrip_thumb_margin_hor * $theme_row->lightbox_filmstrip_thumb_border_width) * $image_rows_count : $image_filmstrip_width); ?>px;
|
254 |
}
|
255 |
|
256 |
.wdi_filmstrip_thumbnail {
|
1312 |
|
1313 |
jQuery(".wdi_filmstrip_right").on(wdi_click, function () {
|
1314 |
jQuery( ".wdi_filmstrip_thumbnails" ).stop(true, false);
|
1315 |
+
if (jQuery(".wdi_filmstrip_thumbnails").position().<?php echo $left_or_top; ?>
|
1316 |
+
>= -(jQuery(".wdi_filmstrip_thumbnails").<?php echo $width_or_height; ?>() - jQuery(".wdi_filmstrip").<?php echo $width_or_height; ?>())) {
|
1317 |
jQuery(".wdi_filmstrip_left").css({opacity: 1, filter: "Alpha(opacity=100)"});
|
1318 |
+
if (jQuery(".wdi_filmstrip_thumbnails").position().<?php echo $left_or_top; ?>
|
1319 |
+
< -(jQuery(".wdi_filmstrip_thumbnails").<?php echo $width_or_height; ?>() - jQuery(".wdi_filmstrip").<?php echo $width_or_height; ?>() - <?php echo $filmstrip_thumb_margin_hor + $image_filmstrip_width; ?>)) {
|
1320 |
jQuery(".wdi_filmstrip_thumbnails").animate({<?php echo $left_or_top; ?>: -(jQuery(".wdi_filmstrip_thumbnails").<?php echo $width_or_height; ?>() - jQuery(".wdi_filmstrip").<?php echo $width_or_height; ?>())}, 500, 'linear');
|
1321 |
}
|
1322 |
else {
|
1324 |
}
|
1325 |
}
|
1326 |
/* Disable right arrow.*/
|
1327 |
+
checkNeedToDisableRightArrow()
|
|
|
|
|
|
|
|
|
1328 |
});
|
1329 |
|
1330 |
jQuery(".wdi_filmstrip_left").on(wdi_click, function () {
|
1339 |
}
|
1340 |
}
|
1341 |
/* Disable left arrow.*/
|
1342 |
+
checkNeedToDisableLeftArrow();
|
|
|
|
|
|
|
|
|
1343 |
});
|
1344 |
|
1345 |
/* Set filmstrip initial position.*/
|
1825 |
jQuery(window).blur(function() {
|
1826 |
event_stack = [];
|
1827 |
window.clearInterval(wdi_playInterval);
|
1828 |
+
jQuery(window).one('focus', function () {
|
1829 |
+
wdi_popup_resize();
|
1830 |
+
})
|
1831 |
});
|
1832 |
|
1833 |
</script>
|
js/wdi_admin.js
CHANGED
@@ -512,7 +512,7 @@ wdi_controller.save_feed = function ( task ) {
|
|
512 |
username = jQuery('#WDI_user_name option:selected').val();
|
513 |
feed_title = jQuery('#WDI_feed_name');
|
514 |
var userObj = wdi_controller.getUserObj(username);
|
515 |
-
if (feed_title.val() ==
|
516 |
alert(wdi_messages.feed_title_field_required);
|
517 |
feed_title.focus().attr( 'style', 'border-color: #FF0000;' );
|
518 |
return false;
|
@@ -535,7 +535,7 @@ wdi_controller.save_feed = function ( task ) {
|
|
535 |
if ( this.isJsonString(json_feed_users) ) {
|
536 |
json_feed_users = JSON.parse(json_feed_users);
|
537 |
for ( var i in json_feed_users ) {
|
538 |
-
if ( json_feed_users[i].username.charAt(0) === '#' ) {
|
539 |
feed_users.push(json_feed_users[i]);
|
540 |
}
|
541 |
}
|
@@ -555,13 +555,7 @@ wdi_controller.save_feed = function ( task ) {
|
|
555 |
jQuery('#wdi_current_id').val(id);
|
556 |
}
|
557 |
jQuery('#task').attr('value', task);
|
558 |
-
|
559 |
-
|
560 |
-
//set_cache_data( users );
|
561 |
-
submit_ajax();
|
562 |
-
/*
|
563 |
-
jQuery('#wdi_save_feed').submit();
|
564 |
-
*/
|
565 |
}
|
566 |
|
567 |
var comlete_redirect_url = '';
|
@@ -583,8 +577,11 @@ function submit_ajax() {
|
|
583 |
if( response['need_cache'] == 1 ) {
|
584 |
jQuery(".caching-process-message").removeClass("wdi_hidden");
|
585 |
/* TODO Timeout need as loader not appear without timeout, need to fix */
|
586 |
-
setTimeout(function(){
|
587 |
-
|
|
|
|
|
|
|
588 |
jQuery("#wdi_save_loading").addClass("wdi_hidden");
|
589 |
window.location = comlete_redirect_url;
|
590 |
}
|
512 |
username = jQuery('#WDI_user_name option:selected').val();
|
513 |
feed_title = jQuery('#WDI_feed_name');
|
514 |
var userObj = wdi_controller.getUserObj(username);
|
515 |
+
if (feed_title.val() == '') {
|
516 |
alert(wdi_messages.feed_title_field_required);
|
517 |
feed_title.focus().attr( 'style', 'border-color: #FF0000;' );
|
518 |
return false;
|
535 |
if ( this.isJsonString(json_feed_users) ) {
|
536 |
json_feed_users = JSON.parse(json_feed_users);
|
537 |
for ( var i in json_feed_users ) {
|
538 |
+
if ( type == 'business' && json_feed_users[i].username.charAt(0) === '#' ) {
|
539 |
feed_users.push(json_feed_users[i]);
|
540 |
}
|
541 |
}
|
555 |
jQuery('#wdi_current_id').val(id);
|
556 |
}
|
557 |
jQuery('#task').attr('value', task);
|
558 |
+
submit_ajax();
|
|
|
|
|
|
|
|
|
|
|
|
|
559 |
}
|
560 |
|
561 |
var comlete_redirect_url = '';
|
577 |
if( response['need_cache'] == 1 ) {
|
578 |
jQuery(".caching-process-message").removeClass("wdi_hidden");
|
579 |
/* TODO Timeout need as loader not appear without timeout, need to fix */
|
580 |
+
setTimeout(function(){
|
581 |
+
wdi_controller.instagram.set_cache_data(comlete_redirect_url, '', feed_id, '', 0, 0, '', '', '', '');
|
582 |
+
}, 1000);
|
583 |
+
}
|
584 |
+
else {
|
585 |
jQuery("#wdi_save_loading").addClass("wdi_hidden");
|
586 |
window.location = comlete_redirect_url;
|
587 |
}
|
js/wdi_admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function wdi_multiple_accounts_option_controller(){var e=jQuery(jQuery("#wdi_user_id").closest("form").find(".form-table").get(1));e.addClass("wdi_multiple_accounts_section");var t="";if(wdi_options.wdi_authenticated_users_list){var i,r=JSON.parse(wdi_options.wdi_authenticated_users_list),a=0;for(i in r)t+="<tr data-multiple-account='"+a+"'>",t+="<th>Access Token</th>",t+='<td><input type="text" name="wdi_instagram_options[wdi_authenticated_users_list][access_token][]" size="53" required="" value="'+r[i].access_token+'"></td>',t+="</tr>",t+="<tr data-multiple-account='"+a+"' class='wdi_username_tr'>",t+="<th>Username</th>",t+='<td><div class="wdi_input_wrapper"><input type="text" name="wdi_instagram_options[wdi_authenticated_users_list][user_name][]" size="53" required="" value="'+r[i].user_name+'"></div><div class="wdi_remove_auth_user">Delete</div></td>',t+='<input type="hidden" name="wdi_instagram_options[wdi_authenticated_users_list][user_id][]" size="53" required="" value="'+r[i].user_id+'">',t+="</tr>",a++;e.append(t)}jQuery(".wdi_remove_auth_user").on("click",function(e){e.preventDefault();e=jQuery(this).closest(".wdi_username_tr").data("multiple-account");return jQuery(this).closest(".wdi_multiple_accounts_section").find('tr[data-multiple-account="'+e+'"]').remove(),!1})}function wdi_advanced_option_controller(){var e=jQuery(jQuery("#wdi_user_id").closest("form").find(".form-table").get(1));e.addClass("wdi_advanced_option wdi_advanced_option_close");$tr=jQuery("<tr class='wdi_advanced_option_head'><th style='width: 100%;'>ADVANCED OPTIONS AND MULTIPLE INSTAGRAM ACCOUNTS</th><td><div class='wdi_advanced_option_icon'></div></td></tr>"),e.prepend($tr),$tr.on("click",function(){e.hasClass("wdi_advanced_option_open")?(e.removeClass("wdi_advanced_option_open"),e.addClass("wdi_advanced_option_close")):(e.removeClass("wdi_advanced_option_close"),e.addClass("wdi_advanced_option_open"))})}function wdi_controller(){}jQuery(document).ready(function(){function e(e){if(!1===e){var t=JSON.parse(localStorage.getItem("wdi_sections"));for(i in null!==t&&!1!==t||(t={wdi_layout_section:"show",wdi_media:"show",wdi_layout:"hide",wdi_advanced:"hide",wdi_lightbox_general:"show",wdi_lightbox_advanced:"hide",wdi_conditional_filters:"show",wdi_how_to_publish:"show"},localStorage.setItem("wdi_sections",JSON.stringify(t))),t){var r=jQuery("#wdi_save_feed").find("[data-section_name='"+i+"']");n(t[i],r)}}else{var a=jQuery(e).data("section_name"),s=null;e.hasClass("wdi_section_open")?(n("show",e),s="show"):e.hasClass("wdi_section_close")&&(n("hide",e),s="hide"),null!=s&&((e=JSON.parse(localStorage.getItem("wdi_sections"))||{})[a]=s,localStorage.setItem("wdi_sections",JSON.stringify(e)))}}function n(e,t){"show"===e?("table"===(e=t.closest(".wdi_section").find(".wdi_elements")).data("display")?e.css({display:"table"}):e.css({display:"block"}),t.css({"border-bottom":"1px solid #f1f1f1",margin:"0 auto 15px"}),t.removeClass("wdi_section_open"),t.addClass("wdi_section_close")):(t.closest(".wdi_section").find(".wdi_elements").css({display:"none"}),t.css({"border-bottom":"0px",margin:"0 auto 0px"}),t.removeClass("wdi_section_close"),t.addClass("wdi_section_open"))}jQuery("#wdi_reset_cache").click(function(e){jQuery(".wdi_reset_cache_success").remove(),jQuery("#wdi_save_loading").removeClass("wdi_hidden"),e.preventDefault(),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,task:"reset",action:"wdi_cache"},success:function(e){!1===e.success?jQuery("#wdi_reset_cache").after("<span class='wdi_reset_cache_success' style='color: #fc0000; margin-left: 15px; line-height: 2;'>Failed</span>"):(wdi_controller.instagram=new WDIInstagram,jQuery.each(e.data,function(e,t){var i=JSON.parse(t.users),r="",a="",s="",n=t.endpoint;jQuery.each(i,function(e,t){""!==t.tag_id?(a=(a=(a=t.username).substr(1,a.length)).replace(" ",""),s=t.tag_id):r=(r=wdi_controller.getUserObj(t.username))&&r.user_name});t=t.feed_id;wdi_controller.instagram.set_cache_data("",r,t,"",0,0,a,s,n,"")}),jQuery("#wdi_reset_cache").after("<span class='wdi_reset_cache_success' style='color: #029117; margin-left: 15px; line-height: 2;'>Success</span>"))}})}),jQuery(".wdi_account_refresh").click(function(){var t=jQuery(this),e=t.data("wdi_account");jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{page:"wdi_settings",action:"wdi_account_refresh",nonce:wdi_ajax.wdi_nonce,user_name:e},success:function(e){t.closest("div").find(".wdi_reset_cache_success").remove(),!0===e.success?(t.after("<span class='wdi_reset_cache_success' style='color: #029117; margin-left: 15px; line-height: 2;'>Success</span>"),t.closest("div").find(".wdi_user_token").val(e.token)):t.after("<span class='wdi_reset_cache_success' style='color: #fc0000; margin-left: 15px; line-height: 2;'>Failed</span>")}})}),wdi_controller.bindSaveFeedEvent(),wdi_controller.bindAddNewUserOrHashtagEvent(),jQuery(".display_type input").on("click",function(){wdi_controller.displaySettingsSection(jQuery(this))}),wdi_controller.conditionalFiltersTabInit(),wdi_controller.bindSaveThemeEvent(),jQuery("body").hasClass("instagram-feed_page_wdi_settings")&&wdi_advanced_option_controller(),jQuery(".wdi_section_name").click(function(){e(jQuery(this))}),e(!1),jQuery(document).on("click",".wdi-account-show-token",function(){jQuery(this).find("i").toggleClass("dashicons-arrow-up-alt2 dashicons-arrow-down-alt2"),jQuery(this).parents("li").find(".wdi-account-accesstoken").slideToggle(300)}),jQuery(document).on("click",".wdi-advanced-options .wdi-advanced-headline",function(){jQuery(this).find("i").toggleClass("dashicons-arrow-up-alt2 dashicons-arrow-down-alt2"),jQuery(this).parents(".wdi-advanced-options").find(".wdi-advanced-body").slideToggle(500)}),jQuery(document).on("click","#wdi_verify",function(){jQuery("#wdi_submit").prop("disabled",!0),jQuery(this).is(":checked")&&jQuery("#wdi_submit").prop("disabled",!1)}),jQuery(document).on("click","#wdi_submit",function(){return confirm(wdi_messages.uninstall_plugin)&&jQuery("#wdi_uninstall_form").submit(),!1}),jQuery("#WDI_feed_name").on("keypress",function(){jQuery(this).removeAttr("style")})}),wdi_controller.getParameterByName=function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");e=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(location.search);return null===e?"":decodeURIComponent(e[1].replace(/\+/g," "))},wdi_controller.apiRedirected=function(){var e=this.getParameterByName("access_token").split("."),t=/^[^\\\/&?><"']*$/;for(i=0;i<e.length;i++)if(null===e[i].match(t))return;var r=e.join(".");jQuery(document).ready(function(){""===wdi_options.wdi_access_token?jQuery("#wdi_access_token").attr("value",r):(jQuery(".wdi_more_token_template .wdi_more_access_token").prop("disabled",!1),jQuery(".wdi_more_token_template .wdi_more_access_token").attr("value",r))}),wdi_controller.instagram.addToken(r),wdi_controller.getUserInfo(r)},wdi_controller.getUserInfo=function(e){this.instagram.getSelfInfo({success:function(e){""===wdi_options.wdi_access_token?(jQuery("#wdi_user_name").attr("value",e.data.username),jQuery("#wdi_user_id").attr("value",e.data.id)):(jQuery(".wdi_more_token_template .wdi_more_user_name").prop("disabled",!1),jQuery(".wdi_more_token_template .wdi_more_user_id").prop("disabled",!1),jQuery(".wdi_more_token_template .wdi_more_user_name").attr("value",e.data.username),jQuery(".wdi_more_token_template .wdi_more_user_id").attr("value",e.data.id)),jQuery(document).trigger("wdi_settings_filled")}})},wdi_controller.oldDisplayType={},wdi_controller.displayTypeMemory={},wdi_controller.switchFeedTabs=function(e,t){jQuery("#wdi_refresh_tab").attr("value",e),jQuery(".wdi_tab").hide(),jQuery("#"+e+"_tab").show(),jQuery(".display_type").css("display","none"),jQuery('.display_type[tab="'+e+'"]').css("display","block"),jQuery('.display_type[tab="'+e+'"]').length?jQuery(".display_type_content").show():jQuery(".display_type_content").hide(),jQuery(".wdi_feed_tabs").filter(".wdi_feed_tab_active").each(function(){jQuery(this).removeClass("wdi_feed_tab_active")}),jQuery("#wdi_"+e).addClass("wdi_feed_tab_active");var i=jQuery(),r=!1;null!=t&&""!=t&&(i=jQuery(".display_type #"+t).prop("checked",!0),jQuery("#wdi_feed_type").attr("value",t)),r||0!=(i=jQuery('.display_type[tab="'+e+'"] input[name="feed_type"]:checked')).length&&(r=!0),r||0!=(i=jQuery('.display_type[tab="'+e+'"] #thumbnails')).length&&(r=!0,i.prop("checked",!0),jQuery("#wdi_feed_type").attr("value","thumbnails")),r&&wdi_controller.displaySettingsSection(i),"conditional_filters"==e&&wdi_controller.updateConditionalFiltersUi()},wdi_controller.displaySettingsSection=function(e){var i=e.attr("id").toLowerCase().trim(),t=e.parent().parent().attr("tab"),e=jQuery("#wdi_refresh_section");wdi_controller.oldDisplayType={section:i,tab:t},wdi_controller.displayTypeMemory[t]=wdi_controller.oldDisplayType,null!=e&&e.attr("value",i);e=jQuery(".wdi_border_wrapper .form-table");jQuery("#wdi_feed_type").attr("value",i);var r=0,a=!1;e.find(".wdi_element").each(function(){0;var e=jQuery(this).find(".wdwt_param").children().children().children().attr("section");if(void 0!==e){a=!1;var t=e.toLowerCase().trim().split(",");for(r=0;r<t.length;r++)t[r]===i&&(jQuery(this).css("display","block"),a=!0);!1===a&&jQuery(this).css("display","none")}})},wdi_controller.switchThemeTabs=function(e,t){jQuery(".wdi_feed_tabs").filter(".wdi_feed_tab_active").each(function(){jQuery(this).removeClass("wdi_feed_tab_active")}),jQuery("#wdi_"+e).addClass("wdi_feed_tab_active"),jQuery("[tab]").each(function(){jQuery(this).attr("tab")!=e?jQuery(this).parent().parent().parent().parent().parent().filter("tr").css("display","none"):jQuery(this).parent().parent().parent().parent().parent().filter("tr").css("display","block")}),jQuery(".display_type").css("display","none"),jQuery('.display_type[tab="'+e+'"]').css("display","block"),jQuery("#wdi_refresh_tab").attr("value",e),null!=t&&""!=t&&jQuery("#wdi_refresh_section").attr("value",t),(null==t&&""!=t?null!=wdi_controller.displayTypeMemory[e]?jQuery(".display_type #"+wdi_controller.displayTypeMemory[e].section):jQuery('.display_type[tab="'+e+'"]').first().find("input"):jQuery(".display_type #"+t)).trigger("click")},wdi_controller.bindSaveFeedEvent=function(){var e=this;jQuery("#wdi_save_feed_submit").on("click",function(){e.save_feed("save_feed")}),jQuery("#wdi_save_feed_apply").on("click",function(){e.save_feed("apply_changes")}),jQuery("#wdi_cancel_changes").on("click",function(){e.save_feed("cancel")})},wdi_controller.save_feed=function(e){var t,i,r,a=[],s={};"cancel"==e&&(window.location=window.location.href),t=jQuery("#WDI_user_name option:selected").data("type"),n=jQuery("#WDI_user_name option:selected").val(),i=jQuery("#WDI_feed_name");var n=wdi_controller.getUserObj(n);if(""==i.val())return alert(wdi_messages.feed_title_field_required),i.focus().attr("style","border-color: #FF0000;"),!1;if(!n)return alert(wdi_messages.user_field_required),!1;if(r={id:n.user_id,username:n.user_name},wdi_controller.checkIfUserNotSaved(e),0==wdi_controller.waitingAjaxRequestEnd.button){if(s=jQuery("#WDI_feed_users").val(),this.isJsonString(s)){for(var d in s=JSON.parse(s))"#"===s[d].username.charAt(0)&&a.push(s[d]);a.push(r)}else a.push(r);users=this.stringifyUserData(a),jQuery("#WDI_feed_users").val(users),jQuery("#wdi_feed_thumb").val(""),"business"==t&&jQuery("#wdi_feed_thumb").val(n.profile_picture_url),"apply_changes"!=e&&"save_feed"!=e||(n=jQuery("#wdi_add_or_edit").val(),jQuery("#wdi_current_id").val(n)),jQuery("#task").attr("value",e),submit_ajax()}};var comlete_redirect_url="";function submit_ajax(){var e=jQuery("#wdi_save_feed").serialize();e+="&action=wdi_apply_changes&page=wdi_feeds",jQuery("#wdi_save_loading").removeClass("wdi_hidden"),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:e,success:function(e){comlete_redirect_url=e.url;var t=e.feed_id;1==e.need_cache?(jQuery(".caching-process-message").removeClass("wdi_hidden"),setTimeout(function(){wdi_controller.instagram.set_cache_data(comlete_redirect_url,"",t,"",0,0,"","","","")},1e3)):(jQuery("#wdi_save_loading").addClass("wdi_hidden"),window.location=comlete_redirect_url)},error:function(e,t,i){window.location=comlete_redirect_url}})}function wdi_spider_select_value(e){e.focus(),e.select()}function wdi_spider_set_input_value(e,t){"add"===t&&""==jQuery("#wdi_access_token").attr("value")&&alert("Please get your access token"),document.getElementById(e)&&(document.getElementById(e).value=t)}function wdi_spider_form_submit(e,t){document.getElementById(t)&&document.getElementById(t).submit(),e.preventDefault?e.preventDefault():e.returnValue=!1}function wdi_bulk_actions(e){e=jQuery(e).val();return""!=e&&(!("delete_all"==e&&!confirm(wdi_messages.do_you_want_to_delete_selected_items))&&(wdi_spider_set_input_value("task",e),jQuery("#wdi_feed_form").submit(),!0))}function wdi_spider_check_all_items(){wdi_spider_check_all_items_checkbox(),jQuery("#check_all").trigger("click")}function wdi_spider_check_all_items_checkbox(){var e;jQuery("#check_all_items").prop("checked")?(jQuery("#check_all_items").prop("checked",!1),jQuery("#draganddrop").hide()):(e=parseInt(jQuery(".displaying-num").html())?parseInt(jQuery(".displaying-num").html()):0,e=(jQuery('input[id^="check_pr_"]').length?parseInt(jQuery('input[id^="check_pr_"]').length):0)+e,jQuery("#check_all_items").prop("checked",!0),e&&(jQuery("#draganddrop").html("<strong><p>Selected "+e+" item"+(1<e?"s":"")+".</p></strong>"),jQuery("#draganddrop").show()))}function wdi_spider_check_all(e){jQuery(e).prop("checked")||(jQuery("#check_all_items").prop("checked",!1),jQuery("#draganddrop").hide())}function wdi_spider_set_input_value(e,t){"add"===t&&""==jQuery("#wdi_access_token").attr("value")&&alert("Please get your access token"),document.getElementById(e)&&(document.getElementById(e).value=t)}function wdi_account_remove(e,t){jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{page:"wdi_settings",action:"wdi_account_disconnect",nonce:wdi_ajax.wdi_nonce,user_name:e,user_id:t},success:function(e){e.success&&(1==jQuery('[class*="wdi-account-list"]').length?((e=jQuery(".wdi-account-list-"+t).parent()).prev().remove(),e.remove(),jQuery("#toplevel_page_wdi_feeds ul").remove(),jQuery("#toplevel_page_wdi_feeds a").attr("href","admin.php?page=wdi_settings")):jQuery(".wdi-account-list-"+t).remove())}})}function wdi_popup_open(){jQuery(".wdi-popup").show()}function wdi_popup_close(){jQuery(".wdi-popup").hide()}wdi_controller.makeInstagramUserRequest=function(e,t){var i,r=this,a=this.getInputType(e),s="hashtag"===a;if(""==e)return alert(wdi_messages.please_write_hashtag),!1;if(""!=e&&!s)return alert(wdi_messages.invalid_hashtag),!1;if(r.checkForDuplicateUser(e))return alert(e+" "+wdi_messages.already_added),!1;switch(i=jQuery("#WDI_user_name option:selected").val(),(s=wdi_controller.getUserObj(i))&&(this.instagram.user=s),a){case"user":break;case"hashtag":var n=(n=e.substr(1,e.length)).replace(" ",""),d=(jQuery("input[name='wdi_feed_settings[hashtag_top_recent]']:checked").val(),{tagname:n,action:"wdi_getHashtagId",wdi_nonce:wdi_ajax.wdi_nonce,user_name:i});jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:d,success:function(e){jQuery("#wdi_add_user_ajax").removeAttr("disabled"),r.isValidResponse(e).valid&&r.addHashtag(n,e)},error:function(e,t,i){}})}},wdi_controller.checkForDuplicateUser=function(e){var t=jQuery("#WDI_feed_users").val();if(this.isJsonString(t)){t=JSON.parse(t);for(var i=0;i<t.length;i++)if(e==t[i].username)return!0}return!1},wdi_controller.getInputType=function(e){switch(e[0]){case"#":return"hashtag";case"%":return"location";default:return"user"}},wdi_controller.stringifyUserData=function(e){for(var t=[],i=0;i<e.length;i++)t.push({id:e[i].id,username:e[i].username,tag_id:void 0!==e[i].tag_id?e[i].tag_id:""});return JSON.stringify(t)},wdi_controller.bindAddNewUserOrHashtagEvent=function(){jQuery("#wdi_add_user_ajax").on("click",function(){void 0!==jQuery(this).prop("disabled")||jQuery(this).prop("disabled",!0);var e=jQuery("#wdi_add_user_ajax_input").val().trim().toLowerCase();!1===wdi_controller.makeInstagramUserRequest(e)&&jQuery(this).removeAttr("disabled","disabled")}),jQuery("#wdi_add_user_ajax_input").on("keypress",function(e){if(13==e.keyCode){void 0!==jQuery("#wdi_add_user_ajax").prop("disabled")||jQuery("#wdi_add_user_ajax").prop("disabled",!0);e=jQuery("#wdi_add_user_ajax_input").val().trim().toLowerCase();return!1===wdi_controller.makeInstagramUserRequest(e)&&jQuery("#wdi_add_user_ajax").removeAttr("disabled","disabled"),!1}})},wdi_controller.removeFeedUser=function(e){var t,i=e.parent().find("a span").text();e.parent().find("a span").hasClass("wdi_hashtag")&&(i="#"+i),0!=this.feed_users.length||void 0!==(t=jQuery("#WDI_feed_users").val())&&this.isJsonString(t)&&(this.feed_users=JSON.parse(t));for(var r=0;r<this.feed_users.length;r++)if(this.feed_users[r].username==i){this.feed_users.splice(r,1);break}for(r=0;r<this.feed_users.length;r++)"#"!==this.feed_users[r].username.charAt(0)&&this.feed_users.splice(r,1);jQuery("#WDI_feed_users").val(this.stringifyUserData(this.feed_users)),e.parent().remove(),wdi_controller.changed_users()},wdi_controller.bindSaveThemeEvent=function(){jQuery("#wdi_save_theme_submit").on("click",function(){jQuery("#task").attr("value","save_feed"),jQuery("#wdi_save_feed").submit()}),jQuery("#wdi_save_theme_apply").on("click",function(){jQuery("#task").attr("value","apply_changes");var e=jQuery("#wdi_add_or_edit").attr("value");jQuery("#wdi_current_id").attr("value",e),jQuery("#wdi_save_feed").submit()}),jQuery("#wdi_save_theme_reset").on("click",function(){jQuery("#task").attr("value","reset_changes");var e=jQuery("#wdi_add_or_edit").attr("value");jQuery("#wdi_current_id").attr("value",e),jQuery("#wdi_save_feed").submit()})},wdi_controller.checkIfUserNotSaved=function(e){switch(e){case"save_feed":e="submit";break;case"apply_changes":e="apply";break;case"reset_changes":e="reset"}if(""==jQuery("#wdi_add_user_ajax_input").val().trim())return wdi_controller.waitingAjaxRequestEnd={button:0},0;var t=jQuery("#wdi_add_user_ajax_input").val().trim().toLowerCase();return wdi_controller.waitingAjaxRequestEnd={button:e},wdi_controller.makeInstagramUserRequest(t),1},wdi_controller.saveFeedAfterAjaxWait=function(e){var t;null!=wdi_controller.waitingAjaxRequestEnd&&(t=wdi_controller.waitingAjaxRequestEnd.button,e&&0!=t&&jQuery("#wdi_save_feed_"+t).trigger("click"),wdi_controller.waitingAjaxRequestEnd=void 0)},wdi_controller.getCookie=function(e){e=("; "+document.cookie).split("; "+e+"=");if(2==e.length)return e.pop().split(";").shift()},wdi_controller.isValidResponse=function(e){var t={};return void 0===e||void 0===e.meta.code||200!=e.meta.code?(t.valid=!1,void 0===e?t.msg=wdi_messages.instagram_server_error:200!==e.meta.code?t.msg=e.meta.error_message:t.msg=""):(t.valid=!0,t.msg="success"),t},wdi_controller.hasData=function(e){return void 0!==e&&void 0!==e.data&&0!=e.data.length},wdi_controller.thumbUser=function(e){return 0<this.feed_users.length&&this.feed_users[0].username===e},wdi_controller.findUser=function(e,t){var i=[];void 0!==t&&void 0!==t.data&&(i=t.data);for(var r=0;r<i.length;r++)if(i[r].username==e)return i[r];return!1},wdi_controller.addHashtag=function(e,t){if(null==e.match(/[~!@$%&*#^()<>?]/)){var i=jQuery('<div class="wdi_user"><a target="_blank" href="https://instagram.com/explore/tags/'+e+'"><img class="wdi_profile_pic" src="'+wdi_url.plugin_url+'images/hashtag.png"><span class="wdi_hashtag">'+e+'</span><i style="display:table-cell;width:25px;"></i></a><img class="wdi_remove_user" onclick="wdi_controller.removeFeedUser(jQuery(this))" src="'+wdi_url.plugin_url+'/images/delete_user.png"></div>');jQuery("#wdi_feed_users_ajax").append(i),jQuery("#wdi_add_user_ajax_input").val("");var r=jQuery("#WDI_feed_users").val();if(this.isJsonString(r)){r=JSON.parse(r);for(var a=0;a<r.length;a++)"#"!==r[a].username.charAt(0)&&r.splice(a,1)}else r=[];t={id:"#"+e,username:"#"+e,profile_picture:"",tag_id:t.tag_id};r.push(t),this.feed_users=r,jQuery("#WDI_feed_users").val(this.stringifyUserData(this.feed_users))}else alert(wdi_messages.invalid_hashtag);this.updateConditionalFiltersUi(),wdi_controller.saveFeedAfterAjaxWait(!0),wdi_controller.changed_users()},wdi_controller.changed_users=function(){for(var e=!1,t=0;t<this.feed_users.length;t++)if("#"===this.feed_users[t].username[0]){e=!0;break}e?(jQuery(".wdi_element_name_hashtag_top_recent").show(),jQuery(".wdi_element_name_show_username_on_thumb").hide()):(jQuery(".wdi_element_name_hashtag_top_recent").hide(),jQuery(".wdi_element_name_show_username_on_thumb").show())},wdi_controller.addUser=function(e){e.username=e.user_name,0==this.checkForDuplicateUser(e.username)?(newUser=jQuery('<div class="wdi_user"><a target="_blank" href="http://www.instagram.com/'+e.username+'"><span class="wdi_username">'+e.username+'</span><i style="display:table-cell;width:25px;"></i></a><img class="wdi_remove_user" onclick="wdi_controller.removeFeedUser(jQuery(this))" src="'+wdi_url.plugin_url+'images/delete_user.png"></div>'),jQuery("#wdi_feed_users_ajax").append(newUser),jQuery("#wdi_add_user_ajax_input").val(""),this.feed_users.push({id:e.id,username:e.username,profile_picture:""})):alert(e.username+" "+wdi_messages.already_added),this.updateConditionalFiltersUi(),wdi_controller.saveFeedAfterAjaxWait(!0)},wdi_controller.getUserProfilePic=function(e){for(var t=0;t<this.feed_users.length;t++)if(e==this.feed_users[t].username)return this.feed_users[t].profile_picture;return"false"},wdi_controller.conditionalFiltersTabInit=function(){this.setInitialFilters(),this.updateFiltersUi();var t=this;function e(){switch(jQuery("#WDI_wrap_conditional_filter_enable input:checked").val()){case"0":jQuery("#WDI_conditional_filters").parent().parent().addClass("wdi_hidden"),jQuery("#WDI_conditional_filter_type").parent().parent().parent().parent().parent().addClass("wdi_hidden"),jQuery("#wdi_final_condition").addClass("wdi_hidden"),jQuery("#WDI_filter_source").addClass("wdi_hidden");break;case"1":jQuery("#WDI_conditional_filters").parent().parent().removeClass("wdi_hidden"),jQuery("#WDI_conditional_filter_type").parent().parent().parent().parent().parent().removeClass("wdi_hidden"),jQuery("#wdi_final_condition").removeClass("wdi_hidden"),jQuery("#WDI_filter_source").removeClass("wdi_hidden")}}jQuery("#wdi_add_filter").on("click",function(){t.addConditionalFilter()&&jQuery("#wdi_filter_input").val("")}),jQuery(".wdi_filter_radio").on("click",function(){jQuery("#wdi_filter_input").trigger("focus")}),jQuery("#wdi_filter_input").on("keypress",function(e){if(13==e.keyCode)return t.addConditionalFilter()&&jQuery(this).val(""),!1}),e(),jQuery("#WDI_wrap_conditional_filter_enable input").on("change",function(){e()}),jQuery("#WDI_conditional_filter_type").on("change",function(){switch("none"==jQuery(this).val()||jQuery("#WDI_conditional_filters").css("display","block"),jQuery(this).parent().find("label").css({display:"inline-block"}),jQuery(this).val()){case"AND":jQuery("#WDI_conditional_filters").css("display","block"),jQuery(this).parent().find("label").html(wdi_messages.and_descr);break;case"OR":jQuery("#WDI_conditional_filters").css("display","block"),jQuery(this).parent().find("label").html(wdi_messages.or_descr);break;case"NOR":jQuery("#WDI_conditional_filters").css("display","block"),jQuery(this).parent().find("label").html(wdi_messages.nor_descr)}wdi_controller.updateFiltersUi()}),jQuery("#WDI_conditional_filter_type").trigger("change")},wdi_controller.addConditionalFilter=function(){var e=jQuery("#wdi_filter_input").val(),t=jQuery("#wdi_filter_type").val();if(filter={},""==e)return!1;switch(e=e.trim(),null==t&&("@"==e[0]?t="mention":"#"==e[0]?t="hashtag":"http"!=e.split("://")[0]&&"https"!=e.split("://")[0]||(t="url")),t){case"username":case"mention":"@"==e[0]&&(e=e.substr(1,e.length));break;case"hashtag":"#"==e[0]&&(e=e.substr(1,e.length));break;case"url":if(!/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(e))return alert(wdi_messages.invalid_url),!1}return filter={filter_type:t,filter_by:e,id:this.randomId()},null!=t?this.filterExists(filter)?(alert(e+" "+wdi_messages.already_added),!1):(this.conditionalFilters.push(filter),this.updateFiltersUi(),!0):(alert(wdi_messages.selectConditionType),!1)},wdi_controller.filterExists=function(e){for(var t=0;t<this.conditionalFilters.length;t++)if(this.conditionalFilters[t].filter_type==e.filter_type&&this.conditionalFilters[t].filter_by==e.filter_by)return!0;return!1},wdi_controller.updateFiltersUi=function(){for(var e,t=jQuery("#wdi_filters_ui").html(""),i=0;i<this.conditionalFilters.length;i++){if(0==i)if(1!=this.conditionalFilters.length)switch(jQuery("#WDI_conditional_filter_type").val()){case"AND":break;case"OR":t.append(jQuery('<span class="wdi_logic">'+wdi_messages.either+"</span>"));break;case"NOR":t.append(jQuery('<span class="wdi_logic">'+wdi_messages.neither+"</span>"))}else switch(jQuery("#WDI_conditional_filter_type").val()){case"AND":case"OR":break;case"NOR":t.append(jQuery('<span class="wdi_logic">'+wdi_messages.not+"</span>"))}switch(jQuery("#WDI_conditional_filter_type").val()){case"AND":e=wdi_messages.and;break;case"OR":e=wdi_messages.or;break;case"NOR":e=wdi_messages.nor}1<=i&&t.append(jQuery('<span class="wdi_logic">'+e+"</span>")),t.append(this.createUiElement(this.conditionalFilters[i]))}this.updateFilterTextarea()},wdi_controller.createUiElement=function(e){var t;switch(e.filter_type){case"mention":t="@";break;case"hashtag":t="#";break;case"location":t="%";break;default:t=""}return jQuery('<span data-id="'+e.id+'" class="wdi_filter_item wdi_filter_by_'+e.filter_type+'"></span>').html(t+e.filter_by+'<span onclick="wdi_controller.removeConditionalFilter(jQuery(this));" class="wdi_remove_filter">X</span>')},wdi_controller.randomId=function(){for(var e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=0;i<5;i++)e+=t.charAt(Math.floor(Math.random()*t.length));return e},wdi_controller.removeConditionalFilter=function(e){for(var t=e.parent().attr("data-id"),i=0;i<this.conditionalFilters.length;i++)this.conditionalFilters[i].id==t&&this.conditionalFilters.splice(i,1);this.updateFiltersUi()},wdi_controller.updateFilterTextarea=function(){var e=this.conditionalFilters,e=JSON.stringify(e);jQuery("#wdi_conditional_filters_textarea").val(e)},wdi_controller.setInitialFilters=function(){var e=[],t=jQuery("#wdi_conditional_filters_textarea").val();this.isJsonString(t)&&(e=JSON.parse(t)),this.conditionalFilters=e},wdi_controller.updateConditionalFiltersUi=function(){wdi_controller.updateFilterSource()},wdi_controller.updateFilterSource=function(){if("liked"!=jQuery('input[name="wdi_feed_settings[liked_feed]"]:checked').val()){var e,t,i=[];jQuery(".wdi_user").each(function(){e=(0!=jQuery(this).find(".wdi_username").length?jQuery(this).find(".wdi_username"):jQuery(this).find(".wdi_hashtag")).text(),t=jQuery(this).find("img").attr("src"),i.push({username:e,image:t})});for(var r=jQuery("#wdi_filter_source").html(""),a=0;a<i.length;a++){s="<div class='wdi_source_user'><span class='wdi_source_img'><img src='"+i[a].image+"'></span><span class='wdi_source_username'>"+i[a].username+"</span></div>";r.html(r.html()+s)}}else{var r,s="<div class='wdi_source_user'><span class='wdi_source_username'>Media I liked</span></div>";(r=jQuery("#wdi_filter_source").html("")).html(r.html()+s)}},wdi_controller.isJsonString=function(e){try{JSON.parse(e)}catch(e){return!1}return!0},wdi_controller.getUserObj=function(e){var t=JSON.parse(wdi_options.wdi_authenticated_users_list);if("object"==typeof t){if("object"==typeof t[e]&&""!=t[e])return t[e];console.log("Error: User not exist on Users object")}else console.log("Error: Wrong response when parsed on users (JSON.parse)");return!1};
|
1 |
+
function wdi_multiple_accounts_option_controller(){var e=jQuery(jQuery("#wdi_user_id").closest("form").find(".form-table").get(1));e.addClass("wdi_multiple_accounts_section");var t="";if(wdi_options.wdi_authenticated_users_list){var i,r=JSON.parse(wdi_options.wdi_authenticated_users_list),a=0;for(i in r)t+="<tr data-multiple-account='"+a+"'>",t+="<th>Access Token</th>",t+='<td><input type="text" name="wdi_instagram_options[wdi_authenticated_users_list][access_token][]" size="53" required="" value="'+r[i].access_token+'"></td>',t+="</tr>",t+="<tr data-multiple-account='"+a+"' class='wdi_username_tr'>",t+="<th>Username</th>",t+='<td><div class="wdi_input_wrapper"><input type="text" name="wdi_instagram_options[wdi_authenticated_users_list][user_name][]" size="53" required="" value="'+r[i].user_name+'"></div><div class="wdi_remove_auth_user">Delete</div></td>',t+='<input type="hidden" name="wdi_instagram_options[wdi_authenticated_users_list][user_id][]" size="53" required="" value="'+r[i].user_id+'">',t+="</tr>",a++;e.append(t)}jQuery(".wdi_remove_auth_user").on("click",function(e){e.preventDefault();e=jQuery(this).closest(".wdi_username_tr").data("multiple-account");return jQuery(this).closest(".wdi_multiple_accounts_section").find('tr[data-multiple-account="'+e+'"]').remove(),!1})}function wdi_advanced_option_controller(){var e=jQuery(jQuery("#wdi_user_id").closest("form").find(".form-table").get(1));e.addClass("wdi_advanced_option wdi_advanced_option_close");$tr=jQuery("<tr class='wdi_advanced_option_head'><th style='width: 100%;'>ADVANCED OPTIONS AND MULTIPLE INSTAGRAM ACCOUNTS</th><td><div class='wdi_advanced_option_icon'></div></td></tr>"),e.prepend($tr),$tr.on("click",function(){e.hasClass("wdi_advanced_option_open")?(e.removeClass("wdi_advanced_option_open"),e.addClass("wdi_advanced_option_close")):(e.removeClass("wdi_advanced_option_close"),e.addClass("wdi_advanced_option_open"))})}function wdi_controller(){}jQuery(document).ready(function(){function e(e){if(!1===e){var t=JSON.parse(localStorage.getItem("wdi_sections"));for(i in null!==t&&!1!==t||(t={wdi_layout_section:"show",wdi_media:"show",wdi_layout:"hide",wdi_advanced:"hide",wdi_lightbox_general:"show",wdi_lightbox_advanced:"hide",wdi_conditional_filters:"show",wdi_how_to_publish:"show"},localStorage.setItem("wdi_sections",JSON.stringify(t))),t){var r=jQuery("#wdi_save_feed").find("[data-section_name='"+i+"']");n(t[i],r)}}else{var a=jQuery(e).data("section_name"),s=null;e.hasClass("wdi_section_open")?(n("show",e),s="show"):e.hasClass("wdi_section_close")&&(n("hide",e),s="hide"),null!=s&&((e=JSON.parse(localStorage.getItem("wdi_sections"))||{})[a]=s,localStorage.setItem("wdi_sections",JSON.stringify(e)))}}function n(e,t){"show"===e?("table"===(e=t.closest(".wdi_section").find(".wdi_elements")).data("display")?e.css({display:"table"}):e.css({display:"block"}),t.css({"border-bottom":"1px solid #f1f1f1",margin:"0 auto 15px"}),t.removeClass("wdi_section_open"),t.addClass("wdi_section_close")):(t.closest(".wdi_section").find(".wdi_elements").css({display:"none"}),t.css({"border-bottom":"0px",margin:"0 auto 0px"}),t.removeClass("wdi_section_close"),t.addClass("wdi_section_open"))}jQuery("#wdi_reset_cache").click(function(e){jQuery(".wdi_reset_cache_success").remove(),jQuery("#wdi_save_loading").removeClass("wdi_hidden"),e.preventDefault(),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,task:"reset",action:"wdi_cache"},success:function(e){!1===e.success?jQuery("#wdi_reset_cache").after("<span class='wdi_reset_cache_success' style='color: #fc0000; margin-left: 15px; line-height: 2;'>Failed</span>"):(wdi_controller.instagram=new WDIInstagram,jQuery.each(e.data,function(e,t){var i=JSON.parse(t.users),r="",a="",s="",n=t.endpoint;jQuery.each(i,function(e,t){""!==t.tag_id?(a=(a=(a=t.username).substr(1,a.length)).replace(" ",""),s=t.tag_id):r=(r=wdi_controller.getUserObj(t.username))&&r.user_name});t=t.feed_id;wdi_controller.instagram.set_cache_data("",r,t,"",0,0,a,s,n,"")}),jQuery("#wdi_reset_cache").after("<span class='wdi_reset_cache_success' style='color: #029117; margin-left: 15px; line-height: 2;'>Success</span>"))}})}),jQuery(".wdi_account_refresh").click(function(){var t=jQuery(this),e=t.data("wdi_account");jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{page:"wdi_settings",action:"wdi_account_refresh",nonce:wdi_ajax.wdi_nonce,user_name:e},success:function(e){t.closest("div").find(".wdi_reset_cache_success").remove(),!0===e.success?(t.after("<span class='wdi_reset_cache_success' style='color: #029117; margin-left: 15px; line-height: 2;'>Success</span>"),t.closest("div").find(".wdi_user_token").val(e.token)):t.after("<span class='wdi_reset_cache_success' style='color: #fc0000; margin-left: 15px; line-height: 2;'>Failed</span>")}})}),wdi_controller.bindSaveFeedEvent(),wdi_controller.bindAddNewUserOrHashtagEvent(),jQuery(".display_type input").on("click",function(){wdi_controller.displaySettingsSection(jQuery(this))}),wdi_controller.conditionalFiltersTabInit(),wdi_controller.bindSaveThemeEvent(),jQuery("body").hasClass("instagram-feed_page_wdi_settings")&&wdi_advanced_option_controller(),jQuery(".wdi_section_name").click(function(){e(jQuery(this))}),e(!1),jQuery(document).on("click",".wdi-account-show-token",function(){jQuery(this).find("i").toggleClass("dashicons-arrow-up-alt2 dashicons-arrow-down-alt2"),jQuery(this).parents("li").find(".wdi-account-accesstoken").slideToggle(300)}),jQuery(document).on("click",".wdi-advanced-options .wdi-advanced-headline",function(){jQuery(this).find("i").toggleClass("dashicons-arrow-up-alt2 dashicons-arrow-down-alt2"),jQuery(this).parents(".wdi-advanced-options").find(".wdi-advanced-body").slideToggle(500)}),jQuery(document).on("click","#wdi_verify",function(){jQuery("#wdi_submit").prop("disabled",!0),jQuery(this).is(":checked")&&jQuery("#wdi_submit").prop("disabled",!1)}),jQuery(document).on("click","#wdi_submit",function(){return confirm(wdi_messages.uninstall_plugin)&&jQuery("#wdi_uninstall_form").submit(),!1}),jQuery("#WDI_feed_name").on("keypress",function(){jQuery(this).removeAttr("style")})}),wdi_controller.getParameterByName=function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");e=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(location.search);return null===e?"":decodeURIComponent(e[1].replace(/\+/g," "))},wdi_controller.apiRedirected=function(){var e=this.getParameterByName("access_token").split("."),t=/^[^\\\/&?><"']*$/;for(i=0;i<e.length;i++)if(null===e[i].match(t))return;var r=e.join(".");jQuery(document).ready(function(){""===wdi_options.wdi_access_token?jQuery("#wdi_access_token").attr("value",r):(jQuery(".wdi_more_token_template .wdi_more_access_token").prop("disabled",!1),jQuery(".wdi_more_token_template .wdi_more_access_token").attr("value",r))}),wdi_controller.instagram.addToken(r),wdi_controller.getUserInfo(r)},wdi_controller.getUserInfo=function(e){this.instagram.getSelfInfo({success:function(e){""===wdi_options.wdi_access_token?(jQuery("#wdi_user_name").attr("value",e.data.username),jQuery("#wdi_user_id").attr("value",e.data.id)):(jQuery(".wdi_more_token_template .wdi_more_user_name").prop("disabled",!1),jQuery(".wdi_more_token_template .wdi_more_user_id").prop("disabled",!1),jQuery(".wdi_more_token_template .wdi_more_user_name").attr("value",e.data.username),jQuery(".wdi_more_token_template .wdi_more_user_id").attr("value",e.data.id)),jQuery(document).trigger("wdi_settings_filled")}})},wdi_controller.oldDisplayType={},wdi_controller.displayTypeMemory={},wdi_controller.switchFeedTabs=function(e,t){jQuery("#wdi_refresh_tab").attr("value",e),jQuery(".wdi_tab").hide(),jQuery("#"+e+"_tab").show(),jQuery(".display_type").css("display","none"),jQuery('.display_type[tab="'+e+'"]').css("display","block"),jQuery('.display_type[tab="'+e+'"]').length?jQuery(".display_type_content").show():jQuery(".display_type_content").hide(),jQuery(".wdi_feed_tabs").filter(".wdi_feed_tab_active").each(function(){jQuery(this).removeClass("wdi_feed_tab_active")}),jQuery("#wdi_"+e).addClass("wdi_feed_tab_active");var i=jQuery(),r=!1;null!=t&&""!=t&&(i=jQuery(".display_type #"+t).prop("checked",!0),jQuery("#wdi_feed_type").attr("value",t)),r||0!=(i=jQuery('.display_type[tab="'+e+'"] input[name="feed_type"]:checked')).length&&(r=!0),r||0!=(i=jQuery('.display_type[tab="'+e+'"] #thumbnails')).length&&(r=!0,i.prop("checked",!0),jQuery("#wdi_feed_type").attr("value","thumbnails")),r&&wdi_controller.displaySettingsSection(i),"conditional_filters"==e&&wdi_controller.updateConditionalFiltersUi()},wdi_controller.displaySettingsSection=function(e){var i=e.attr("id").toLowerCase().trim(),t=e.parent().parent().attr("tab"),e=jQuery("#wdi_refresh_section");wdi_controller.oldDisplayType={section:i,tab:t},wdi_controller.displayTypeMemory[t]=wdi_controller.oldDisplayType,null!=e&&e.attr("value",i);e=jQuery(".wdi_border_wrapper .form-table");jQuery("#wdi_feed_type").attr("value",i);var r=0,a=!1;e.find(".wdi_element").each(function(){0;var e=jQuery(this).find(".wdwt_param").children().children().children().attr("section");if(void 0!==e){a=!1;var t=e.toLowerCase().trim().split(",");for(r=0;r<t.length;r++)t[r]===i&&(jQuery(this).css("display","block"),a=!0);!1===a&&jQuery(this).css("display","none")}})},wdi_controller.switchThemeTabs=function(e,t){jQuery(".wdi_feed_tabs").filter(".wdi_feed_tab_active").each(function(){jQuery(this).removeClass("wdi_feed_tab_active")}),jQuery("#wdi_"+e).addClass("wdi_feed_tab_active"),jQuery("[tab]").each(function(){jQuery(this).attr("tab")!=e?jQuery(this).parent().parent().parent().parent().parent().filter("tr").css("display","none"):jQuery(this).parent().parent().parent().parent().parent().filter("tr").css("display","block")}),jQuery(".display_type").css("display","none"),jQuery('.display_type[tab="'+e+'"]').css("display","block"),jQuery("#wdi_refresh_tab").attr("value",e),null!=t&&""!=t&&jQuery("#wdi_refresh_section").attr("value",t),(null==t&&""!=t?null!=wdi_controller.displayTypeMemory[e]?jQuery(".display_type #"+wdi_controller.displayTypeMemory[e].section):jQuery('.display_type[tab="'+e+'"]').first().find("input"):jQuery(".display_type #"+t)).trigger("click")},wdi_controller.bindSaveFeedEvent=function(){var e=this;jQuery("#wdi_save_feed_submit").on("click",function(){e.save_feed("save_feed")}),jQuery("#wdi_save_feed_apply").on("click",function(){e.save_feed("apply_changes")}),jQuery("#wdi_cancel_changes").on("click",function(){e.save_feed("cancel")})},wdi_controller.save_feed=function(e){var t,i,r,a=[],s={};"cancel"==e&&(window.location=window.location.href),t=jQuery("#WDI_user_name option:selected").data("type"),n=jQuery("#WDI_user_name option:selected").val(),i=jQuery("#WDI_feed_name");var n=wdi_controller.getUserObj(n);if(""==i.val())return alert(wdi_messages.feed_title_field_required),i.focus().attr("style","border-color: #FF0000;"),!1;if(!n)return alert(wdi_messages.user_field_required),!1;if(r={id:n.user_id,username:n.user_name},wdi_controller.checkIfUserNotSaved(e),0==wdi_controller.waitingAjaxRequestEnd.button){if(s=jQuery("#WDI_feed_users").val(),this.isJsonString(s)){for(var d in s=JSON.parse(s))"business"==t&&"#"===s[d].username.charAt(0)&&a.push(s[d]);a.push(r)}else a.push(r);users=this.stringifyUserData(a),jQuery("#WDI_feed_users").val(users),jQuery("#wdi_feed_thumb").val(""),"business"==t&&jQuery("#wdi_feed_thumb").val(n.profile_picture_url),"apply_changes"!=e&&"save_feed"!=e||(n=jQuery("#wdi_add_or_edit").val(),jQuery("#wdi_current_id").val(n)),jQuery("#task").attr("value",e),submit_ajax()}};var comlete_redirect_url="";function submit_ajax(){var e=jQuery("#wdi_save_feed").serialize();e+="&action=wdi_apply_changes&page=wdi_feeds",jQuery("#wdi_save_loading").removeClass("wdi_hidden"),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:e,success:function(e){comlete_redirect_url=e.url;var t=e.feed_id;1==e.need_cache?(jQuery(".caching-process-message").removeClass("wdi_hidden"),setTimeout(function(){wdi_controller.instagram.set_cache_data(comlete_redirect_url,"",t,"",0,0,"","","","")},1e3)):(jQuery("#wdi_save_loading").addClass("wdi_hidden"),window.location=comlete_redirect_url)},error:function(e,t,i){window.location=comlete_redirect_url}})}function wdi_spider_select_value(e){e.focus(),e.select()}function wdi_spider_set_input_value(e,t){"add"===t&&""==jQuery("#wdi_access_token").attr("value")&&alert("Please get your access token"),document.getElementById(e)&&(document.getElementById(e).value=t)}function wdi_spider_form_submit(e,t){document.getElementById(t)&&document.getElementById(t).submit(),e.preventDefault?e.preventDefault():e.returnValue=!1}function wdi_bulk_actions(e){e=jQuery(e).val();return""!=e&&(!("delete_all"==e&&!confirm(wdi_messages.do_you_want_to_delete_selected_items))&&(wdi_spider_set_input_value("task",e),jQuery("#wdi_feed_form").submit(),!0))}function wdi_spider_check_all_items(){wdi_spider_check_all_items_checkbox(),jQuery("#check_all").trigger("click")}function wdi_spider_check_all_items_checkbox(){var e;jQuery("#check_all_items").prop("checked")?(jQuery("#check_all_items").prop("checked",!1),jQuery("#draganddrop").hide()):(e=parseInt(jQuery(".displaying-num").html())?parseInt(jQuery(".displaying-num").html()):0,e=(jQuery('input[id^="check_pr_"]').length?parseInt(jQuery('input[id^="check_pr_"]').length):0)+e,jQuery("#check_all_items").prop("checked",!0),e&&(jQuery("#draganddrop").html("<strong><p>Selected "+e+" item"+(1<e?"s":"")+".</p></strong>"),jQuery("#draganddrop").show()))}function wdi_spider_check_all(e){jQuery(e).prop("checked")||(jQuery("#check_all_items").prop("checked",!1),jQuery("#draganddrop").hide())}function wdi_spider_set_input_value(e,t){"add"===t&&""==jQuery("#wdi_access_token").attr("value")&&alert("Please get your access token"),document.getElementById(e)&&(document.getElementById(e).value=t)}function wdi_account_remove(e,t){jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{page:"wdi_settings",action:"wdi_account_disconnect",nonce:wdi_ajax.wdi_nonce,user_name:e,user_id:t},success:function(e){e.success&&(1==jQuery('[class*="wdi-account-list"]').length?((e=jQuery(".wdi-account-list-"+t).parent()).prev().remove(),e.remove(),jQuery("#toplevel_page_wdi_feeds ul").remove(),jQuery("#toplevel_page_wdi_feeds a").attr("href","admin.php?page=wdi_settings")):jQuery(".wdi-account-list-"+t).remove())}})}function wdi_popup_open(){jQuery(".wdi-popup").show()}function wdi_popup_close(){jQuery(".wdi-popup").hide()}wdi_controller.makeInstagramUserRequest=function(e,t){var i,r=this,a=this.getInputType(e),s="hashtag"===a;if(""==e)return alert(wdi_messages.please_write_hashtag),!1;if(""!=e&&!s)return alert(wdi_messages.invalid_hashtag),!1;if(r.checkForDuplicateUser(e))return alert(e+" "+wdi_messages.already_added),!1;switch(i=jQuery("#WDI_user_name option:selected").val(),(s=wdi_controller.getUserObj(i))&&(this.instagram.user=s),a){case"user":break;case"hashtag":var n=(n=e.substr(1,e.length)).replace(" ",""),d=(jQuery("input[name='wdi_feed_settings[hashtag_top_recent]']:checked").val(),{tagname:n,action:"wdi_getHashtagId",wdi_nonce:wdi_ajax.wdi_nonce,user_name:i});jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:d,success:function(e){jQuery("#wdi_add_user_ajax").removeAttr("disabled"),r.isValidResponse(e).valid&&r.addHashtag(n,e)},error:function(e,t,i){}})}},wdi_controller.checkForDuplicateUser=function(e){var t=jQuery("#WDI_feed_users").val();if(this.isJsonString(t)){t=JSON.parse(t);for(var i=0;i<t.length;i++)if(e==t[i].username)return!0}return!1},wdi_controller.getInputType=function(e){switch(e[0]){case"#":return"hashtag";case"%":return"location";default:return"user"}},wdi_controller.stringifyUserData=function(e){for(var t=[],i=0;i<e.length;i++)t.push({id:e[i].id,username:e[i].username,tag_id:void 0!==e[i].tag_id?e[i].tag_id:""});return JSON.stringify(t)},wdi_controller.bindAddNewUserOrHashtagEvent=function(){jQuery("#wdi_add_user_ajax").on("click",function(){void 0!==jQuery(this).prop("disabled")||jQuery(this).prop("disabled",!0);var e=jQuery("#wdi_add_user_ajax_input").val().trim().toLowerCase();!1===wdi_controller.makeInstagramUserRequest(e)&&jQuery(this).removeAttr("disabled","disabled")}),jQuery("#wdi_add_user_ajax_input").on("keypress",function(e){if(13==e.keyCode){void 0!==jQuery("#wdi_add_user_ajax").prop("disabled")||jQuery("#wdi_add_user_ajax").prop("disabled",!0);e=jQuery("#wdi_add_user_ajax_input").val().trim().toLowerCase();return!1===wdi_controller.makeInstagramUserRequest(e)&&jQuery("#wdi_add_user_ajax").removeAttr("disabled","disabled"),!1}})},wdi_controller.removeFeedUser=function(e){var t,i=e.parent().find("a span").text();e.parent().find("a span").hasClass("wdi_hashtag")&&(i="#"+i),0!=this.feed_users.length||void 0!==(t=jQuery("#WDI_feed_users").val())&&this.isJsonString(t)&&(this.feed_users=JSON.parse(t));for(var r=0;r<this.feed_users.length;r++)if(this.feed_users[r].username==i){this.feed_users.splice(r,1);break}for(r=0;r<this.feed_users.length;r++)"#"!==this.feed_users[r].username.charAt(0)&&this.feed_users.splice(r,1);jQuery("#WDI_feed_users").val(this.stringifyUserData(this.feed_users)),e.parent().remove(),wdi_controller.changed_users()},wdi_controller.bindSaveThemeEvent=function(){jQuery("#wdi_save_theme_submit").on("click",function(){jQuery("#task").attr("value","save_feed"),jQuery("#wdi_save_feed").submit()}),jQuery("#wdi_save_theme_apply").on("click",function(){jQuery("#task").attr("value","apply_changes");var e=jQuery("#wdi_add_or_edit").attr("value");jQuery("#wdi_current_id").attr("value",e),jQuery("#wdi_save_feed").submit()}),jQuery("#wdi_save_theme_reset").on("click",function(){jQuery("#task").attr("value","reset_changes");var e=jQuery("#wdi_add_or_edit").attr("value");jQuery("#wdi_current_id").attr("value",e),jQuery("#wdi_save_feed").submit()})},wdi_controller.checkIfUserNotSaved=function(e){switch(e){case"save_feed":e="submit";break;case"apply_changes":e="apply";break;case"reset_changes":e="reset"}if(""==jQuery("#wdi_add_user_ajax_input").val().trim())return wdi_controller.waitingAjaxRequestEnd={button:0},0;var t=jQuery("#wdi_add_user_ajax_input").val().trim().toLowerCase();return wdi_controller.waitingAjaxRequestEnd={button:e},wdi_controller.makeInstagramUserRequest(t),1},wdi_controller.saveFeedAfterAjaxWait=function(e){var t;null!=wdi_controller.waitingAjaxRequestEnd&&(t=wdi_controller.waitingAjaxRequestEnd.button,e&&0!=t&&jQuery("#wdi_save_feed_"+t).trigger("click"),wdi_controller.waitingAjaxRequestEnd=void 0)},wdi_controller.getCookie=function(e){e=("; "+document.cookie).split("; "+e+"=");if(2==e.length)return e.pop().split(";").shift()},wdi_controller.isValidResponse=function(e){var t={};return void 0===e||void 0===e.meta.code||200!=e.meta.code?(t.valid=!1,void 0===e?t.msg=wdi_messages.instagram_server_error:200!==e.meta.code?t.msg=e.meta.error_message:t.msg=""):(t.valid=!0,t.msg="success"),t},wdi_controller.hasData=function(e){return void 0!==e&&void 0!==e.data&&0!=e.data.length},wdi_controller.thumbUser=function(e){return 0<this.feed_users.length&&this.feed_users[0].username===e},wdi_controller.findUser=function(e,t){var i=[];void 0!==t&&void 0!==t.data&&(i=t.data);for(var r=0;r<i.length;r++)if(i[r].username==e)return i[r];return!1},wdi_controller.addHashtag=function(e,t){if(null==e.match(/[~!@$%&*#^()<>?]/)){var i=jQuery('<div class="wdi_user"><a target="_blank" href="https://instagram.com/explore/tags/'+e+'"><img class="wdi_profile_pic" src="'+wdi_url.plugin_url+'images/hashtag.png"><span class="wdi_hashtag">'+e+'</span><i style="display:table-cell;width:25px;"></i></a><img class="wdi_remove_user" onclick="wdi_controller.removeFeedUser(jQuery(this))" src="'+wdi_url.plugin_url+'/images/delete_user.png"></div>');jQuery("#wdi_feed_users_ajax").append(i),jQuery("#wdi_add_user_ajax_input").val("");var r=jQuery("#WDI_feed_users").val();if(this.isJsonString(r)){r=JSON.parse(r);for(var a=0;a<r.length;a++)"#"!==r[a].username.charAt(0)&&r.splice(a,1)}else r=[];t={id:"#"+e,username:"#"+e,profile_picture:"",tag_id:t.tag_id};r.push(t),this.feed_users=r,jQuery("#WDI_feed_users").val(this.stringifyUserData(this.feed_users))}else alert(wdi_messages.invalid_hashtag);this.updateConditionalFiltersUi(),wdi_controller.saveFeedAfterAjaxWait(!0),wdi_controller.changed_users()},wdi_controller.changed_users=function(){for(var e=!1,t=0;t<this.feed_users.length;t++)if("#"===this.feed_users[t].username[0]){e=!0;break}e?(jQuery(".wdi_element_name_hashtag_top_recent").show(),jQuery(".wdi_element_name_show_username_on_thumb").hide()):(jQuery(".wdi_element_name_hashtag_top_recent").hide(),jQuery(".wdi_element_name_show_username_on_thumb").show())},wdi_controller.addUser=function(e){e.username=e.user_name,0==this.checkForDuplicateUser(e.username)?(newUser=jQuery('<div class="wdi_user"><a target="_blank" href="http://www.instagram.com/'+e.username+'"><span class="wdi_username">'+e.username+'</span><i style="display:table-cell;width:25px;"></i></a><img class="wdi_remove_user" onclick="wdi_controller.removeFeedUser(jQuery(this))" src="'+wdi_url.plugin_url+'images/delete_user.png"></div>'),jQuery("#wdi_feed_users_ajax").append(newUser),jQuery("#wdi_add_user_ajax_input").val(""),this.feed_users.push({id:e.id,username:e.username,profile_picture:""})):alert(e.username+" "+wdi_messages.already_added),this.updateConditionalFiltersUi(),wdi_controller.saveFeedAfterAjaxWait(!0)},wdi_controller.getUserProfilePic=function(e){for(var t=0;t<this.feed_users.length;t++)if(e==this.feed_users[t].username)return this.feed_users[t].profile_picture;return"false"},wdi_controller.conditionalFiltersTabInit=function(){this.setInitialFilters(),this.updateFiltersUi();var t=this;function e(){switch(jQuery("#WDI_wrap_conditional_filter_enable input:checked").val()){case"0":jQuery("#WDI_conditional_filters").parent().parent().addClass("wdi_hidden"),jQuery("#WDI_conditional_filter_type").parent().parent().parent().parent().parent().addClass("wdi_hidden"),jQuery("#wdi_final_condition").addClass("wdi_hidden"),jQuery("#WDI_filter_source").addClass("wdi_hidden");break;case"1":jQuery("#WDI_conditional_filters").parent().parent().removeClass("wdi_hidden"),jQuery("#WDI_conditional_filter_type").parent().parent().parent().parent().parent().removeClass("wdi_hidden"),jQuery("#wdi_final_condition").removeClass("wdi_hidden"),jQuery("#WDI_filter_source").removeClass("wdi_hidden")}}jQuery("#wdi_add_filter").on("click",function(){t.addConditionalFilter()&&jQuery("#wdi_filter_input").val("")}),jQuery(".wdi_filter_radio").on("click",function(){jQuery("#wdi_filter_input").trigger("focus")}),jQuery("#wdi_filter_input").on("keypress",function(e){if(13==e.keyCode)return t.addConditionalFilter()&&jQuery(this).val(""),!1}),e(),jQuery("#WDI_wrap_conditional_filter_enable input").on("change",function(){e()}),jQuery("#WDI_conditional_filter_type").on("change",function(){switch("none"==jQuery(this).val()||jQuery("#WDI_conditional_filters").css("display","block"),jQuery(this).parent().find("label").css({display:"inline-block"}),jQuery(this).val()){case"AND":jQuery("#WDI_conditional_filters").css("display","block"),jQuery(this).parent().find("label").html(wdi_messages.and_descr);break;case"OR":jQuery("#WDI_conditional_filters").css("display","block"),jQuery(this).parent().find("label").html(wdi_messages.or_descr);break;case"NOR":jQuery("#WDI_conditional_filters").css("display","block"),jQuery(this).parent().find("label").html(wdi_messages.nor_descr)}wdi_controller.updateFiltersUi()}),jQuery("#WDI_conditional_filter_type").trigger("change")},wdi_controller.addConditionalFilter=function(){var e=jQuery("#wdi_filter_input").val(),t=jQuery("#wdi_filter_type").val();if(filter={},""==e)return!1;switch(e=e.trim(),null==t&&("@"==e[0]?t="mention":"#"==e[0]?t="hashtag":"http"!=e.split("://")[0]&&"https"!=e.split("://")[0]||(t="url")),t){case"username":case"mention":"@"==e[0]&&(e=e.substr(1,e.length));break;case"hashtag":"#"==e[0]&&(e=e.substr(1,e.length));break;case"url":if(!/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(e))return alert(wdi_messages.invalid_url),!1}return filter={filter_type:t,filter_by:e,id:this.randomId()},null!=t?this.filterExists(filter)?(alert(e+" "+wdi_messages.already_added),!1):(this.conditionalFilters.push(filter),this.updateFiltersUi(),!0):(alert(wdi_messages.selectConditionType),!1)},wdi_controller.filterExists=function(e){for(var t=0;t<this.conditionalFilters.length;t++)if(this.conditionalFilters[t].filter_type==e.filter_type&&this.conditionalFilters[t].filter_by==e.filter_by)return!0;return!1},wdi_controller.updateFiltersUi=function(){for(var e,t=jQuery("#wdi_filters_ui").html(""),i=0;i<this.conditionalFilters.length;i++){if(0==i)if(1!=this.conditionalFilters.length)switch(jQuery("#WDI_conditional_filter_type").val()){case"AND":break;case"OR":t.append(jQuery('<span class="wdi_logic">'+wdi_messages.either+"</span>"));break;case"NOR":t.append(jQuery('<span class="wdi_logic">'+wdi_messages.neither+"</span>"))}else switch(jQuery("#WDI_conditional_filter_type").val()){case"AND":case"OR":break;case"NOR":t.append(jQuery('<span class="wdi_logic">'+wdi_messages.not+"</span>"))}switch(jQuery("#WDI_conditional_filter_type").val()){case"AND":e=wdi_messages.and;break;case"OR":e=wdi_messages.or;break;case"NOR":e=wdi_messages.nor}1<=i&&t.append(jQuery('<span class="wdi_logic">'+e+"</span>")),t.append(this.createUiElement(this.conditionalFilters[i]))}this.updateFilterTextarea()},wdi_controller.createUiElement=function(e){var t;switch(e.filter_type){case"mention":t="@";break;case"hashtag":t="#";break;case"location":t="%";break;default:t=""}return jQuery('<span data-id="'+e.id+'" class="wdi_filter_item wdi_filter_by_'+e.filter_type+'"></span>').html(t+e.filter_by+'<span onclick="wdi_controller.removeConditionalFilter(jQuery(this));" class="wdi_remove_filter">X</span>')},wdi_controller.randomId=function(){for(var e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=0;i<5;i++)e+=t.charAt(Math.floor(Math.random()*t.length));return e},wdi_controller.removeConditionalFilter=function(e){for(var t=e.parent().attr("data-id"),i=0;i<this.conditionalFilters.length;i++)this.conditionalFilters[i].id==t&&this.conditionalFilters.splice(i,1);this.updateFiltersUi()},wdi_controller.updateFilterTextarea=function(){var e=this.conditionalFilters,e=JSON.stringify(e);jQuery("#wdi_conditional_filters_textarea").val(e)},wdi_controller.setInitialFilters=function(){var e=[],t=jQuery("#wdi_conditional_filters_textarea").val();this.isJsonString(t)&&(e=JSON.parse(t)),this.conditionalFilters=e},wdi_controller.updateConditionalFiltersUi=function(){wdi_controller.updateFilterSource()},wdi_controller.updateFilterSource=function(){if("liked"!=jQuery('input[name="wdi_feed_settings[liked_feed]"]:checked').val()){var e,t,i=[];jQuery(".wdi_user").each(function(){e=(0!=jQuery(this).find(".wdi_username").length?jQuery(this).find(".wdi_username"):jQuery(this).find(".wdi_hashtag")).text(),t=jQuery(this).find("img").attr("src"),i.push({username:e,image:t})});for(var r=jQuery("#wdi_filter_source").html(""),a=0;a<i.length;a++){s="<div class='wdi_source_user'><span class='wdi_source_img'><img src='"+i[a].image+"'></span><span class='wdi_source_username'>"+i[a].username+"</span></div>";r.html(r.html()+s)}}else{var r,s="<div class='wdi_source_user'><span class='wdi_source_username'>Media I liked</span></div>";(r=jQuery("#wdi_filter_source").html("")).html(r.html()+s)}},wdi_controller.isJsonString=function(e){try{JSON.parse(e)}catch(e){return!1}return!0},wdi_controller.getUserObj=function(e){var t=JSON.parse(wdi_options.wdi_authenticated_users_list);if("object"==typeof t){if("object"==typeof t[e]&&""!=t[e])return t[e];console.log("Error: User not exist on Users object")}else console.log("Error: Wrong response when parsed on users (JSON.parse)");return!1};
|
js/wdi_frontend.js
CHANGED
@@ -882,7 +882,6 @@ wdi_front.displayFeedItems = function (data, currentFeed) {
|
|
882 |
}
|
883 |
}
|
884 |
var wdi_media_type = "";
|
885 |
-
currentFeed['imageIndex'] = i;
|
886 |
if (typeof data[i]["wdi_hashtag"] != "undefined") {
|
887 |
wdi_media_type = data[i]["wdi_hashtag"];
|
888 |
}
|
882 |
}
|
883 |
}
|
884 |
var wdi_media_type = "";
|
|
|
885 |
if (typeof data[i]["wdi_hashtag"] != "undefined") {
|
886 |
wdi_media_type = data[i]["wdi_hashtag"];
|
887 |
}
|
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,d){var r,t;void 0!==(d=jQuery("#wdi_feed_"+d.feed_row.wdi_feed_counter))&&(wdi_error_show=!0,d.find(".wdi_spinner").remove(),r=d.find(".wdi_js_error"),t=d.find(".wdi_token_error"),0!=i&&(void 0!==i.meta&&1==i.meta.error&&"OAuthException"===i.meta.error_type||void 0!==i.error&&"OAuthException"===i.error.type)?(d.find(".wdi_single_user").remove(),t.removeClass("wdi_hidden"),"1"!=wdi_front_messages.wdi_token_error_flag&&jQuery.ajax({type:"POST",url:wdi_url.ajax_url,dataType:"json",data:{action:"wdi_token_flag",wdi_token_flag_nonce:wdi_front_messages.wdi_token_flag_nonce},success:function(e){}})):void 0!==i.error&&void 0!==i.error.message&&(r.html(i.error.message),d.find(".wdi_single_user").remove(),r.removeClass("wdi_js_error"),r.addClass("wdi_js_error_no_animate"),jQuery(".wdi_js_error_no_animate").show()),wdi_front_messages.show_alerts||console.log("%c"+e,"color:#cc0000;")),wdi_error_show=!0},wdi_front.globalInit=function(){var e=wdi_front.feed_counter,i=0;void 0!==wdi_ajax.ajax_response&&(i=wdi_feed_counter_init.wdi_feed_counter_init);for(var d,r=i;r<=e;r++)0!==jQuery("#wdi_feed_"+r).length&&((d=new WDIFeed(window["wdi_feed_"+r])).instagram=new WDIInstagram,d.instagram.filterArguments={feed:d},d.instagram.addToken(d.feed_row.access_token),wdi_front.access_token=d.feed_row.access_token,d.dataLoaded=0,d.dataStorageRaw=[],d.dataStorage=[],d.dataStorageList=[],d.allResponseLength=0,d.currentResponseLength=0,d.temproraryUsersData=[],d.removedUsers=0,d.nowLoadingImages=!0,d.imageIndex=0,d.resIndex=0,d.currentPage=1,d.currentPageLoadMore=0,d.userSortFlags=[],d.customFilterChanged=!1,d.maxConditionalFiltersRequestCount=10,d.instagramRequestCounter=0,d.mediaRequestsDone=!1,d.conditionalFilterBuffer=[],d.stopInfiniteScrollFlag=!1,"masonry"==d.feed_row.feed_type&&(d.displayedData=[]),"pagination"==d.feed_row.feed_display_view?(d.feed_row.resort_after_load_more=0,"image_browser"!=d.feed_row.feed_type?(d.feed_row.load_more_number=parseInt(d.feed_row.pagination_per_page_number),d.feed_row.number_of_photos=d.allResponseLength):(d.feed_row.number_of_photos=1+parseInt(d.feed_row.image_browser_preload_number),d.feed_row.load_more_number=parseInt(d.feed_row.image_browser_load_number)),d.freeSpaces=(Math.floor(d.feed_row.pagination_per_page_number/d.feed_row.number_of_columns)+1)*d.feed_row.number_of_columns-d.feed_row.pagination_per_page_number):d.freeSpaces=0,d.galleryBox=function(e){wdi_spider_createpopup(wdi_url.ajax_url+"?gallery_id="+this.feed_row.id+"&image_id="+e,this.feed_row.wdi_feed_counter,this.feed_row.lightbox_width,this.feed_row.lightbox_height,1,"testpopup",5,this,e)},wdi_responsive.columnControl(d),"masonry"==d.feed_row.feed_type&&jQuery(window).trigger("resize"),wdi_front.bindEvents(d),window["wdi_feed_"+r]=d,wdi_front.init(d))},wdi_front.init=function(e){if(jQuery(".wdi_js_error").hide(),e.photoCounter=e.feed_row.number_of_photos,"liked"==e.feed_row.liked_feed)e.feed_users=["self"];else{if(!wdi_front.isJsonString(e.feed_row.feed_users))return void wdi_front.show_alert(wdi_front_messages.invalid_users_format,!1,e);e.feed_users=JSON.parse(e.feed_row.feed_users)}var i=[],d=[],r=[];void 0!==window.wdi_all_tags&&(i=window.wdi_all_tags);for(var t=0;t<e.feed_users.length;t++)"#"===e.feed_users[t].username[0]&&void 0!==e.feed_users[t].tag_id?(i[e.feed_users[t].tag_id]=e.feed_users[t],r[t]=e.feed_users[t]):d[0]=e.feed_users[t];window.wdi_all_tags=i,e.feed_users=void 0===r||wdi_front.isEmpty(r)?d:r;var a=wdi_front.getFeedItemResolution(e);e.feedImageResolution=a.image,e.feedVideoResolution=a.video,e.dataCount=e.feed_users.length;for(var o=0;o<e.dataCount;o++)wdi_front.instagramRequest(o,e);0<e.feed_row.number_of_photos&&wdi_front.ajaxLoader(e),"1"===e.feed_row.display_header&&wdi_front.show("header",e),"1"===e.feed_row.show_usernames&&wdi_front.show("users",e)},wdi_front.getFeedItemResolution=function(e){var i={image:"standard_resolution",video:"standard_resolution"};if("thumbnail"===e.feed_row.feed_resolution)return{image:"thumbnail",video:"low_bandwidth"};if("low"===e.feed_row.feed_resolution)return{image:"low_resolution",video:"low_resolution"};if("standard"===e.feed_row.feed_resolution)return{image:"standard_resolution",video:"standard_resolution"};var d=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter).find(".wdi_feed_wrapper");d.append('<div class="wdi_feed_item" id="wdi_feed_item_example"></div>'),wdi_responsive.columnControl(e,1);e=d.attr("wdi-res").split("wdi_col_");if(d.find("#wdi_feed_item_example").remove(),2!==e.length)return i;e=parseInt(e[1]);if(e<=0)return i;e=d.width()/e-10;return e<=150?(i.image="thumbnail",i.video="low_bandwidth"):150<e&&e<=320?(i.image="low_resolution",i.video="low_resolution"):(i.image="standard_resolution",i.video="standard_resolution"),i},wdi_front.isJsonString=function(e){try{JSON.parse(e)}catch(e){return!1}return!0},wdi_front.instagramRequest=function(i,d){var r=this,e=d.feed_users;if("string"==typeof e[i]&&"self"===e[i])d.instagram.getRecentLikedMedia({success:function(e){void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,d),d.mediaRequestsDone=!0,0!=(e=r.checkMediaResponse(e,d))&&r.saveSelfUserData(e,d)}});else if("hashtag"==this.getInputType(e[i].username)){if(this.isJsonString(d.feed_row.feed_users))for(var t in json_feed_users=JSON.parse(d.feed_row.feed_users),json_feed_users)"#"!==json_feed_users[t].username.charAt(0)&&(user=json_feed_users[t]);d.instagram.getTagRecentMedia(this.stripHashtag(e[i].username),{feed_id:d.feed_row.id,user_id:user.id,user_name:user.username,success:function(e){if(void 0!==e.error&&"undefined"!=e.error.type||void 0!==e.meta&&1==e.meta.error)return d.dataLoaded=1,wdi_front.show_alert(!1,e,d),!1;d.mediaRequestsDone=!0,e=r.checkMediaResponse(e,d),d.dataLoaded=1,0!=e&&r.saveUserData(e,d.feed_users[i],d)}},null,d.feed_row.hashtag_top_recent,0)}else"user"==this.getInputType(e[i].username)&&d.instagram.getUserMedia({feed_id:d.feed_row.id,user_id:e[i].id,user_name:e[i].username,success:function(e){if(void 0!==e.meta&&1==typeof e.meta.error)return d.dataLoaded=1,wdi_front.show_alert(!1,e,d),!1;d.mediaRequestsDone=!0,d.dataLoaded=1,0!=(e=r.checkMediaResponse(e,d))?r.saveUserData(e,d.feed_users[i],d):wdi_front.allImagesLoaded(d)}},"",0)},wdi_front.isHashtag=function(e){return"#"===e[0]},wdi_front.saveUserData=function(e,i,d){e.user_id=i.id,e.username=i.username,"#"===e.user_id[0]&&(e.data=wdi_front.appendRequestHashtag(e.data,e.user_id)),d.usersData.push(e),d.currentResponseLength=wdi_front.getArrayContentLength(d.usersData,"data"),d.allResponseLength+=d.currentResponseLength,d.dataCount==d.usersData.length&&(d.currentResponseLength<d.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(d)?wdi_front.loadMore("initial-keep",d):(wdi_front.displayFeed(d),wdi_front.applyFilters(d),wdi_front.activeUsersCount(d)||"load_more_btn"==d.feed_row.feed_display_view&&((d=jQuery("#wdi_feed_"+d.feed_row.wdi_feed_counter)).find(".wdi_load_more").addClass("wdi_hidden"),d.find(".wdi_spinner").addClass("wdi_hidden"))))},wdi_front.saveSelfUserData=function(e,i){e.user_id="",e.username="",i.usersData.push(e),i.currentResponseLength=wdi_front.getArrayContentLength(i.usersData,"data"),i.allResponseLength+=i.currentResponseLength,i.dataCount==i.usersData.length&&(i.currentResponseLength<i.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(i)?wdi_front.loadMore("initial-keep",i):(wdi_front.displayFeed(i),wdi_front.applyFilters(i),wdi_front.activeUsersCount(i)||"load_more_btn"==i.feed_row.feed_display_view&&((i=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter)).find(".wdi_load_more").addClass("wdi_hidden"),i.find(".wdi_spinner").addClass("wdi_hidden"))))},wdi_front.userHasNoPhoto=function(e,i){var d=0,r=e.usersData;void 0!==i&&(r=i);for(var t=0;t<r.length;t++)void 0===r[t].pagination&&(r[t].pagination=[]),"liked"===e.feed_row.liked_feed?void 0===r[t].pagination.next_max_like_id&&d++:void 0===r[t].pagination.next_max_id&&d++;return d==r.length?1:0},wdi_front.appendRequestHashtag=function(e,i){for(var d=0;d<e.length;d++)e[d].wdi_hashtag=i;return e},wdi_front.displayFeed=function(e,i){void 0===i&&(i=1);for(var d=0;d<e.usersData.length;d++)e.dataStorageList=e.usersData[d].data,e.dataStorage[d]=e.usersData[d].data;var r=e.feed_row.number_of_photos,t=e.feed_row.load_more_number,a=0,o=r,r="";"pagination"==e.feed_row.feed_display_view?(1<e.allResponseLength&&jQuery("#wdi_pagination").removeClass("wdi_hidden"),e.feed_row.number_of_photos=e.allResponseLength,"image_browser"==e.feed_row.feed_type?e.paginator=parseInt(e.feed_row.number_of_photos):e.paginator=Math.ceil(parseInt(e.feed_row.number_of_photos)/parseInt(t)),r=(o=1===i?(a=0,"image_browser"==e.feed_row.feed_type?1:t):"image_browser"==e.feed_row.feed_type?(a=i-1)+1:(a=(i-1)*t)+t,e.dataStorageList.slice(a,o))):void 0!==e.already_loaded_count?(a=parseInt(e.already_loaded_count),o=e.already_loaded_count+parseInt(t),r=e.dataStorageList.slice(a,o),e.already_loaded_count+=r.length):(r=e.dataStorageList.slice(a,o),e.already_loaded_count=r.length),e.parsedData=wdi_front.parseLighboxData(e,!0),"masonry"==e.feed_row.feed_type&&wdi_front.masonryDisplayFeedItems(r,e),"thumbnails"!=e.feed_row.feed_type&&"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||wdi_front.displayFeedItems(r,e),"pagination"==e.feed_row.feed_display_view&&e.currentPage<e.paginator&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter).find("#wdi_last_page").removeClass("wdi_disabled"),wdi_front.updateUsersImages(e)},wdi_front.updateUsersImages=function(i){jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter).find(".wdi_single_user .wdi_user_img_wrap img").each(function(){if((jQuery(this).attr("src")==wdi_url.plugin_url+"images/missing.png"||""==jQuery(this).attr("src"))&&"liked"!=i.feed_row.liked_feed)for(var e=0;e<i.usersData.length;e++)i.usersData[e].username==jQuery(this).parent().parent().find("h3").text()&&0!=i.usersData[e].data.length&&jQuery(this).attr("src",i.usersData[e].data[0].images.thumbnail.url)})},wdi_front.checkLoaded=function(e){var i=e.feed_row.wdi_feed_counter,d=jQuery("#wdi_feed_"+i);e.dataStorageList.length>e.already_loaded_count?d.find(".wdi_load_more").removeClass("wdi_hidden"):d.find(".wdi_load_more").addClass("wdi_hidden"),d.find(".wdi_spinner").addClass("wdi_hidden"),setTimeout(function(){d.find(".wdi_ajax_loading").addClass("wdi_hidden")},500)},wdi_front.masonryDisplayFeedItems=function(e,i){var d=[],r=[];if(0!=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length){jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_masonry_column").each(function(){1==i.feed_row.resort_after_load_more&&(jQuery(this).html(""),i.imageIndex=0),1==i.customFilterChanged&&(jQuery(this).html(""),i.imageIndex=0),"pagination"==i.feed_row.feed_display_view?d.push(0):d.push(jQuery(this).height()),r.push(jQuery(this))}),1==i.customFilterChanged&&(i.customFilterChanged=!1);for(var t,a,o,n=0;n<e.length;n++)"object"==typeof e[n].videos&&null==e[n].videos.standard_resolution||(i.displayedData.push(e[n]),t="",void 0!==e[n].wdi_hashtag&&(t=e[n].wdi_hashtag),a="image"==e[n].type?wdi_front.getPhotoTemplate(i,t):e[n].hasOwnProperty("videos")||"video"==e[n].type?wdi_front.getVideoTemplate(i,t):wdi_front.getSliderTemplate(i,t),o=e[n],t=a(wdi_front.createObject(o,i)),a=wdi_front.array_min(d),o=wdi_front.getImageResolution(e[n]),r[a.index].html(r[a.index].html()+t),d[a.index]+=r[a.index].width()*o,i.imageIndex++,"pagination"==i.feed_row.feed_display_view&&((n+1)%i.feed_row.pagination_per_page_number==0?i.resIndex+=i.freeSpaces+1:i.resIndex++));i.wdi_loadedImages=0;var s=!1;i.wdi_load_count=n;var _=i.feed_row.wdi_feed_counter;jQuery("#wdi_feed_"+_+" .wdi_img").on("load",function(){i.wdi_loadedImages++,!1===s&&(wdi_responsive.columnControl(i,1),s=!0)});wdi_front.checkLoaded(i),1==i.paginatorNextFlag&&wdi_front.updatePagination(i,"next"),i.infiniteScrollFlag=!1}},wdi_front.getImageResolution=function(e){var i;return e="image"===e.type?(i=e.images.standard_resolution.height,e.images.standard_resolution.width):"video"===e.type?(i=e.videos.standard_resolution.height,e.videos.standard_resolution.width):(i=(e.carousel_media[0].images||e.carousel_media[0].videos).standard_resolution.height,(e.carousel_media[0].images||e.carousel_media[0].videos).standard_resolution.width),i/e},wdi_front.getDataLength=function(e,i){var d=0;if(void 0===i)for(var r=0;r<e.dataStorage.length;r++)d+=e.dataStorage[r].length;else for(r=0;r<i.length;r++)d+=i[r].length;return d},wdi_front.getArrayContentLength=function(e,i){for(var d=0,r=0;r<e.length;r++)"finished"!=e[r].finished&&void 0===e[r].error&&(d+=e[r][i].length);return d},wdi_front.displayFeedItems=function(e,d){if(0!=jQuery("#wdi_feed_"+d.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length){for(var i,r,t,a=d.feed_row.wdi_feed_counter,o=jQuery("#wdi_feed_"+a+" .wdi_feed_wrapper"),n=0;n<e.length;n++){if(void 0===e[n])return;"object"==typeof e[n].videos&&null==e[n].videos.standard_resolution||(t="",void 0!==e[d.imageIndex=n].wdi_hashtag&&(t=e[n].wdi_hashtag),i="image"==e[n].type?wdi_front.getPhotoTemplate(d,t):e[n].hasOwnProperty("videos")?wdi_front.getVideoTemplate(d,t):wdi_front.getSliderTemplate(d,t),r=e[n],t="",void 0!==(r=wdi_front.createObject(r,d))&&(t=i(r)),o.html(o.html()+t),d.imageIndex++,"pagination"==d.feed_row.feed_display_view&&((n+1)%d.feed_row.pagination_per_page_number==0?d.resIndex+=d.freeSpaces+1:d.resIndex++))}!function(){var e=d.feed_row.wdi_feed_counter,i=jQuery("#wdi_feed_"+e);d.dataStorageList.length>d.already_loaded_count?i.find(".wdi_load_more").removeClass("wdi_hidden"):i.find(".wdi_load_more").addClass("wdi_hidden"),i.find(".wdi_spinner").addClass("wdi_hidden");setTimeout(function(){i.find(".wdi_ajax_loading").addClass("wdi_hidden")},500)}()}},wdi_front.checkFeedFinished=function(e){for(var i=0;i<e.usersData.length;i++)if(void 0===e.usersData[i].finished)return!1;return!0},wdi_front.createObject=function(e,i){var d=null!=e.caption?e.caption.text:" ";switch(e.type){case"image":var r=e.images[i.feedImageResolution].url,t=void 0,a=e.hasOwnProperty("thumbnail")?e.thumbnail:wdi_url.plugin_url+"images/missing.png";break;case"video":r=void 0,t=e.hasOwnProperty("videos")?e.videos[i.feedVideoResolution].url:wdi_url.plugin_url+"images/video_missing.png",a=e.hasOwnProperty("thumbnail")?e.thumbnail:wdi_url.plugin_url+"images/video_missing.png";break;case"carousel":if(0===e.carousel_media.length)r=wdi_url.plugin_url+"images/missing.png",t=void 0,a=wdi_url.plugin_url+"images/missing.png";else switch(e.carousel_media[0].type){case"image":r=e.carousel_media[0].images[i.feedImageResolution].url,t=void 0,a=e.hasOwnProperty("thumbnail")?e.thumbnail:wdi_url.plugin_url+"images/missing.png";break;case"video":r=void 0,t=e.carousel_media[0].videos[i.feedVideoResolution].url,a=e.hasOwnProperty("thumbnail")?e.thumbnail:wdi_url.plugin_url+"images/video_missing.png";break;default:r=wdi_url.plugin_url+"images/missing.png",t=void 0,a=wdi_url.plugin_url+"images/missing.png"}break;default:r=wdi_url.plugin_url+"images/missing.png",t=void 0,a=wdi_url.plugin_url+"images/missing.png"}var o,n=i.imageIndex,s="square";(_="image"===e.type?(o=e.images.standard_resolution.height,e.images.standard_resolution.width):"video"===e.type?(o=e.videos.standard_resolution.height,e.videos.standard_resolution.width):(o=(e.carousel_media[0].images||e.carousel_media[0].videos).standard_resolution.height,(e.carousel_media[0].images||e.carousel_media[0].videos).standard_resolution.width))<o?s="portrait":o<_&&(s="landscape");var _=e.user.username;return""===_&&(_="no_user"),{id:e.id,thumb_url:a,caption:wdi_front.escape_tags(d),image_url:r,likes:void 0!==e.likes.count?e.likes.count:e.likes,comments:void 0!==e.comments.count?e.comments.count:e.comments,wdi_index:n,wdi_res_index:i.resIndex,wdi_media_user:_,link:e.link,video_url:t,wdi_username:_,wdi_shape:s}},wdi_front.getPhotoTemplate=function(e,i){var d="",r="",t="",a="tenweb-i-arrows-out",o="";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(a=""),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(o='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(d+=" wdi_full_caption");var n="";switch("blog_style"!==e.feed_row.feed_type&&(n="masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":r="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":r="onclick=\"window.open ('<%= link%>','_blank')\"",t="wdi_hover_off",a="";break;case"custom_redirect":r="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",t="wdi_hover_off",a="";break;case"none":t="wdi_cursor_off wdi_hover_off",a=r=""}var s='<div class="wdi_feed_item '+d+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> wdi_type="image" id="wdi_'+e.feed_row.wdi_feed_counter+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img <%= wdi_shape == \'square\' ? \'wdi_shape_square\' : (wdi_shape == \'portrait\' ? \'wdi_shape_portrait\' : (wdi_shape == \'landscape\' ? \'wdi_shape_landscape\' : \'wdi_shape_square\') ) %>"><img class="wdi_img" src="<%=thumb_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+t+'" >'+o+'<div class="wdi_thumb_icon" '+r+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+a+'"></i></div></div></div></div></div></div>',d=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(s+='<div class="wdi_photo_meta">',o=void 0!==e.dataStorageList[d].likes.count?e.dataStorageList[d].likes.count:e.dataStorageList[d].likes,"1"===e.feed_row.show_likes&&0!==o&&(s+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o"> <%= likes%></i></div>'),d=void 0!==e.dataStorageList[d].comments.count?e.dataStorageList[d].comments.count:e.dataStorageList[d].comments,"1"===e.feed_row.show_comments&&0!==d&&(s+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square"> <%= comments%></i></div>'),s+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(s+='<div class="wdi_photo_title" onclick='+n+" ><%=caption%></div>"),s+="</div>"),s+="</div>",_.template(s)},wdi_front.getSliderTemplate=function(e,i){var d="",r="",t="",a="tenweb-i-clone",o="";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(a=""),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(o='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(d+=" wdi_full_caption");var n="";switch("blog_style"!==e.feed_row.feed_type&&(n="masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":r="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":r="onclick=\"window.open ('<%= link%>','_blank')\"",t="wdi_hover_off",a="tenweb-i-clone";break;case"custom_redirect":r="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",t="wdi_hover_off",a="";break;case"none":t="wdi_cursor_off wdi_hover_off",a=r=""}var s='<div class="wdi_feed_item '+d+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> wdi_type="slideshow" id="wdi_'+e.feed_row.wdi_feed_counter+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img <%= wdi_shape == \'square\' ? \'wdi_shape_square\' : (wdi_shape == \'portrait\' ? \'wdi_shape_portrait\' : (wdi_shape == \'landscape\' ? \'wdi_shape_landscape\' : \'wdi_shape_square\') ) %>"><img class="wdi_img" src="<%=thumb_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+t+'" >'+o+'<div class="wdi_thumb_icon" '+r+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+a+'"></i></div></div></div></div></div></div>',d=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(s+='<div class="wdi_photo_meta">',o=void 0!==e.dataStorageList[d].likes.count?e.dataStorageList[d].likes.count:e.dataStorageList[d].likes,"1"===e.feed_row.show_likes&&0!==o&&(s+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o"> <%= likes%></i></div>'),d=void 0!==e.dataStorageList[d].comments.count?e.dataStorageList[d].comments.count:e.dataStorageList[d].comments,"1"===e.feed_row.show_comments&&0!==d&&(s+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square"> <%= comments%></i></div>'),s+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(s+='<div class="wdi_photo_title" onclick='+n+" ><%=caption%></div>"),s+="</div>"),s+="</div>",_.template(s)},wdi_front.replaceToVideo=function(e,i,d){overlayHtml="<video style='width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;' controls=''><source src='"+e+"' type='video/mp4'>Your browser does not support the video tag. </video>",jQuery("#wdi_feed_"+d+' [wdi_index="'+i+'"] .wdi_photo_wrap_inner').html(overlayHtml),jQuery("#wdi_feed_"+d+' [wdi_index="'+i+'"] .wdi_photo_wrap_inner video').get(0).play()},wdi_front.getVideoTemplate=function(e,i){var d="",r="tenweb-i-play",t="",a="",o="";"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(o='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(d+=" wdi_full_caption");var n="";switch("blog_style"!==e.feed_row.feed_type&&(n="masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":t="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":t="onclick=\"window.open ('<%= link%>','_blank')\"",a="wdi_hover_off",r="tenweb-i-play";break;case"custom_redirect":t="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",a="wdi_hover_off",r="";break;case"none":a="wdi_cursor_off wdi_hover_off",r="","blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(t="onclick=wdi_front.replaceToVideo('<%= video_url%>','<%= wdi_index%>',"+e.feed_row.wdi_feed_counter+")",a="",r="tenweb-i-play")}var s='<div class="wdi_feed_item '+d+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> wdi_type="image" id="wdi_'+e.feed_row.wdi_feed_counter+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img <%= wdi_shape == \'square\' ? \'wdi_shape_square\' : (wdi_shape == \'portrait\' ? \'wdi_shape_portrait\' : (wdi_shape == \'landscape\' ? \'wdi_shape_landscape\' : \'wdi_shape_square\') ) %>"><img class="wdi_img" src="<%=thumb_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+a+'" '+t+">"+o+'<div class="wdi_thumb_icon" style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+r+'"></i></div></div></div></div></div></div>',d=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(s+='<div class="wdi_photo_meta">',o=void 0!==e.dataStorageList[d].likes.count?e.dataStorageList[d].likes.count:e.dataStorageList[d].likes,"1"===e.feed_row.show_likes&&0!==o&&(s+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o"> <%= likes%></i></div>'),d=void 0!==e.dataStorageList[d].comments.count?e.dataStorageList[d].comments.count:e.dataStorageList[d].comments,"1"===e.feed_row.show_comments&&0!==d&&(s+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square"> <%= comments%></i></div>'),s+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(s+='<div class="wdi_photo_title" onclick='+n+" ><%=caption%></div>"),s+="</div>"),s+="</div>",_.template(s)},wdi_front.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(){jQuery(document).find("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_load_more").addClass("wdi_hidden"),jQuery(document).find("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_spinner").removeClass("wdi_hidden"),setTimeout(function(){wdi_front.loadMore(jQuery(this).find(".wdi_load_more_wrap"),e)},1e3)}),"pagination"==e.feed_row.feed_display_view&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_next").on(wdi_front.clickOrTouch,function(){parseInt(jQuery("#wdi_current_page").text())+1>e.paginator||(e.currentPage=parseInt(jQuery("#wdi_current_page").text())+1,wdi_front.changePage(jQuery(this),e))}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_prev").on(wdi_front.clickOrTouch,function(){parseInt(jQuery("#wdi_current_page").text())-1<=0||(e.currentPage=parseInt(jQuery("#wdi_current_page").text())-1,wdi_front.changePage(jQuery(this),e))}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_last_page").on(wdi_front.clickOrTouch,function(){e.currentPage=e.paginator,wdi_front.changePage(jQuery(this),e)}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_first_page").on(wdi_front.clickOrTouch,function(){e.currentPage=1,wdi_front.changePage(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&&(e.dataStorageList.length>e.already_loaded_count||void 0===e.already_loaded_count?(e.infiniteScrollFlag=!0,wdi_front.loadMore(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_infinite_scroll"),e)):wdi_front.allImagesLoaded(e))},wdi_front.changePage=function(e,i){var d=e.closest(".wdi_feed_container");d.find(".wdi_page_loading").removeClass("wdi_hidden"),new_page_number=i.currentPage,1<new_page_number?jQuery("#wdi_first_page").removeClass("wdi_disabled"):1===new_page_number&&jQuery("#wdi_first_page").addClass("wdi_disabled"),new_page_number==parseInt(i.paginator)?jQuery("#wdi_last_page").addClass("wdi_disabled"):new_page_number<parseInt(i.paginator)&&jQuery("#wdi_last_page").removeClass("wdi_disabled"),("masonry"==i.feed_row.feed_type?e.parent().parent().parent().find(".wdi_feed_wrapper .wdi_masonry_column"):e.parent().parent().parent().find(".wdi_feed_wrapper")).empty(),e.parent().find("#wdi_current_page").empty().text(new_page_number),wdi_front.displayFeed(i,new_page_number),d.find(".wdi_page_loading").addClass("wdi_hidden")},wdi_front.updatePagination=function(e,i,d){var r="#wdi_feed_"+e.feed_row.wdi_feed_counter;switch(jQuery(r+' [wdi_page="'+e.currentPage+'"]').each(function(){jQuery(this).removeClass("wdi_hidden")}),i){case"next":var d=e.currentPage-1;jQuery(r+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(r+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"prev":d=e.currentPage+1;jQuery(r+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(r+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"custom":(d=d)!=e.currentPage&&(jQuery(r+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(r+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")}))}e.paginatorNextFlag=!1,jQuery(r+" .wdi_feed_wrapper").css("height","auto"),jQuery(r+" #wdi_current_page").text(e.currentPage)},wdi_front.loadMore=function(e,i){var d;if(""!=e&&void 0!==e&&"initial"!=e&&"initial-keep"!=e&&(d=window[e.parent().parent().parent().parent().attr("id")]),void 0!==i&&(d=i),wdi_front.ajaxLoader(d),this.isJsonString(d.feed_row.feed_users))for(var r in json_feed_users=JSON.parse(d.feed_row.feed_users),json_feed_users)iuser=json_feed_users[r],"#"!==json_feed_users[r].username.charAt(0)&&(iuser=json_feed_users[r]);"masonry"===d.feed_row.feed_type&&"pagination"==d.feed_row.feed_display_view&&jQuery("#wdi_feed_"+wdi_front.feed_counter+" .wdi_full_caption").each(function(){jQuery(this).find(".wdi_photo_title").trigger(wdi_front.clickOrTouch)}),d.loadMoreDataCount=d.feed_users.length,wdi_front.displayFeed(d)},wdi_front.loadMoreRequest=function(e,i,d,r){d.mediaRequestsDone&&""!=i&&d.usersData},wdi_front.checkForLoadMoreDone=function(e,i){var d,r=e.feed_row.load_more_number,t=e.feed_row.number_of_photos;0==e.loadMoreDataCount&&(e.temproraryUsersData=wdi_front.mergeData(e.temproraryUsersData,e.usersData),d=wdi_front.getArrayContentLength(e.temproraryUsersData,"data"),"initial-keep"==i&&(i="initial"),"initial"==i?d<t&&!wdi_front.userHasNoPhoto(e,e.temproraryUsersData)&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount?wdi_front.loadMore("initial",e):(e.usersData=e.temproraryUsersData,wdi_front.displayFeed(e),wdi_front.applyFilters(e),e.temproraryUsersData=[]):d<r&&!wdi_front.userHasNoPhoto(e,e.temproraryUsersData)&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount?wdi_front.loadMore(void 0,e):(e.usersData=e.temproraryUsersData,wdi_front.activeUsersCount(e)&&(wdi_front.displayFeed(e,r),wdi_front.applyFilters(e),e.temproraryUsersData=[])))},wdi_front.allDataHasFinished=function(e){for(var i=0,d=0;d<e.dataStorageRaw.length;d++)""==e.usersData[d].pagination.next_url&&(i++,e.usersData[d].finished="finished");return i==e.dataStorageRaw.length&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_load_more").remove(),!0)},wdi_front.mergeData=function(e,i){for(var d=0;d<i.length;d++)void 0!==e[d]?"finished"!=i[d].finished&&(void 0===e[d].pagination.next_max_id&&void 0===e[d].pagination.next_max_like_id||(e[d].data=e[d].data.concat(i[d].data),e[d].pagination=i[d].pagination,e[d].user_id=i[d].user_id,e[d].username=i[d].username,e[d].meta=i[d].meta)):e.push(i[d]);return e},wdi_front.brokenImageHandler=function(e){return!0},wdi_front.ajaxLoader=function(e){var i,d=e.feed_row.wdi_feed_counter,d=jQuery(document).find("#wdi_feed_"+d);return"load_more_btn"==e.feed_row.feed_display_view&&(d.find(".wdi_load_more").addClass("wdi_hidden"),d.find(".wdi_spinner").removeClass("wdi_hidden")),"infinite_scroll"==e.feed_row.feed_display_view&&(0==d.find(".wdi_ajax_loading").length?(i=jQuery('<div class="wdi_ajax_loading"><div><div><img class="wdi_load_more_spinner" src="'+wdi_url.plugin_url+'images/ajax_loader.png"></div></div></div>'),d.find(".wdi_feed_container").append(i)):i=d.find(".wdi_ajax_loading"),i.removeClass("wdi_hidden")),1},wdi_front.allImagesLoaded=function(e){wdi_front.getDataLength(e);e.mediaRequestsDone||jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").remove("wdi_nomedia"),0==e.allResponseLength&&1===e.dataLoaded&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").append("<p class='wdi_nomedia'>"+wdi_front_messages.feed_nomedia+"</p>");var i=e.feed_row.wdi_feed_counter,i=jQuery("#wdi_feed_"+i);"load_more_btn"==e.feed_row.feed_display_view&&(parseInt(e.allResponseLength)>parseInt(e.feed_row.number_of_photos)&&i.find(".wdi_load_more").removeClass("wdi_hidden"),i.find(".wdi_spinner").addClass("wdi_hidden")),"infinite_scroll"==e.feed_row.feed_display_view&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_ajax_loading").addClass("wdi_hidden")},wdi_front.show=function(e,i){var d,r,t=i.feed_row.wdi_feed_counter,a=jQuery("#wdi_feed_"+t+" .wdi_feed_container");"header"===e&&(d={feed_thumb:i.feed_row.feed_thumb,feed_name:i.feed_row.feed_name},r=wdi_front.getHeaderTemplate()(d),d=a.find(".wdi_feed_header").html(),a.find(".wdi_feed_header").html(d+r))},wdi_front.getUserTemplate=function(e,i){var d=e.dataCount,r="#"===i[0]?"//instagram.com/explore/tags/"+i.substr(1,i.length):"//instagram.com/"+i,t="onclick='"+('window.open("'+r+'","_blank")')+"'",r='<div class="wdi_single_user" user_index="<%=user_index%>"><div class="wdi_header_user_text <%=hashtagClass%>"><div class="wdi_user_img_wrap"><img onerror="wdi_front.brokenImageHandler(this);" src="<%= user_img_url%>">';return 1<d&&(r+='<div title="'+wdi_front_messages.filter_title+'" class="wdi_filter_overlay"><div class="wdi_filter_icon"><span onclick="wdi_front.addFilter(<%=user_index%>,<%=feed_counter%>);" class="tenweb-i tenweb-i-filter"></span></div></div>'),r+="</div>",r+="<h3 "+t+"><%= user_name%></h3>","#"!==i[0]?("1"==e.feed_row.follow_on_instagram_btn&&(r+='<div class="wdi_user_controls"><div class="wdi_follow_btn" onclick="window.open(\'//instagram.com/<%= user_name%>\',\'_blank\')"><span> '+wdi_front_messages.follow+"</span></div></div>"),r+='<div class="wdi_media_info"><p class="wdi_posts"><span class="tenweb-i tenweb-i-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span class="tenweb-i tenweb-i-user"></span><%= counts.followed_by%></p></div>'):r+='<div class="wdi_user_controls"></div><div class="wdi_media_info"><p class="wdi_posts"><span class="tenweb-i tenweb-i-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span></span></p></div>',r+='<div class="wdi_clear"></div>',1==d&&"#"!==i[0]&&"1"==e.feed_row.display_user_info&&(r+='<div class="wdi_bio"><%= bio%></div>',r+='<div class="wdi_website"><a target="_blank" href="<%= website_url%>" ><%= website%></a></div>'),r+="</div></div>",_.template(r)},wdi_front.getHeaderTemplate=function(){return _.template('<div class="wdi_header_wrapper"><div class="wdi_header_img_wrap"><img src="<%=feed_thumb%>"></div><div class="wdi_header_text"><%=feed_name%></div><div class="wdi_clear"></div>')},wdi_front.addFilter=function(e,i){var d=window["wdi_feed_"+i],i=d.dataCount;if(!(i<2)&&0==d.nowLoadingImages){i=jQuery("#wdi_feed_"+d.feed_row.wdi_feed_counter+'_users [user_index="'+e+'"]');i.find(".wdi_filter_overlay").toggleClass("wdi_filter_active_bg"),i.find(".wdi_header_user_text h3").toggleClass("wdi_filter_active_col"),i.find(".wdi_media_info").toggleClass("wdi_filter_active_col"),i.find(".wdi_follow_btn").toggleClass("wdi_filter_active_col"),d.customFilterChanged=!0,0==d.userSortFlags[e].flag?d.userSortFlags[e].flag=!0:d.userSortFlags[e].flag=!1;for(var r=0,t=0;t<d.userSortFlags.length;t++)1==d.userSortFlags[t].flag&&r++;"pagination"==d.feed_row.feed_display_view&&(d.resIndex=0),0!=r?wdi_front.filterData(d):d.customFilteredData=d.dataStorageList,wdi_front.displayFeed(d),"pagination"==d.feed_row.feed_display_view&&(d.paginator=Math.ceil(d.imageIndex/parseInt(d.feed_row.pagination_per_page_number)),d.currentPage=d.paginator,wdi_front.updatePagination(d,"custom",1),jQuery("#wdi_first_page").removeClass("wdi_disabled"),jQuery("#wdi_last_page").addClass("wdi_disabled"))}},wdi_front.filterData=function(e){var i=e.userSortFlags;e.customFilteredData=[];for(var d=0;d<e.dataStorageList.length;d++)for(var r=0;r<i.length;r++)(void 0!==e.dataStorageList[d].user.id&&e.dataStorageList[d].user.id==i[r].id||e.dataStorageList[d].wdi_hashtag==i[r].name)&&1==i[r].flag&&e.customFilteredData.push(e.dataStorageList[d])},wdi_front.applyFilters=function(e){for(var i=0;i<e.userSortFlags.length;i++)1==e.userSortFlags[i].flag&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+'[user_index="'+i+'"]'),wdi_front.addFilter(i,e.feed_row.wdi_feed_counter),wdi_front.addFilter(i,e.feed_row.wdi_feed_counter))},wdi_front.getImgCount=function(e){for(var i=e.dataStorage,d=0,r=0;r<i.length;r++)d+=i[r].length;return d},wdi_front.parseLighboxData=function(e,i){for(var d,r,t,a,o=e.dataStorage,n=[],s=[],_=0;_<o.length;_++)for(var w=0;w<o[_].length;w++)n.push(o[_][w]);for(_=0;_<n.length;_++)void 0!==n[_]&&(r=void 0!==n[_]&&void 0!==n[_].media_url?n[_].media_url:wdi_url.plugin_url+"images/video_missing.png",r=n[_].thumbnail,void 0!==n[_]&&void 0===n[_].media_url&&("carousel"!==n[_].type||(void 0!==(a=n[_].carousel_media[0])&&void 0!==a.images||void 0!==a&&void 0!==a.videos)&&(r=a.thumbnail)),a=void(t=0)!==n[_].comments.count?n[_].comments.count:n[_].comments,void 0!==n[_]&&void 0!==a&&(t=a),d={alt:"",avg_rating:"",comment_count:t,date:wdi_front.convertUnixDate(n[_].created_time),description:wdi_front.getDescription(void 0!==n[_].caption&&null!==n[_].caption?wdi_front.escape_tags(n[_].caption.text):""),filename:wdi_front.getFileName(n[_]),filetype:wdi_front.getFileType(n[_]),hit_count:"0",id:n[_].id,image_url:n[_].link,number:0,rate:"",rate_count:"0",username:void 0!==n[_].user?n[_].user.username:"",profile_picture:void 0!==n[_].user?n[_].user.profile_picture:"",thumb_url:r,comments_data:void 0!==n[_].comments?n[_].comments.data:"",images:n[_].images||n[_].videos,carousel_media:void 0!==n[_].carousel_media?n[_].carousel_media:null},s.push(d));return s},wdi_front.convertUnixDate=function(e){var i=new Date(e).getTime()/1e3,e=new Date(0);e.setUTCSeconds(i);i=e.getFullYear()+"-"+(e.getMonth()+1)+"-"+e.getDate();return i+=" "+e.getHours()+":"+e.getMinutes()},wdi_front.getDescription=function(e){return e=e.replace(/\r?\n|\r/g," ")},wdi_front.getFileName=function(e){if(void 0!==e){var i=e.link;if("video"===e.type&&e.hasOwnProperty("videos")&&null!=e.videos.standard_resolution)return e.videos.standard_resolution.url;if(void 0===i)return"";i=i.split("/");return i[i.length-2]}},wdi_front.getFileType=function(e){return"video"==e.type&&e.hasOwnProperty("videos")?"EMBED_OEMBED_INSTAGRAM_VIDEO":"carousel"==e.type&&e.hasOwnProperty("carousel_media")?"EMBED_OEMBED_INSTAGRAM_CAROUSEL":"EMBED_OEMBED_INSTAGRAM_IMAGE"},wdi_front.array_max=function(e){for(var i=e[0],d=0,r=1;r<e.length;r++)i<e[r]&&(i=e[r],d=r);return{value:i,index:d}},wdi_front.array_min=function(e){for(var i=e[0],d=0,r=1;r<e.length;r++)i>e[r]&&(i=e[r],d=r);return{value:i,index:d}},wdi_front.activeUsersCount=function(e){for(var i=0,d=0;d<e.usersData.length;d++)"finished"!=e.usersData[d].finished&&i++;return i},wdi_front.checkMediaResponse=function(e,i){return""==e||void 0===e||null==e||void 0!==e.error?(errorMessage=wdi_front_messages.connection_error,wdi_front.show_alert(errorMessage,e,i),!1):""!=e&&void 0!==e&&null!=e&&void 0!==e.meta&&200!=e.meta.code?(errorMessage=e.meta.error_message,wdi_front.show_alert(errorMessage,e,i),!1):e},wdi_front.stripHashtag=function(e){return"#"!==e[0]?e:e.substr(1,e.length)},wdi_front.getInputType=function(e){switch(e[0]){case"#":return"hashtag";case"%":return"location";default:return"user"}},wdi_front.regexpTestCaption=function(e,i){var d=!1,r=!1,t=i.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&"),i=new RegExp("(?:^|\\s)"+t+"(?:^|\\s)"),a=new RegExp("(?:^|\\s)"+t,"g");for(null!=i.exec(e)&&(d=!0);null!=(match=a.exec(e));)r=!0;return 1==d||1==r},wdi_front.replaceNewLines=function(e){var i,d="vUkCJvN2ps3t",r=[];for(e=e.replace(/\r?\n|\r/g,d),i=new RegExp(d,"g");null!=(match=i.exec(e));)r.push(match.index);for(var t=e.split(d),a=0,o=0;o<t.length;o++)""==t[o]?a++:a=0,0<a&&(t.splice(o,1),a--,o--);return e=t.join(" ")},wdi_front.isEmptyObject=function(e){for(var i in e)if(e.hasOwnProperty(i))return!1;return!0},wdi_front.isEmpty=function(e){return!e||0===e.length};var WDIFeed=function(e){this.data=e.data,this.dataCount=e.dataCount,this.feed_row=e.feed_row,this.usersData=e.usersData,(_this=this).set_images_loading_flag=function(e){window.addEventListener("load",function(){e.nowLoadingImages=!1})},this.set_images_loading_flag(_this)};function wdi_extractHostname(e){return void 0===e||""===e?"":e.replace(/(^\w+:|^)\/\//,"")}WDIFeed.prototype.mediaExists=function(e,i){for(var d=0;d<i.length;d++)if(e.id==i[d].id)return!0;return!1},WDIFeed.prototype.getIdFromUrl=function(e){for(var i=e.split("/"),d=!1,r=0;r<i.length;r++)if("p"==i[r]&&void 0!==i[r+1]){d=i[r+1];break}return d},WDIFeed.prototype.avoidDuplicateMedia=function(e){var i=e.data,d=[];void 0===i&&(i=[]);for(var r=0;r<i.length;r++)this.mediaExists(i[r],this.dataStorageList)||this.mediaExists(i[r],d)||this.mediaExists(i[r],this.conditionalFilterBuffer)||d.push(i[r]);return this.conditionalFilterBuffer=this.conditionalFilterBuffer.concat(d),{data:d,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.storeRawData=function(e,i){var r=this;if("object"==typeof this[i]&&"number"==typeof this[i].length)for(var d=0;d<e.length;d++){var t="";wdi_front.isHashtag(e[d].user_id)?void 0!==e[d].pagination.cursors&&(t=e[d].pagination.cursors.after):"liked"==r.feed_row.liked_feed?void 0===(t=e[d].pagination.next_max_like_id)&&(t=""):(null==e[d].pagination&&(e[d].pagination=[]),void 0===(t=e[d].pagination.next_max_id)&&(t="")),void 0===this[i][d]?this[i].push({data:e[d].data,index:0,locked:!1,hash_id:t,usersDataFinished:!1,userId:e[d].user_id,length:function(){return this.data.length-this.index},getData:function(e){var i=this.data.slice(this.index,this.index+e);if(this.index+=Math.min(e,this.length()),this.index==this.data.length&&1==this.locked&&0==this.usersDataFinished)for(var d=0;d<r.usersData.length;d++)if(r.usersData[d].user_id==this.userId){this.usersDataFinished=!0;break}return i}}):0==this[i][d].locked&&(t!=this[i][d].hash_id?(this[i][d].data=this[i][d].data.concat(e[d].data),this[i][d].hash_id=t):this[i][d].locked=!0)}},wdi_front.updateUsersIfNecessary=function(o){for(var n=o.feed_users,e=!1,i=0;i<n.length;i++)"#"!=n[i].username.substr(0,1)?""!=n[i].id&&"username"!=n[i].id||(e=!0,o.instagram.searchForUsersByName(n[i].username,{success:function(e){if(void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,o),200==e.meta.code&&0<e.data.length){for(var i=!1,d=0;d<e.data.length;d++)if(e.data[d].username==e.args.username){i=!0;break}if(i)for(var r=0;r<n.length;r++)e.data[d].username==n[r].username&&(n[r].id=e.data[d].id)}for(var t=!1,a=0;a<n.length;a++)if(""==n[a].id||"username"==n[a].id){t=!0;break}t||(o.feed_row.feed_users=JSON.stringify(n),wdi_front.init(o))},username:n[i].username})):n[i].id=n[i].username;return e},void 0!==wdi_ajax.ajax_response?jQuery(document).one("ajaxStop",function(){"not_declared"!=wdi_front.type&&(wdi_front.clickOrTouch=wdi_front.detectEvent(),wdi_front.globalInit())}):jQuery(document).ready(function(){"not_declared"!=wdi_front.type&&(wdi_front.clickOrTouch=wdi_front.detectEvent(),wdi_front.globalInit())}),jQuery(document).ready(function(){setTimeout(function(){"1"===wdi_front_messages.show_alerts&&"I"!==jQuery(".wdi_check_fontawesome .tenweb-i-instagram").prop("tagName")&&console.log("Font Awesome is not loaded properly. Please ask for support https://wordpress.org/support/plugin/wd-instagram-feed/")},2e3)});
|
1 |
+
"undefined"==typeof wdi_front&&(wdi_front={type:"not_declared"});var wdi_error_show=!(wdi_front.detectEvent=function(){var e="click";return/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())&&(e="touchend"),e}),wdi_error_init=!1;function wdi_baseName(e){var i=e.substr(e.lastIndexOf("/"));return e.replace(i,"")}wdi_front.escape_tags=function(e){return void 0===e&&(e=""),e=e.toString().replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")},wdi_front.show_alert=function(e,i,d){var r,t;void 0!==(d=jQuery("#wdi_feed_"+d.feed_row.wdi_feed_counter))&&(wdi_error_show=!0,d.find(".wdi_spinner").remove(),r=d.find(".wdi_js_error"),t=d.find(".wdi_token_error"),0!=i&&(void 0!==i.meta&&1==i.meta.error&&"OAuthException"===i.meta.error_type||void 0!==i.error&&"OAuthException"===i.error.type)?(d.find(".wdi_single_user").remove(),t.removeClass("wdi_hidden"),"1"!=wdi_front_messages.wdi_token_error_flag&&jQuery.ajax({type:"POST",url:wdi_url.ajax_url,dataType:"json",data:{action:"wdi_token_flag",wdi_token_flag_nonce:wdi_front_messages.wdi_token_flag_nonce},success:function(e){}})):void 0!==i.error&&void 0!==i.error.message&&(r.html(i.error.message),d.find(".wdi_single_user").remove(),r.removeClass("wdi_js_error"),r.addClass("wdi_js_error_no_animate"),jQuery(".wdi_js_error_no_animate").show()),wdi_front_messages.show_alerts||console.log("%c"+e,"color:#cc0000;")),wdi_error_show=!0},wdi_front.globalInit=function(){var e=wdi_front.feed_counter,i=0;void 0!==wdi_ajax.ajax_response&&(i=wdi_feed_counter_init.wdi_feed_counter_init);for(var d,r=i;r<=e;r++)0!==jQuery("#wdi_feed_"+r).length&&((d=new WDIFeed(window["wdi_feed_"+r])).instagram=new WDIInstagram,d.instagram.filterArguments={feed:d},d.instagram.addToken(d.feed_row.access_token),wdi_front.access_token=d.feed_row.access_token,d.dataLoaded=0,d.dataStorageRaw=[],d.dataStorage=[],d.dataStorageList=[],d.allResponseLength=0,d.currentResponseLength=0,d.temproraryUsersData=[],d.removedUsers=0,d.nowLoadingImages=!0,d.imageIndex=0,d.resIndex=0,d.currentPage=1,d.currentPageLoadMore=0,d.userSortFlags=[],d.customFilterChanged=!1,d.maxConditionalFiltersRequestCount=10,d.instagramRequestCounter=0,d.mediaRequestsDone=!1,d.conditionalFilterBuffer=[],d.stopInfiniteScrollFlag=!1,"masonry"==d.feed_row.feed_type&&(d.displayedData=[]),"pagination"==d.feed_row.feed_display_view?(d.feed_row.resort_after_load_more=0,"image_browser"!=d.feed_row.feed_type?(d.feed_row.load_more_number=parseInt(d.feed_row.pagination_per_page_number),d.feed_row.number_of_photos=d.allResponseLength):(d.feed_row.number_of_photos=1+parseInt(d.feed_row.image_browser_preload_number),d.feed_row.load_more_number=parseInt(d.feed_row.image_browser_load_number)),d.freeSpaces=(Math.floor(d.feed_row.pagination_per_page_number/d.feed_row.number_of_columns)+1)*d.feed_row.number_of_columns-d.feed_row.pagination_per_page_number):d.freeSpaces=0,d.galleryBox=function(e){wdi_spider_createpopup(wdi_url.ajax_url+"?gallery_id="+this.feed_row.id+"&image_id="+e,this.feed_row.wdi_feed_counter,this.feed_row.lightbox_width,this.feed_row.lightbox_height,1,"testpopup",5,this,e)},wdi_responsive.columnControl(d),"masonry"==d.feed_row.feed_type&&jQuery(window).trigger("resize"),wdi_front.bindEvents(d),window["wdi_feed_"+r]=d,wdi_front.init(d))},wdi_front.init=function(e){if(jQuery(".wdi_js_error").hide(),e.photoCounter=e.feed_row.number_of_photos,"liked"==e.feed_row.liked_feed)e.feed_users=["self"];else{if(!wdi_front.isJsonString(e.feed_row.feed_users))return void wdi_front.show_alert(wdi_front_messages.invalid_users_format,!1,e);e.feed_users=JSON.parse(e.feed_row.feed_users)}var i=[],d=[],r=[];void 0!==window.wdi_all_tags&&(i=window.wdi_all_tags);for(var t=0;t<e.feed_users.length;t++)"#"===e.feed_users[t].username[0]&&void 0!==e.feed_users[t].tag_id?(i[e.feed_users[t].tag_id]=e.feed_users[t],r[t]=e.feed_users[t]):d[0]=e.feed_users[t];window.wdi_all_tags=i,e.feed_users=void 0===r||wdi_front.isEmpty(r)?d:r;var a=wdi_front.getFeedItemResolution(e);e.feedImageResolution=a.image,e.feedVideoResolution=a.video,e.dataCount=e.feed_users.length;for(var o=0;o<e.dataCount;o++)wdi_front.instagramRequest(o,e);0<e.feed_row.number_of_photos&&wdi_front.ajaxLoader(e),"1"===e.feed_row.display_header&&wdi_front.show("header",e),"1"===e.feed_row.show_usernames&&wdi_front.show("users",e)},wdi_front.getFeedItemResolution=function(e){var i={image:"standard_resolution",video:"standard_resolution"};if("thumbnail"===e.feed_row.feed_resolution)return{image:"thumbnail",video:"low_bandwidth"};if("low"===e.feed_row.feed_resolution)return{image:"low_resolution",video:"low_resolution"};if("standard"===e.feed_row.feed_resolution)return{image:"standard_resolution",video:"standard_resolution"};var d=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter).find(".wdi_feed_wrapper");d.append('<div class="wdi_feed_item" id="wdi_feed_item_example"></div>'),wdi_responsive.columnControl(e,1);e=d.attr("wdi-res").split("wdi_col_");if(d.find("#wdi_feed_item_example").remove(),2!==e.length)return i;e=parseInt(e[1]);if(e<=0)return i;e=d.width()/e-10;return e<=150?(i.image="thumbnail",i.video="low_bandwidth"):150<e&&e<=320?(i.image="low_resolution",i.video="low_resolution"):(i.image="standard_resolution",i.video="standard_resolution"),i},wdi_front.isJsonString=function(e){try{JSON.parse(e)}catch(e){return!1}return!0},wdi_front.instagramRequest=function(i,d){var r=this,e=d.feed_users;if("string"==typeof e[i]&&"self"===e[i])d.instagram.getRecentLikedMedia({success:function(e){void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,d),d.mediaRequestsDone=!0,0!=(e=r.checkMediaResponse(e,d))&&r.saveSelfUserData(e,d)}});else if("hashtag"==this.getInputType(e[i].username)){if(this.isJsonString(d.feed_row.feed_users))for(var t in json_feed_users=JSON.parse(d.feed_row.feed_users),json_feed_users)"#"!==json_feed_users[t].username.charAt(0)&&(user=json_feed_users[t]);d.instagram.getTagRecentMedia(this.stripHashtag(e[i].username),{feed_id:d.feed_row.id,user_id:user.id,user_name:user.username,success:function(e){if(void 0!==e.error&&"undefined"!=e.error.type||void 0!==e.meta&&1==e.meta.error)return d.dataLoaded=1,wdi_front.show_alert(!1,e,d),!1;d.mediaRequestsDone=!0,e=r.checkMediaResponse(e,d),d.dataLoaded=1,0!=e&&r.saveUserData(e,d.feed_users[i],d)}},null,d.feed_row.hashtag_top_recent,0)}else"user"==this.getInputType(e[i].username)&&d.instagram.getUserMedia({feed_id:d.feed_row.id,user_id:e[i].id,user_name:e[i].username,success:function(e){if(void 0!==e.meta&&1==typeof e.meta.error)return d.dataLoaded=1,wdi_front.show_alert(!1,e,d),!1;d.mediaRequestsDone=!0,d.dataLoaded=1,0!=(e=r.checkMediaResponse(e,d))?r.saveUserData(e,d.feed_users[i],d):wdi_front.allImagesLoaded(d)}},"",0)},wdi_front.isHashtag=function(e){return"#"===e[0]},wdi_front.saveUserData=function(e,i,d){e.user_id=i.id,e.username=i.username,"#"===e.user_id[0]&&(e.data=wdi_front.appendRequestHashtag(e.data,e.user_id)),d.usersData.push(e),d.currentResponseLength=wdi_front.getArrayContentLength(d.usersData,"data"),d.allResponseLength+=d.currentResponseLength,d.dataCount==d.usersData.length&&(d.currentResponseLength<d.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(d)?wdi_front.loadMore("initial-keep",d):(wdi_front.displayFeed(d),wdi_front.applyFilters(d),wdi_front.activeUsersCount(d)||"load_more_btn"==d.feed_row.feed_display_view&&((d=jQuery("#wdi_feed_"+d.feed_row.wdi_feed_counter)).find(".wdi_load_more").addClass("wdi_hidden"),d.find(".wdi_spinner").addClass("wdi_hidden"))))},wdi_front.saveSelfUserData=function(e,i){e.user_id="",e.username="",i.usersData.push(e),i.currentResponseLength=wdi_front.getArrayContentLength(i.usersData,"data"),i.allResponseLength+=i.currentResponseLength,i.dataCount==i.usersData.length&&(i.currentResponseLength<i.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(i)?wdi_front.loadMore("initial-keep",i):(wdi_front.displayFeed(i),wdi_front.applyFilters(i),wdi_front.activeUsersCount(i)||"load_more_btn"==i.feed_row.feed_display_view&&((i=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter)).find(".wdi_load_more").addClass("wdi_hidden"),i.find(".wdi_spinner").addClass("wdi_hidden"))))},wdi_front.userHasNoPhoto=function(e,i){var d=0,r=e.usersData;void 0!==i&&(r=i);for(var t=0;t<r.length;t++)void 0===r[t].pagination&&(r[t].pagination=[]),"liked"===e.feed_row.liked_feed?void 0===r[t].pagination.next_max_like_id&&d++:void 0===r[t].pagination.next_max_id&&d++;return d==r.length?1:0},wdi_front.appendRequestHashtag=function(e,i){for(var d=0;d<e.length;d++)e[d].wdi_hashtag=i;return e},wdi_front.displayFeed=function(e,i){void 0===i&&(i=1);for(var d=0;d<e.usersData.length;d++)e.dataStorageList=e.usersData[d].data,e.dataStorage[d]=e.usersData[d].data;var r=e.feed_row.number_of_photos,t=e.feed_row.load_more_number,a=0,o=r,r="";"pagination"==e.feed_row.feed_display_view?(1<e.allResponseLength&&jQuery("#wdi_pagination").removeClass("wdi_hidden"),e.feed_row.number_of_photos=e.allResponseLength,"image_browser"==e.feed_row.feed_type?e.paginator=parseInt(e.feed_row.number_of_photos):e.paginator=Math.ceil(parseInt(e.feed_row.number_of_photos)/parseInt(t)),r=(o=1===i?(a=0,"image_browser"==e.feed_row.feed_type?1:t):"image_browser"==e.feed_row.feed_type?(a=i-1)+1:(a=(i-1)*t)+t,e.dataStorageList.slice(a,o))):void 0!==e.already_loaded_count?(a=parseInt(e.already_loaded_count),o=e.already_loaded_count+parseInt(t),r=e.dataStorageList.slice(a,o),e.already_loaded_count+=r.length):(r=e.dataStorageList.slice(a,o),e.already_loaded_count=r.length),e.parsedData=wdi_front.parseLighboxData(e,!0),"masonry"==e.feed_row.feed_type&&wdi_front.masonryDisplayFeedItems(r,e),"thumbnails"!=e.feed_row.feed_type&&"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||wdi_front.displayFeedItems(r,e),"pagination"==e.feed_row.feed_display_view&&e.currentPage<e.paginator&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter).find("#wdi_last_page").removeClass("wdi_disabled"),wdi_front.updateUsersImages(e)},wdi_front.updateUsersImages=function(i){jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter).find(".wdi_single_user .wdi_user_img_wrap img").each(function(){if((jQuery(this).attr("src")==wdi_url.plugin_url+"images/missing.png"||""==jQuery(this).attr("src"))&&"liked"!=i.feed_row.liked_feed)for(var e=0;e<i.usersData.length;e++)i.usersData[e].username==jQuery(this).parent().parent().find("h3").text()&&0!=i.usersData[e].data.length&&jQuery(this).attr("src",i.usersData[e].data[0].images.thumbnail.url)})},wdi_front.checkLoaded=function(e){var i=e.feed_row.wdi_feed_counter,d=jQuery("#wdi_feed_"+i);e.dataStorageList.length>e.already_loaded_count?d.find(".wdi_load_more").removeClass("wdi_hidden"):d.find(".wdi_load_more").addClass("wdi_hidden"),d.find(".wdi_spinner").addClass("wdi_hidden"),setTimeout(function(){d.find(".wdi_ajax_loading").addClass("wdi_hidden")},500)},wdi_front.masonryDisplayFeedItems=function(e,i){var d=[],r=[];if(0!=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length){jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_masonry_column").each(function(){1==i.feed_row.resort_after_load_more&&(jQuery(this).html(""),i.imageIndex=0),1==i.customFilterChanged&&(jQuery(this).html(""),i.imageIndex=0),"pagination"==i.feed_row.feed_display_view?d.push(0):d.push(jQuery(this).height()),r.push(jQuery(this))}),1==i.customFilterChanged&&(i.customFilterChanged=!1);for(var t,a,o,n=0;n<e.length;n++)"object"==typeof e[n].videos&&null==e[n].videos.standard_resolution||(i.displayedData.push(e[n]),t="",void 0!==e[n].wdi_hashtag&&(t=e[n].wdi_hashtag),a="image"==e[n].type?wdi_front.getPhotoTemplate(i,t):e[n].hasOwnProperty("videos")||"video"==e[n].type?wdi_front.getVideoTemplate(i,t):wdi_front.getSliderTemplate(i,t),o=e[n],t=a(wdi_front.createObject(o,i)),a=wdi_front.array_min(d),o=wdi_front.getImageResolution(e[n]),r[a.index].html(r[a.index].html()+t),d[a.index]+=r[a.index].width()*o,i.imageIndex++,"pagination"==i.feed_row.feed_display_view&&((n+1)%i.feed_row.pagination_per_page_number==0?i.resIndex+=i.freeSpaces+1:i.resIndex++));i.wdi_loadedImages=0;var s=!1;i.wdi_load_count=n;var _=i.feed_row.wdi_feed_counter;jQuery("#wdi_feed_"+_+" .wdi_img").on("load",function(){i.wdi_loadedImages++,!1===s&&(wdi_responsive.columnControl(i,1),s=!0)});wdi_front.checkLoaded(i),1==i.paginatorNextFlag&&wdi_front.updatePagination(i,"next"),i.infiniteScrollFlag=!1}},wdi_front.getImageResolution=function(e){var i;return e="image"===e.type?(i=e.images.standard_resolution.height,e.images.standard_resolution.width):"video"===e.type?(i=e.videos.standard_resolution.height,e.videos.standard_resolution.width):(i=(e.carousel_media[0].images||e.carousel_media[0].videos).standard_resolution.height,(e.carousel_media[0].images||e.carousel_media[0].videos).standard_resolution.width),i/e},wdi_front.getDataLength=function(e,i){var d=0;if(void 0===i)for(var r=0;r<e.dataStorage.length;r++)d+=e.dataStorage[r].length;else for(r=0;r<i.length;r++)d+=i[r].length;return d},wdi_front.getArrayContentLength=function(e,i){for(var d=0,r=0;r<e.length;r++)"finished"!=e[r].finished&&void 0===e[r].error&&(d+=e[r][i].length);return d},wdi_front.displayFeedItems=function(e,d){if(0!=jQuery("#wdi_feed_"+d.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length){for(var i,r,t,a=d.feed_row.wdi_feed_counter,o=jQuery("#wdi_feed_"+a+" .wdi_feed_wrapper"),n=0;n<e.length;n++){if(void 0===e[n])return;"object"==typeof e[n].videos&&null==e[n].videos.standard_resolution||(t="",void 0!==e[n].wdi_hashtag&&(t=e[n].wdi_hashtag),i="image"==e[n].type?wdi_front.getPhotoTemplate(d,t):e[n].hasOwnProperty("videos")?wdi_front.getVideoTemplate(d,t):wdi_front.getSliderTemplate(d,t),r=e[n],t="",void 0!==(r=wdi_front.createObject(r,d))&&(t=i(r)),o.html(o.html()+t),d.imageIndex++,"pagination"==d.feed_row.feed_display_view&&((n+1)%d.feed_row.pagination_per_page_number==0?d.resIndex+=d.freeSpaces+1:d.resIndex++))}!function(){var e=d.feed_row.wdi_feed_counter,i=jQuery("#wdi_feed_"+e);d.dataStorageList.length>d.already_loaded_count?i.find(".wdi_load_more").removeClass("wdi_hidden"):i.find(".wdi_load_more").addClass("wdi_hidden"),i.find(".wdi_spinner").addClass("wdi_hidden");setTimeout(function(){i.find(".wdi_ajax_loading").addClass("wdi_hidden")},500)}()}},wdi_front.checkFeedFinished=function(e){for(var i=0;i<e.usersData.length;i++)if(void 0===e.usersData[i].finished)return!1;return!0},wdi_front.createObject=function(e,i){var d=null!=e.caption?e.caption.text:" ";switch(e.type){case"image":var r=e.images[i.feedImageResolution].url,t=void 0,a=e.hasOwnProperty("thumbnail")?e.thumbnail:wdi_url.plugin_url+"images/missing.png";break;case"video":r=void 0,t=e.hasOwnProperty("videos")?e.videos[i.feedVideoResolution].url:wdi_url.plugin_url+"images/video_missing.png",a=e.hasOwnProperty("thumbnail")?e.thumbnail:wdi_url.plugin_url+"images/video_missing.png";break;case"carousel":if(0===e.carousel_media.length)r=wdi_url.plugin_url+"images/missing.png",t=void 0,a=wdi_url.plugin_url+"images/missing.png";else switch(e.carousel_media[0].type){case"image":r=e.carousel_media[0].images[i.feedImageResolution].url,t=void 0,a=e.hasOwnProperty("thumbnail")?e.thumbnail:wdi_url.plugin_url+"images/missing.png";break;case"video":r=void 0,t=e.carousel_media[0].videos[i.feedVideoResolution].url,a=e.hasOwnProperty("thumbnail")?e.thumbnail:wdi_url.plugin_url+"images/video_missing.png";break;default:r=wdi_url.plugin_url+"images/missing.png",t=void 0,a=wdi_url.plugin_url+"images/missing.png"}break;default:r=wdi_url.plugin_url+"images/missing.png",t=void 0,a=wdi_url.plugin_url+"images/missing.png"}var o,n=i.imageIndex,s="square";(_="image"===e.type?(o=e.images.standard_resolution.height,e.images.standard_resolution.width):"video"===e.type?(o=e.videos.standard_resolution.height,e.videos.standard_resolution.width):(o=(e.carousel_media[0].images||e.carousel_media[0].videos).standard_resolution.height,(e.carousel_media[0].images||e.carousel_media[0].videos).standard_resolution.width))<o?s="portrait":o<_&&(s="landscape");var _=e.user.username;return""===_&&(_="no_user"),{id:e.id,thumb_url:a,caption:wdi_front.escape_tags(d),image_url:r,likes:void 0!==e.likes.count?e.likes.count:e.likes,comments:void 0!==e.comments.count?e.comments.count:e.comments,wdi_index:n,wdi_res_index:i.resIndex,wdi_media_user:_,link:e.link,video_url:t,wdi_username:_,wdi_shape:s}},wdi_front.getPhotoTemplate=function(e,i){var d="",r="",t="",a="tenweb-i-arrows-out",o="";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(a=""),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(o='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(d+=" wdi_full_caption");var n="";switch("blog_style"!==e.feed_row.feed_type&&(n="masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":r="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":r="onclick=\"window.open ('<%= link%>','_blank')\"",t="wdi_hover_off",a="";break;case"custom_redirect":r="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",t="wdi_hover_off",a="";break;case"none":t="wdi_cursor_off wdi_hover_off",a=r=""}var s='<div class="wdi_feed_item '+d+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> wdi_type="image" id="wdi_'+e.feed_row.wdi_feed_counter+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img <%= wdi_shape == \'square\' ? \'wdi_shape_square\' : (wdi_shape == \'portrait\' ? \'wdi_shape_portrait\' : (wdi_shape == \'landscape\' ? \'wdi_shape_landscape\' : \'wdi_shape_square\') ) %>"><img class="wdi_img" src="<%=thumb_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+t+'" >'+o+'<div class="wdi_thumb_icon" '+r+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+a+'"></i></div></div></div></div></div></div>',d=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(s+='<div class="wdi_photo_meta">',o=void 0!==e.dataStorageList[d].likes.count?e.dataStorageList[d].likes.count:e.dataStorageList[d].likes,"1"===e.feed_row.show_likes&&0!==o&&(s+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o"> <%= likes%></i></div>'),d=void 0!==e.dataStorageList[d].comments.count?e.dataStorageList[d].comments.count:e.dataStorageList[d].comments,"1"===e.feed_row.show_comments&&0!==d&&(s+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square"> <%= comments%></i></div>'),s+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(s+='<div class="wdi_photo_title" onclick='+n+" ><%=caption%></div>"),s+="</div>"),s+="</div>",_.template(s)},wdi_front.getSliderTemplate=function(e,i){var d="",r="",t="",a="tenweb-i-clone",o="";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(a=""),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(o='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(d+=" wdi_full_caption");var n="";switch("blog_style"!==e.feed_row.feed_type&&(n="masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":r="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":r="onclick=\"window.open ('<%= link%>','_blank')\"",t="wdi_hover_off",a="tenweb-i-clone";break;case"custom_redirect":r="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",t="wdi_hover_off",a="";break;case"none":t="wdi_cursor_off wdi_hover_off",a=r=""}var s='<div class="wdi_feed_item '+d+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> wdi_type="slideshow" id="wdi_'+e.feed_row.wdi_feed_counter+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img <%= wdi_shape == \'square\' ? \'wdi_shape_square\' : (wdi_shape == \'portrait\' ? \'wdi_shape_portrait\' : (wdi_shape == \'landscape\' ? \'wdi_shape_landscape\' : \'wdi_shape_square\') ) %>"><img class="wdi_img" src="<%=thumb_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+t+'" >'+o+'<div class="wdi_thumb_icon" '+r+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+a+'"></i></div></div></div></div></div></div>',d=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(s+='<div class="wdi_photo_meta">',o=void 0!==e.dataStorageList[d].likes.count?e.dataStorageList[d].likes.count:e.dataStorageList[d].likes,"1"===e.feed_row.show_likes&&0!==o&&(s+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o"> <%= likes%></i></div>'),d=void 0!==e.dataStorageList[d].comments.count?e.dataStorageList[d].comments.count:e.dataStorageList[d].comments,"1"===e.feed_row.show_comments&&0!==d&&(s+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square"> <%= comments%></i></div>'),s+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(s+='<div class="wdi_photo_title" onclick='+n+" ><%=caption%></div>"),s+="</div>"),s+="</div>",_.template(s)},wdi_front.replaceToVideo=function(e,i,d){overlayHtml="<video style='width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;' controls=''><source src='"+e+"' type='video/mp4'>Your browser does not support the video tag. </video>",jQuery("#wdi_feed_"+d+' [wdi_index="'+i+'"] .wdi_photo_wrap_inner').html(overlayHtml),jQuery("#wdi_feed_"+d+' [wdi_index="'+i+'"] .wdi_photo_wrap_inner video').get(0).play()},wdi_front.getVideoTemplate=function(e,i){var d="",r="tenweb-i-play",t="",a="",o="";"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(o='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(d+=" wdi_full_caption");var n="";switch("blog_style"!==e.feed_row.feed_type&&(n="masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":t="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":t="onclick=\"window.open ('<%= link%>','_blank')\"",a="wdi_hover_off",r="tenweb-i-play";break;case"custom_redirect":t="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",a="wdi_hover_off",r="";break;case"none":a="wdi_cursor_off wdi_hover_off",r="","blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(t="onclick=wdi_front.replaceToVideo('<%= video_url%>','<%= wdi_index%>',"+e.feed_row.wdi_feed_counter+")",a="",r="tenweb-i-play")}var s='<div class="wdi_feed_item '+d+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> wdi_type="image" id="wdi_'+e.feed_row.wdi_feed_counter+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img <%= wdi_shape == \'square\' ? \'wdi_shape_square\' : (wdi_shape == \'portrait\' ? \'wdi_shape_portrait\' : (wdi_shape == \'landscape\' ? \'wdi_shape_landscape\' : \'wdi_shape_square\') ) %>"><img class="wdi_img" src="<%=thumb_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+a+'" '+t+">"+o+'<div class="wdi_thumb_icon" style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+r+'"></i></div></div></div></div></div></div>',d=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(s+='<div class="wdi_photo_meta">',o=void 0!==e.dataStorageList[d].likes.count?e.dataStorageList[d].likes.count:e.dataStorageList[d].likes,"1"===e.feed_row.show_likes&&0!==o&&(s+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o"> <%= likes%></i></div>'),d=void 0!==e.dataStorageList[d].comments.count?e.dataStorageList[d].comments.count:e.dataStorageList[d].comments,"1"===e.feed_row.show_comments&&0!==d&&(s+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square"> <%= comments%></i></div>'),s+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(s+='<div class="wdi_photo_title" onclick='+n+" ><%=caption%></div>"),s+="</div>"),s+="</div>",_.template(s)},wdi_front.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(){jQuery(document).find("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_load_more").addClass("wdi_hidden"),jQuery(document).find("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_spinner").removeClass("wdi_hidden"),setTimeout(function(){wdi_front.loadMore(jQuery(this).find(".wdi_load_more_wrap"),e)},1e3)}),"pagination"==e.feed_row.feed_display_view&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_next").on(wdi_front.clickOrTouch,function(){parseInt(jQuery("#wdi_current_page").text())+1>e.paginator||(e.currentPage=parseInt(jQuery("#wdi_current_page").text())+1,wdi_front.changePage(jQuery(this),e))}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_prev").on(wdi_front.clickOrTouch,function(){parseInt(jQuery("#wdi_current_page").text())-1<=0||(e.currentPage=parseInt(jQuery("#wdi_current_page").text())-1,wdi_front.changePage(jQuery(this),e))}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_last_page").on(wdi_front.clickOrTouch,function(){e.currentPage=e.paginator,wdi_front.changePage(jQuery(this),e)}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_first_page").on(wdi_front.clickOrTouch,function(){e.currentPage=1,wdi_front.changePage(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&&(e.dataStorageList.length>e.already_loaded_count||void 0===e.already_loaded_count?(e.infiniteScrollFlag=!0,wdi_front.loadMore(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_infinite_scroll"),e)):wdi_front.allImagesLoaded(e))},wdi_front.changePage=function(e,i){var d=e.closest(".wdi_feed_container");d.find(".wdi_page_loading").removeClass("wdi_hidden"),new_page_number=i.currentPage,1<new_page_number?jQuery("#wdi_first_page").removeClass("wdi_disabled"):1===new_page_number&&jQuery("#wdi_first_page").addClass("wdi_disabled"),new_page_number==parseInt(i.paginator)?jQuery("#wdi_last_page").addClass("wdi_disabled"):new_page_number<parseInt(i.paginator)&&jQuery("#wdi_last_page").removeClass("wdi_disabled"),("masonry"==i.feed_row.feed_type?e.parent().parent().parent().find(".wdi_feed_wrapper .wdi_masonry_column"):e.parent().parent().parent().find(".wdi_feed_wrapper")).empty(),e.parent().find("#wdi_current_page").empty().text(new_page_number),wdi_front.displayFeed(i,new_page_number),d.find(".wdi_page_loading").addClass("wdi_hidden")},wdi_front.updatePagination=function(e,i,d){var r="#wdi_feed_"+e.feed_row.wdi_feed_counter;switch(jQuery(r+' [wdi_page="'+e.currentPage+'"]').each(function(){jQuery(this).removeClass("wdi_hidden")}),i){case"next":var d=e.currentPage-1;jQuery(r+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(r+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"prev":d=e.currentPage+1;jQuery(r+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(r+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"custom":(d=d)!=e.currentPage&&(jQuery(r+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(r+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")}))}e.paginatorNextFlag=!1,jQuery(r+" .wdi_feed_wrapper").css("height","auto"),jQuery(r+" #wdi_current_page").text(e.currentPage)},wdi_front.loadMore=function(e,i){var d;if(""!=e&&void 0!==e&&"initial"!=e&&"initial-keep"!=e&&(d=window[e.parent().parent().parent().parent().attr("id")]),void 0!==i&&(d=i),wdi_front.ajaxLoader(d),this.isJsonString(d.feed_row.feed_users))for(var r in json_feed_users=JSON.parse(d.feed_row.feed_users),json_feed_users)iuser=json_feed_users[r],"#"!==json_feed_users[r].username.charAt(0)&&(iuser=json_feed_users[r]);"masonry"===d.feed_row.feed_type&&"pagination"==d.feed_row.feed_display_view&&jQuery("#wdi_feed_"+wdi_front.feed_counter+" .wdi_full_caption").each(function(){jQuery(this).find(".wdi_photo_title").trigger(wdi_front.clickOrTouch)}),d.loadMoreDataCount=d.feed_users.length,wdi_front.displayFeed(d)},wdi_front.loadMoreRequest=function(e,i,d,r){d.mediaRequestsDone&&""!=i&&d.usersData},wdi_front.checkForLoadMoreDone=function(e,i){var d,r=e.feed_row.load_more_number,t=e.feed_row.number_of_photos;0==e.loadMoreDataCount&&(e.temproraryUsersData=wdi_front.mergeData(e.temproraryUsersData,e.usersData),d=wdi_front.getArrayContentLength(e.temproraryUsersData,"data"),"initial-keep"==i&&(i="initial"),"initial"==i?d<t&&!wdi_front.userHasNoPhoto(e,e.temproraryUsersData)&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount?wdi_front.loadMore("initial",e):(e.usersData=e.temproraryUsersData,wdi_front.displayFeed(e),wdi_front.applyFilters(e),e.temproraryUsersData=[]):d<r&&!wdi_front.userHasNoPhoto(e,e.temproraryUsersData)&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount?wdi_front.loadMore(void 0,e):(e.usersData=e.temproraryUsersData,wdi_front.activeUsersCount(e)&&(wdi_front.displayFeed(e,r),wdi_front.applyFilters(e),e.temproraryUsersData=[])))},wdi_front.allDataHasFinished=function(e){for(var i=0,d=0;d<e.dataStorageRaw.length;d++)""==e.usersData[d].pagination.next_url&&(i++,e.usersData[d].finished="finished");return i==e.dataStorageRaw.length&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_load_more").remove(),!0)},wdi_front.mergeData=function(e,i){for(var d=0;d<i.length;d++)void 0!==e[d]?"finished"!=i[d].finished&&(void 0===e[d].pagination.next_max_id&&void 0===e[d].pagination.next_max_like_id||(e[d].data=e[d].data.concat(i[d].data),e[d].pagination=i[d].pagination,e[d].user_id=i[d].user_id,e[d].username=i[d].username,e[d].meta=i[d].meta)):e.push(i[d]);return e},wdi_front.brokenImageHandler=function(e){return!0},wdi_front.ajaxLoader=function(e){var i,d=e.feed_row.wdi_feed_counter,d=jQuery(document).find("#wdi_feed_"+d);return"load_more_btn"==e.feed_row.feed_display_view&&(d.find(".wdi_load_more").addClass("wdi_hidden"),d.find(".wdi_spinner").removeClass("wdi_hidden")),"infinite_scroll"==e.feed_row.feed_display_view&&(0==d.find(".wdi_ajax_loading").length?(i=jQuery('<div class="wdi_ajax_loading"><div><div><img class="wdi_load_more_spinner" src="'+wdi_url.plugin_url+'images/ajax_loader.png"></div></div></div>'),d.find(".wdi_feed_container").append(i)):i=d.find(".wdi_ajax_loading"),i.removeClass("wdi_hidden")),1},wdi_front.allImagesLoaded=function(e){wdi_front.getDataLength(e);e.mediaRequestsDone||jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").remove("wdi_nomedia"),0==e.allResponseLength&&1===e.dataLoaded&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").append("<p class='wdi_nomedia'>"+wdi_front_messages.feed_nomedia+"</p>");var i=e.feed_row.wdi_feed_counter,i=jQuery("#wdi_feed_"+i);"load_more_btn"==e.feed_row.feed_display_view&&(parseInt(e.allResponseLength)>parseInt(e.feed_row.number_of_photos)&&i.find(".wdi_load_more").removeClass("wdi_hidden"),i.find(".wdi_spinner").addClass("wdi_hidden")),"infinite_scroll"==e.feed_row.feed_display_view&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_ajax_loading").addClass("wdi_hidden")},wdi_front.show=function(e,i){var d,r,t=i.feed_row.wdi_feed_counter,a=jQuery("#wdi_feed_"+t+" .wdi_feed_container");"header"===e&&(d={feed_thumb:i.feed_row.feed_thumb,feed_name:i.feed_row.feed_name},r=wdi_front.getHeaderTemplate()(d),d=a.find(".wdi_feed_header").html(),a.find(".wdi_feed_header").html(d+r))},wdi_front.getUserTemplate=function(e,i){var d=e.dataCount,r="#"===i[0]?"//instagram.com/explore/tags/"+i.substr(1,i.length):"//instagram.com/"+i,t="onclick='"+('window.open("'+r+'","_blank")')+"'",r='<div class="wdi_single_user" user_index="<%=user_index%>"><div class="wdi_header_user_text <%=hashtagClass%>"><div class="wdi_user_img_wrap"><img onerror="wdi_front.brokenImageHandler(this);" src="<%= user_img_url%>">';return 1<d&&(r+='<div title="'+wdi_front_messages.filter_title+'" class="wdi_filter_overlay"><div class="wdi_filter_icon"><span onclick="wdi_front.addFilter(<%=user_index%>,<%=feed_counter%>);" class="tenweb-i tenweb-i-filter"></span></div></div>'),r+="</div>",r+="<h3 "+t+"><%= user_name%></h3>","#"!==i[0]?("1"==e.feed_row.follow_on_instagram_btn&&(r+='<div class="wdi_user_controls"><div class="wdi_follow_btn" onclick="window.open(\'//instagram.com/<%= user_name%>\',\'_blank\')"><span> '+wdi_front_messages.follow+"</span></div></div>"),r+='<div class="wdi_media_info"><p class="wdi_posts"><span class="tenweb-i tenweb-i-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span class="tenweb-i tenweb-i-user"></span><%= counts.followed_by%></p></div>'):r+='<div class="wdi_user_controls"></div><div class="wdi_media_info"><p class="wdi_posts"><span class="tenweb-i tenweb-i-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span></span></p></div>',r+='<div class="wdi_clear"></div>',1==d&&"#"!==i[0]&&"1"==e.feed_row.display_user_info&&(r+='<div class="wdi_bio"><%= bio%></div>',r+='<div class="wdi_website"><a target="_blank" href="<%= website_url%>" ><%= website%></a></div>'),r+="</div></div>",_.template(r)},wdi_front.getHeaderTemplate=function(){return _.template('<div class="wdi_header_wrapper"><div class="wdi_header_img_wrap"><img src="<%=feed_thumb%>"></div><div class="wdi_header_text"><%=feed_name%></div><div class="wdi_clear"></div>')},wdi_front.addFilter=function(e,i){var d=window["wdi_feed_"+i],i=d.dataCount;if(!(i<2)&&0==d.nowLoadingImages){i=jQuery("#wdi_feed_"+d.feed_row.wdi_feed_counter+'_users [user_index="'+e+'"]');i.find(".wdi_filter_overlay").toggleClass("wdi_filter_active_bg"),i.find(".wdi_header_user_text h3").toggleClass("wdi_filter_active_col"),i.find(".wdi_media_info").toggleClass("wdi_filter_active_col"),i.find(".wdi_follow_btn").toggleClass("wdi_filter_active_col"),d.customFilterChanged=!0,0==d.userSortFlags[e].flag?d.userSortFlags[e].flag=!0:d.userSortFlags[e].flag=!1;for(var r=0,t=0;t<d.userSortFlags.length;t++)1==d.userSortFlags[t].flag&&r++;"pagination"==d.feed_row.feed_display_view&&(d.resIndex=0),0!=r?wdi_front.filterData(d):d.customFilteredData=d.dataStorageList,wdi_front.displayFeed(d),"pagination"==d.feed_row.feed_display_view&&(d.paginator=Math.ceil(d.imageIndex/parseInt(d.feed_row.pagination_per_page_number)),d.currentPage=d.paginator,wdi_front.updatePagination(d,"custom",1),jQuery("#wdi_first_page").removeClass("wdi_disabled"),jQuery("#wdi_last_page").addClass("wdi_disabled"))}},wdi_front.filterData=function(e){var i=e.userSortFlags;e.customFilteredData=[];for(var d=0;d<e.dataStorageList.length;d++)for(var r=0;r<i.length;r++)(void 0!==e.dataStorageList[d].user.id&&e.dataStorageList[d].user.id==i[r].id||e.dataStorageList[d].wdi_hashtag==i[r].name)&&1==i[r].flag&&e.customFilteredData.push(e.dataStorageList[d])},wdi_front.applyFilters=function(e){for(var i=0;i<e.userSortFlags.length;i++)1==e.userSortFlags[i].flag&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+'[user_index="'+i+'"]'),wdi_front.addFilter(i,e.feed_row.wdi_feed_counter),wdi_front.addFilter(i,e.feed_row.wdi_feed_counter))},wdi_front.getImgCount=function(e){for(var i=e.dataStorage,d=0,r=0;r<i.length;r++)d+=i[r].length;return d},wdi_front.parseLighboxData=function(e,i){for(var d,r,t,a,o=e.dataStorage,n=[],s=[],_=0;_<o.length;_++)for(var w=0;w<o[_].length;w++)n.push(o[_][w]);for(_=0;_<n.length;_++)void 0!==n[_]&&(r=void 0!==n[_]&&void 0!==n[_].media_url?n[_].media_url:wdi_url.plugin_url+"images/video_missing.png",r=n[_].thumbnail,void 0!==n[_]&&void 0===n[_].media_url&&("carousel"!==n[_].type||(void 0!==(a=n[_].carousel_media[0])&&void 0!==a.images||void 0!==a&&void 0!==a.videos)&&(r=a.thumbnail)),a=void(t=0)!==n[_].comments.count?n[_].comments.count:n[_].comments,void 0!==n[_]&&void 0!==a&&(t=a),d={alt:"",avg_rating:"",comment_count:t,date:wdi_front.convertUnixDate(n[_].created_time),description:wdi_front.getDescription(void 0!==n[_].caption&&null!==n[_].caption?wdi_front.escape_tags(n[_].caption.text):""),filename:wdi_front.getFileName(n[_]),filetype:wdi_front.getFileType(n[_]),hit_count:"0",id:n[_].id,image_url:n[_].link,number:0,rate:"",rate_count:"0",username:void 0!==n[_].user?n[_].user.username:"",profile_picture:void 0!==n[_].user?n[_].user.profile_picture:"",thumb_url:r,comments_data:void 0!==n[_].comments?n[_].comments.data:"",images:n[_].images||n[_].videos,carousel_media:void 0!==n[_].carousel_media?n[_].carousel_media:null},s.push(d));return s},wdi_front.convertUnixDate=function(e){var i=new Date(e).getTime()/1e3,e=new Date(0);e.setUTCSeconds(i);i=e.getFullYear()+"-"+(e.getMonth()+1)+"-"+e.getDate();return i+=" "+e.getHours()+":"+e.getMinutes()},wdi_front.getDescription=function(e){return e=e.replace(/\r?\n|\r/g," ")},wdi_front.getFileName=function(e){if(void 0!==e){var i=e.link;if("video"===e.type&&e.hasOwnProperty("videos")&&null!=e.videos.standard_resolution)return e.videos.standard_resolution.url;if(void 0===i)return"";i=i.split("/");return i[i.length-2]}},wdi_front.getFileType=function(e){return"video"==e.type&&e.hasOwnProperty("videos")?"EMBED_OEMBED_INSTAGRAM_VIDEO":"carousel"==e.type&&e.hasOwnProperty("carousel_media")?"EMBED_OEMBED_INSTAGRAM_CAROUSEL":"EMBED_OEMBED_INSTAGRAM_IMAGE"},wdi_front.array_max=function(e){for(var i=e[0],d=0,r=1;r<e.length;r++)i<e[r]&&(i=e[r],d=r);return{value:i,index:d}},wdi_front.array_min=function(e){for(var i=e[0],d=0,r=1;r<e.length;r++)i>e[r]&&(i=e[r],d=r);return{value:i,index:d}},wdi_front.activeUsersCount=function(e){for(var i=0,d=0;d<e.usersData.length;d++)"finished"!=e.usersData[d].finished&&i++;return i},wdi_front.checkMediaResponse=function(e,i){return""==e||void 0===e||null==e||void 0!==e.error?(errorMessage=wdi_front_messages.connection_error,wdi_front.show_alert(errorMessage,e,i),!1):""!=e&&void 0!==e&&null!=e&&void 0!==e.meta&&200!=e.meta.code?(errorMessage=e.meta.error_message,wdi_front.show_alert(errorMessage,e,i),!1):e},wdi_front.stripHashtag=function(e){return"#"!==e[0]?e:e.substr(1,e.length)},wdi_front.getInputType=function(e){switch(e[0]){case"#":return"hashtag";case"%":return"location";default:return"user"}},wdi_front.regexpTestCaption=function(e,i){var d=!1,r=!1,t=i.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&"),i=new RegExp("(?:^|\\s)"+t+"(?:^|\\s)"),a=new RegExp("(?:^|\\s)"+t,"g");for(null!=i.exec(e)&&(d=!0);null!=(match=a.exec(e));)r=!0;return 1==d||1==r},wdi_front.replaceNewLines=function(e){var i,d="vUkCJvN2ps3t",r=[];for(e=e.replace(/\r?\n|\r/g,d),i=new RegExp(d,"g");null!=(match=i.exec(e));)r.push(match.index);for(var t=e.split(d),a=0,o=0;o<t.length;o++)""==t[o]?a++:a=0,0<a&&(t.splice(o,1),a--,o--);return e=t.join(" ")},wdi_front.isEmptyObject=function(e){for(var i in e)if(e.hasOwnProperty(i))return!1;return!0},wdi_front.isEmpty=function(e){return!e||0===e.length};var WDIFeed=function(e){this.data=e.data,this.dataCount=e.dataCount,this.feed_row=e.feed_row,this.usersData=e.usersData,(_this=this).set_images_loading_flag=function(e){window.addEventListener("load",function(){e.nowLoadingImages=!1})},this.set_images_loading_flag(_this)};function wdi_extractHostname(e){return void 0===e||""===e?"":e.replace(/(^\w+:|^)\/\//,"")}WDIFeed.prototype.mediaExists=function(e,i){for(var d=0;d<i.length;d++)if(e.id==i[d].id)return!0;return!1},WDIFeed.prototype.getIdFromUrl=function(e){for(var i=e.split("/"),d=!1,r=0;r<i.length;r++)if("p"==i[r]&&void 0!==i[r+1]){d=i[r+1];break}return d},WDIFeed.prototype.avoidDuplicateMedia=function(e){var i=e.data,d=[];void 0===i&&(i=[]);for(var r=0;r<i.length;r++)this.mediaExists(i[r],this.dataStorageList)||this.mediaExists(i[r],d)||this.mediaExists(i[r],this.conditionalFilterBuffer)||d.push(i[r]);return this.conditionalFilterBuffer=this.conditionalFilterBuffer.concat(d),{data:d,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.storeRawData=function(e,i){var r=this;if("object"==typeof this[i]&&"number"==typeof this[i].length)for(var d=0;d<e.length;d++){var t="";wdi_front.isHashtag(e[d].user_id)?void 0!==e[d].pagination.cursors&&(t=e[d].pagination.cursors.after):"liked"==r.feed_row.liked_feed?void 0===(t=e[d].pagination.next_max_like_id)&&(t=""):(null==e[d].pagination&&(e[d].pagination=[]),void 0===(t=e[d].pagination.next_max_id)&&(t="")),void 0===this[i][d]?this[i].push({data:e[d].data,index:0,locked:!1,hash_id:t,usersDataFinished:!1,userId:e[d].user_id,length:function(){return this.data.length-this.index},getData:function(e){var i=this.data.slice(this.index,this.index+e);if(this.index+=Math.min(e,this.length()),this.index==this.data.length&&1==this.locked&&0==this.usersDataFinished)for(var d=0;d<r.usersData.length;d++)if(r.usersData[d].user_id==this.userId){this.usersDataFinished=!0;break}return i}}):0==this[i][d].locked&&(t!=this[i][d].hash_id?(this[i][d].data=this[i][d].data.concat(e[d].data),this[i][d].hash_id=t):this[i][d].locked=!0)}},wdi_front.updateUsersIfNecessary=function(o){for(var n=o.feed_users,e=!1,i=0;i<n.length;i++)"#"!=n[i].username.substr(0,1)?""!=n[i].id&&"username"!=n[i].id||(e=!0,o.instagram.searchForUsersByName(n[i].username,{success:function(e){if(void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,o),200==e.meta.code&&0<e.data.length){for(var i=!1,d=0;d<e.data.length;d++)if(e.data[d].username==e.args.username){i=!0;break}if(i)for(var r=0;r<n.length;r++)e.data[d].username==n[r].username&&(n[r].id=e.data[d].id)}for(var t=!1,a=0;a<n.length;a++)if(""==n[a].id||"username"==n[a].id){t=!0;break}t||(o.feed_row.feed_users=JSON.stringify(n),wdi_front.init(o))},username:n[i].username})):n[i].id=n[i].username;return e},void 0!==wdi_ajax.ajax_response?jQuery(document).one("ajaxStop",function(){"not_declared"!=wdi_front.type&&(wdi_front.clickOrTouch=wdi_front.detectEvent(),wdi_front.globalInit())}):jQuery(document).ready(function(){"not_declared"!=wdi_front.type&&(wdi_front.clickOrTouch=wdi_front.detectEvent(),wdi_front.globalInit())}),jQuery(document).ready(function(){setTimeout(function(){"1"===wdi_front_messages.show_alerts&&"I"!==jQuery(".wdi_check_fontawesome .tenweb-i-instagram").prop("tagName")&&console.log("Font Awesome is not loaded properly. Please ask for support https://wordpress.org/support/plugin/wd-instagram-feed/")},2e3)});
|
js/wdi_instagram.js
CHANGED
@@ -1052,10 +1052,11 @@ function WDIInstagram(args) {
|
|
1052 |
if( tag_id === '' ) {
|
1053 |
tag_id = 'false';
|
1054 |
}
|
1055 |
-
}
|
|
|
1056 |
tag_id = this.getTagId(tagname);
|
1057 |
if (user_name === '') {
|
1058 |
-
user_name = jQuery(
|
1059 |
}
|
1060 |
if ( feed_id === 0 ) {
|
1061 |
feed_id = wdi_ajax.feed_id;
|
@@ -1066,7 +1067,6 @@ function WDIInstagram(args) {
|
|
1066 |
if( typeof wdi_ajax.wdi_cache_request_count != 'undefined' && wdi_ajax.wdi_cache_request_count !== "" ) {
|
1067 |
wdi_cache_request_count = parseInt(wdi_ajax.wdi_cache_request_count);
|
1068 |
}
|
1069 |
-
|
1070 |
jQuery.ajax({
|
1071 |
type: "POST",
|
1072 |
url: wdi_ajax.ajax_url,
|
@@ -1086,7 +1086,7 @@ function WDIInstagram(args) {
|
|
1086 |
if( response['next_url'] != '' ) {
|
1087 |
response['iter']++;
|
1088 |
|
1089 |
-
if( response['iter']
|
1090 |
if( frontend === 1 ) {
|
1091 |
if( tag_id === 'false' ) {
|
1092 |
_this.getTagRecentMedia( tagname, args, next_url, endpoint, 1);
|
1052 |
if( tag_id === '' ) {
|
1053 |
tag_id = 'false';
|
1054 |
}
|
1055 |
+
}
|
1056 |
+
else {
|
1057 |
tag_id = this.getTagId(tagname);
|
1058 |
if (user_name === '') {
|
1059 |
+
user_name = jQuery('#WDI_user_name').val();
|
1060 |
}
|
1061 |
if ( feed_id === 0 ) {
|
1062 |
feed_id = wdi_ajax.feed_id;
|
1067 |
if( typeof wdi_ajax.wdi_cache_request_count != 'undefined' && wdi_ajax.wdi_cache_request_count !== "" ) {
|
1068 |
wdi_cache_request_count = parseInt(wdi_ajax.wdi_cache_request_count);
|
1069 |
}
|
|
|
1070 |
jQuery.ajax({
|
1071 |
type: "POST",
|
1072 |
url: wdi_ajax.ajax_url,
|
1086 |
if( response['next_url'] != '' ) {
|
1087 |
response['iter']++;
|
1088 |
|
1089 |
+
if( response['iter'] >= wdi_cache_request_count ) {
|
1090 |
if( frontend === 1 ) {
|
1091 |
if( tag_id === 'false' ) {
|
1092 |
_this.getTagRecentMedia( tagname, args, next_url, endpoint, 1);
|
js/wdi_instagram.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function WDIInstagram(e){this.user={},this.access_tokens=[],this.filters=[],void 0!==e&&(void 0!==e.access_tokens&&(this.access_tokens=e.access_tokens),void 0!==e.filters&&(this.filters=e.filters));var _=this;function g(){return void 0!==_.user&&void 0!==_.user.user_name?_.user.user_name:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user?wdi_object.user.user_name:""}function u(){return void 0!==_.user&&void 0!==_.user.access_token?_.user.access_token:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user&&void 0!==wdi_object.user.access_token?wdi_object.user.access_token:""}this.statusCode={429:function(){console.log(" 429: Too many requests. Try after one hour")}},this.getFilter=function(e){var s=_.filters;if(void 0===s)return!1;for(var t=0;t<s.length;t++)if(s[t].where==e)if("object"==typeof s[t].what&&2==s[t].what.length){if(void 0!==window[s[t].what[0]]&&"function"==typeof window[s[t].what[0]][s[t].what[1]])return window[s[t].what[0]][s[t].what[1]]}else{if("string"!=typeof s[t].what)return"function"==typeof s[t].what&&s[t].what;if("function"==typeof window[s[t].what])return window[s[t].what]}return!1},this.addToken=function(e){"string"==typeof e&&_.access_tokens.push(e)},this.resetTokens=function(){_.access_tokens=[]},this.getTagRecentMedia=function(n,i,e,c,a){var s=!1,t=this.statusCode,o=!1,u=(this.getFilter("getTagRecentMedia"),wdi_ajax.feed_id),d=g();c=0===parseInt(c)?"top_media":"recent_media",void 0===i||0===i.length||("success"in i&&(s=!0),"statusCode"in i&&(t=i.statusCode),"error"in i&&(o=!0),"args"in i||(i.args={}),"count"in i?(i.count=parseInt(i.count),(!Number.isInteger(i.count)||i.count<=0)&&(i.count=33)):i.count=33,"feed_id"in i&&(u=i.feed_id),"user_name"in i&&(d=i.user_name));var f=this.getTagId(n);function w(e){void 0===e.data&&(e.data=[]),s&&("object"==typeof i.success&&2==i.success.length?void 0!==window[i.success[0]]&&"function"==typeof window[i.success[0]][i.success[1]]&&window[i.success[0]][i.success[1]](e):"string"==typeof i.success?"function"==typeof window[i.success]&&window[i.success](e):"function"==typeof i.success&&i.success(e))}jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{action:"wdi_getTagRecentMedia",wdi_nonce:wdi_ajax.wdi_nonce,user_name:d,feed_id:u,next_url:e,tagname:n,wdiTagId:f,endpoint:c},success:function(e){var s,t,o=!1,r="";void 0!==e.error&&(o=!0,r=e.error.type),void 0===e.data||void 0!==e.data&&0===e.data.length&&0===a?_.set_cache_data("",d,u,"",0,1,n,f,c,i):(0===e.data.length?e.meta={code:400,error:o,error_type:r}:(!1===f&&(f=""),void 0!==e.tag_data&&(void 0!==(s=e.tag_data).tag_id&&(f=s.tag_id),t=[],void 0!==window.wdi_all_tags&&(t=window.wdi_all_tags),t[s.tag_id]=s,window.wdi_all_tags=t),e.meta={code:200,error:o,error_type:r}),e.tag_id=f,w(e))},error:function(e){o&&("object"==typeof i.error&&2==i.error.length?"function"==typeof window[i.error[0]][i.error[1]]&&window[i.error[0]][i.error[1]](e):"string"==typeof i.error?"function"==typeof window[i.error]&&window[i.error](e):"function"==typeof i.error&&i.error(e))},statusCode:t})},this.getTagId=function(e){var s,t,o=[];if("undefined"!=typeof wdi_controller){if(void 0===(o=wdi_controller.feed_users))return!1;0!==o.length||void 0!==(s=jQuery("#WDI_feed_users").val())&&""!==s&&(o=JSON.parse(s))}else void 0!==window.wdi_all_tags&&(o=window.wdi_all_tags);for(t in o)if(e===o[t].username||"#"+e===o[t].username)return void 0!==o[t].tag_id&&o[t].tag_id;return!1},this.searchForTagsByName=function(e,t){var o=this,r=!1,n=this.statusCode,i=!1;filter=this.getFilter("searchForTagsByName"),void 0===t||0===t.length||("success"in t&&(r=!0),"error"in t&&(i=!0),"statusCode"in t&&(n=t.statusCode));var c="https://api.instagram.com/v1/tags/search?q="+e+"&access_token="+u();_.getDataFromCache(function(e){function s(e){r&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(filter&&(e=filter(e,o.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(filter&&(e=filter(e,o.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(filter&&(e=filter(e,o.filterArguments)),t.success(e)))}!1===e?jQuery.ajax({type:"POST",url:c,dataType:"jsonp",success:function(e){_.setDataToCache(c,e),s(e)},error:function(e){i&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:n}):s(e)},c)},this.searchForUsersByName=function(e,s){var t=this,o=!1,r=(this.statusCode,!1),n=this.getFilter("searchForUsersByName");void 0===s||0===s.length||("success"in s&&(o=!0),"error"in s&&(r=!0),"statusCode"in s&&s.statusCode),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/search?q="+e+"&access_token="+u(),success:function(e){o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(n&&(e=n(e,t.filterArguments)),e.args=s,window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(n&&(e=n(e,t.filterArguments)),e.args=s,window[s.success](e)):"function"==typeof s.success&&(n&&(e=n(e,t.filterArguments)),(e.args=s).success(e)))},error:function(e){r&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:this.statusCode})},this.getRecentLikedMedia=function(s){var t=this,o=!1,e=this.statusCode,r=!1,n=this.getFilter("getRecentLikedMedia"),i="https://api.instagram.com/v1/users/self/media/liked?access_token="+u();void 0===s||0===s.length||("success"in s&&(o=!0),"error"in s&&(r=!0),"statusCode"in s&&(e=s.statusCode),"args"in s?argFlag=!0:s.args={},"count"in s?(s.count=parseInt(s.count),(!Number.isInteger(s.count)||s.count<=0)&&(s.count=20)):s.count=20,i+="&count="+s.count,"next_max_like_id"in s&&(i+="&next_max_like_id="+s.next_max_like_id)),jQuery.ajax({type:"POST",dataType:"jsonp",url:i,success:function(e){o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(n&&(e=n(e,t.filterArguments,s.args)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(n&&(e=n(e,t.filterArguments,s.args)),window[s.success](e)):"function"==typeof s.success&&(n&&(e=n(e,t.filterArguments,s.args)),s.success(e)))},error:function(e){r&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:e})},this.getUserRecentMedia=function(e,s){var t=this,o=!1,r=this.statusCode,n=!1,i=this.getFilter("getUserRecentMedia"),e="https://api.instagram.com/v1/users/"+e+"/media/recent/?access_token="+u();void 0===s||0===s.length||("success"in s&&(o=!0),"statusCode"in s&&(r=s.statusCode),"args"in s||(s.args={}),"error"in s&&(n=!0),"count"in s?(s.count=parseInt(s.count),(!Number.isInteger(s.count)||s.count<=0)&&(s.count=33)):s.count=33,e+="&count="+s.count,"min_id"in s&&(e+="&min_id="+s.min_id),"max_id"in s&&(e+="&max_id="+s.max_id)),jQuery.ajax({type:"POST",dataType:"jsonp",url:e,success:function(e){void 0===e.data&&(e.data=[]),o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(i&&(e=i(e,t.filterArguments,s.args)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(i&&(e=i(e,t.filterArguments,s.args)),window[s.success](e)):"function"==typeof s.success&&(i&&(e=i(e,t.filterArguments,s.args)),s.success(e)))},error:function(e){n&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:r})},this.getUserMedia=function(o,e,r){e=void 0===e?"":e;var n=this,i=!1,s=this.statusCode,t=!1,c=this.getFilter("getUserMedia"),a=g(),u=wdi_ajax.feed_id;void 0===o||0===o.length||("success"in o&&(i=!0),"error"in o&&(t=!0),"statusCode"in o&&(s=o.statusCode),"args"in o||(o.args={}),"count"in o?(o.count=parseInt(o.count),(!Number.isInteger(o.count)||o.count<=0)&&(o.count=20)):o.count=20,"feed_id"in o&&(u=o.feed_id),"user_name"in o&&(a=o.user_name)),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,action:"wdi_getUserMedia",user_name:a,feed_id:u,next_url:e},success:function(e){var s=!1,t="";void 0!==e.error&&(s=!0,t=e.error.type),void 0===e.data||void 0!==e.data&&0===e.data.length&&0===r?_.set_cache_data("",a,u,"",0,1,"","","",o):0!==e.data.length?(e.meta={code:200,error:s,error_type:t},i&&("object"==typeof o.success&&2==o.success.length?void 0!==window[o.success[0]]&&"function"==typeof window[o.success[0]][o.success[1]]&&(c&&(e=_.addTags(e),e=c(e,n.filterArguments,o)),window[o.success[0]][o.success[1]](e)):"string"==typeof o.success?"function"==typeof window[o.success]&&(c&&(e=_.addTags(e),e=c(e,n.filterArguments,o)),window[o.success](e)):"function"==typeof o.success&&o.success(e))):(e.meta={code:400,error:s,error_type:t},o.success(e))},error:function(e){t&&("object"==typeof o.error&&2==o.error.length?"function"==typeof window[o.error[0]][o.error[1]]&&window[o.error[0]][o.error[1]](e):"string"==typeof o.error?"function"==typeof window[o.error]&&window[o.error](e):"function"==typeof o.error&&o.error(e))},statusCode:s})},this.set_cache_data=function(s,t,o,r,e,n,i,c,a,u){var d;0===n?(""===t&&(t=jQuery("#WDI_user_name").val()),0===o&&(o=jQuery("#wdi_add_or_edit").val()),""===a&&0!==jQuery("#wdi_feed_users_ajax .wdi_user").length&&(a=jQuery("#WDI_wrap_hashtag_top_recent input[name='wdi_feed_settings[hashtag_top_recent]']:checked").val()),a="0"===a?"top_media":"recent_media",""===c&&"undefined"!=typeof users&&(d=JSON.parse(users),c=d[0].tag_id),""===c&&(c="false")):(c=this.getTagId(i),""===t&&(t=jQuery("#WDI_user_name").val()),0===o&&(o=wdi_ajax.feed_id));var f=10;void 0!==wdi_ajax.wdi_cache_request_count&&""!==wdi_ajax.wdi_cache_request_count&&(f=parseInt(wdi_ajax.wdi_cache_request_count)),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{action:"wdi_set_preload_cache_data",tag_id:c,tagname:i,user_name:t,feed_id:o,endpoint:a,wdi_nonce:wdi_ajax.wdi_nonce,next_url:r,iter:e},success:function(e){""!=e.next_url?(e.iter++,e.iter>f?1===n?"false"===c?_.getTagRecentMedia(i,u,r,a,1):_.getUserMedia(u,e.next_url,1):(jQuery("#wdi_save_loading").addClass("wdi_hidden"),window.location=s):_.set_cache_data(s,t,o,e.next_url,e.iter,n,i,c,a,u)):1===n?"false"===c?_.getTagRecentMedia(i,u,r,a,1):_.getUserMedia(u,e.next_url,1):(jQuery("#wdi_save_loading").addClass("wdi_hidden"),jQuery("#wdi_save_loading .caching-process-message").addClass("wdi_hidden"),""!==s&&(window.location=s))},error:function(e,s,t){jQuery("#wdi_save_loading .caching-process-message").addClass("wdi_hidden"),jQuery("#wdi_save_loading").addClass("wdi_hidden")}})},this.getUserInfo=function(e,s){var t=this,o=!1,r=this.statusCode,n=!1,i=this.getFilter("getUserInfo");void 0===s||0===s.length||("success"in s&&(o=!0),"error"in s&&(n=!0),"statusCode"in s&&(r=s.statusCode)),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/"+e+"/?access_token="+u(),success:function(e){o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(i&&(e=i(e,t.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(i&&(e=i(e,t.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(i&&(e=i(e,t.filterArguments)),s.success(e)))},error:function(e){n&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:r})},this.getSelfInfo=function(t){var o=this,r=!1,n=this.statusCode,i=!1,c=this.getFilter("getSelfInfo");void 0===t||0===t.length||("success"in t&&(r=!0),"error"in t&&(i=!0),"statusCode"in t&&(n=t.statusCode));var a="https://graph.facebook.com/v3.2/"+(void 0!==_.user&&void 0!==_.user.user_id?_.user.user_id:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user?wdi_object.user.user_id:"")+"?fields=id,ig_id,username,name,biography,profile_picture_url,followers_count,follows_count,media_count,website&access_token="+u();_.getDataFromCache(function(e){var s;!1===e?jQuery.ajax({type:"POST",dataType:"jsonp",url:a,statusCode:n,success:function(e){_.setDataToCache(a,e),r&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(c&&(e.meta={code:200},e=c(e,o.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(c&&(e.meta={code:200},e=c(e,o.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(c&&(e.meta={code:200},e=c(e,o.filterArguments)),t.success(e)))},error:function(e){i&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))}}):(s=e,r&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(c&&(s=c(s,o.filterArguments)),window[t.success[0]][t.success[1]](s)):"string"==typeof t.success?"function"==typeof window[t.success]&&(c&&(s=c(s,o.filterArguments)),window[t.success](s)):"function"==typeof t.success&&(c&&(s=c(s,o.filterArguments)),t.success(s))))},a)},this.getRecentMediaComments=function(e,s,t){var o=this,r=!1,n=this.statusCode,i=!1,c=this.getFilter("getRecentMediaComments");void 0===s||0===s.length||("success"in s&&(r=!0),"error"in s&&(i=!0),"statusCode"in s&&(n=s.statusCode)),jQuery(".wdi_comment_container #ajax_loading #opacity_div").css("display","block"),jQuery(".wdi_comment_container #ajax_loading #loading_div").css("display","block"),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,action:"wdi_getRecentMediaComments",user_name:g(),media_id:e,next:t},success:function(e){e=e,r&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(c&&(e=c(e,o.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(c&&(e=c(e,o.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(c&&(e=c(e,o.filterArguments)),s.success(e)))},complete:function(){jQuery(".wdi_comment_container #ajax_loading #opacity_div").css("display","none"),jQuery(".wdi_comment_container #ajax_loading #loading_div").css("display","none")},error:function(e){i&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:n})},this.getRecentMediaLikes=function(e,s){var t=this,o=!1,r=this.statusCode,n=!1,i=this.getFilter("getRecentMediaLikes");void 0===s||0===s.length||("success"in s&&(o=!0),"error"in s&&(n=!0),"statusCode"in s&&(r=s.statusCode)),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/media/"+e+"/likes?access_token="+u(),success:function(e){o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(i&&(e=i(e,t.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(i&&(e=i(e,t.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(i&&(e=i(e,t.filterArguments)),s.success(e)))},error:function(e){n&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:r})},this.getDataFromCache=function(s,e,t){void 0===t&&(t=!0),jQuery.ajax({type:"POST",async:t,url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_cache_name:e,wdi_nonce:wdi_ajax.wdi_nonce,WDI_MINIFY:wdi_ajax.WDI_MINIFY,task:"get",action:"wdi_cache"},success:function(e){e.success&&void 0!==e.cache_data&&null!==e.cache_data?(e=JSON.parse(e.cache_data),s(e)):s(!1)}})},this.setDataToCache=function(e,s){jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_cache_name:e,wdi_cache_response:JSON.stringify(s),wdi_nonce:wdi_ajax.wdi_nonce,task:"set",action:"wdi_cache"},success:function(e){}})}}
|
1 |
+
function WDIInstagram(e){this.user={},this.access_tokens=[],this.filters=[],void 0!==e&&(void 0!==e.access_tokens&&(this.access_tokens=e.access_tokens),void 0!==e.filters&&(this.filters=e.filters));var _=this;function g(){return void 0!==_.user&&void 0!==_.user.user_name?_.user.user_name:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user?wdi_object.user.user_name:""}function u(){return void 0!==_.user&&void 0!==_.user.access_token?_.user.access_token:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user&&void 0!==wdi_object.user.access_token?wdi_object.user.access_token:""}this.statusCode={429:function(){console.log(" 429: Too many requests. Try after one hour")}},this.getFilter=function(e){var s=_.filters;if(void 0===s)return!1;for(var t=0;t<s.length;t++)if(s[t].where==e)if("object"==typeof s[t].what&&2==s[t].what.length){if(void 0!==window[s[t].what[0]]&&"function"==typeof window[s[t].what[0]][s[t].what[1]])return window[s[t].what[0]][s[t].what[1]]}else{if("string"!=typeof s[t].what)return"function"==typeof s[t].what&&s[t].what;if("function"==typeof window[s[t].what])return window[s[t].what]}return!1},this.addToken=function(e){"string"==typeof e&&_.access_tokens.push(e)},this.resetTokens=function(){_.access_tokens=[]},this.getTagRecentMedia=function(n,i,e,c,a){var s=!1,t=this.statusCode,o=!1,u=(this.getFilter("getTagRecentMedia"),wdi_ajax.feed_id),d=g();c=0===parseInt(c)?"top_media":"recent_media",void 0===i||0===i.length||("success"in i&&(s=!0),"statusCode"in i&&(t=i.statusCode),"error"in i&&(o=!0),"args"in i||(i.args={}),"count"in i?(i.count=parseInt(i.count),(!Number.isInteger(i.count)||i.count<=0)&&(i.count=33)):i.count=33,"feed_id"in i&&(u=i.feed_id),"user_name"in i&&(d=i.user_name));var f=this.getTagId(n);function w(e){void 0===e.data&&(e.data=[]),s&&("object"==typeof i.success&&2==i.success.length?void 0!==window[i.success[0]]&&"function"==typeof window[i.success[0]][i.success[1]]&&window[i.success[0]][i.success[1]](e):"string"==typeof i.success?"function"==typeof window[i.success]&&window[i.success](e):"function"==typeof i.success&&i.success(e))}jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{action:"wdi_getTagRecentMedia",wdi_nonce:wdi_ajax.wdi_nonce,user_name:d,feed_id:u,next_url:e,tagname:n,wdiTagId:f,endpoint:c},success:function(e){var s,t,o=!1,r="";void 0!==e.error&&(o=!0,r=e.error.type),void 0===e.data||void 0!==e.data&&0===e.data.length&&0===a?_.set_cache_data("",d,u,"",0,1,n,f,c,i):(0===e.data.length?e.meta={code:400,error:o,error_type:r}:(!1===f&&(f=""),void 0!==e.tag_data&&(void 0!==(s=e.tag_data).tag_id&&(f=s.tag_id),t=[],void 0!==window.wdi_all_tags&&(t=window.wdi_all_tags),t[s.tag_id]=s,window.wdi_all_tags=t),e.meta={code:200,error:o,error_type:r}),e.tag_id=f,w(e))},error:function(e){o&&("object"==typeof i.error&&2==i.error.length?"function"==typeof window[i.error[0]][i.error[1]]&&window[i.error[0]][i.error[1]](e):"string"==typeof i.error?"function"==typeof window[i.error]&&window[i.error](e):"function"==typeof i.error&&i.error(e))},statusCode:t})},this.getTagId=function(e){var s,t,o=[];if("undefined"!=typeof wdi_controller){if(void 0===(o=wdi_controller.feed_users))return!1;0!==o.length||void 0!==(s=jQuery("#WDI_feed_users").val())&&""!==s&&(o=JSON.parse(s))}else void 0!==window.wdi_all_tags&&(o=window.wdi_all_tags);for(t in o)if(e===o[t].username||"#"+e===o[t].username)return void 0!==o[t].tag_id&&o[t].tag_id;return!1},this.searchForTagsByName=function(e,t){var o=this,r=!1,n=this.statusCode,i=!1;filter=this.getFilter("searchForTagsByName"),void 0===t||0===t.length||("success"in t&&(r=!0),"error"in t&&(i=!0),"statusCode"in t&&(n=t.statusCode));var c="https://api.instagram.com/v1/tags/search?q="+e+"&access_token="+u();_.getDataFromCache(function(e){function s(e){r&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(filter&&(e=filter(e,o.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(filter&&(e=filter(e,o.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(filter&&(e=filter(e,o.filterArguments)),t.success(e)))}!1===e?jQuery.ajax({type:"POST",url:c,dataType:"jsonp",success:function(e){_.setDataToCache(c,e),s(e)},error:function(e){i&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))},statusCode:n}):s(e)},c)},this.searchForUsersByName=function(e,s){var t=this,o=!1,r=(this.statusCode,!1),n=this.getFilter("searchForUsersByName");void 0===s||0===s.length||("success"in s&&(o=!0),"error"in s&&(r=!0),"statusCode"in s&&s.statusCode),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/search?q="+e+"&access_token="+u(),success:function(e){o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(n&&(e=n(e,t.filterArguments)),e.args=s,window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(n&&(e=n(e,t.filterArguments)),e.args=s,window[s.success](e)):"function"==typeof s.success&&(n&&(e=n(e,t.filterArguments)),(e.args=s).success(e)))},error:function(e){r&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:this.statusCode})},this.getRecentLikedMedia=function(s){var t=this,o=!1,e=this.statusCode,r=!1,n=this.getFilter("getRecentLikedMedia"),i="https://api.instagram.com/v1/users/self/media/liked?access_token="+u();void 0===s||0===s.length||("success"in s&&(o=!0),"error"in s&&(r=!0),"statusCode"in s&&(e=s.statusCode),"args"in s?argFlag=!0:s.args={},"count"in s?(s.count=parseInt(s.count),(!Number.isInteger(s.count)||s.count<=0)&&(s.count=20)):s.count=20,i+="&count="+s.count,"next_max_like_id"in s&&(i+="&next_max_like_id="+s.next_max_like_id)),jQuery.ajax({type:"POST",dataType:"jsonp",url:i,success:function(e){o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(n&&(e=n(e,t.filterArguments,s.args)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(n&&(e=n(e,t.filterArguments,s.args)),window[s.success](e)):"function"==typeof s.success&&(n&&(e=n(e,t.filterArguments,s.args)),s.success(e)))},error:function(e){r&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:e})},this.getUserRecentMedia=function(e,s){var t=this,o=!1,r=this.statusCode,n=!1,i=this.getFilter("getUserRecentMedia"),e="https://api.instagram.com/v1/users/"+e+"/media/recent/?access_token="+u();void 0===s||0===s.length||("success"in s&&(o=!0),"statusCode"in s&&(r=s.statusCode),"args"in s||(s.args={}),"error"in s&&(n=!0),"count"in s?(s.count=parseInt(s.count),(!Number.isInteger(s.count)||s.count<=0)&&(s.count=33)):s.count=33,e+="&count="+s.count,"min_id"in s&&(e+="&min_id="+s.min_id),"max_id"in s&&(e+="&max_id="+s.max_id)),jQuery.ajax({type:"POST",dataType:"jsonp",url:e,success:function(e){void 0===e.data&&(e.data=[]),o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(i&&(e=i(e,t.filterArguments,s.args)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(i&&(e=i(e,t.filterArguments,s.args)),window[s.success](e)):"function"==typeof s.success&&(i&&(e=i(e,t.filterArguments,s.args)),s.success(e)))},error:function(e){n&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:r})},this.getUserMedia=function(o,e,r){e=void 0===e?"":e;var n=this,i=!1,s=this.statusCode,t=!1,c=this.getFilter("getUserMedia"),a=g(),u=wdi_ajax.feed_id;void 0===o||0===o.length||("success"in o&&(i=!0),"error"in o&&(t=!0),"statusCode"in o&&(s=o.statusCode),"args"in o||(o.args={}),"count"in o?(o.count=parseInt(o.count),(!Number.isInteger(o.count)||o.count<=0)&&(o.count=20)):o.count=20,"feed_id"in o&&(u=o.feed_id),"user_name"in o&&(a=o.user_name)),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,action:"wdi_getUserMedia",user_name:a,feed_id:u,next_url:e},success:function(e){var s=!1,t="";void 0!==e.error&&(s=!0,t=e.error.type),void 0===e.data||void 0!==e.data&&0===e.data.length&&0===r?_.set_cache_data("",a,u,"",0,1,"","","",o):0!==e.data.length?(e.meta={code:200,error:s,error_type:t},i&&("object"==typeof o.success&&2==o.success.length?void 0!==window[o.success[0]]&&"function"==typeof window[o.success[0]][o.success[1]]&&(c&&(e=_.addTags(e),e=c(e,n.filterArguments,o)),window[o.success[0]][o.success[1]](e)):"string"==typeof o.success?"function"==typeof window[o.success]&&(c&&(e=_.addTags(e),e=c(e,n.filterArguments,o)),window[o.success](e)):"function"==typeof o.success&&o.success(e))):(e.meta={code:400,error:s,error_type:t},o.success(e))},error:function(e){t&&("object"==typeof o.error&&2==o.error.length?"function"==typeof window[o.error[0]][o.error[1]]&&window[o.error[0]][o.error[1]](e):"string"==typeof o.error?"function"==typeof window[o.error]&&window[o.error](e):"function"==typeof o.error&&o.error(e))},statusCode:s})},this.set_cache_data=function(s,t,o,r,e,n,i,c,a,u){var d;0===n?(""===t&&(t=jQuery("#WDI_user_name").val()),0===o&&(o=jQuery("#wdi_add_or_edit").val()),""===a&&0!==jQuery("#wdi_feed_users_ajax .wdi_user").length&&(a=jQuery("#WDI_wrap_hashtag_top_recent input[name='wdi_feed_settings[hashtag_top_recent]']:checked").val()),a="0"===a?"top_media":"recent_media",""===c&&"undefined"!=typeof users&&(d=JSON.parse(users),c=d[0].tag_id),""===c&&(c="false")):(c=this.getTagId(i),""===t&&(t=jQuery("#WDI_user_name").val()),0===o&&(o=wdi_ajax.feed_id));var f=10;void 0!==wdi_ajax.wdi_cache_request_count&&""!==wdi_ajax.wdi_cache_request_count&&(f=parseInt(wdi_ajax.wdi_cache_request_count)),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{action:"wdi_set_preload_cache_data",tag_id:c,tagname:i,user_name:t,feed_id:o,endpoint:a,wdi_nonce:wdi_ajax.wdi_nonce,next_url:r,iter:e},success:function(e){""!=e.next_url?(e.iter++,e.iter>=f?1===n?"false"===c?_.getTagRecentMedia(i,u,r,a,1):_.getUserMedia(u,e.next_url,1):(jQuery("#wdi_save_loading").addClass("wdi_hidden"),window.location=s):_.set_cache_data(s,t,o,e.next_url,e.iter,n,i,c,a,u)):1===n?"false"===c?_.getTagRecentMedia(i,u,r,a,1):_.getUserMedia(u,e.next_url,1):(jQuery("#wdi_save_loading").addClass("wdi_hidden"),jQuery("#wdi_save_loading .caching-process-message").addClass("wdi_hidden"),""!==s&&(window.location=s))},error:function(e,s,t){jQuery("#wdi_save_loading .caching-process-message").addClass("wdi_hidden"),jQuery("#wdi_save_loading").addClass("wdi_hidden")}})},this.getUserInfo=function(e,s){var t=this,o=!1,r=this.statusCode,n=!1,i=this.getFilter("getUserInfo");void 0===s||0===s.length||("success"in s&&(o=!0),"error"in s&&(n=!0),"statusCode"in s&&(r=s.statusCode)),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/users/"+e+"/?access_token="+u(),success:function(e){o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(i&&(e=i(e,t.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(i&&(e=i(e,t.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(i&&(e=i(e,t.filterArguments)),s.success(e)))},error:function(e){n&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:r})},this.getSelfInfo=function(t){var o=this,r=!1,n=this.statusCode,i=!1,c=this.getFilter("getSelfInfo");void 0===t||0===t.length||("success"in t&&(r=!0),"error"in t&&(i=!0),"statusCode"in t&&(n=t.statusCode));var a="https://graph.facebook.com/v3.2/"+(void 0!==_.user&&void 0!==_.user.user_id?_.user.user_id:"undefined"!=typeof wdi_object&&void 0!==wdi_object.user?wdi_object.user.user_id:"")+"?fields=id,ig_id,username,name,biography,profile_picture_url,followers_count,follows_count,media_count,website&access_token="+u();_.getDataFromCache(function(e){var s;!1===e?jQuery.ajax({type:"POST",dataType:"jsonp",url:a,statusCode:n,success:function(e){_.setDataToCache(a,e),r&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(c&&(e.meta={code:200},e=c(e,o.filterArguments)),window[t.success[0]][t.success[1]](e)):"string"==typeof t.success?"function"==typeof window[t.success]&&(c&&(e.meta={code:200},e=c(e,o.filterArguments)),window[t.success](e)):"function"==typeof t.success&&(c&&(e.meta={code:200},e=c(e,o.filterArguments)),t.success(e)))},error:function(e){i&&("object"==typeof t.error&&2==t.error.length?"function"==typeof window[t.error[0]][t.error[1]]&&window[t.error[0]][t.error[1]](e):"string"==typeof t.error?"function"==typeof window[t.error]&&window[t.error](e):"function"==typeof t.error&&t.error(e))}}):(s=e,r&&("object"==typeof t.success&&2==t.success.length?void 0!==window[t.success[0]]&&"function"==typeof window[t.success[0]][t.success[1]]&&(c&&(s=c(s,o.filterArguments)),window[t.success[0]][t.success[1]](s)):"string"==typeof t.success?"function"==typeof window[t.success]&&(c&&(s=c(s,o.filterArguments)),window[t.success](s)):"function"==typeof t.success&&(c&&(s=c(s,o.filterArguments)),t.success(s))))},a)},this.getRecentMediaComments=function(e,s,t){var o=this,r=!1,n=this.statusCode,i=!1,c=this.getFilter("getRecentMediaComments");void 0===s||0===s.length||("success"in s&&(r=!0),"error"in s&&(i=!0),"statusCode"in s&&(n=s.statusCode)),jQuery(".wdi_comment_container #ajax_loading #opacity_div").css("display","block"),jQuery(".wdi_comment_container #ajax_loading #loading_div").css("display","block"),jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_nonce:wdi_ajax.wdi_nonce,action:"wdi_getRecentMediaComments",user_name:g(),media_id:e,next:t},success:function(e){e=e,r&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(c&&(e=c(e,o.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(c&&(e=c(e,o.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(c&&(e=c(e,o.filterArguments)),s.success(e)))},complete:function(){jQuery(".wdi_comment_container #ajax_loading #opacity_div").css("display","none"),jQuery(".wdi_comment_container #ajax_loading #loading_div").css("display","none")},error:function(e){i&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:n})},this.getRecentMediaLikes=function(e,s){var t=this,o=!1,r=this.statusCode,n=!1,i=this.getFilter("getRecentMediaLikes");void 0===s||0===s.length||("success"in s&&(o=!0),"error"in s&&(n=!0),"statusCode"in s&&(r=s.statusCode)),jQuery.ajax({type:"POST",dataType:"jsonp",url:"https://api.instagram.com/v1/media/"+e+"/likes?access_token="+u(),success:function(e){o&&("object"==typeof s.success&&2==s.success.length?void 0!==window[s.success[0]]&&"function"==typeof window[s.success[0]][s.success[1]]&&(i&&(e=i(e,t.filterArguments)),window[s.success[0]][s.success[1]](e)):"string"==typeof s.success?"function"==typeof window[s.success]&&(i&&(e=i(e,t.filterArguments)),window[s.success](e)):"function"==typeof s.success&&(i&&(e=i(e,t.filterArguments)),s.success(e)))},error:function(e){n&&("object"==typeof s.error&&2==s.error.length?"function"==typeof window[s.error[0]][s.error[1]]&&window[s.error[0]][s.error[1]](e):"string"==typeof s.error?"function"==typeof window[s.error]&&window[s.error](e):"function"==typeof s.error&&s.error(e))},statusCode:r})},this.getDataFromCache=function(s,e,t){void 0===t&&(t=!0),jQuery.ajax({type:"POST",async:t,url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_cache_name:e,wdi_nonce:wdi_ajax.wdi_nonce,WDI_MINIFY:wdi_ajax.WDI_MINIFY,task:"get",action:"wdi_cache"},success:function(e){e.success&&void 0!==e.cache_data&&null!==e.cache_data?(e=JSON.parse(e.cache_data),s(e)):s(!1)}})},this.setDataToCache=function(e,s){jQuery.ajax({type:"POST",url:wdi_ajax.ajax_url,dataType:"json",data:{wdi_cache_name:e,wdi_cache_response:JSON.stringify(s),wdi_nonce:wdi_ajax.wdi_nonce,task:"set",action:"wdi_cache"},success:function(e){}})}}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: custom instagram feed, feed, instagram, hashtag, Instagram feed, instagram
|
|
4 |
Requires at least: 3.9
|
5 |
Requires PHP: 5.2
|
6 |
Tested up to: 5.7
|
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,13 @@ 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.17 =
|
509 |
Improved: Load more functionality.
|
510 |
Fixed: Show thumbnails for Video posts.
|
4 |
Requires at least: 3.9
|
5 |
Requires PHP: 5.2
|
6 |
Tested up to: 5.7
|
7 |
+
Stable tag: 1.4.18
|
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.18 =
|
509 |
+
Added: Possibility to show IGTV media in the feed.
|
510 |
+
Fixed: Lightbox filmstrip issue.
|
511 |
+
Fixed: Issue on changing account type from business to personal.
|
512 |
+
Fixed: Show caption for posts loaded with load more.
|
513 |
+
Fixed: Logic of cache.
|
514 |
+
|
515 |
= 1.4.17 =
|
516 |
Improved: Load more functionality.
|
517 |
Fixed: Show thumbnails for Video posts.
|
wd-instagram-feed.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: 10Web Social Photo Feed
|
4 |
* Plugin URI: https://10web.io/plugins/wordpress-instagram-feed/?utm_source=instagram_feed&utm_medium=free_plugin
|
5 |
* Description: 10Web Social Photo Feed is a user-friendly tool for displaying user or hashtag-based feeds on your website. You can create feeds with one of the available layouts. It allows displaying image metadata, open up images in lightbox, download them and even share in social networking websites.
|
6 |
-
* Version: 1.4.
|
7 |
* Author: 10Web
|
8 |
* Author URI: https://10Web.io/plugins/?utm_source=instagram_feed&utm_medium=free_plugin
|
9 |
* License: GPLv2 or later
|
3 |
* Plugin Name: 10Web Social Photo Feed
|
4 |
* Plugin URI: https://10web.io/plugins/wordpress-instagram-feed/?utm_source=instagram_feed&utm_medium=free_plugin
|
5 |
* Description: 10Web Social Photo Feed is a user-friendly tool for displaying user or hashtag-based feeds on your website. You can create feeds with one of the available layouts. It allows displaying image metadata, open up images in lightbox, download them and even share in social networking websites.
|
6 |
+
* Version: 1.4.18
|
7 |
* Author: 10Web
|
8 |
* Author URI: https://10Web.io/plugins/?utm_source=instagram_feed&utm_medium=free_plugin
|
9 |
* License: GPLv2 or later
|