Version Description
Improved: Pagination logic. Fixed: Compatibility with PHP8.
Download this release
Release Info
| Developer | 10web |
| Plugin | |
| Version | 1.4.16 |
| Comparing to | |
| See all releases | |
Code changes from version 1.4.15 to 1.4.16
- config.php +1 -1
- framework/WDIInstagram.php +61 -8
- framework/WDILibrary.php +1 -189
- frontend/views/thumbnails.php +4 -0
- js/gallerybox/wdi_gallery_box.js +3 -0
- js/gallerybox/wdi_gallery_box.min.js +1 -1
- js/wdi_frontend.js +196 -792
- js/wdi_frontend.min.js +1 -1
- js/wdi_instagram.js +0 -1
- js/wdi_instagram.min.js +1 -1
- readme.txt +6 -3
- wd-instagram-feed.php +1 -1
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.16');
|
| 7 |
define('WDI_IS_FREE', TRUE);
|
| 8 |
define('WDI_PREFIX', 'wdi');
|
| 9 |
define('WDI_DIR', WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__)));
|
framework/WDIInstagram.php
CHANGED
|
@@ -31,7 +31,22 @@ class WDIInstagram {
|
|
| 31 |
* @return array current feed filter data
|
| 32 |
*/
|
| 33 |
public function get_filters( $feed_id ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
return array();
|
|
|
|
| 35 |
}
|
| 36 |
|
| 37 |
/**
|
|
@@ -59,14 +74,56 @@ class WDIInstagram {
|
|
| 59 |
if ( isset($this->wdi_authenticated_users_list) && is_array($this->wdi_authenticated_users_list) && isset($this->wdi_authenticated_users_list[$user_name]) ) {
|
| 60 |
$cache_data = $this->cache->get_cache_data($feed_id);
|
| 61 |
if ( isset($cache_data) && $cache_data["success"] && isset($cache_data["cache_data"]) ) {
|
| 62 |
-
|
| 63 |
-
|
|
|
|
|
|
|
| 64 |
} else {
|
| 65 |
return json_encode(array('data'=>''));
|
| 66 |
}
|
| 67 |
}
|
| 68 |
}
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
/**
|
| 71 |
* Get comments from endpoint or from cache
|
| 72 |
*
|
|
@@ -189,14 +246,10 @@ class WDIInstagram {
|
|
| 189 |
),
|
| 190 |
),
|
| 191 |
"user_has_liked" => ($like_count > 0),
|
| 192 |
-
"likes" =>
|
| 193 |
-
"count" => isset($media["like_count"]) ? $media["like_count"] : 0, // media.like_count
|
| 194 |
-
),
|
| 195 |
"tags" => array(),
|
| 196 |
"filter" => "Normal",
|
| 197 |
-
"comments" =>
|
| 198 |
-
"count" => isset($media["comments_count"]) ? $media["comments_count"] : 0, // media.comments_count
|
| 199 |
-
),
|
| 200 |
"media_type" => $media["media_type"],
|
| 201 |
"type" => $media_type,
|
| 202 |
"link" => (isset($media["permalink"]) ? $media["permalink"] : ""),
|
| 31 |
* @return array current feed filter data
|
| 32 |
*/
|
| 33 |
public function get_filters( $feed_id ) {
|
| 34 |
+
global $wpdb;
|
| 35 |
+
$row = $wpdb->get_row("SELECT conditional_filter_enable, conditional_filter_type, conditional_filters FROM " . $wpdb->prefix . WDI_FEED_TABLE . " WHERE id = " . $feed_id, ARRAY_A);
|
| 36 |
+
|
| 37 |
+
if( $row['conditional_filter_enable'] ) {
|
| 38 |
+
$conditional_filters = json_decode($row['conditional_filters'], 1);
|
| 39 |
+
if( empty($conditional_filters) ) {
|
| 40 |
+
return array();
|
| 41 |
+
}
|
| 42 |
+
return array(
|
| 43 |
+
'conditional_filter_enable' => $row['conditional_filter_enable'],
|
| 44 |
+
'conditional_filter_type' => $row['conditional_filter_type'],
|
| 45 |
+
'conditional_filters' => json_decode($row['conditional_filters'], 1),
|
| 46 |
+
);
|
| 47 |
+
} else {
|
| 48 |
return array();
|
| 49 |
+
}
|
| 50 |
}
|
| 51 |
|
| 52 |
/**
|
| 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 |
+
$cache_data = base64_decode($cache_data["cache_data"]);
|
| 78 |
+
$cache_data = json_decode($cache_data,1 );
|
| 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'=>''));
|
| 83 |
}
|
| 84 |
}
|
| 85 |
}
|
| 86 |
|
| 87 |
+
/**
|
| 88 |
+
* Sorting data according options
|
| 89 |
+
*
|
| 90 |
+
* @param integer $feed_id
|
| 91 |
+
* @param array $cache_datas connected username
|
| 92 |
+
*
|
| 93 |
+
* @return array $cache_datas sorted array
|
| 94 |
+
*/
|
| 95 |
+
public function sortData( $feed_id, $cache_datas ) {
|
| 96 |
+
global $wpdb;
|
| 97 |
+
$result = $wpdb->get_row( "SELECT sort_images_by, display_order FROM ".$wpdb->prefix."wdi_feeds WHERE id = ".intval($feed_id), ARRAY_A );
|
| 98 |
+
|
| 99 |
+
switch ($result['sort_images_by']) {
|
| 100 |
+
case 'date':
|
| 101 |
+
if( $result['display_order'] == 'asc' ) {
|
| 102 |
+
array_multisort (array_column($cache_datas, 'created_time'), SORT_ASC, $cache_datas);
|
| 103 |
+
} else {
|
| 104 |
+
array_multisort (array_column($cache_datas, 'created_time'), SORT_DESC, $cache_datas);
|
| 105 |
+
}
|
| 106 |
+
break;
|
| 107 |
+
case 'likes':
|
| 108 |
+
if( $result['display_order'] == 'asc' ) {
|
| 109 |
+
array_multisort (array_column($cache_datas, 'likes'), SORT_ASC, $cache_datas);
|
| 110 |
+
} else {
|
| 111 |
+
array_multisort (array_column($cache_datas, 'likes'), SORT_DESC, $cache_datas);
|
| 112 |
+
}
|
| 113 |
+
break;
|
| 114 |
+
case 'comments':
|
| 115 |
+
if( $result['display_order'] == 'asc' ) {
|
| 116 |
+
array_multisort (array_column($cache_datas, 'comments'), SORT_ASC, $cache_datas);
|
| 117 |
+
} else {
|
| 118 |
+
array_multisort (array_column($cache_datas, 'comments'), SORT_DESC, $cache_datas);
|
| 119 |
+
}
|
| 120 |
+
break;
|
| 121 |
+
default:
|
| 122 |
+
shuffle($cache_datas);
|
| 123 |
+
}
|
| 124 |
+
return $cache_datas;
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
/**
|
| 128 |
* Get comments from endpoint or from cache
|
| 129 |
*
|
| 246 |
),
|
| 247 |
),
|
| 248 |
"user_has_liked" => ($like_count > 0),
|
| 249 |
+
"likes" => isset($media["like_count"]) ? $media["like_count"] : 0, // media.like_count
|
|
|
|
|
|
|
| 250 |
"tags" => array(),
|
| 251 |
"filter" => "Normal",
|
| 252 |
+
"comments" => isset($media["comments_count"]) ? $media["comments_count"] : 0, // media.comments_count
|
|
|
|
|
|
|
| 253 |
"media_type" => $media["media_type"],
|
| 254 |
"type" => $media_type,
|
| 255 |
"link" => (isset($media["permalink"]) ? $media["permalink"] : ""),
|
framework/WDILibrary.php
CHANGED
|
@@ -309,32 +309,6 @@ class WDILibrary {
|
|
| 309 |
<?php
|
| 310 |
}
|
| 311 |
|
| 312 |
-
public static function search_select($search_by, $search_select_id = 'search_select_value', $search_select_value, $playlists, $form_id) {
|
| 313 |
-
?>
|
| 314 |
-
<div class="alignleft actions" style="clear:both;">
|
| 315 |
-
<script>
|
| 316 |
-
function wdi_spider_search_select() {
|
| 317 |
-
document.getElementById("page_number").value = "1";
|
| 318 |
-
document.getElementById("search_or_not").value = "search";
|
| 319 |
-
document.getElementById("<?php echo $form_id; ?>").submit();
|
| 320 |
-
}
|
| 321 |
-
</script>
|
| 322 |
-
<div class="alignleft actions" >
|
| 323 |
-
<label for="<?php echo $search_select_id; ?>" style="font-size:14px; width:50px; display:inline-block;"><?php echo $search_by; ?>:</label>
|
| 324 |
-
<select id="<?php echo $search_select_id; ?>" name="<?php echo $search_select_id; ?>" onchange="wdi_spider_search_select();" style="float: none; width: 150px;">
|
| 325 |
-
<?php
|
| 326 |
-
foreach ($playlists as $id => $playlist) {
|
| 327 |
-
?>
|
| 328 |
-
<option value="<?php echo $id; ?>" <?php echo (($search_select_value == $id) ? 'selected="selected"' : ''); ?>><?php echo $playlist; ?></option>
|
| 329 |
-
<?php
|
| 330 |
-
}
|
| 331 |
-
?>
|
| 332 |
-
</select>
|
| 333 |
-
</div>
|
| 334 |
-
</div>
|
| 335 |
-
<?php
|
| 336 |
-
}
|
| 337 |
-
|
| 338 |
public static function html_page_nav($count_items, $page_number, $form_id, $items_per_page = 20) {
|
| 339 |
$limit = 20;
|
| 340 |
if ($count_items) {
|
|
@@ -670,169 +644,7 @@ class WDILibrary {
|
|
| 670 |
<?php
|
| 671 |
}
|
| 672 |
}
|
| 673 |
-
|
| 674 |
-
public static function ajax_html_frontend_page_nav($theme_row, $count_items, $page_number, $form_id, $limit = 20, $current_view, $id, $cur_alb_gal_id = 0, $type = 'album', $enable_seo = false, $pagination = 1) {
|
| 675 |
-
$type = self::get('type_' . $current_view, $type);
|
| 676 |
-
$album_gallery_id = self::get('album_gallery_id_' . $current_view, $cur_alb_gal_id);
|
| 677 |
-
if ($count_items) {
|
| 678 |
-
if ($count_items % $limit) {
|
| 679 |
-
$items_county = ($count_items - $count_items % $limit) / $limit + 1;
|
| 680 |
-
}
|
| 681 |
-
else {
|
| 682 |
-
$items_county = ($count_items - $count_items % $limit) / $limit;
|
| 683 |
-
}
|
| 684 |
-
}
|
| 685 |
-
else {
|
| 686 |
-
$items_county = 1;
|
| 687 |
-
}
|
| 688 |
-
if ($page_number > $items_county) {
|
| 689 |
-
return;
|
| 690 |
-
}
|
| 691 |
-
$first_page = "first-page-" . $current_view;
|
| 692 |
-
$prev_page = "prev-page-" . $current_view;
|
| 693 |
-
$next_page = "next-page-" . $current_view;
|
| 694 |
-
$last_page = "last-page-" . $current_view;
|
| 695 |
-
?>
|
| 696 |
-
<span class="wdi_nav_cont_<?php echo $current_view; ?>">
|
| 697 |
-
<?php
|
| 698 |
-
if ($pagination == 1) {
|
| 699 |
-
?>
|
| 700 |
-
<div class="tablenav-pages_<?php echo $current_view; ?>">
|
| 701 |
-
<?php
|
| 702 |
-
if ($theme_row->page_nav_number) {
|
| 703 |
-
?>
|
| 704 |
-
<span class="displaying-num_<?php echo $current_view; ?>"><?php echo $count_items . __(' item(s)', 'wd-instagram-feed'); ?></span>
|
| 705 |
-
<?php
|
| 706 |
-
}
|
| 707 |
-
if ($count_items > $limit) {
|
| 708 |
-
if ($theme_row->page_nav_button_text) {
|
| 709 |
-
$first_button = __('First', 'wd-instagram-feed');
|
| 710 |
-
$previous_button = __('Previous', 'wd-instagram-feed');
|
| 711 |
-
$next_button = __('Next', 'wd-instagram-feed');
|
| 712 |
-
$last_button = __('Last', 'wd-instagram-feed');
|
| 713 |
-
}
|
| 714 |
-
else {
|
| 715 |
-
$first_button = '«';
|
| 716 |
-
$previous_button = '‹';
|
| 717 |
-
$next_button = '›';
|
| 718 |
-
$last_button = '»';
|
| 719 |
-
}
|
| 720 |
-
if ($page_number == 1) {
|
| 721 |
-
$first_page = "first-page disabled";
|
| 722 |
-
$prev_page = "prev-page disabled";
|
| 723 |
-
}
|
| 724 |
-
if ($page_number >= $items_county) {
|
| 725 |
-
$next_page = "next-page disabled";
|
| 726 |
-
$last_page = "last-page disabled";
|
| 727 |
-
}
|
| 728 |
-
?>
|
| 729 |
-
<span class="pagination-links_<?php echo $current_view; ?>">
|
| 730 |
-
<a class="<?php echo $first_page; ?>" title="<?php echo __('Go to the first page', 'wd-instagram-feed'); ?>"><?php echo $first_button; ?></a>
|
| 731 |
-
<a class="<?php echo $prev_page; ?>" title="<?php echo __('Go to the previous page', 'wd-instagram-feed'); ?>" <?php echo $page_number > 1 && $enable_seo ? 'href="' . add_query_arg(array("page_number_" . $current_view => $page_number - 1), $_SERVER['REQUEST_URI']) . '"' : ""; ?>><?php echo $previous_button; ?></a>
|
| 732 |
-
<span class="paging-input_<?php echo $current_view; ?>">
|
| 733 |
-
<span class="total-pages_<?php echo $current_view; ?>"><?php echo $page_number; ?></span> <?php echo __('of', 'wd-instagram-feed'); ?> <span class="total-pages_<?php echo $current_view; ?>">
|
| 734 |
-
<?php echo $items_county; ?>
|
| 735 |
-
</span>
|
| 736 |
-
</span>
|
| 737 |
-
<a class="<?php echo $next_page ?>" title="<?php echo __('Go to the next page', 'wd-instagram-feed'); ?>" <?php echo $page_number + 1 <= $items_county && $enable_seo ? 'href="' . add_query_arg(array("page_number_" . $current_view => $page_number + 1), $_SERVER['REQUEST_URI']) . '"' : ""; ?>><?php echo $next_button; ?></a>
|
| 738 |
-
<a class="<?php echo $last_page ?>" title="<?php echo __('Go to the last page', 'wd-instagram-feed'); ?>"><?php echo $last_button; ?></a>
|
| 739 |
-
</span>
|
| 740 |
-
<?php
|
| 741 |
-
}
|
| 742 |
-
?>
|
| 743 |
-
</div>
|
| 744 |
-
<?php
|
| 745 |
-
}
|
| 746 |
-
elseif ($pagination == 2) {
|
| 747 |
-
if ($count_items > $limit * $page_number) {
|
| 748 |
-
?>
|
| 749 |
-
<div id="wdi_load_<?php echo $current_view; ?>" class="tablenav-pages_<?php echo $current_view; ?>">
|
| 750 |
-
<a class="wdi_load_btn_<?php echo $current_view; ?> wdi_load_btn" href="javascript:void(0);"><?php echo __('Load More...', 'wd-instagram-feed'); ?></a>
|
| 751 |
-
<input type="hidden" id="wdi_load_more_<?php echo $current_view; ?>" name="wdi_load_more_<?php echo $current_view; ?>" value="on" />
|
| 752 |
-
</div>
|
| 753 |
-
<?php
|
| 754 |
-
}
|
| 755 |
-
}
|
| 756 |
-
elseif ($pagination == 3) {
|
| 757 |
-
if ($count_items > $limit * $page_number) {
|
| 758 |
-
?>
|
| 759 |
-
<script type="text/javascript">
|
| 760 |
-
jQuery(window).on("scroll", function() {
|
| 761 |
-
if (jQuery(document).scrollTop() + jQuery(window).height() > (jQuery('#<?php echo $form_id; ?>').offset().top + jQuery('#<?php echo $form_id; ?>').height())) {
|
| 762 |
-
wdi_spider_page_<?php echo $current_view; ?>('', <?php echo $page_number; ?>, 1, true);
|
| 763 |
-
jQuery(window).off("scroll");
|
| 764 |
-
return false;
|
| 765 |
-
}
|
| 766 |
-
});
|
| 767 |
-
</script>
|
| 768 |
-
<?php
|
| 769 |
-
}
|
| 770 |
-
}
|
| 771 |
-
?>
|
| 772 |
-
<input type="hidden" id="page_number_<?php echo $current_view; ?>" name="page_number_<?php echo $current_view; ?>" value="<?php echo self::get('page_number_' . $current_view, 1, 'intval'); ?>" />
|
| 773 |
-
<script type="text/javascript">
|
| 774 |
-
function wdi_spider_page_<?php echo $current_view; ?>(cur, x, y, load_more) {
|
| 775 |
-
if (typeof load_more == "undefined") {
|
| 776 |
-
var load_more = false;
|
| 777 |
-
}
|
| 778 |
-
if (jQuery(cur).hasClass('disabled')) {
|
| 779 |
-
return false;
|
| 780 |
-
}
|
| 781 |
-
var items_county_<?php echo $current_view; ?> = <?php echo $items_county; ?>;
|
| 782 |
-
switch (y) {
|
| 783 |
-
case 1:
|
| 784 |
-
if (x >= items_county_<?php echo $current_view; ?>) {
|
| 785 |
-
document.getElementById('page_number_<?php echo $current_view; ?>').value = items_county_<?php echo $current_view; ?>;
|
| 786 |
-
}
|
| 787 |
-
else {
|
| 788 |
-
document.getElementById('page_number_<?php echo $current_view; ?>').value = x + 1;
|
| 789 |
-
}
|
| 790 |
-
break;
|
| 791 |
-
case 2:
|
| 792 |
-
document.getElementById('page_number_<?php echo $current_view; ?>').value = items_county_<?php echo $current_view; ?>;
|
| 793 |
-
break;
|
| 794 |
-
case -1:
|
| 795 |
-
if (x == 1) {
|
| 796 |
-
document.getElementById('page_number_<?php echo $current_view; ?>').value = 1;
|
| 797 |
-
}
|
| 798 |
-
else {
|
| 799 |
-
document.getElementById('page_number_<?php echo $current_view; ?>').value = x - 1;
|
| 800 |
-
}
|
| 801 |
-
break;
|
| 802 |
-
case -2:
|
| 803 |
-
document.getElementById('page_number_<?php echo $current_view; ?>').value = 1;
|
| 804 |
-
break;
|
| 805 |
-
default:
|
| 806 |
-
document.getElementById('page_number_<?php echo $current_view; ?>').value = 1;
|
| 807 |
-
}
|
| 808 |
-
wdi_spider_frontend_ajax('<?php echo $form_id; ?>', '<?php echo $current_view; ?>', '<?php echo $id; ?>', '<?php echo $album_gallery_id; ?>', '', '<?php echo $type; ?>', 0, '', '', load_more);
|
| 809 |
-
}
|
| 810 |
-
jQuery(document).ready(function() {
|
| 811 |
-
|
| 812 |
-
jQuery('.<?php echo $first_page; ?>').on('click', function() {
|
| 813 |
-
wdi_spider_page_<?php echo $current_view; ?>(this, <?php echo $page_number; ?>, -2);
|
| 814 |
-
});
|
| 815 |
-
jQuery('.<?php echo $prev_page; ?>').on('click', function() {
|
| 816 |
-
wdi_spider_page_<?php echo $current_view; ?>(this, <?php echo $page_number; ?>, -1);
|
| 817 |
-
return false;
|
| 818 |
-
});
|
| 819 |
-
jQuery('.<?php echo $next_page; ?>').on('click', function() {
|
| 820 |
-
wdi_spider_page_<?php echo $current_view; ?>(this, <?php echo $page_number; ?>, 1);
|
| 821 |
-
return false;
|
| 822 |
-
});
|
| 823 |
-
jQuery('.<?php echo $last_page; ?>').on('click', function() {
|
| 824 |
-
wdi_spider_page_<?php echo $current_view; ?>(this, <?php echo $page_number; ?>, 2);
|
| 825 |
-
});
|
| 826 |
-
jQuery('.wdi_load_btn_<?php echo $current_view; ?>').on('click', function() {
|
| 827 |
-
wdi_spider_page_<?php echo $current_view; ?>(this, <?php echo $page_number; ?>, 1, true);
|
| 828 |
-
return false;
|
| 829 |
-
});
|
| 830 |
-
});
|
| 831 |
-
</script>
|
| 832 |
-
</span>
|
| 833 |
-
<?php
|
| 834 |
-
}
|
| 835 |
-
|
| 836 |
public static function ajax_html_frontend_search_box($form_id, $current_view, $cur_gal_id, $images_count, $search_box_width = 180) {
|
| 837 |
$wdi_search = self::get('wdi_search_' . $current_view, '');
|
| 838 |
$type = self::get('type_' . $current_view, 'album');
|
| 309 |
<?php
|
| 310 |
}
|
| 311 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 312 |
public static function html_page_nav($count_items, $page_number, $form_id, $items_per_page = 20) {
|
| 313 |
$limit = 20;
|
| 314 |
if ($count_items) {
|
| 644 |
<?php
|
| 645 |
}
|
| 646 |
}
|
| 647 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 648 |
public static function ajax_html_frontend_search_box($form_id, $current_view, $cur_gal_id, $images_count, $search_box_width = 180) {
|
| 649 |
$wdi_search = self::get('wdi_search_' . $current_view, '');
|
| 650 |
$type = self::get('type_' . $current_view, 'album');
|
frontend/views/thumbnails.php
CHANGED
|
@@ -99,6 +99,10 @@ class WDI_Thumbnails_view {
|
|
| 99 |
}
|
| 100 |
}
|
| 101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
?>
|
| 103 |
|
| 104 |
</div>
|
| 99 |
}
|
| 100 |
}
|
| 101 |
|
| 102 |
+
if ($feed_row['feed_display_view'] === 'pagination') { ?>
|
| 103 |
+
<div class="wdi_page_loading wdi_hidden"><div><div><img class="wdi_load_more_spinner" src="<?php echo WDI_URL ?>/images/ajax_loader.png"></div></div></div>
|
| 104 |
+
<?php
|
| 105 |
+
}
|
| 106 |
?>
|
| 107 |
|
| 108 |
</div>
|
js/gallerybox/wdi_gallery_box.js
CHANGED
|
@@ -149,6 +149,9 @@ var wdi_construct_popup = function (popup, currentFeed, image_rows, current_imag
|
|
| 149 |
var img_html = '<video style="' + img_style + '" class="wdi_filmstrip_thumbnail_img" src="' + src + '" onclick="' + onclick + '" ontouchend="' + ontouchend + '" image_id="' + image_row.id + '" image_key="' + i + '" alt="' + image_row.alt + '" /></video>';
|
| 150 |
break;
|
| 151 |
case 'EMBED_OEMBED_INSTAGRAM_CAROUSEL':
|
|
|
|
|
|
|
|
|
|
| 152 |
switch (image_row.carousel_media[0].type) {
|
| 153 |
case 'image':
|
| 154 |
src = image_row.carousel_media[0].images.thumbnail.url;
|
| 149 |
var img_html = '<video style="' + img_style + '" class="wdi_filmstrip_thumbnail_img" src="' + src + '" onclick="' + onclick + '" ontouchend="' + ontouchend + '" image_id="' + image_row.id + '" image_key="' + i + '" alt="' + image_row.alt + '" /></video>';
|
| 150 |
break;
|
| 151 |
case 'EMBED_OEMBED_INSTAGRAM_CAROUSEL':
|
| 152 |
+
if( image_row.carousel_media.length === 0 ){
|
| 153 |
+
continue;
|
| 154 |
+
}
|
| 155 |
switch (image_row.carousel_media[0].type) {
|
| 156 |
case 'image':
|
| 157 |
src = image_row.carousel_media[0].images.thumbnail.url;
|
js/gallerybox/wdi_gallery_box.min.js
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
var isPopUpOpened=!1,wdi_data=[];function wdi_spider_createpopup(e,t,i,a,r,n,d,o,s){if(e=e.replace(/&/g,"&"),!isPopUpOpened&&(isPopUpOpened=!0,!wdi_spider_hasalreadyreceivedpopup(n)&&!wdi_spider_isunsupporteduseragent())){jQuery("html").attr("style","overflow:hidden !important;"),jQuery("#wdi_spider_popup_loading_"+t).css({display:"block"}),jQuery("#wdi_spider_popup_overlay_"+t).css({display:"block"});for(var _,m=0,c=0;c<o.parsedData.length;c++)if(o.parsedData[c].id===s){m=c,_=[o.parsedData[c]];break}jQuery.ajax({type:"POST",url:e,dataType:"text",data:{action:"WDIGalleryBox",image_rows:JSON.stringify(_),feed_id:o.feed_row.id,feed_counter:o.feed_row.wdi_feed_counter,current_image_index:m,image_rows_count:o.parsedData.length,carousel_media_row:JSON.stringify(_[0].carousel_media)},success:function(e){e=jQuery('<div id="wdi_spider_popup_wrap" class="wdi_spider_popup_wrap wdi_lightbox_theme_'+o.feed_row.theme_id+'" style="width:'+i+"px;height:"+a+"px;margin-top:-"+a/2+"px;margin-left: -"+i/2+'px; ">'+e+"</div>");new wdi_construct_popup(e,o,o.parsedData,s).construct(),e.hide().appendTo("body"),wdi_spider_showpopup(n,d,e,r),jQuery("#wdi_spider_popup_loading_"+t).css({display:"none !important;"})}})}}var wdi_construct_popup=function(y,f,v,b){this.theme_row={},this.construct=function(){this.theme_row=window["wdi_theme_"+f.feed_row.theme_id],f.feed_row.popup_enable_filmstrip&&"1"===f.feed_row.popup_enable_filmstrip&&this.add_filmstrip(),this.set_wdi_data()},this.add_filmstrip=function(){var e="horizontal";"right"!==this.theme_row.lightbox_filmstrip_pos&&"left"!==this.theme_row.lightbox_filmstrip_pos||(e="vertical");for(var t="horizontal"===e?"tenweb-i-angle-left":"tenweb-i-angle-up",i="horizontal"===e?"tenweb-i-angle-right":"tenweb-i-angle-down",a="",r=n="horizontal"===e?void 0!==f.feed_row.popup_filmstrip_height?f.feed_row.popup_filmstrip_height:"20":void 0!==f.feed_row.popup_filmstrip_height?f.feed_row.popup_filmstrip_height:"50",n=r=parseInt(r),d=0;d<v.length;d++){var o,s,_,m=v[d];_=m.resolution&&""!==m.resolution?(m.resolution.split(" "),u=intval($resolution_arr[0]),l=intval($resolution_arr[2]),0!==u&&0!==l?(o=u*(s=Math.max(r/u,n/l)),l*s):(o=r,n)):(o=r,n);var c=(r-(o*=s=Math.max(r/o,n/_)))/2,u=(n-(_*=s))/2,l="wdi_filmstrip_thumbnail "+(parseInt(m.id)===parseInt(b)?"wdi_thumb_active":"wdi_thumb_deactive"),w="width:"+o+"px;height:"+_+"px;margin-left:"+c+"px;margin-top:"+u+"px;",p="wdi_change_image(parseInt(jQuery('#wdi_current_image_key').val()), '"+d+"', wdi_data)",h="wdi_change_image(parseInt(jQuery('#wdi_current_image_key').val()), '"+d+"', wdi_data)";switch(m.filetype){case"EMBED_OEMBED_INSTAGRAM_IMAGE":var g='<img style="'+w+'" class="wdi_filmstrip_thumbnail_img" src="'+(void 0!==m.images[f.feedImageResolution]&&void 0!==m.images[f.feedImageResolution].url?m.images[f.feedImageResolution].url:m.thumb_url)+'" onclick="'+p+'" ontouchend="'+h+'" image_id="'+m.id+'" image_key="'+d+'" alt="'+m.alt+'" />';break;case"EMBED_OEMBED_INSTAGRAM_VIDEO":g='<video style="'+w+'" class="wdi_filmstrip_thumbnail_img" src="'+(void 0!==m.filename?m.filename:m.thumb_url)+'" onclick="'+p+'" ontouchend="'+h+'" image_id="'+m.id+'" image_key="'+d+'" alt="'+m.alt+'" /></video>';break;case"EMBED_OEMBED_INSTAGRAM_CAROUSEL":switch(m.carousel_media[0].type){case"image":g='<img style="'+w+'" class="wdi_filmstrip_thumbnail_img" src="'+m.carousel_media[0].images.thumbnail.url+'" onclick="'+p+'" ontouchend="'+h+'" image_id="'+m.id+'" image_key="'+d+'" alt="'+m.alt+'" />';break;case"video":g='<video style="'+w+'" class="wdi_filmstrip_thumbnail_img" src="'+m.carousel_media[0].videos.low_resolution.url+'" onclick="'+p+'" ontouchend="'+h+'" image_id="'+m.id+'" image_key="'+d+'" alt="'+m.alt+'" /></video>';break;default:g='<img style="'+w+'" class="wdi_filmstrip_thumbnail_img" src="'+(wdi_url.plugin_url+"images/missing.png")+'" onclick="'+p+'" ontouchend="'+h+'" image_id="'+m.id+'" image_key="'+d+'" alt="'+m.alt+'" />'}}a+='<div id="wdi_filmstrip_thumbnail_'+d+'" class="'+l+'">'+g+"</div>"}i='<div class="wdi_filmstrip_left"><i class="tenweb-i '+t+'"></i></div><div class="wdi_filmstrip"><div class="wdi_filmstrip_thumbnails">'+a+'</div></div><div class="wdi_filmstrip_right"><i class="tenweb-i '+i+'"></i></div>';y.find(".wdi_filmstrip_container").append(i)},this.set_wdi_data=function(){wdi_data=[];for(var e=0;e<v.length;e++)wdi_data[e]=[],wdi_data[e].number=e+1,wdi_data[e].id=v[e].id,wdi_data[e].alt=v[e].alt,wdi_data[e].description=wdi_front.escape_tags(v[e].description),wdi_data[e].username=v[e].username,wdi_data[e].profile_picture=v[e].profile_picture,wdi_data[e].image_url=v[e].image_url,wdi_data[e].thumb_url=v[e].thumb_url,wdi_data[e].src=v[e].images.standard_resolution.url,wdi_data[e].date=v[e].date,wdi_data[e].comment_count=v[e].comment_count,wdi_data[e].filetype=v[e].filetype,wdi_data[e].filename=v[e].filename,wdi_data[e].avg_rating=v[e].avg_rating,wdi_data[e].rate=v[e].rate,wdi_data[e].rate_count=v[e].rate_count,wdi_data[e].hit_count=v[e].hit_count,wdi_data[e].comments_data=void 0!==v[e].comments_data?v[e].comments_data:"null",wdi_data[e].carousel_media=void 0!==v[e].carousel_media?v[e].carousel_media:null}};function wdi_spider_showpopup(e,t,i,a){isPopUpOpened=!0,i.show(),wdi_spider_receivedpopup(e,t)}function wdi_spider_hasalreadyreceivedpopup(e){return-1<document.cookie.indexOf(e)&&delete document.cookie[document.cookie.indexOf(e)],!1}function wdi_spider_receivedpopup(e,t){var i=new Date;i.setDate(i.getDate()+t),document.cookie=e+"=true;expires="+i.toUTCString()+";path=/",jQuery(".wdi_image_info").mCustomScrollbar({autoHideScrollbar:!1,scrollInertia:150,advanced:{updateOnContentResize:!0}})}function wdi_spider_isunsupporteduseragent(){return!window.XMLHttpRequest}function wdi_spider_destroypopup(e){null!=document.getElementById("wdi_spider_popup_wrap")&&(wdi_comments_manager.popup_destroyed(),void 0!==jQuery().fullscreen&&jQuery.isFunction(jQuery().fullscreen)&&jQuery.fullscreen.isFullScreen()&&jQuery.fullscreen.exit(),setTimeout(function(){jQuery(".wdi_spider_popup_wrap").remove(),jQuery(".wdi_spider_popup_loading").css({display:"none"}),jQuery(".wdi_spider_popup_overlay").css({display:"none"}),jQuery(document).off("keydown"),jQuery("html").attr("style","")},20)),isPopUpOpened=!1;var t=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()),i=document.querySelector('meta[name="viewport"]');t&&i&&(i.content="width=device-width, initial-scale=1");i=jQuery(document).scrollTop();window.location.hash="",jQuery(document).scrollTop(i),"undefined"!=typeof wdi_playInterval&&clearInterval(wdi_playInterval)}function wdi_spider_ajax_save(e,t){return wdi_comments_manager.init(t),!1}function wdi_spider_set_input_value(e,t){document.getElementById(e)&&(document.getElementById(e).value=t)}function wdi_spider_form_submit(e,t){document.getElementById(t)&&document.getElementById(t).submit(),e.preventDefault?e.preventDefault():e.returnValue=!1}function wdi_spider_check_required(e,t){return""==jQuery("#"+e).val()&&(wdi_front.show_alert(t+"* "+wdi_objectL10n.wdi_field_required),jQuery("#"+e).attr("style","border-color: #FF0000;"),jQuery("#"+e).focus(),!0)}function wdi_spider_check_email(e){if(""!=jQuery("#"+e).val())return-1==jQuery("#"+e).val().replace(/^\s+|\s+$/g,"").search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)&&(wdi_front.show_alert(wdi_objectL10n.wdi_mail_validation),!0)}function wdi_captcha_refresh(e){document.getElementById(e+"_img")&&document.getElementById(e+"_input")&&(srcArr=document.getElementById(e+"_img").src.split("&r="),document.getElementById(e+"_img").src=srcArr[0]+"&r="+Math.floor(100*Math.random()),document.getElementById(e+"_img").style.display="inline-block",document.getElementById(e+"_input").value="")}function wdi_play_pause(e){var t=-1<navigator.userAgent.indexOf("Chrome"),i=-1<navigator.userAgent.indexOf("Safari");t&&i&&(i=!1),i||(i=e.get(0),e=!1,navigator.userAgent.match(/firefox/i)&&(e=!0),e||(i.paused?i.play():i.pause()))}function wdi_spider_display_embed(e,t,i,a,r){var n="";switch(e){case"EMBED_OEMBED_INSTAGRAM_VIDEO":var d="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(d+=" "+attr+'="'+a[attr]+'"');d+=" >",""!=t&&(d+='<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls><source src="'+i+'" type="video/mp4"> Your browser does not support the video tag. </video>'),n+=d+="</div>";break;case"EMBED_OEMBED_INSTAGRAM_IMAGE":d="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(d+=" "+attr+'="'+a[attr]+'"');d+=" >",""!=t&&(d+='<img src="'+i+'" style=" max-width:100% !important; max-height:100% !important; width:auto; height:auto;">'),n+=d+="</div>";break;case"EMBED_OEMBED_INSTAGRAM_CAROUSEL":d="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(d+=" "+attr+'="'+a[attr]+'"');d+=" >";for(var o=0;o<r.length;o++)"image"==r[o].type?d+='<img src="'+r[o].images.standard_resolution.url+'" style="max-width:100% !important; max-height:100% !important; width:auto !important; height:auto !important;" data-id="'+o+'" class="carousel_media '+(0==o?"active":"")+'">':"video"==r[o].type&&(void 0!==r[o].videos&&void 0!==r[o].videos.standard_resolution&&void 0!==r[o].videos.standard_resolution.url&&(i=r[o].videos.standard_resolution.url),d+='<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls data-id="'+o+'" class="carousel_media '+(0==o?"active":"")+'"><source src="'+i+'" type="video/mp4"> Your browser does not support the video tag. </video>');n+=d+="</div>"}return n}function wdi_testBrowser_cssTransitions(){return wdi_testDom("Transition")}function wdi_testBrowser_cssTransforms3d(){return wdi_testDom("Perspective")}function wdi_testDom(e){for(var t=["","Webkit","Moz","ms","O","Khtml"],i=t.length;i--;)if(void 0!==document.body.style[t[i]+e])return!0;return!1}function wdi_cube(e,t,i,a,r,n,d,o,s,_){return wdi_testBrowser_cssTransitions()?wdi_testBrowser_cssTransforms3d()?(wdi_trans_in_progress=!0,jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive"),jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active"),jQuery(".wdi_slide_bg").css("perspective",1e3),jQuery(o).css({transform:"translateZ("+e+"px)",backfaceVisibility:"hidden"}),jQuery(s).css({opacity:1,filter:"Alpha(opacity=100)",backfaceVisibility:"hidden",transform:"translateY("+i+"px) translateX("+t+"px) rotateY("+r+"deg) rotateX("+a+"deg)"}),jQuery(".wdi_slider").css({transform:"translateZ(-"+e+"px)",transformStyle:"preserve-3d"}),setTimeout(function(){jQuery(".wdi_slider").css({transition:"all "+wdi_transition_duration+"ms ease-in-out",transform:"translateZ(-"+e+"px) rotateX("+n+"deg) rotateY("+d+"deg)"})},20),void jQuery(".wdi_slider").one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(function(){jQuery(o).removeAttr("style"),jQuery(s).removeAttr("style"),jQuery(".wdi_slider").removeAttr("style"),jQuery(o).css({opacity:0,filter:"Alpha(opacity=0)","z-index":1}),jQuery(s).css({opacity:1,filter:"Alpha(opacity=100)","z-index":2}),wdi_trans_in_progress=!1,jQuery(o).html(""),"undefined"==typeof event_stack||0<event_stack.length&&(key=event_stack[0].split("-"),event_stack.shift(),wdi_change_image(key[0],key[1],wdi_data,!0));wdi_change_watermark_container()}))):wdi_fallback3d(o,s,_):wdi_fallback(o,s,_)}function wdi_cubeH(e,t,i){var a=jQuery(e).width()/2;"right"==i?wdi_cube(a,a,0,0,90,0,-90,e,t,i):"left"==i&&wdi_cube(a,-a,0,0,-90,0,90,e,t,i)}function wdi_cubeV(e,t,i){var a=jQuery(e).height()/2;"right"==i?wdi_cube(a,0,-a,90,0,-90,0,e,t,i):"left"==i&&wdi_cube(a,0,a,-90,0,90,0,e,t,i)}function wdi_fallback(e,t,i){wdi_fade(e,t,i)}function wdi_fallback3d(e,t,i){wdi_sliceV(e,t,i)}function wdi_none(e,t,i){jQuery(e).css({opacity:0,"z-index":1}),jQuery(t).css({opacity:1,"z-index":2}),jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive"),jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active"),wdi_trans_in_progress=!1,jQuery(e).html(""),wdi_change_watermark_container()}function wdi_fade(e,t,i){jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive"),jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active"),wdi_testBrowser_cssTransitions()?(jQuery(t).css("transition","opacity "+wdi_transition_duration+"ms linear"),jQuery(e).css({opacity:0,"z-index":1}),jQuery(t).css({opacity:1,"z-index":2}),wdi_change_watermark_container()):(jQuery(e).animate({opacity:0,"z-index":1},wdi_transition_duration),jQuery(t).animate({opacity:1,"z-index":2},{duration:wdi_transition_duration,complete:function(){wdi_trans_in_progress=!1,jQuery(e).html(""),wdi_change_watermark_container()}}),jQuery(e).fadeTo(wdi_transition_duration,0),jQuery(t).fadeTo(wdi_transition_duration,1))}function wdi_grid(e,t,i,a,r,n,d,o,s,_){if(!wdi_testBrowser_cssTransitions())return wdi_fallback(o,s,_);wdi_trans_in_progress=!0,jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive"),jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");var m=wdi_transition_duration/(e+t);var c=jQuery(o).find("img"),u=jQuery('<span style="display: block;" />').addClass("wdi_grid");jQuery(o).prepend(u);var l=jQuery(".wdi_slide_bg"),w=c.width(),p=c.height(),_=l.width(),l=l.height(),h=Math.floor(_/e),g=Math.floor(l/t),y=_-e*h,f=Math.ceil(y/e),v=l-t*g,b=Math.ceil(v/t),j=0,Q=Math.ceil((jQuery(".wdi_slide_bg").width()-c.width())/2),k=void 0===c.attr("src")?"":c.attr("src");a="min-auto"===(a="auto"===a?_:a)?-_:a,r="min-auto"===(r="auto"===r?l:r)?-l:r;for(var x,C,E,M,I,A,B,O,T,D,S=0;S<e;S++){var z,K=0,R=Math.floor((jQuery(".wdi_slide_bg").height()-c.height())/2),V=h;0<y&&(V+=z=f<=y?f:y,y-=z);for(var L=0;L<t;L++){var G=g,H=v;0<H&&(G+=z=b<=H?b:v,0),u.append((x=V,C=G,E=K,M=R,I=j,A=Q,B=k,O=w,T=p,D=(S+(D=L))*m,jQuery('<span class="wdi_gridlet" />').css({display:"block",width:x,height:C,top:E,left:I,backgroundImage:'url("'+B+'")',backgroundColor:jQuery(".wdi_spider_popup_wrap").css("background-color"),backgroundRepeat:"no-repeat",backgroundPosition:A+"px "+M+"px",backgroundSize:O+"px "+T+"px",transition:"all "+wdi_transition_duration+"ms ease-in-out "+D+"ms",transform:"none"}))),K+=G,R-=G}Q-=V,j+=V}l=u.children().last();u.show(),c.css("opacity",0),u.children().first().addClass("rs-top-left"),u.children().last().addClass("rs-bottom-right"),u.children().eq(t-1).addClass("rs-bottom-left"),u.children().eq(-t).addClass("rs-top-right"),setTimeout(function(){u.children().css({opacity:d,transform:"rotate("+i+"deg) translateX("+a+"px) translateY("+r+"px) scale("+n+")"})},1),jQuery(s).css("opacity",1),jQuery(l).one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(function(){jQuery(o).css({opacity:0,"z-index":1}),jQuery(s).css({opacity:1,"z-index":2}),c.css("opacity",1),u.remove(),wdi_trans_in_progress=!1,jQuery(o).html(""),"undefined"==typeof event_stack||0<event_stack.length&&(key=event_stack[0].split("-"),event_stack.shift(),wdi_change_image(key[0],key[1],wdi_data,!0));wdi_change_watermark_container()}))}function wdi_sliceH(e,t,i){var a;"right"==i?a="min-auto":"left"==i&&(a="auto"),wdi_grid(1,8,0,a,0,1,0,e,t,i)}function wdi_sliceV(e,t,i){var a;"right"==i?a="min-auto":"left"==i&&(a="auto"),wdi_grid(10,1,0,0,a,1,0,e,t,i)}function wdi_slideV(e,t,i){var a;"right"==i?a="auto":"left"==i&&(a="min-auto"),wdi_grid(1,1,0,0,a,1,1,e,t,i)}function wdi_slideH(e,t,i){var a;"right"==i?a="min-auto":"left"==i&&(a="auto"),wdi_grid(1,1,0,a,0,1,1,e,t,i)}function wdi_scaleOut(e,t,i){wdi_grid(1,1,0,0,0,1.5,0,e,t,i)}function wdi_scaleIn(e,t,i){wdi_grid(1,1,0,0,0,.5,0,e,t,i)}function wdi_blockScale(e,t,i){wdi_grid(8,6,0,0,0,.6,0,e,t,i)}function wdi_kaleidoscope(e,t,i){wdi_grid(10,8,0,0,0,1,0,e,t,i)}function wdi_fan(e,t,i){var a,r;"right"==i?(a=45,r=100):"left"==i&&(a=-45,r=-100),wdi_grid(1,10,a,r,0,1,0,e,t,i)}function wdi_blindV(e,t,i){wdi_grid(1,8,0,0,0,.7,0,e,t)}function wdi_blindH(e,t,i){wdi_grid(10,1,0,0,0,.7,0,e,t)}function wdi_random(e,t,i){var a=["sliceH","sliceV","slideH","slideV","scaleOut","scaleIn","blockScale","kaleidoscope","fan","blindH","blindV"];this["wdi_"+a[Math.floor(Math.random()*a.length)]](e,t,i)}function wdi_pause_stream(e){jQuery(e).find("video").each(function(){jQuery(this).get(0).pause()})}function wdi_reset_zoom(){var e=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()),t=document.querySelector('meta[name="viewport"]');e&&t&&(t.content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0")}Object.size=function(e){var t,i=0;for(t in e)e.hasOwnProperty(t)&&i++;return i},wdi_comments_manager={media_id:"",mediaComments:[],load_more_count:10,commentCounter:0,currentKey:-1,init:function(e){this.instagram=new WDIInstagram,this.instagram.addToken(wdi_front.access_token),this.currentKey!=e&&(this.currentKey=e,this.reset_comments())},reset_comments:function(){jQuery("#wdi_load_more_comments").remove(),jQuery("#wdi_added_comments").html(""),this.commentCounter=0,this.media_id=wdi_data[this.currentKey].id,this.getAjaxComments(this.currentKey)},clear_comments:function(){jQuery("#wdi_load_more_comments").remove(),jQuery("#wdi_added_comments").html(""),this.commentCounter=0},popup_destroyed:function(){this.media_id="",this.mediaComments=[],this.commentCounter=0,this.currentKey=-1},showComments:function(e,t){(Object.size(e)-this.commentCounter-t<0||void 0===t)&&(t=Object.size(e)-this.commentCounter);var a=this.commentCounter;for(i=Object.size(e)-a-1;i>=Object.size(e)-a-t;i--){this.commentCounter++;var r=e[i].text,r=wdi_front.escape_tags(r);r=this.filterCommentText(r);var n=e[i].username,d=jQuery('<div class="wdi_single_comment"></div>');d.append(jQuery('<p class="wdi_comment_header_p"><span class="wdi_comment_header"><a target="_blank" href="//instagram.com/'+n+'">'+n+'</a></span><span class="wdi_comment_date">'+wdi_front.convertUnixDate(e[i].timestamp)+"</span></p>")),d.append(jQuery('<div class="wdi_comment_body_p"><span class="wdi_comment_body"><p>'+r+"</p></span></div>")),jQuery("#wdi_added_comments").prepend(d)}0==jQuery(".wdi_single_comment").length&&jQuery("#wdi_added_comments").html('<p class="wdi_no_comment">There are no comments to show</p>'),this.updateScrollbar()},updateScrollbar:function(){var e=jQuery("#wdi_comments"),t=jQuery("#wdi_added_comments");jQuery(".wdi_comments").attr("class","wdi_comments"),jQuery(".wdi_comments").html(""),jQuery(".wdi_comments").append(e),jQuery(".wdi_comments").append(t),void 0!==jQuery().mCustomScrollbar&&jQuery.isFunction(jQuery().mCustomScrollbar)&&jQuery(".wdi_comments").mCustomScrollbar({scrollInertia:250}),jQuery(".wdi_comments_close_btn").on("click",wdi_comment)},getAjaxComments:function(){var e="";void 0!==wdi_data[wdi_comments_manager.currentKey].comments_data.next&&(e=wdi_data[wdi_comments_manager.currentKey].comments_data.next),this.instagram.getRecentMediaComments(this.media_id,{success:function(e){if(""==e||null==e||null==e||void 0!==e.error)return errorMessage="Network Error, please try again later :(",console.log("%c"+errorMessage,"color:#cc0000;"),void jQuery("#wdi_added_comments").html('<p class="wdi_no_comment">Comments are currently unavailable</p>');if(200!=e.meta.code)return errorMessage=e.meta.error_message,console.log("%c"+errorMessage,"color:#cc0000;"),void jQuery("#wdi_added_comments").html('<p class="wdi_no_comment">Comments are currently unavailable</p>');void 0!==wdi_data[wdi_comments_manager.currentKey].comments_data.data?(wdi_data[wdi_comments_manager.currentKey].comments_data.data=e.data.concat(wdi_data[wdi_comments_manager.currentKey].comments_data.data),wdi_data[wdi_comments_manager.currentKey].comment_count+=wdi_data[wdi_comments_manager.currentKey].comments_data.data.length):(wdi_data[wdi_comments_manager.currentKey].comments_data=e,wdi_data[wdi_comments_manager.currentKey].comment_count=wdi_data[wdi_comments_manager.currentKey].comments_data.data.length),wdi_data[wdi_comments_manager.currentKey].comments_data.next=void 0!==e.paging?e.paging.next:"",wdi_comments_manager.mediaComments=e.data;var t=wdi_data[wdi_comments_manager.currentKey];wdi_comments_manager.showComments(t.comments_data.data,wdi_comments_manager.load_more_count),wdi_comments_manager.ajax_comments_ready(e.data)}},e)},ajax_comments_ready:function(e){this.createLoadMoreAndBindEvent(wdi_comments_manager.currentKey)},createLoadMoreAndBindEvent:function(e){""==e&&(e=wdi_comments_manager.currentKey),(""!==wdi_data[e].comments_data.next||wdi_data[e].comments_data.data.length>wdi_comments_manager.load_more_count&&jQuery(".wdi_single_comment").length<wdi_data[e].comments_data.data.length&&0==jQuery("#wdi_load_more_comments").length)&&jQuery("#wdi_added_comments").prepend(jQuery('<p id="wdi_load_more_comments" class="wdi_load_more_comments">load more comments</p>')),jQuery(".wdi_comment_container #wdi_load_more_comments").on("click",function(){wdi_comments_manager.commentCounter+wdi_comments_manager.load_more_count>wdi_data[e].comments_data.data.length&&""!=wdi_data[e].comments_data.next&&wdi_comments_manager.getAjaxComments(this.currentKey),jQuery(this).remove(),wdi_comments_manager.showComments(wdi_data[e].comments_data.data,wdi_comments_manager.load_more_count),wdi_comments_manager.createLoadMoreAndBindEvent(wdi_comments_manager.currentKey)})},filterCommentText:function(e){for(var t=e.split(" "),i="",a=0;a<t.length;a++)switch(t[a][0]){case"@":i+='<a target="blank" class="wdi_comm_text_link" href="//instagram.com/'+t[a].substring(1,t[a].length)+'">'+t[a]+"</a> ";break;case"#":i+='<a target="blank" class="wdi_comm_text_link" href="//instagram.com/explore/tags/'+t[a].substring(1,t[a].length)+'">'+t[a]+"</a> ";break;default:i+=t[a]+" "}return i=i.substring(0,i.length-1)}};
|
| 1 |
+
var isPopUpOpened=!1,wdi_data=[];function wdi_spider_createpopup(e,t,i,a,r,n,d,o,s){if(e=e.replace(/&/g,"&"),!isPopUpOpened&&(isPopUpOpened=!0,!wdi_spider_hasalreadyreceivedpopup(n)&&!wdi_spider_isunsupporteduseragent())){jQuery("html").attr("style","overflow:hidden !important;"),jQuery("#wdi_spider_popup_loading_"+t).css({display:"block"}),jQuery("#wdi_spider_popup_overlay_"+t).css({display:"block"});for(var _,m=0,c=0;c<o.parsedData.length;c++)if(o.parsedData[c].id===s){m=c,_=[o.parsedData[c]];break}jQuery.ajax({type:"POST",url:e,dataType:"text",data:{action:"WDIGalleryBox",image_rows:JSON.stringify(_),feed_id:o.feed_row.id,feed_counter:o.feed_row.wdi_feed_counter,current_image_index:m,image_rows_count:o.parsedData.length,carousel_media_row:JSON.stringify(_[0].carousel_media)},success:function(e){e=jQuery('<div id="wdi_spider_popup_wrap" class="wdi_spider_popup_wrap wdi_lightbox_theme_'+o.feed_row.theme_id+'" style="width:'+i+"px;height:"+a+"px;margin-top:-"+a/2+"px;margin-left: -"+i/2+'px; ">'+e+"</div>");new wdi_construct_popup(e,o,o.parsedData,s).construct(),e.hide().appendTo("body"),wdi_spider_showpopup(n,d,e,r),jQuery("#wdi_spider_popup_loading_"+t).css({display:"none !important;"})}})}}var wdi_construct_popup=function(y,f,v,b){this.theme_row={},this.construct=function(){this.theme_row=window["wdi_theme_"+f.feed_row.theme_id],f.feed_row.popup_enable_filmstrip&&"1"===f.feed_row.popup_enable_filmstrip&&this.add_filmstrip(),this.set_wdi_data()},this.add_filmstrip=function(){var e="horizontal";"right"!==this.theme_row.lightbox_filmstrip_pos&&"left"!==this.theme_row.lightbox_filmstrip_pos||(e="vertical");for(var t="horizontal"===e?"tenweb-i-angle-left":"tenweb-i-angle-up",i="horizontal"===e?"tenweb-i-angle-right":"tenweb-i-angle-down",a="",r=n="horizontal"===e?void 0!==f.feed_row.popup_filmstrip_height?f.feed_row.popup_filmstrip_height:"20":void 0!==f.feed_row.popup_filmstrip_height?f.feed_row.popup_filmstrip_height:"50",n=r=parseInt(r),d=0;d<v.length;d++){var o,s,_,m=v[d];_=m.resolution&&""!==m.resolution?(m.resolution.split(" "),u=intval($resolution_arr[0]),l=intval($resolution_arr[2]),0!==u&&0!==l?(o=u*(s=Math.max(r/u,n/l)),l*s):(o=r,n)):(o=r,n);var c=(r-(o*=s=Math.max(r/o,n/_)))/2,u=(n-(_*=s))/2,l="wdi_filmstrip_thumbnail "+(parseInt(m.id)===parseInt(b)?"wdi_thumb_active":"wdi_thumb_deactive"),w="width:"+o+"px;height:"+_+"px;margin-left:"+c+"px;margin-top:"+u+"px;",p="wdi_change_image(parseInt(jQuery('#wdi_current_image_key').val()), '"+d+"', wdi_data)",h="wdi_change_image(parseInt(jQuery('#wdi_current_image_key').val()), '"+d+"', wdi_data)";switch(m.filetype){case"EMBED_OEMBED_INSTAGRAM_IMAGE":var g='<img style="'+w+'" class="wdi_filmstrip_thumbnail_img" src="'+(void 0!==m.images[f.feedImageResolution]&&void 0!==m.images[f.feedImageResolution].url?m.images[f.feedImageResolution].url:m.thumb_url)+'" onclick="'+p+'" ontouchend="'+h+'" image_id="'+m.id+'" image_key="'+d+'" alt="'+m.alt+'" />';break;case"EMBED_OEMBED_INSTAGRAM_VIDEO":g='<video style="'+w+'" class="wdi_filmstrip_thumbnail_img" src="'+(void 0!==m.filename?m.filename:m.thumb_url)+'" onclick="'+p+'" ontouchend="'+h+'" image_id="'+m.id+'" image_key="'+d+'" alt="'+m.alt+'" /></video>';break;case"EMBED_OEMBED_INSTAGRAM_CAROUSEL":if(0===m.carousel_media.length)continue;switch(m.carousel_media[0].type){case"image":g='<img style="'+w+'" class="wdi_filmstrip_thumbnail_img" src="'+m.carousel_media[0].images.thumbnail.url+'" onclick="'+p+'" ontouchend="'+h+'" image_id="'+m.id+'" image_key="'+d+'" alt="'+m.alt+'" />';break;case"video":g='<video style="'+w+'" class="wdi_filmstrip_thumbnail_img" src="'+m.carousel_media[0].videos.low_resolution.url+'" onclick="'+p+'" ontouchend="'+h+'" image_id="'+m.id+'" image_key="'+d+'" alt="'+m.alt+'" /></video>';break;default:g='<img style="'+w+'" class="wdi_filmstrip_thumbnail_img" src="'+(wdi_url.plugin_url+"images/missing.png")+'" onclick="'+p+'" ontouchend="'+h+'" image_id="'+m.id+'" image_key="'+d+'" alt="'+m.alt+'" />'}}a+='<div id="wdi_filmstrip_thumbnail_'+d+'" class="'+l+'">'+g+"</div>"}i='<div class="wdi_filmstrip_left"><i class="tenweb-i '+t+'"></i></div><div class="wdi_filmstrip"><div class="wdi_filmstrip_thumbnails">'+a+'</div></div><div class="wdi_filmstrip_right"><i class="tenweb-i '+i+'"></i></div>';y.find(".wdi_filmstrip_container").append(i)},this.set_wdi_data=function(){wdi_data=[];for(var e=0;e<v.length;e++)wdi_data[e]=[],wdi_data[e].number=e+1,wdi_data[e].id=v[e].id,wdi_data[e].alt=v[e].alt,wdi_data[e].description=wdi_front.escape_tags(v[e].description),wdi_data[e].username=v[e].username,wdi_data[e].profile_picture=v[e].profile_picture,wdi_data[e].image_url=v[e].image_url,wdi_data[e].thumb_url=v[e].thumb_url,wdi_data[e].src=v[e].images.standard_resolution.url,wdi_data[e].date=v[e].date,wdi_data[e].comment_count=v[e].comment_count,wdi_data[e].filetype=v[e].filetype,wdi_data[e].filename=v[e].filename,wdi_data[e].avg_rating=v[e].avg_rating,wdi_data[e].rate=v[e].rate,wdi_data[e].rate_count=v[e].rate_count,wdi_data[e].hit_count=v[e].hit_count,wdi_data[e].comments_data=void 0!==v[e].comments_data?v[e].comments_data:"null",wdi_data[e].carousel_media=void 0!==v[e].carousel_media?v[e].carousel_media:null}};function wdi_spider_showpopup(e,t,i,a){isPopUpOpened=!0,i.show(),wdi_spider_receivedpopup(e,t)}function wdi_spider_hasalreadyreceivedpopup(e){return-1<document.cookie.indexOf(e)&&delete document.cookie[document.cookie.indexOf(e)],!1}function wdi_spider_receivedpopup(e,t){var i=new Date;i.setDate(i.getDate()+t),document.cookie=e+"=true;expires="+i.toUTCString()+";path=/",jQuery(".wdi_image_info").mCustomScrollbar({autoHideScrollbar:!1,scrollInertia:150,advanced:{updateOnContentResize:!0}})}function wdi_spider_isunsupporteduseragent(){return!window.XMLHttpRequest}function wdi_spider_destroypopup(e){null!=document.getElementById("wdi_spider_popup_wrap")&&(wdi_comments_manager.popup_destroyed(),void 0!==jQuery().fullscreen&&jQuery.isFunction(jQuery().fullscreen)&&jQuery.fullscreen.isFullScreen()&&jQuery.fullscreen.exit(),setTimeout(function(){jQuery(".wdi_spider_popup_wrap").remove(),jQuery(".wdi_spider_popup_loading").css({display:"none"}),jQuery(".wdi_spider_popup_overlay").css({display:"none"}),jQuery(document).off("keydown"),jQuery("html").attr("style","")},20)),isPopUpOpened=!1;var t=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()),i=document.querySelector('meta[name="viewport"]');t&&i&&(i.content="width=device-width, initial-scale=1");i=jQuery(document).scrollTop();window.location.hash="",jQuery(document).scrollTop(i),"undefined"!=typeof wdi_playInterval&&clearInterval(wdi_playInterval)}function wdi_spider_ajax_save(e,t){return wdi_comments_manager.init(t),!1}function wdi_spider_set_input_value(e,t){document.getElementById(e)&&(document.getElementById(e).value=t)}function wdi_spider_form_submit(e,t){document.getElementById(t)&&document.getElementById(t).submit(),e.preventDefault?e.preventDefault():e.returnValue=!1}function wdi_spider_check_required(e,t){return""==jQuery("#"+e).val()&&(wdi_front.show_alert(t+"* "+wdi_objectL10n.wdi_field_required),jQuery("#"+e).attr("style","border-color: #FF0000;"),jQuery("#"+e).focus(),!0)}function wdi_spider_check_email(e){if(""!=jQuery("#"+e).val())return-1==jQuery("#"+e).val().replace(/^\s+|\s+$/g,"").search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)&&(wdi_front.show_alert(wdi_objectL10n.wdi_mail_validation),!0)}function wdi_captcha_refresh(e){document.getElementById(e+"_img")&&document.getElementById(e+"_input")&&(srcArr=document.getElementById(e+"_img").src.split("&r="),document.getElementById(e+"_img").src=srcArr[0]+"&r="+Math.floor(100*Math.random()),document.getElementById(e+"_img").style.display="inline-block",document.getElementById(e+"_input").value="")}function wdi_play_pause(e){var t=-1<navigator.userAgent.indexOf("Chrome"),i=-1<navigator.userAgent.indexOf("Safari");t&&i&&(i=!1),i||(i=e.get(0),e=!1,navigator.userAgent.match(/firefox/i)&&(e=!0),e||(i.paused?i.play():i.pause()))}function wdi_spider_display_embed(e,t,i,a,r){var n="";switch(e){case"EMBED_OEMBED_INSTAGRAM_VIDEO":var d="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(d+=" "+attr+'="'+a[attr]+'"');d+=" >",""!=t&&(d+='<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls><source src="'+i+'" type="video/mp4"> Your browser does not support the video tag. </video>'),n+=d+="</div>";break;case"EMBED_OEMBED_INSTAGRAM_IMAGE":d="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(d+=" "+attr+'="'+a[attr]+'"');d+=" >",""!=t&&(d+='<img src="'+i+'" style=" max-width:100% !important; max-height:100% !important; width:auto; height:auto;">'),n+=d+="</div>";break;case"EMBED_OEMBED_INSTAGRAM_CAROUSEL":d="<div ";for(attr in a)/src/i.test(attr)||""!=attr&&""!=a[attr]&&(d+=" "+attr+'="'+a[attr]+'"');d+=" >";for(var o=0;o<r.length;o++)"image"==r[o].type?d+='<img src="'+r[o].images.standard_resolution.url+'" style="max-width:100% !important; max-height:100% !important; width:auto !important; height:auto !important;" data-id="'+o+'" class="carousel_media '+(0==o?"active":"")+'">':"video"==r[o].type&&(void 0!==r[o].videos&&void 0!==r[o].videos.standard_resolution&&void 0!==r[o].videos.standard_resolution.url&&(i=r[o].videos.standard_resolution.url),d+='<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls data-id="'+o+'" class="carousel_media '+(0==o?"active":"")+'"><source src="'+i+'" type="video/mp4"> Your browser does not support the video tag. </video>');n+=d+="</div>"}return n}function wdi_testBrowser_cssTransitions(){return wdi_testDom("Transition")}function wdi_testBrowser_cssTransforms3d(){return wdi_testDom("Perspective")}function wdi_testDom(e){for(var t=["","Webkit","Moz","ms","O","Khtml"],i=t.length;i--;)if(void 0!==document.body.style[t[i]+e])return!0;return!1}function wdi_cube(e,t,i,a,r,n,d,o,s,_){return wdi_testBrowser_cssTransitions()?wdi_testBrowser_cssTransforms3d()?(wdi_trans_in_progress=!0,jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive"),jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active"),jQuery(".wdi_slide_bg").css("perspective",1e3),jQuery(o).css({transform:"translateZ("+e+"px)",backfaceVisibility:"hidden"}),jQuery(s).css({opacity:1,filter:"Alpha(opacity=100)",backfaceVisibility:"hidden",transform:"translateY("+i+"px) translateX("+t+"px) rotateY("+r+"deg) rotateX("+a+"deg)"}),jQuery(".wdi_slider").css({transform:"translateZ(-"+e+"px)",transformStyle:"preserve-3d"}),setTimeout(function(){jQuery(".wdi_slider").css({transition:"all "+wdi_transition_duration+"ms ease-in-out",transform:"translateZ(-"+e+"px) rotateX("+n+"deg) rotateY("+d+"deg)"})},20),void jQuery(".wdi_slider").one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(function(){jQuery(o).removeAttr("style"),jQuery(s).removeAttr("style"),jQuery(".wdi_slider").removeAttr("style"),jQuery(o).css({opacity:0,filter:"Alpha(opacity=0)","z-index":1}),jQuery(s).css({opacity:1,filter:"Alpha(opacity=100)","z-index":2}),wdi_trans_in_progress=!1,jQuery(o).html(""),"undefined"==typeof event_stack||0<event_stack.length&&(key=event_stack[0].split("-"),event_stack.shift(),wdi_change_image(key[0],key[1],wdi_data,!0));wdi_change_watermark_container()}))):wdi_fallback3d(o,s,_):wdi_fallback(o,s,_)}function wdi_cubeH(e,t,i){var a=jQuery(e).width()/2;"right"==i?wdi_cube(a,a,0,0,90,0,-90,e,t,i):"left"==i&&wdi_cube(a,-a,0,0,-90,0,90,e,t,i)}function wdi_cubeV(e,t,i){var a=jQuery(e).height()/2;"right"==i?wdi_cube(a,0,-a,90,0,-90,0,e,t,i):"left"==i&&wdi_cube(a,0,a,-90,0,90,0,e,t,i)}function wdi_fallback(e,t,i){wdi_fade(e,t,i)}function wdi_fallback3d(e,t,i){wdi_sliceV(e,t,i)}function wdi_none(e,t,i){jQuery(e).css({opacity:0,"z-index":1}),jQuery(t).css({opacity:1,"z-index":2}),jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive"),jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active"),wdi_trans_in_progress=!1,jQuery(e).html(""),wdi_change_watermark_container()}function wdi_fade(e,t,i){jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive"),jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active"),wdi_testBrowser_cssTransitions()?(jQuery(t).css("transition","opacity "+wdi_transition_duration+"ms linear"),jQuery(e).css({opacity:0,"z-index":1}),jQuery(t).css({opacity:1,"z-index":2}),wdi_change_watermark_container()):(jQuery(e).animate({opacity:0,"z-index":1},wdi_transition_duration),jQuery(t).animate({opacity:1,"z-index":2},{duration:wdi_transition_duration,complete:function(){wdi_trans_in_progress=!1,jQuery(e).html(""),wdi_change_watermark_container()}}),jQuery(e).fadeTo(wdi_transition_duration,0),jQuery(t).fadeTo(wdi_transition_duration,1))}function wdi_grid(e,t,i,a,r,n,d,o,s,_){if(!wdi_testBrowser_cssTransitions())return wdi_fallback(o,s,_);wdi_trans_in_progress=!0,jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive"),jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");var m=wdi_transition_duration/(e+t);var c=jQuery(o).find("img"),u=jQuery('<span style="display: block;" />').addClass("wdi_grid");jQuery(o).prepend(u);var l=jQuery(".wdi_slide_bg"),w=c.width(),p=c.height(),_=l.width(),l=l.height(),h=Math.floor(_/e),g=Math.floor(l/t),y=_-e*h,f=Math.ceil(y/e),v=l-t*g,b=Math.ceil(v/t),j=0,Q=Math.ceil((jQuery(".wdi_slide_bg").width()-c.width())/2),k=void 0===c.attr("src")?"":c.attr("src");a="min-auto"===(a="auto"===a?_:a)?-_:a,r="min-auto"===(r="auto"===r?l:r)?-l:r;for(var x,C,E,M,I,A,B,O,T,D,S=0;S<e;S++){var z,K=0,R=Math.floor((jQuery(".wdi_slide_bg").height()-c.height())/2),V=h;0<y&&(V+=z=f<=y?f:y,y-=z);for(var L=0;L<t;L++){var G=g,H=v;0<H&&(G+=z=b<=H?b:v,0),u.append((x=V,C=G,E=K,M=R,I=j,A=Q,B=k,O=w,T=p,D=(S+(D=L))*m,jQuery('<span class="wdi_gridlet" />').css({display:"block",width:x,height:C,top:E,left:I,backgroundImage:'url("'+B+'")',backgroundColor:jQuery(".wdi_spider_popup_wrap").css("background-color"),backgroundRepeat:"no-repeat",backgroundPosition:A+"px "+M+"px",backgroundSize:O+"px "+T+"px",transition:"all "+wdi_transition_duration+"ms ease-in-out "+D+"ms",transform:"none"}))),K+=G,R-=G}Q-=V,j+=V}l=u.children().last();u.show(),c.css("opacity",0),u.children().first().addClass("rs-top-left"),u.children().last().addClass("rs-bottom-right"),u.children().eq(t-1).addClass("rs-bottom-left"),u.children().eq(-t).addClass("rs-top-right"),setTimeout(function(){u.children().css({opacity:d,transform:"rotate("+i+"deg) translateX("+a+"px) translateY("+r+"px) scale("+n+")"})},1),jQuery(s).css("opacity",1),jQuery(l).one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(function(){jQuery(o).css({opacity:0,"z-index":1}),jQuery(s).css({opacity:1,"z-index":2}),c.css("opacity",1),u.remove(),wdi_trans_in_progress=!1,jQuery(o).html(""),"undefined"==typeof event_stack||0<event_stack.length&&(key=event_stack[0].split("-"),event_stack.shift(),wdi_change_image(key[0],key[1],wdi_data,!0));wdi_change_watermark_container()}))}function wdi_sliceH(e,t,i){var a;"right"==i?a="min-auto":"left"==i&&(a="auto"),wdi_grid(1,8,0,a,0,1,0,e,t,i)}function wdi_sliceV(e,t,i){var a;"right"==i?a="min-auto":"left"==i&&(a="auto"),wdi_grid(10,1,0,0,a,1,0,e,t,i)}function wdi_slideV(e,t,i){var a;"right"==i?a="auto":"left"==i&&(a="min-auto"),wdi_grid(1,1,0,0,a,1,1,e,t,i)}function wdi_slideH(e,t,i){var a;"right"==i?a="min-auto":"left"==i&&(a="auto"),wdi_grid(1,1,0,a,0,1,1,e,t,i)}function wdi_scaleOut(e,t,i){wdi_grid(1,1,0,0,0,1.5,0,e,t,i)}function wdi_scaleIn(e,t,i){wdi_grid(1,1,0,0,0,.5,0,e,t,i)}function wdi_blockScale(e,t,i){wdi_grid(8,6,0,0,0,.6,0,e,t,i)}function wdi_kaleidoscope(e,t,i){wdi_grid(10,8,0,0,0,1,0,e,t,i)}function wdi_fan(e,t,i){var a,r;"right"==i?(a=45,r=100):"left"==i&&(a=-45,r=-100),wdi_grid(1,10,a,r,0,1,0,e,t,i)}function wdi_blindV(e,t,i){wdi_grid(1,8,0,0,0,.7,0,e,t)}function wdi_blindH(e,t,i){wdi_grid(10,1,0,0,0,.7,0,e,t)}function wdi_random(e,t,i){var a=["sliceH","sliceV","slideH","slideV","scaleOut","scaleIn","blockScale","kaleidoscope","fan","blindH","blindV"];this["wdi_"+a[Math.floor(Math.random()*a.length)]](e,t,i)}function wdi_pause_stream(e){jQuery(e).find("video").each(function(){jQuery(this).get(0).pause()})}function wdi_reset_zoom(){var e=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()),t=document.querySelector('meta[name="viewport"]');e&&t&&(t.content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0")}Object.size=function(e){var t,i=0;for(t in e)e.hasOwnProperty(t)&&i++;return i},wdi_comments_manager={media_id:"",mediaComments:[],load_more_count:10,commentCounter:0,currentKey:-1,init:function(e){this.instagram=new WDIInstagram,this.instagram.addToken(wdi_front.access_token),this.currentKey!=e&&(this.currentKey=e,this.reset_comments())},reset_comments:function(){jQuery("#wdi_load_more_comments").remove(),jQuery("#wdi_added_comments").html(""),this.commentCounter=0,this.media_id=wdi_data[this.currentKey].id,this.getAjaxComments(this.currentKey)},clear_comments:function(){jQuery("#wdi_load_more_comments").remove(),jQuery("#wdi_added_comments").html(""),this.commentCounter=0},popup_destroyed:function(){this.media_id="",this.mediaComments=[],this.commentCounter=0,this.currentKey=-1},showComments:function(e,t){(Object.size(e)-this.commentCounter-t<0||void 0===t)&&(t=Object.size(e)-this.commentCounter);var a=this.commentCounter;for(i=Object.size(e)-a-1;i>=Object.size(e)-a-t;i--){this.commentCounter++;var r=e[i].text,r=wdi_front.escape_tags(r);r=this.filterCommentText(r);var n=e[i].username,d=jQuery('<div class="wdi_single_comment"></div>');d.append(jQuery('<p class="wdi_comment_header_p"><span class="wdi_comment_header"><a target="_blank" href="//instagram.com/'+n+'">'+n+'</a></span><span class="wdi_comment_date">'+wdi_front.convertUnixDate(e[i].timestamp)+"</span></p>")),d.append(jQuery('<div class="wdi_comment_body_p"><span class="wdi_comment_body"><p>'+r+"</p></span></div>")),jQuery("#wdi_added_comments").prepend(d)}0==jQuery(".wdi_single_comment").length&&jQuery("#wdi_added_comments").html('<p class="wdi_no_comment">There are no comments to show</p>'),this.updateScrollbar()},updateScrollbar:function(){var e=jQuery("#wdi_comments"),t=jQuery("#wdi_added_comments");jQuery(".wdi_comments").attr("class","wdi_comments"),jQuery(".wdi_comments").html(""),jQuery(".wdi_comments").append(e),jQuery(".wdi_comments").append(t),void 0!==jQuery().mCustomScrollbar&&jQuery.isFunction(jQuery().mCustomScrollbar)&&jQuery(".wdi_comments").mCustomScrollbar({scrollInertia:250}),jQuery(".wdi_comments_close_btn").on("click",wdi_comment)},getAjaxComments:function(){var e="";void 0!==wdi_data[wdi_comments_manager.currentKey].comments_data.next&&(e=wdi_data[wdi_comments_manager.currentKey].comments_data.next),this.instagram.getRecentMediaComments(this.media_id,{success:function(e){if(""==e||null==e||null==e||void 0!==e.error)return errorMessage="Network Error, please try again later :(",console.log("%c"+errorMessage,"color:#cc0000;"),void jQuery("#wdi_added_comments").html('<p class="wdi_no_comment">Comments are currently unavailable</p>');if(200!=e.meta.code)return errorMessage=e.meta.error_message,console.log("%c"+errorMessage,"color:#cc0000;"),void jQuery("#wdi_added_comments").html('<p class="wdi_no_comment">Comments are currently unavailable</p>');void 0!==wdi_data[wdi_comments_manager.currentKey].comments_data.data?(wdi_data[wdi_comments_manager.currentKey].comments_data.data=e.data.concat(wdi_data[wdi_comments_manager.currentKey].comments_data.data),wdi_data[wdi_comments_manager.currentKey].comment_count+=wdi_data[wdi_comments_manager.currentKey].comments_data.data.length):(wdi_data[wdi_comments_manager.currentKey].comments_data=e,wdi_data[wdi_comments_manager.currentKey].comment_count=wdi_data[wdi_comments_manager.currentKey].comments_data.data.length),wdi_data[wdi_comments_manager.currentKey].comments_data.next=void 0!==e.paging?e.paging.next:"",wdi_comments_manager.mediaComments=e.data;var t=wdi_data[wdi_comments_manager.currentKey];wdi_comments_manager.showComments(t.comments_data.data,wdi_comments_manager.load_more_count),wdi_comments_manager.ajax_comments_ready(e.data)}},e)},ajax_comments_ready:function(e){this.createLoadMoreAndBindEvent(wdi_comments_manager.currentKey)},createLoadMoreAndBindEvent:function(e){""==e&&(e=wdi_comments_manager.currentKey),(""!==wdi_data[e].comments_data.next||wdi_data[e].comments_data.data.length>wdi_comments_manager.load_more_count&&jQuery(".wdi_single_comment").length<wdi_data[e].comments_data.data.length&&0==jQuery("#wdi_load_more_comments").length)&&jQuery("#wdi_added_comments").prepend(jQuery('<p id="wdi_load_more_comments" class="wdi_load_more_comments">load more comments</p>')),jQuery(".wdi_comment_container #wdi_load_more_comments").on("click",function(){wdi_comments_manager.commentCounter+wdi_comments_manager.load_more_count>wdi_data[e].comments_data.data.length&&""!=wdi_data[e].comments_data.next&&wdi_comments_manager.getAjaxComments(this.currentKey),jQuery(this).remove(),wdi_comments_manager.showComments(wdi_data[e].comments_data.data,wdi_comments_manager.load_more_count),wdi_comments_manager.createLoadMoreAndBindEvent(wdi_comments_manager.currentKey)})},filterCommentText:function(e){for(var t=e.split(" "),i="",a=0;a<t.length;a++)switch(t[a][0]){case"@":i+='<a target="blank" class="wdi_comm_text_link" href="//instagram.com/'+t[a].substring(1,t[a].length)+'">'+t[a]+"</a> ";break;case"#":i+='<a target="blank" class="wdi_comm_text_link" href="//instagram.com/explore/tags/'+t[a].substring(1,t[a].length)+'">'+t[a]+"</a> ";break;default:i+=t[a]+" "}return i=i.substring(0,i.length-1)}};
|
js/wdi_frontend.js
CHANGED
|
@@ -102,6 +102,7 @@ wdi_front.globalInit = function () {
|
|
| 102 |
|
| 103 |
wdi_front.access_token = currentFeed['feed_row']['access_token'];
|
| 104 |
|
|
|
|
| 105 |
currentFeed.dataStorageRaw = []; //stores all getted data from instagram api
|
| 106 |
currentFeed.dataStorage = []; //stores all avialable data
|
| 107 |
currentFeed.dataStorageList = []; //?
|
|
@@ -163,7 +164,7 @@ wdi_front.globalInit = function () {
|
|
| 163 |
currentFeed.feed_row.resort_after_load_more = 0;
|
| 164 |
if (currentFeed.feed_row.feed_type != 'image_browser') {
|
| 165 |
currentFeed.feed_row.load_more_number = parseInt(currentFeed.feed_row.pagination_per_page_number);
|
| 166 |
-
currentFeed.feed_row.number_of_photos =
|
| 167 |
} else {
|
| 168 |
currentFeed.feed_row.number_of_photos = 1 + parseInt(currentFeed.feed_row.image_browser_preload_number);
|
| 169 |
currentFeed.feed_row.load_more_number = parseInt(currentFeed.feed_row.image_browser_load_number);
|
|
@@ -361,11 +362,13 @@ wdi_front.instagramRequest = function (id, currentFeed) {
|
|
| 361 |
user_name: user.username,
|
| 362 |
success: function (response) {
|
| 363 |
if ( ( typeof response.error != 'undefined' && response.error.type != 'undefined' ) || ( typeof response.meta != 'undefined' && response.meta.error == true ) ) {
|
|
|
|
| 364 |
wdi_front.show_alert(false, response, currentFeed);
|
| 365 |
return false;
|
| 366 |
}
|
| 367 |
currentFeed.mediaRequestsDone = true;
|
| 368 |
response = _this.checkMediaResponse(response, currentFeed);
|
|
|
|
| 369 |
if ( response != false ) {
|
| 370 |
_this.saveUserData(response, currentFeed.feed_users[id], currentFeed);
|
| 371 |
}
|
|
@@ -384,13 +387,17 @@ wdi_front.instagramRequest = function (id, currentFeed) {
|
|
| 384 |
user_name: feed_users[id].username,
|
| 385 |
success: function (response) {
|
| 386 |
if ( typeof response.meta != 'undefined' && typeof response.meta.error == true ) {
|
|
|
|
| 387 |
wdi_front.show_alert(false, response, currentFeed);
|
| 388 |
return false;
|
| 389 |
}
|
| 390 |
currentFeed.mediaRequestsDone = true;
|
|
|
|
| 391 |
response = _this.checkMediaResponse(response, currentFeed);
|
| 392 |
if ( response != false ) {
|
| 393 |
_this.saveUserData(response, currentFeed.feed_users[id], currentFeed);
|
|
|
|
|
|
|
| 394 |
}
|
| 395 |
}
|
| 396 |
}, '', 0);
|
|
@@ -540,49 +547,67 @@ wdi_front.appendRequestHashtag = function (data, hashtag) {
|
|
| 540 |
* also checks if one request is not enough for displaying all images user wanted
|
| 541 |
* it recursively calls wdi_front.loadMore() until the desired number of photos is reached
|
| 542 |
*/
|
| 543 |
-
wdi_front.displayFeed = function (currentFeed,
|
| 544 |
-
if(currentFeed.data.length >= currentFeed.allResponseLength) {
|
| 545 |
-
if (currentFeed.feed_row.feed_display_view == 'load_more_btn') {
|
| 546 |
-
var wdi_feed_counter = currentFeed.feed_row['wdi_feed_counter'];
|
| 547 |
-
jQuery('#wdi_feed_' + wdi_feed_counter).find('.wdi_load_more').remove();
|
| 548 |
-
jQuery('#wdi_feed_' + wdi_feed_counter).find('.wdi_spinner').remove();
|
| 549 |
-
}
|
| 550 |
-
return;
|
| 551 |
-
}
|
| 552 |
-
if (currentFeed.customFilterChanged == false) {
|
| 553 |
-
// sorting data...
|
| 554 |
-
var data = wdi_front.feedSort(currentFeed, load_more_number);
|
| 555 |
-
}
|
| 556 |
-
|
| 557 |
-
//becomes true when user clicks in frontend filter
|
| 558 |
-
//if isset to true then loadmore recursion would not start
|
| 559 |
-
var frontendCustomFilterClicked = currentFeed.customFilterChanged;
|
| 560 |
|
| 561 |
-
|
| 562 |
-
|
| 563 |
-
|
| 564 |
|
| 565 |
-
|
| 566 |
-
currentFeed
|
|
|
|
|
|
|
| 567 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 568 |
|
| 569 |
-
|
| 570 |
-
if (currentFeed.feed_row.
|
| 571 |
-
|
| 572 |
-
|
| 573 |
-
|
| 574 |
-
|
| 575 |
-
currentFeed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 576 |
}
|
| 577 |
} else {
|
| 578 |
-
|
| 579 |
-
|
| 580 |
-
|
| 581 |
-
|
| 582 |
-
currentFeed
|
|
|
|
|
|
|
|
|
|
|
|
|
| 583 |
}
|
| 584 |
}
|
| 585 |
|
|
|
|
|
|
|
|
|
|
| 586 |
//checking feed_type and calling proper rendering functions
|
| 587 |
if (currentFeed.feed_row.feed_type == 'masonry') {
|
| 588 |
wdi_front.masonryDisplayFeedItems(data, currentFeed);
|
|
@@ -592,34 +617,6 @@ wdi_front.displayFeed = function (currentFeed, load_more_number) {
|
|
| 592 |
wdi_front.displayFeedItems(data, currentFeed);
|
| 593 |
}
|
| 594 |
|
| 595 |
-
//recursively calling load more to get photos
|
| 596 |
-
var dataLength = wdi_front.getDataLength(currentFeed);
|
| 597 |
-
|
| 598 |
-
// Counting how many images had to load during the pagination according to options
|
| 599 |
-
var mustLoadedCount = parseInt(currentFeed.feed_row.number_of_photos)+parseInt(currentFeed.feed_row.load_more_number*currentFeed.currentPageLoadMore);
|
| 600 |
-
if (dataLength < mustLoadedCount && !frontendCustomFilterClicked && currentFeed.instagramRequestCounter <= currentFeed.maxConditionalFiltersRequestCount && !wdi_front.allDataHasFinished(currentFeed)) {
|
| 601 |
-
wdi_front.loadMore('', currentFeed);
|
| 602 |
-
}
|
| 603 |
-
else {
|
| 604 |
-
currentFeed.currentPageLoadMore++;
|
| 605 |
-
wdi_front.allImagesLoaded(currentFeed);
|
| 606 |
-
}
|
| 607 |
-
|
| 608 |
-
/**
|
| 609 |
-
* if maximum number of requests are reached then stop laoding more images and show images which are available
|
| 610 |
-
* @param {Number} currentFeed.instagramRequestCounter > currentFeed.maxConditionalFiltersRequestCount [description]
|
| 611 |
-
* @return {Boolean}
|
| 612 |
-
*/
|
| 613 |
-
if (currentFeed.instagramRequestCounter > currentFeed.maxConditionalFiltersRequestCount) {
|
| 614 |
-
wdi_front.allImagesLoaded(currentFeed);
|
| 615 |
-
|
| 616 |
-
//if no data was received then
|
| 617 |
-
if (data.length == 0) {
|
| 618 |
-
//if feed_display_view is set to infinite scroll then after reaching the limit once set this flag to false
|
| 619 |
-
//this will stop infinite scrolling and will not load any images even when scrolling
|
| 620 |
-
currentFeed.stopInfiniteScrollFlag = true;
|
| 621 |
-
}
|
| 622 |
-
}
|
| 623 |
|
| 624 |
//checking if display_view is pagination and we are not on the last page then enable
|
| 625 |
//last page button
|
|
@@ -627,27 +624,8 @@ wdi_front.displayFeed = function (currentFeed, load_more_number) {
|
|
| 627 |
jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter).find('#wdi_last_page').removeClass('wdi_disabled');
|
| 628 |
}
|
| 629 |
|
| 630 |
-
// reset instagram request counter to zero for next set of requests
|
| 631 |
-
currentFeed.instagramRequestCounter = 0;
|
| 632 |
-
|
| 633 |
-
//reset conditional filter buffer for the next bunch of requests
|
| 634 |
-
currentFeed.conditionalFilterBuffer = [];
|
| 635 |
-
|
| 636 |
//if there are any missing images in header then replace them with new ones if possible
|
| 637 |
wdi_front.updateUsersImages(currentFeed);
|
| 638 |
-
|
| 639 |
-
// /**
|
| 640 |
-
// * Enable image lazy laoding if pagination is not enabeled because pagination has option for preloading images
|
| 641 |
-
// * which is the opposide of lazy load
|
| 642 |
-
// */
|
| 643 |
-
// if( currentFeed.feed_row.feed_display_view != 'pagination' ){
|
| 644 |
-
// jQuery(function() {
|
| 645 |
-
// jQuery('img.wdi_img').lazyload({
|
| 646 |
-
// skip_invisible : false,
|
| 647 |
-
// threshold : 400
|
| 648 |
-
// });
|
| 649 |
-
// });
|
| 650 |
-
// }
|
| 651 |
}
|
| 652 |
|
| 653 |
/**
|
|
@@ -674,6 +652,24 @@ wdi_front.updateUsersImages = function (currentFeed) {
|
|
| 674 |
});
|
| 675 |
}
|
| 676 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 677 |
/**
|
| 678 |
* Displays data in masonry layout
|
| 679 |
* @param {Object} data data to be displayed
|
|
@@ -763,14 +759,16 @@ wdi_front.masonryDisplayFeedItems = function (data, currentFeed) {
|
|
| 763 |
}
|
| 764 |
}
|
| 765 |
|
|
|
|
|
|
|
| 766 |
//binding onload event for ajax loader
|
| 767 |
currentFeed.wdi_loadedImages = 0;
|
| 768 |
var columnFlag = false;
|
| 769 |
currentFeed.wdi_load_count = i;
|
| 770 |
var wdi_feed_counter = currentFeed.feed_row['wdi_feed_counter'];
|
| 771 |
-
var feed_wrapper = jQuery('#wdi_feed_' + wdi_feed_counter + '
|
| 772 |
currentFeed.wdi_loadedImages++;
|
| 773 |
-
|
| 774 |
|
| 775 |
//calls wdi_responsive.columnControl() which calculates column number on page
|
| 776 |
//and gives feed_wrapper proper column class
|
|
@@ -778,40 +776,10 @@ wdi_front.masonryDisplayFeedItems = function (data, currentFeed) {
|
|
| 778 |
wdi_responsive.columnControl(currentFeed, 1);
|
| 779 |
columnFlag = true;
|
| 780 |
}
|
| 781 |
-
|
| 782 |
-
//Binds caption opening and closing event to each image photo_title/mmmmmm
|
| 783 |
-
// if (currentFeed.feed_row.feed_type != 'blog_style') {
|
| 784 |
-
// wdi_responsive.bindMasonryCaptionEvent(jQuery(this).parent().parent().parent().parent().find('.wdi_photo_title'), currentFeed);
|
| 785 |
-
// }
|
| 786 |
-
|
| 787 |
});
|
| 788 |
|
| 789 |
-
checkLoaded();
|
| 790 |
-
/**
|
| 791 |
-
* if feed type is not blog style then after displaying images assign click evetns to their captions
|
| 792 |
-
* this part of code is a bit differenet from free version because of image lazy loading feature
|
| 793 |
-
*
|
| 794 |
-
* in free version events are assigned directly in onload event, but when lazy loading added it cased duplicate event fireing
|
| 795 |
-
* so event assigning moved to here
|
| 796 |
-
*
|
| 797 |
-
*/
|
| 798 |
-
// if ( currentFeed.feed_row.feed_type != 'blog_style' ){
|
| 799 |
-
// jQuery('#wdi_feed_'+currentFeed.feed_row.wdi_feed_counter+' .wdi_photo_title').each(function(){
|
| 800 |
-
// wdi_responsive.bindMasonryCaptionEvent(jQuery(this),currentFeed);
|
| 801 |
-
// });
|
| 802 |
-
// }
|
| 803 |
-
|
| 804 |
|
| 805 |
-
//checks if all iamges have been succesfully loaded then it updates variables for next time use
|
| 806 |
-
function checkLoaded() {
|
| 807 |
-
|
| 808 |
-
if (currentFeed.wdi_load_count === currentFeed.wdi_loadedImages && currentFeed.wdi_loadedImages != 0) {
|
| 809 |
-
currentFeed.loadedImages = 0;
|
| 810 |
-
currentFeed.wdi_load_count = 0;
|
| 811 |
-
wdi_front.allImagesLoaded(currentFeed);
|
| 812 |
-
|
| 813 |
-
}
|
| 814 |
-
}
|
| 815 |
|
| 816 |
//checking if pagination next button was clicked then change page
|
| 817 |
if (currentFeed.paginatorNextFlag == true) {
|
|
@@ -874,152 +842,84 @@ wdi_front.displayFeedItems = function (data, currentFeed) {
|
|
| 874 |
//no feed in DOM, ignore
|
| 875 |
return;
|
| 876 |
}
|
| 877 |
-
|
| 878 |
//gets ready data, gets data template, and appens it into feed_wrapper
|
| 879 |
var wdi_feed_counter = currentFeed.feed_row['wdi_feed_counter'];
|
| 880 |
var feed_wrapper = jQuery('#wdi_feed_' + wdi_feed_counter + ' .wdi_feed_wrapper');
|
| 881 |
-
|
| 882 |
-
|
| 883 |
-
|
| 884 |
-
|
| 885 |
-
|
| 886 |
-
|
| 887 |
-
|
| 888 |
-
|
| 889 |
-
|
| 890 |
-
|
| 891 |
-
|
| 892 |
-
currentFeed.customFilterChanged = false;
|
| 893 |
-
}
|
| 894 |
-
|
| 895 |
-
var lastIndex = wdi_front.getImgCount(currentFeed) - data.length - 1;
|
| 896 |
-
|
| 897 |
-
/**
|
| 898 |
-
* if feed display view is set to pagination then check if the current page has not enough photos to be a complete page then
|
| 899 |
-
* --currentPage so that after loading new images we stay on the same page and see new images which will be located in that page
|
| 900 |
-
* also do the same thing when recievied data has lenght equal to zero
|
| 901 |
-
*/
|
| 902 |
-
if (currentFeed.feed_row.feed_display_view == 'pagination') {
|
| 903 |
-
var local_load_more_number = currentFeed.feed_row.load_more_number;
|
| 904 |
-
if(currentFeed.feed_row.feed_type == 'image_browser') {
|
| 905 |
-
local_load_more_number = 1;
|
| 906 |
-
}
|
| 907 |
-
if (jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter + ' [wdi_page="' + (currentFeed.currentPage - 1) + '"]').length < local_load_more_number || data.length == 0) {
|
| 908 |
-
currentFeed.currentPage = (--currentFeed.currentPage <= 1) ? 1 : currentFeed.currentPage;
|
| 909 |
}
|
| 910 |
-
|
| 911 |
-
|
| 912 |
-
|
| 913 |
for (var i = 0; i < data.length; i++) {
|
| 914 |
-
if(
|
| 915 |
return;
|
| 916 |
}
|
| 917 |
-
if (
|
| 918 |
-
if (
|
| 919 |
continue;
|
| 920 |
}
|
| 921 |
}
|
| 922 |
var wdi_media_type = "";
|
| 923 |
-
|
|
|
|
| 924 |
wdi_media_type = data[i]["wdi_hashtag"];
|
| 925 |
}
|
| 926 |
if (data[i]['type'] == 'image') {
|
| 927 |
var photoTemplate = wdi_front.getPhotoTemplate(currentFeed, wdi_media_type);
|
| 928 |
-
}
|
|
|
|
| 929 |
var photoTemplate = wdi_front.getVideoTemplate(currentFeed, wdi_media_type);
|
| 930 |
}
|
| 931 |
-
else{
|
| 932 |
var photoTemplate = wdi_front.getSliderTemplate(currentFeed, wdi_media_type);
|
| 933 |
}
|
| 934 |
-
|
| 935 |
var rawItem = data[i];
|
| 936 |
var item = wdi_front.createObject(rawItem, currentFeed);
|
| 937 |
-
|
| 938 |
var html = '';
|
| 939 |
/* undefined when carousel media not defined */
|
| 940 |
-
if(
|
| 941 |
html = photoTemplate(item);
|
| 942 |
}
|
| 943 |
feed_wrapper.html(feed_wrapper.html() + html);
|
| 944 |
-
|
| 945 |
currentFeed.imageIndex++;
|
| 946 |
//changing responsive indexes for pagination
|
| 947 |
if (currentFeed.feed_row.feed_display_view == 'pagination') {
|
| 948 |
if ((i + 1) % currentFeed.feed_row.pagination_per_page_number === 0) {
|
| 949 |
currentFeed.resIndex += currentFeed.freeSpaces + 1;
|
| 950 |
-
}
|
|
|
|
| 951 |
currentFeed.resIndex++;
|
| 952 |
}
|
| 953 |
}
|
| 954 |
}
|
| 955 |
-
|
| 956 |
-
|
| 957 |
-
//fixing last row in case of full caption is open
|
| 958 |
-
//for that triggering click twice to open and close caption text that will fix last row
|
| 959 |
-
/*ttt 1.1.12*/
|
| 960 |
-
//jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' .wdi_feed_wrapper [wdi_index=' + lastIndex + '] .wdi_photo_title').trigger(wdi_front.clickOrTouch);
|
| 961 |
-
//jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' .wdi_feed_wrapper [wdi_index=' + lastIndex + '] .wdi_photo_title').trigger(wdi_front.clickOrTouch);
|
| 962 |
-
|
| 963 |
-
|
| 964 |
-
//binding onload event for ajax loader
|
| 965 |
-
currentFeed.wdi_loadedImages = 0;
|
| 966 |
-
var columnFlag = false;
|
| 967 |
-
currentFeed.wdi_load_count = i;
|
| 968 |
-
var wdi_feed_counter = currentFeed.feed_row['wdi_feed_counter'];
|
| 969 |
-
var feed_wrapper = jQuery('#wdi_feed_' + wdi_feed_counter + ' img.wdi_img').on('load', function ()
|
| 970 |
-
{
|
| 971 |
-
currentFeed.wdi_loadedImages++;
|
| 972 |
-
checkLoaded();
|
| 973 |
-
|
| 974 |
-
//calls wdi_responsive.columnControl() which calculates column number on page
|
| 975 |
-
//and gives feed_wrapper proper column class
|
| 976 |
-
if (columnFlag === false) {
|
| 977 |
-
wdi_responsive.columnControl(currentFeed, 1);
|
| 978 |
-
columnFlag = true;
|
| 979 |
-
}
|
| 980 |
-
|
| 981 |
-
// //Binds caption opening and closing event to each image photo_title/mmmmmm
|
| 982 |
-
// if (currentFeed.feed_row.feed_type != 'blog_style') {
|
| 983 |
-
// wdi_responsive.bindCaptionEvent(jQuery(this).parent().parent().parent().parent().find('.wdi_photo_title'), currentFeed);
|
| 984 |
-
// }
|
| 985 |
-
});
|
| 986 |
-
|
| 987 |
-
|
| 988 |
-
/**
|
| 989 |
-
* if feed type is not blog style then after displaying images assign click evetns to their captions
|
| 990 |
-
* this part of code is a bit differenet from free version because of image lazy loading feature
|
| 991 |
-
*
|
| 992 |
-
* in free version events are assigned directly in onload event, but when lazy loading added it cased duplicate event fireing
|
| 993 |
-
* so event assigning moved to here
|
| 994 |
-
*
|
| 995 |
-
*/
|
| 996 |
-
// if ( currentFeed.feed_row.feed_type != 'blog_style' ){
|
| 997 |
-
// jQuery('#wdi_feed_'+currentFeed.feed_row.wdi_feed_counter+' .wdi_photo_title').each(function(){
|
| 998 |
-
// wdi_responsive.bindCaptionEvent(jQuery(this),currentFeed);
|
| 999 |
-
// });
|
| 1000 |
-
|
| 1001 |
-
// }
|
| 1002 |
-
|
| 1003 |
|
| 1004 |
//checks if all iamges have been succesfully loaded then it updates variables for next time use
|
| 1005 |
function checkLoaded()
|
| 1006 |
{
|
| 1007 |
-
|
| 1008 |
-
currentFeed.loadedImages = 0;
|
| 1009 |
-
currentFeed.wdi_load_count = 0;
|
| 1010 |
-
wdi_front.allImagesLoaded(currentFeed);
|
| 1011 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1012 |
}
|
|
|
|
|
|
|
|
|
|
| 1013 |
}
|
| 1014 |
-
|
| 1015 |
-
//checking if pagination next button was clicked then change page
|
| 1016 |
-
if (currentFeed.paginatorNextFlag == true) {
|
| 1017 |
-
wdi_front.updatePagination(currentFeed, 'next');
|
| 1018 |
-
}
|
| 1019 |
-
|
| 1020 |
-
//check if load more done successfully then set infinite scroll flag to false
|
| 1021 |
-
currentFeed.infiniteScrollFlag = false;
|
| 1022 |
-
|
| 1023 |
}
|
| 1024 |
|
| 1025 |
wdi_front.checkFeedFinished = function (currentFeed) {
|
|
@@ -1031,193 +931,6 @@ wdi_front.checkFeedFinished = function (currentFeed) {
|
|
| 1031 |
return true;
|
| 1032 |
}
|
| 1033 |
|
| 1034 |
-
wdi_front.sortingOperator = function (sortImagesBy, sortOrder) {
|
| 1035 |
-
var operator;
|
| 1036 |
-
switch (sortImagesBy) {
|
| 1037 |
-
case 'date':
|
| 1038 |
-
{
|
| 1039 |
-
switch (sortOrder) {
|
| 1040 |
-
case 'asc':
|
| 1041 |
-
{
|
| 1042 |
-
operator = function (a, b)
|
| 1043 |
-
{
|
| 1044 |
-
return (a['created_time'] > b['created_time']) ? 1 : -1;
|
| 1045 |
-
}
|
| 1046 |
-
break;
|
| 1047 |
-
}
|
| 1048 |
-
case 'desc':
|
| 1049 |
-
{
|
| 1050 |
-
operator = function (a, b)
|
| 1051 |
-
{
|
| 1052 |
-
return (a['created_time'] > b['created_time']) ? -1 : 1;
|
| 1053 |
-
}
|
| 1054 |
-
break;
|
| 1055 |
-
}
|
| 1056 |
-
}
|
| 1057 |
-
break;
|
| 1058 |
-
}
|
| 1059 |
-
case 'likes':
|
| 1060 |
-
{
|
| 1061 |
-
switch (sortOrder) {
|
| 1062 |
-
case 'asc':
|
| 1063 |
-
{
|
| 1064 |
-
operator = function (a, b)
|
| 1065 |
-
{
|
| 1066 |
-
return (a['likes']['count'] < b['likes']['count']) ? -1 : 1;
|
| 1067 |
-
}
|
| 1068 |
-
break;
|
| 1069 |
-
}
|
| 1070 |
-
case 'desc':
|
| 1071 |
-
{
|
| 1072 |
-
operator = function (a, b)
|
| 1073 |
-
{
|
| 1074 |
-
return (a['likes']['count'] < b['likes']['count']) ? 1 : -1;
|
| 1075 |
-
}
|
| 1076 |
-
break;
|
| 1077 |
-
}
|
| 1078 |
-
}
|
| 1079 |
-
break;
|
| 1080 |
-
}
|
| 1081 |
-
case 'comments':
|
| 1082 |
-
{
|
| 1083 |
-
switch (sortOrder) {
|
| 1084 |
-
case 'asc':
|
| 1085 |
-
{
|
| 1086 |
-
operator = function (a, b)
|
| 1087 |
-
{
|
| 1088 |
-
return (a['comments']['count'] < b['comments']['count']) ? -1 : 1;
|
| 1089 |
-
}
|
| 1090 |
-
break;
|
| 1091 |
-
}
|
| 1092 |
-
case 'desc':
|
| 1093 |
-
{
|
| 1094 |
-
operator = function (a, b)
|
| 1095 |
-
{
|
| 1096 |
-
return (a['comments']['count'] < b['comments']['count']) ? 1 : -1;
|
| 1097 |
-
}
|
| 1098 |
-
break;
|
| 1099 |
-
}
|
| 1100 |
-
}
|
| 1101 |
-
break;
|
| 1102 |
-
}
|
| 1103 |
-
case 'random':
|
| 1104 |
-
{
|
| 1105 |
-
operator = function (a, b)
|
| 1106 |
-
{
|
| 1107 |
-
var num = Math.random();
|
| 1108 |
-
return (num > 0.5) ? 1 : -1;
|
| 1109 |
-
}
|
| 1110 |
-
break;
|
| 1111 |
-
}
|
| 1112 |
-
}
|
| 1113 |
-
return operator;
|
| 1114 |
-
}
|
| 1115 |
-
|
| 1116 |
-
/*
|
| 1117 |
-
* Calls smart picker method and then after receiving data it sorts data based on user choice
|
| 1118 |
-
*/
|
| 1119 |
-
wdi_front.feedSort = function (currentFeed, load_more_number) {
|
| 1120 |
-
var sortImagesBy = currentFeed.feed_row['sort_images_by'];
|
| 1121 |
-
var sortOrder = currentFeed.feed_row['display_order'];
|
| 1122 |
-
if (currentFeed.feed_row['resort_after_load_more'] === '1') {
|
| 1123 |
-
currentFeed['data'] = currentFeed['data'].concat(wdi_front.smartPicker(currentFeed, load_more_number));
|
| 1124 |
-
}
|
| 1125 |
-
else {
|
| 1126 |
-
currentFeed['data'] = wdi_front.smartPicker(currentFeed, load_more_number);
|
| 1127 |
-
}
|
| 1128 |
-
var operator = wdi_front.sortingOperator(sortImagesBy, sortOrder);
|
| 1129 |
-
currentFeed['data'].sort(operator);
|
| 1130 |
-
return currentFeed['data'];
|
| 1131 |
-
}
|
| 1132 |
-
|
| 1133 |
-
/*
|
| 1134 |
-
* Filters all requested data and takes some amount of data for each user
|
| 1135 |
-
* and stops picking when it reaches number_of_photos limit
|
| 1136 |
-
*/
|
| 1137 |
-
wdi_front.smartPicker = function (currentFeed, load_more_number) {
|
| 1138 |
-
var dataStorage = [];
|
| 1139 |
-
var dataLength = 0;
|
| 1140 |
-
var readyData = [];
|
| 1141 |
-
var number_of_photos = parseInt(currentFeed['feed_row']['number_of_photos']);
|
| 1142 |
-
var perUser = Math.ceil(number_of_photos / currentFeed['usersData'].length);
|
| 1143 |
-
var remainder = 0;
|
| 1144 |
-
// check if loadmore was clicked
|
| 1145 |
-
if (load_more_number != '' && typeof load_more_number != 'undefined' && load_more_number != null) {
|
| 1146 |
-
number_of_photos = parseInt(load_more_number);
|
| 1147 |
-
perUser = Math.ceil(number_of_photos / wdi_front.activeUsersCount(currentFeed));
|
| 1148 |
-
}
|
| 1149 |
-
|
| 1150 |
-
var sortOperator = function (a, b){
|
| 1151 |
-
return (a['data'].length > b['data'].length) ? 1 : -1;
|
| 1152 |
-
}
|
| 1153 |
-
|
| 1154 |
-
var sortOperator1 = function (a, b) {
|
| 1155 |
-
return (a.length() > b.length()) ? 1 : -1;
|
| 1156 |
-
}
|
| 1157 |
-
|
| 1158 |
-
// storing user data in global dataStoreageRaw variable
|
| 1159 |
-
currentFeed.storeRawData(currentFeed.usersData, 'dataStorageRaw');
|
| 1160 |
-
|
| 1161 |
-
// dataStorageRaw
|
| 1162 |
-
var dataStorageRaw = currentFeed['dataStorageRaw'].sort(sortOperator1);
|
| 1163 |
-
|
| 1164 |
-
//sorts user data desc
|
| 1165 |
-
var usersData = currentFeed['usersData'].sort(sortOperator);
|
| 1166 |
-
//picks data from users and updates pagination in request json
|
| 1167 |
-
|
| 1168 |
-
//for next time call
|
| 1169 |
-
for ( var i = 0; i < usersData.length; i++ ) {
|
| 1170 |
-
remainder += perUser;
|
| 1171 |
-
/* if data is less then amount for each user then pick all data */
|
| 1172 |
-
if (dataStorageRaw[i].length() <= remainder) {
|
| 1173 |
-
/* update remainder */
|
| 1174 |
-
remainder -= dataStorageRaw[i].length();
|
| 1175 |
-
|
| 1176 |
-
/* get and store data */
|
| 1177 |
-
dataStorage.push(dataStorageRaw[i].getData(dataStorageRaw[i].length()));
|
| 1178 |
-
/* update data length */
|
| 1179 |
-
dataLength += dataStorage[dataStorage.length - 1].length;
|
| 1180 |
-
}
|
| 1181 |
-
else {
|
| 1182 |
-
if (dataLength + remainder > number_of_photos) {
|
| 1183 |
-
remainder = number_of_photos - dataLength;
|
| 1184 |
-
}
|
| 1185 |
-
|
| 1186 |
-
var pickedData = [];
|
| 1187 |
-
if (currentFeed['auto_trigger'] === false) {
|
| 1188 |
-
pickedData = pickedData.concat(dataStorageRaw[i].getData(remainder));
|
| 1189 |
-
}
|
| 1190 |
-
else {
|
| 1191 |
-
if (pickedData.length + wdi_front.getDataLength(currentFeed) + wdi_front.getDataLength(currentFeed, dataStorage) < currentFeed['feed_row']['number_of_photos']) {
|
| 1192 |
-
pickedData = pickedData.concat(dataStorageRaw[i].getData(remainder));
|
| 1193 |
-
}
|
| 1194 |
-
}
|
| 1195 |
-
|
| 1196 |
-
remainder = 0;
|
| 1197 |
-
dataLength += pickedData.length;
|
| 1198 |
-
dataStorage.push(pickedData);
|
| 1199 |
-
}
|
| 1200 |
-
}
|
| 1201 |
-
//checks if in golbal storage user already exisit then it adds new data to user old data
|
| 1202 |
-
//else it simple puches new user with it's data to global storage
|
| 1203 |
-
for (i = 0; i < dataStorage.length; i++) {
|
| 1204 |
-
if (typeof currentFeed.dataStorage[i] === 'undefined') {
|
| 1205 |
-
currentFeed.dataStorage.push(dataStorage[i]);
|
| 1206 |
-
}
|
| 1207 |
-
else {
|
| 1208 |
-
currentFeed.dataStorage[i] = currentFeed.dataStorage[i].concat(dataStorage[i]);
|
| 1209 |
-
}
|
| 1210 |
-
}
|
| 1211 |
-
|
| 1212 |
-
// parsing data for lightbox
|
| 1213 |
-
currentFeed.parsedData = wdi_front.parseLighboxData(currentFeed);
|
| 1214 |
-
|
| 1215 |
-
// combines together all avialable data in global storage and returns it
|
| 1216 |
-
for (i = 0; i < dataStorage.length; i++) {
|
| 1217 |
-
readyData = readyData.concat(dataStorage[i]);
|
| 1218 |
-
}
|
| 1219 |
-
return readyData;
|
| 1220 |
-
}
|
| 1221 |
|
| 1222 |
/*
|
| 1223 |
* returns json object for inserting photo template
|
|
@@ -1285,8 +998,8 @@ wdi_front.createObject = function (obj, currentFeed) {
|
|
| 1285 |
'thumbType': thumbType,
|
| 1286 |
'caption': wdi_front.escape_tags(caption),
|
| 1287 |
'image_url': image_url,
|
| 1288 |
-
'likes': obj['likes']['count'],
|
| 1289 |
-
'comments': obj['comments']['count'],
|
| 1290 |
'wdi_index': imageIndex,
|
| 1291 |
'wdi_res_index': currentFeed.resIndex,
|
| 1292 |
'wdi_media_user': obj_user_name,
|
|
@@ -1298,52 +1011,21 @@ wdi_front.createObject = function (obj, currentFeed) {
|
|
| 1298 |
return photoObject;
|
| 1299 |
}
|
| 1300 |
|
| 1301 |
-
/*
|
| 1302 |
-
* If pagination is on sets the proper page number
|
| 1303 |
-
*/
|
| 1304 |
-
wdi_front.setPage = function (currentFeed) {
|
| 1305 |
-
var display_type = currentFeed.feed_row.feed_display_view;
|
| 1306 |
-
var feed_type = currentFeed.feed_row.feed_type;
|
| 1307 |
-
if (display_type != 'pagination') {
|
| 1308 |
-
return '';
|
| 1309 |
-
}
|
| 1310 |
-
var imageIndex = currentFeed.imageIndex;
|
| 1311 |
-
if (feed_type == 'image_browser') {
|
| 1312 |
-
var divider = 1;
|
| 1313 |
-
} else {
|
| 1314 |
-
var divider = Math.abs(currentFeed.feed_row.pagination_per_page_number);
|
| 1315 |
-
}
|
| 1316 |
-
|
| 1317 |
-
currentFeed.paginator = Math.ceil((imageIndex + 1) / divider);
|
| 1318 |
-
|
| 1319 |
-
|
| 1320 |
-
return currentFeed.paginator;
|
| 1321 |
-
}
|
| 1322 |
|
| 1323 |
/*
|
| 1324 |
* Template for all feed items which have type=image
|
| 1325 |
*/
|
| 1326 |
wdi_front.getPhotoTemplate = function (currentFeed , type) {
|
| 1327 |
-
var page = wdi_front.setPage(currentFeed);
|
| 1328 |
var customClass = '';
|
| 1329 |
var pagination = '';
|
| 1330 |
var onclick = '';
|
| 1331 |
var overlayCustomClass = '';
|
| 1332 |
var thumbClass = 'tenweb-i-arrows-out';
|
| 1333 |
var showUsernameOnThumb = '';
|
|
|
|
| 1334 |
if (currentFeed.feed_row.feed_type == 'blog_style' || currentFeed.feed_row.feed_type == 'image_browser') {
|
| 1335 |
thumbClass = '';
|
| 1336 |
}
|
| 1337 |
-
if (page != '') {
|
| 1338 |
-
pagination = 'wdi_page="' + page + '"';
|
| 1339 |
-
sourceAttr = 'src';
|
| 1340 |
-
} else {
|
| 1341 |
-
sourceAttr = 'src';
|
| 1342 |
-
}
|
| 1343 |
-
|
| 1344 |
-
if (page != '' && page != 1) {
|
| 1345 |
-
customClass = 'wdi_hidden';
|
| 1346 |
-
}
|
| 1347 |
|
| 1348 |
|
| 1349 |
if (currentFeed.feed_row.show_username_on_thumb == '1' && currentFeed.data.length && currentFeed.data[0].user.username !== "") {
|
|
@@ -1414,10 +1096,12 @@ wdi_front.getPhotoTemplate = function (currentFeed , type) {
|
|
| 1414 |
var imageIndex = currentFeed['imageIndex'];
|
| 1415 |
if (currentFeed['feed_row']['show_likes'] === '1' || currentFeed['feed_row']['show_comments'] === '1' || currentFeed['feed_row']['show_description'] === '1') {
|
| 1416 |
source += '<div class="wdi_photo_meta">';
|
| 1417 |
-
|
|
|
|
| 1418 |
source += '<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o"> <%= likes%></i></div>';
|
| 1419 |
}
|
| 1420 |
-
|
|
|
|
| 1421 |
source += '<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square"> <%= comments%></i></div>';
|
| 1422 |
}
|
| 1423 |
source += '<div class="wdi_clear"></div>';
|
|
@@ -1438,27 +1122,16 @@ wdi_front.getPhotoTemplate = function (currentFeed , type) {
|
|
| 1438 |
* Template for all feed items which have type=image
|
| 1439 |
*/
|
| 1440 |
wdi_front.getSliderTemplate = function (currentFeed, type) {
|
| 1441 |
-
var page = wdi_front.setPage(currentFeed);
|
| 1442 |
var customClass = '';
|
| 1443 |
var pagination = '';
|
| 1444 |
var onclick = '';
|
| 1445 |
var overlayCustomClass = '';
|
| 1446 |
var thumbClass = 'tenweb-i-clone';
|
| 1447 |
var showUsernameOnThumb = '';
|
|
|
|
| 1448 |
if (currentFeed.feed_row.feed_type == 'blog_style' || currentFeed.feed_row.feed_type == 'image_browser') {
|
| 1449 |
thumbClass = '';
|
| 1450 |
}
|
| 1451 |
-
if (page != '') {
|
| 1452 |
-
pagination = 'wdi_page="' + page + '"';
|
| 1453 |
-
sourceAttr = 'src';
|
| 1454 |
-
} else {
|
| 1455 |
-
sourceAttr = 'src';
|
| 1456 |
-
}
|
| 1457 |
-
|
| 1458 |
-
if (page != '' && page != 1) {
|
| 1459 |
-
customClass = 'wdi_hidden';
|
| 1460 |
-
}
|
| 1461 |
-
|
| 1462 |
|
| 1463 |
if (currentFeed.feed_row.show_username_on_thumb == '1' && currentFeed.data.length && currentFeed.data[0].user.username !== "") {
|
| 1464 |
showUsernameOnThumb = '<span class="wdi_media_user">@<%= wdi_username%></span>';
|
|
@@ -1534,10 +1207,12 @@ wdi_front.getSliderTemplate = function (currentFeed, type) {
|
|
| 1534 |
var imageIndex = currentFeed['imageIndex'];
|
| 1535 |
if (currentFeed['feed_row']['show_likes'] === '1' || currentFeed['feed_row']['show_comments'] === '1' || currentFeed['feed_row']['show_description'] === '1') {
|
| 1536 |
source += '<div class="wdi_photo_meta">';
|
| 1537 |
-
|
|
|
|
| 1538 |
source += '<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o"> <%= likes%></i></div>';
|
| 1539 |
}
|
| 1540 |
-
|
|
|
|
| 1541 |
source += '<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square"> <%= comments%></i></div>';
|
| 1542 |
}
|
| 1543 |
source += '<div class="wdi_clear"></div>';
|
|
@@ -1568,26 +1243,14 @@ wdi_front.replaceToVideo = function (url, index, feed_counter) {
|
|
| 1568 |
* Template for all feed items which have type=video
|
| 1569 |
*/
|
| 1570 |
wdi_front.getVideoTemplate = function (currentFeed, type) {
|
| 1571 |
-
var page = wdi_front.setPage(currentFeed);
|
| 1572 |
var customClass = '';
|
| 1573 |
var pagination = '';
|
| 1574 |
var thumbClass = 'tenweb-i-play';
|
| 1575 |
var onclick = '';
|
| 1576 |
var overlayCustomClass = '';
|
| 1577 |
-
var sourceAttr
|
| 1578 |
var showUsernameOnThumb = '';
|
| 1579 |
|
| 1580 |
-
|
| 1581 |
-
if (page != '') {
|
| 1582 |
-
pagination = 'wdi_page="' + page + '"';
|
| 1583 |
-
sourceAttr = 'src';
|
| 1584 |
-
} else {
|
| 1585 |
-
sourceAttr = 'src';
|
| 1586 |
-
}
|
| 1587 |
-
if (page != '' && page != 1) {
|
| 1588 |
-
customClass = 'wdi_hidden';
|
| 1589 |
-
}
|
| 1590 |
-
|
| 1591 |
if (currentFeed.feed_row.show_username_on_thumb == '1' && currentFeed.data.length && currentFeed.data[0].user.username !== "") {
|
| 1592 |
showUsernameOnThumb = '<span class="wdi_media_user">@<%= wdi_username%></span>';
|
| 1593 |
}
|
|
@@ -1660,10 +1323,12 @@ wdi_front.getVideoTemplate = function (currentFeed, type) {
|
|
| 1660 |
var imageIndex = currentFeed['imageIndex'];
|
| 1661 |
if (currentFeed['feed_row']['show_likes'] === '1' || currentFeed['feed_row']['show_comments'] === '1' || currentFeed['feed_row']['show_description'] === '1') {
|
| 1662 |
source += '<div class="wdi_photo_meta">';
|
| 1663 |
-
|
|
|
|
| 1664 |
source += '<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o"> <%= likes%></i></div>';
|
| 1665 |
}
|
| 1666 |
-
|
|
|
|
| 1667 |
source += '<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square"> <%= comments%></i></div>';
|
| 1668 |
}
|
| 1669 |
source += '<div class="wdi_clear"></div>';
|
|
@@ -1688,8 +1353,13 @@ wdi_front.bindEvents = function (currentFeed) {
|
|
| 1688 |
if (currentFeed.feed_row.feed_display_view == 'load_more_btn') {
|
| 1689 |
//binding load more event
|
| 1690 |
jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' .wdi_load_more_container').on(wdi_front.clickOrTouch, function () {
|
|
|
|
|
|
|
|
|
|
| 1691 |
//do the actual load more operation
|
| 1692 |
-
|
|
|
|
|
|
|
| 1693 |
});
|
| 1694 |
}
|
| 1695 |
|
|
@@ -1697,19 +1367,31 @@ wdi_front.bindEvents = function (currentFeed) {
|
|
| 1697 |
//binding pagination events
|
| 1698 |
jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' #wdi_next').on(wdi_front.clickOrTouch, function ()
|
| 1699 |
{
|
| 1700 |
-
wdi_front.paginatorNext(jQuery(this), currentFeed)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1701 |
});
|
| 1702 |
jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' #wdi_prev').on(wdi_front.clickOrTouch, function ()
|
| 1703 |
{
|
| 1704 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1705 |
});
|
| 1706 |
jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' #wdi_last_page').on(wdi_front.clickOrTouch, function ()
|
| 1707 |
{
|
| 1708 |
-
|
|
|
|
| 1709 |
});
|
| 1710 |
jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' #wdi_first_page').on(wdi_front.clickOrTouch, function ()
|
| 1711 |
{
|
| 1712 |
-
|
|
|
|
| 1713 |
});
|
| 1714 |
//setting pagiantion flags
|
| 1715 |
currentFeed.paginatorNextFlag = false;
|
|
@@ -1726,100 +1408,48 @@ wdi_front.bindEvents = function (currentFeed) {
|
|
| 1726 |
}
|
| 1727 |
|
| 1728 |
wdi_front.infiniteScroll = function (currentFeed) {
|
|
|
|
| 1729 |
if ((jQuery(window).scrollTop() + jQuery(window).height() - 100) >= jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' #wdi_infinite_scroll').offset().top) {
|
| 1730 |
-
if (currentFeed.
|
| 1731 |
currentFeed.infiniteScrollFlag = true;
|
| 1732 |
wdi_front.loadMore(jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' #wdi_infinite_scroll'), currentFeed);
|
| 1733 |
} else
|
| 1734 |
-
if (currentFeed.stopInfiniteScrollFlag) {
|
| 1735 |
wdi_front.allImagesLoaded(currentFeed);
|
| 1736 |
-
}
|
| 1737 |
|
| 1738 |
}
|
| 1739 |
}
|
| 1740 |
|
| 1741 |
-
wdi_front.paginationFirstPage = function (btn, currentFeed) {
|
| 1742 |
-
if (currentFeed.paginator == 1 || currentFeed.currentPage == 1) {
|
| 1743 |
-
btn.addClass('wdi_disabled');
|
| 1744 |
-
return;
|
| 1745 |
-
}
|
| 1746 |
-
var oldPage = currentFeed.currentPage;
|
| 1747 |
-
currentFeed.currentPage = 1;
|
| 1748 |
-
wdi_front.updatePagination(currentFeed, 'custom', oldPage);
|
| 1749 |
|
| 1750 |
-
|
| 1751 |
-
var
|
| 1752 |
-
|
| 1753 |
|
| 1754 |
-
|
| 1755 |
-
|
| 1756 |
-
|
| 1757 |
-
|
| 1758 |
-
|
| 1759 |
-
if (currentFeed.paginator == 1 || currentFeed.currentPage == currentFeed.paginator) {
|
| 1760 |
-
return;
|
| 1761 |
}
|
| 1762 |
-
|
| 1763 |
-
|
| 1764 |
-
|
| 1765 |
-
|
| 1766 |
-
//disableing last page button
|
| 1767 |
-
btn.addClass('wdi_disabled');
|
| 1768 |
-
|
| 1769 |
-
//enabling first page button
|
| 1770 |
-
var first_page_btn = btn.parent().find('#wdi_first_page');
|
| 1771 |
-
first_page_btn.removeClass('wdi_disabled');
|
| 1772 |
-
}
|
| 1773 |
-
|
| 1774 |
-
wdi_front.paginatorNext = function (btn, currentFeed) {
|
| 1775 |
-
var last_page_btn = btn.parent().find('#wdi_last_page');
|
| 1776 |
-
var first_page_btn = btn.parent().find('#wdi_first_page');
|
| 1777 |
-
currentFeed.paginatorNextFlag = true;
|
| 1778 |
-
if (currentFeed.paginator == currentFeed.currentPage && !wdi_front.checkFeedFinished(currentFeed)) {
|
| 1779 |
-
currentFeed.currentPage++;
|
| 1780 |
-
var number_of_photos = currentFeed.feed_row.number_of_photos;
|
| 1781 |
-
wdi_front.loadMore(btn, currentFeed, number_of_photos);
|
| 1782 |
-
//on the last page don't show got to last page button
|
| 1783 |
-
last_page_btn.addClass('wdi_disabled');
|
| 1784 |
-
} else
|
| 1785 |
-
if (currentFeed.paginator > currentFeed.currentPage) {
|
| 1786 |
-
currentFeed.currentPage++;
|
| 1787 |
-
wdi_front.updatePagination(currentFeed, 'next');
|
| 1788 |
-
//check if new page isn't the last one then enable last page button
|
| 1789 |
-
if (currentFeed.paginator > currentFeed.currentPage) {
|
| 1790 |
-
last_page_btn.removeClass('wdi_disabled');
|
| 1791 |
-
} else {
|
| 1792 |
-
last_page_btn.addClass('wdi_disabled');
|
| 1793 |
-
}
|
| 1794 |
-
}
|
| 1795 |
-
//enable first page button
|
| 1796 |
-
first_page_btn.removeClass('wdi_disabled');
|
| 1797 |
-
}
|
| 1798 |
-
|
| 1799 |
-
wdi_front.paginatorPrev = function (btn, currentFeed)
|
| 1800 |
-
{
|
| 1801 |
-
var last_page_btn = btn.parent().find('#wdi_last_page');
|
| 1802 |
-
var first_page_btn = btn.parent().find('#wdi_first_page');
|
| 1803 |
-
if (currentFeed.currentPage == 1) {
|
| 1804 |
-
first_page_btn.addClass('wdi_disabled');
|
| 1805 |
-
return;
|
| 1806 |
}
|
| 1807 |
-
|
| 1808 |
-
|
| 1809 |
-
|
| 1810 |
-
|
| 1811 |
-
//enable last page button
|
| 1812 |
-
last_page_btn.removeClass('wdi_disabled');
|
| 1813 |
-
|
| 1814 |
-
if (currentFeed.currentPage == 1) {
|
| 1815 |
-
first_page_btn.addClass('wdi_disabled');
|
| 1816 |
}
|
| 1817 |
-
|
|
|
|
|
|
|
| 1818 |
}
|
| 1819 |
|
|
|
|
| 1820 |
//displays proper images for specific page after pagination buttons click event
|
| 1821 |
wdi_front.updatePagination = function (currentFeed, dir, oldPage)
|
| 1822 |
{
|
|
|
|
| 1823 |
var currentFeedString = '#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'];
|
| 1824 |
jQuery(currentFeedString + ' [wdi_page="' + currentFeed.currentPage + '"]').each(function ()
|
| 1825 |
{
|
|
@@ -1874,7 +1504,7 @@ wdi_front.loadMore = function (button, _currentFeed) {
|
|
| 1874 |
if ( typeof _currentFeed != 'undefined' ) {
|
| 1875 |
var currentFeed = _currentFeed;
|
| 1876 |
}
|
| 1877 |
-
|
| 1878 |
wdi_front.ajaxLoader(currentFeed);
|
| 1879 |
if ( this.isJsonString(currentFeed.feed_row.feed_users) ) {
|
| 1880 |
json_feed_users = JSON.parse(currentFeed.feed_row.feed_users);
|
|
@@ -1885,31 +1515,6 @@ wdi_front.loadMore = function (button, _currentFeed) {
|
|
| 1885 |
}
|
| 1886 |
}
|
| 1887 |
}
|
| 1888 |
-
//check if any filter is enabled and filter user images has finished
|
| 1889 |
-
//then stop any load more action
|
| 1890 |
-
var activeFilter = 0,
|
| 1891 |
-
finishedFilter = 0;
|
| 1892 |
-
for (var i = 0; i < currentFeed.userSortFlags.length; i++) {
|
| 1893 |
-
if (currentFeed.userSortFlags[i].flag === true) {
|
| 1894 |
-
activeFilter++;
|
| 1895 |
-
for (var j = 0; j < currentFeed.usersData.length; j++) {
|
| 1896 |
-
if (currentFeed.userSortFlags[i]['id'] === currentFeed.usersData[j]['user_id']) {
|
| 1897 |
-
if (currentFeed.usersData[j]['finished'] === 'finished') {
|
| 1898 |
-
finishedFilter++;
|
| 1899 |
-
}
|
| 1900 |
-
}
|
| 1901 |
-
}
|
| 1902 |
-
}
|
| 1903 |
-
}
|
| 1904 |
-
if (activeFilter === finishedFilter && activeFilter != 0) {
|
| 1905 |
-
return;
|
| 1906 |
-
}
|
| 1907 |
-
// if button is not provided than it enables auto_tiggering and recursively loads images
|
| 1908 |
-
currentFeed['auto_trigger'] = false;
|
| 1909 |
-
if (button === '') {
|
| 1910 |
-
currentFeed['auto_trigger'] = true;
|
| 1911 |
-
}
|
| 1912 |
-
|
| 1913 |
|
| 1914 |
//check if masonry view is on and and feed display type is pagination then
|
| 1915 |
//close all captions before loading more pages for porper pagination rendering
|
|
@@ -1919,43 +1524,8 @@ wdi_front.loadMore = function (button, _currentFeed) {
|
|
| 1919 |
});
|
| 1920 |
}
|
| 1921 |
|
| 1922 |
-
// check if all data loaded then remove ajaxLoader
|
| 1923 |
-
// To do Arsho
|
| 1924 |
-
for (var i = 0; i < currentFeed.usersData.length; i++) {
|
| 1925 |
-
if (currentFeed.usersData[i]['finished'] === 'finished') {
|
| 1926 |
-
dataCounter++;
|
| 1927 |
-
}
|
| 1928 |
-
}
|
| 1929 |
-
if (dataCounter === currentFeed.usersData.length) {
|
| 1930 |
-
wdi_front.allImagesLoaded(currentFeed);
|
| 1931 |
-
jQuery('#wdi_feed_' + currentFeed['feed_row']['wdi_feed_counter'] + ' .wdi_load_more').remove();
|
| 1932 |
-
}
|
| 1933 |
-
var usersData = currentFeed['usersData'];
|
| 1934 |
currentFeed.loadMoreDataCount = currentFeed.feed_users.length;
|
| 1935 |
-
|
| 1936 |
-
for (var i = 0; i < usersData.length; i++) {
|
| 1937 |
-
var pagination = usersData[i]['pagination'];
|
| 1938 |
-
var hashtag_id = (typeof usersData[i]['tag_id'] !== 'undefined') ? usersData[i]['tag_id'] : '';
|
| 1939 |
-
var hashtag = (typeof usersData[i]['username'] !== 'undefined' && hashtag_id) ? usersData[i]['username'] : '';
|
| 1940 |
-
|
| 1941 |
-
var user = {
|
| 1942 |
-
old_user_id: usersData[i]['user_id'],
|
| 1943 |
-
odl_username: usersData[i]['username'],
|
| 1944 |
-
user_id: iuser.id,
|
| 1945 |
-
username: iuser.username,
|
| 1946 |
-
hashtag: hashtag,
|
| 1947 |
-
hashtag_id: hashtag_id
|
| 1948 |
-
};
|
| 1949 |
-
|
| 1950 |
-
//checking if pagination url exists then load images, else skip
|
| 1951 |
-
if (button == 'initial-keep') {
|
| 1952 |
-
currentFeed.temproraryUsersData[i] = currentFeed.usersData[i];
|
| 1953 |
-
}
|
| 1954 |
-
if ( currentFeed.loadMoreDataCount > 0 ) {
|
| 1955 |
-
currentFeed.loadMoreDataCount--
|
| 1956 |
-
}
|
| 1957 |
-
wdi_front.checkForLoadMoreDone(currentFeed, button);
|
| 1958 |
-
}
|
| 1959 |
}
|
| 1960 |
|
| 1961 |
/*
|
|
@@ -2144,8 +1714,7 @@ function wdi_baseName(str) {
|
|
| 2144 |
//ajax loading
|
| 2145 |
wdi_front.ajaxLoader = function (currentFeed) {
|
| 2146 |
var wdi_feed_counter = currentFeed.feed_row['wdi_feed_counter'];
|
| 2147 |
-
|
| 2148 |
-
var feed_container = jQuery('#wdi_feed_' + wdi_feed_counter);
|
| 2149 |
if (currentFeed.feed_row.feed_display_view == 'load_more_btn') {
|
| 2150 |
feed_container.find('.wdi_load_more').addClass('wdi_hidden');
|
| 2151 |
feed_container.find('.wdi_spinner').removeClass('wdi_hidden');
|
|
@@ -2155,12 +1724,13 @@ wdi_front.ajaxLoader = function (currentFeed) {
|
|
| 2155 |
var loadingDiv;
|
| 2156 |
if (feed_container.find('.wdi_ajax_loading').length == 0) {
|
| 2157 |
loadingDiv = 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>');
|
| 2158 |
-
feed_container.append(loadingDiv);
|
| 2159 |
} else {
|
| 2160 |
loadingDiv = feed_container.find('.wdi_ajax_loading');
|
| 2161 |
}
|
| 2162 |
loadingDiv.removeClass('wdi_hidden');
|
| 2163 |
}
|
|
|
|
| 2164 |
}
|
| 2165 |
|
| 2166 |
//if all images loaded then clicking load more causes it's removal
|
|
@@ -2171,7 +1741,7 @@ wdi_front.allImagesLoaded = function (currentFeed) {
|
|
| 2171 |
jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter + " .wdi_feed_wrapper").remove("wdi_nomedia");
|
| 2172 |
}
|
| 2173 |
/* display message if feed contains no image at all */
|
| 2174 |
-
if (
|
| 2175 |
jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter + " .wdi_feed_wrapper").append("<p class='wdi_nomedia'>" + wdi_front_messages.feed_nomedia + "</p>");
|
| 2176 |
}
|
| 2177 |
|
|
@@ -2180,7 +1750,9 @@ wdi_front.allImagesLoaded = function (currentFeed) {
|
|
| 2180 |
var feed_container = jQuery('#wdi_feed_' + wdi_feed_counter);
|
| 2181 |
|
| 2182 |
if (currentFeed.feed_row.feed_display_view == 'load_more_btn') {
|
| 2183 |
-
|
|
|
|
|
|
|
| 2184 |
feed_container.find('.wdi_spinner').addClass('wdi_hidden');
|
| 2185 |
}
|
| 2186 |
|
|
@@ -2217,167 +1789,6 @@ wdi_front.show = function (name, currentFeed) {
|
|
| 2217 |
containerHtml = feed_container.find('.wdi_feed_header').html();
|
| 2218 |
feed_container.find('.wdi_feed_header').html(containerHtml + html);
|
| 2219 |
}
|
| 2220 |
-
/* @ToDo This function is not used. It must be removed.
|
| 2221 |
-
function show_users(currentFeed) {
|
| 2222 |
-
feed_container.find('.wdi_feed_users').html('');
|
| 2223 |
-
var users = currentFeed['feed_users'];
|
| 2224 |
-
var access_token = currentFeed['feed_row']['access_token'];
|
| 2225 |
-
var i = 0;
|
| 2226 |
-
currentFeed.headerUserinfo = [];
|
| 2227 |
-
getThumb();
|
| 2228 |
-
//recursively calls itself until all user data is ready then displyes it with escapeRequest
|
| 2229 |
-
function getThumb() {
|
| 2230 |
-
if (currentFeed.headerUserinfo.length == users.length) {
|
| 2231 |
-
escapeRequest(currentFeed.headerUserinfo, currentFeed);
|
| 2232 |
-
return;
|
| 2233 |
-
}
|
| 2234 |
-
var _user = users[currentFeed.headerUserinfo.length];
|
| 2235 |
-
if (typeof _user === 'string' && _user === 'self') {
|
| 2236 |
-
alert(2333);
|
| 2237 |
-
currentFeed.instagram.getSelfInfo({
|
| 2238 |
-
success: function (response) {
|
| 2239 |
-
if(typeof response.meta!= 'undefined' && typeof response.meta.error_type != 'undefined'){
|
| 2240 |
-
wdi_front.show_alert(false, response, currentFeed);
|
| 2241 |
-
}
|
| 2242 |
-
response = _this.checkMediaResponse(response, currentFeed);
|
| 2243 |
-
// @ToDo free There is a difference in free!
|
| 2244 |
-
if (response != false) {
|
| 2245 |
-
var obj = {
|
| 2246 |
-
id: response['data']['id'],
|
| 2247 |
-
name: response['data']['username'],
|
| 2248 |
-
url: response['data']['profile_picture'],
|
| 2249 |
-
bio: wdi_front.escape_tags(response['data']['bio']),
|
| 2250 |
-
counts: response['data']['counts'],
|
| 2251 |
-
website: wdi_front.escape_tags(response['data']['website']),
|
| 2252 |
-
full_name: wdi_front.escape_tags(response['data']['full_name'])
|
| 2253 |
-
}
|
| 2254 |
-
currentFeed.headerUserinfo.push(obj);
|
| 2255 |
-
i++;
|
| 2256 |
-
getThumb();
|
| 2257 |
-
}
|
| 2258 |
-
},
|
| 2259 |
-
args: {
|
| 2260 |
-
ignoreFiltering: true,
|
| 2261 |
-
}
|
| 2262 |
-
});
|
| 2263 |
-
}
|
| 2264 |
-
else if (false && _this.getInputType(_user.username) == 'hashtag') {
|
| 2265 |
-
currentFeed.instagram.searchForTagsByName(_this.stripHashtag(_user.username), {
|
| 2266 |
-
success: function (response) {
|
| 2267 |
-
if(typeof response.meta != "undefined" && typeof response.meta.error_type != "undefined"){
|
| 2268 |
-
wdi_front.show_alert(false, response, currentFeed);
|
| 2269 |
-
}
|
| 2270 |
-
response = _this.checkMediaResponse(response, currentFeed);
|
| 2271 |
-
if (response != false) {
|
| 2272 |
-
if (response['data'].length == 0) {
|
| 2273 |
-
var thumb_img = '';
|
| 2274 |
-
var counts = {media: ''};
|
| 2275 |
-
} else {
|
| 2276 |
-
var thumb_img = '';// we will get image src later when will have all the sources
|
| 2277 |
-
//thumb_img = response['data'][0]['images']['thumbnail']['url'];
|
| 2278 |
-
var counts = {media: response['data'][0]['media_count']};
|
| 2279 |
-
}
|
| 2280 |
-
|
| 2281 |
-
var obj = {
|
| 2282 |
-
name: users[i]['username'],
|
| 2283 |
-
url: thumb_img,
|
| 2284 |
-
counts: counts,
|
| 2285 |
-
};
|
| 2286 |
-
i++;
|
| 2287 |
-
currentFeed.headerUserinfo.push(obj);
|
| 2288 |
-
getThumb();
|
| 2289 |
-
}
|
| 2290 |
-
},
|
| 2291 |
-
args: {
|
| 2292 |
-
ignoreFiltering: true,
|
| 2293 |
-
}
|
| 2294 |
-
});
|
| 2295 |
-
}
|
| 2296 |
-
else if (_this.getInputType(_user.username) == 'user') {
|
| 2297 |
-
currentFeed.instagram.getSelfInfo({
|
| 2298 |
-
///deprecated API
|
| 2299 |
-
///currentFeed.instagram.getUserInfo(_user.id, {
|
| 2300 |
-
success: function (response) {
|
| 2301 |
-
if(typeof response.meta!= 'undefined' && typeof response.meta.error_type != 'undefined'){
|
| 2302 |
-
wdi_front.show_alert(false, response, currentFeed);
|
| 2303 |
-
}
|
| 2304 |
-
response = _this.checkMediaResponse(response, currentFeed);
|
| 2305 |
-
|
| 2306 |
-
if(response != false && response["meta"]["code"] === 400 && response["meta"]["error_type"] === "APINotAllowedError"){
|
| 2307 |
-
var obj = null;
|
| 2308 |
-
currentFeed.headerUserinfo.push(obj);
|
| 2309 |
-
i++;
|
| 2310 |
-
getThumb();
|
| 2311 |
-
}
|
| 2312 |
-
|
| 2313 |
-
if (response != false && response["meta"]["code"] === 200) {
|
| 2314 |
-
var obj = {
|
| 2315 |
-
id: response['data']['id'],
|
| 2316 |
-
name: response['data']['username'],
|
| 2317 |
-
url: response['data']['profile_picture'],
|
| 2318 |
-
bio: wdi_front.escape_tags(response['data']['bio']),
|
| 2319 |
-
counts: response['data']['counts'],
|
| 2320 |
-
website: wdi_front.escape_tags(response['data']['website']),
|
| 2321 |
-
full_name: wdi_front.escape_tags(response['data']['full_name'])
|
| 2322 |
-
}
|
| 2323 |
-
currentFeed.headerUserinfo.push(obj);
|
| 2324 |
-
i++;
|
| 2325 |
-
getThumb();
|
| 2326 |
-
}
|
| 2327 |
-
},
|
| 2328 |
-
args: {
|
| 2329 |
-
ignoreFiltering: true,
|
| 2330 |
-
}
|
| 2331 |
-
});
|
| 2332 |
-
}
|
| 2333 |
-
}
|
| 2334 |
-
|
| 2335 |
-
//when all user data is ready break recursion and create user elements
|
| 2336 |
-
function escapeRequest(info, currentFeed) {
|
| 2337 |
-
feed_container.find('.wdi_feed_users').html('');
|
| 2338 |
-
for (var k = 0; k < info.length; k++) {
|
| 2339 |
-
//setting all user filters to false
|
| 2340 |
-
if(info[k]=== null){
|
| 2341 |
-
continue;
|
| 2342 |
-
}
|
| 2343 |
-
var userFilter = {
|
| 2344 |
-
'flag': false,
|
| 2345 |
-
'id': info[k]['id'],
|
| 2346 |
-
'name': info[k]['name']
|
| 2347 |
-
};
|
| 2348 |
-
|
| 2349 |
-
//user inforamtion
|
| 2350 |
-
var hashtagClass = (info[k]['name'][0] == '#') ? 'wdi_header_hashtag' : '';
|
| 2351 |
-
var website_host_name = wdi_extractHostname(info[k]['website']);
|
| 2352 |
-
var templateData = {
|
| 2353 |
-
'user_index': k,
|
| 2354 |
-
'user_img_url': info[k]['url'],
|
| 2355 |
-
'counts': info[k]["counts"],
|
| 2356 |
-
'feed_counter': currentFeed.feed_row.wdi_feed_counter,
|
| 2357 |
-
'user_name': info[k]['name'],
|
| 2358 |
-
'bio': wdi_front.escape_tags(info[k]['bio']),
|
| 2359 |
-
'website': website_host_name,
|
| 2360 |
-
'website_url': info[k]['website'],
|
| 2361 |
-
'usersCount': currentFeed.feed_row.feed_users.length,
|
| 2362 |
-
'hashtagClass': hashtagClass
|
| 2363 |
-
};
|
| 2364 |
-
|
| 2365 |
-
var userTemplate = wdi_front.getUserTemplate(currentFeed, info[k]['name']),
|
| 2366 |
-
html = userTemplate(templateData),
|
| 2367 |
-
containerHtml = feed_container.find('.wdi_feed_users').html();
|
| 2368 |
-
|
| 2369 |
-
feed_container.find('.wdi_feed_users').html(containerHtml + html);
|
| 2370 |
-
|
| 2371 |
-
currentFeed.userSortFlags.push(userFilter);
|
| 2372 |
-
|
| 2373 |
-
var clearFloat = jQuery('<div class="wdi_clear"></div>');
|
| 2374 |
-
|
| 2375 |
-
}
|
| 2376 |
-
feed_container.find('.wdi_feed_users').append(clearFloat);
|
| 2377 |
-
wdi_front.updateUsersImages(currentFeed);
|
| 2378 |
-
};
|
| 2379 |
-
}
|
| 2380 |
-
*/
|
| 2381 |
}
|
| 2382 |
|
| 2383 |
wdi_front.getUserTemplate = function (currentFeed, username) {
|
|
@@ -2557,9 +1968,6 @@ wdi_front.getImgCount = function (currentFeed) {
|
|
| 2557 |
// parses image data for lightbox popup
|
| 2558 |
wdi_front.parseLighboxData = function (currentFeed, filterFlag) {
|
| 2559 |
var dataStorage = currentFeed.dataStorage;
|
| 2560 |
-
var sortImagesBy = currentFeed.feed_row['sort_images_by'];
|
| 2561 |
-
var sortOrder = currentFeed.feed_row['display_order'];
|
| 2562 |
-
var sortOperator = wdi_front.sortingOperator(sortImagesBy, sortOrder);
|
| 2563 |
var data = [];
|
| 2564 |
|
| 2565 |
var popupData = [];
|
|
@@ -2567,15 +1975,10 @@ wdi_front.parseLighboxData = function (currentFeed, filterFlag) {
|
|
| 2567 |
|
| 2568 |
//if filterFlag is true, it means that some filter for frontend content is enabled so give
|
| 2569 |
//lightbox only those images which are visible at that moment else give all avialable
|
| 2570 |
-
|
| 2571 |
-
|
| 2572 |
-
|
| 2573 |
-
for (var i = 0; i < dataStorage.length; i++) {
|
| 2574 |
-
for (var j = 0; j < dataStorage[i].length; j++) {
|
| 2575 |
-
data.push(dataStorage[i][j]);
|
| 2576 |
-
}
|
| 2577 |
}
|
| 2578 |
-
data.sort(sortOperator);
|
| 2579 |
}
|
| 2580 |
for (i = 0; i < data.length; i++) {
|
| 2581 |
if( typeof data[i] === 'undefined' ) {
|
|
@@ -2594,8 +1997,9 @@ wdi_front.parseLighboxData = function (currentFeed, filterFlag) {
|
|
| 2594 |
}
|
| 2595 |
}
|
| 2596 |
var comment_count = 0;
|
| 2597 |
-
|
| 2598 |
-
|
|
|
|
| 2599 |
}
|
| 2600 |
obj = {
|
| 2601 |
'alt': '',
|
| 102 |
|
| 103 |
wdi_front.access_token = currentFeed['feed_row']['access_token'];
|
| 104 |
|
| 105 |
+
currentFeed.dataLoaded = 0;
|
| 106 |
currentFeed.dataStorageRaw = []; //stores all getted data from instagram api
|
| 107 |
currentFeed.dataStorage = []; //stores all avialable data
|
| 108 |
currentFeed.dataStorageList = []; //?
|
| 164 |
currentFeed.feed_row.resort_after_load_more = 0;
|
| 165 |
if (currentFeed.feed_row.feed_type != 'image_browser') {
|
| 166 |
currentFeed.feed_row.load_more_number = parseInt(currentFeed.feed_row.pagination_per_page_number);
|
| 167 |
+
currentFeed.feed_row.number_of_photos = currentFeed.allResponseLength;
|
| 168 |
} else {
|
| 169 |
currentFeed.feed_row.number_of_photos = 1 + parseInt(currentFeed.feed_row.image_browser_preload_number);
|
| 170 |
currentFeed.feed_row.load_more_number = parseInt(currentFeed.feed_row.image_browser_load_number);
|
| 362 |
user_name: user.username,
|
| 363 |
success: function (response) {
|
| 364 |
if ( ( typeof response.error != 'undefined' && response.error.type != 'undefined' ) || ( typeof response.meta != 'undefined' && response.meta.error == true ) ) {
|
| 365 |
+
currentFeed.dataLoaded = 1;
|
| 366 |
wdi_front.show_alert(false, response, currentFeed);
|
| 367 |
return false;
|
| 368 |
}
|
| 369 |
currentFeed.mediaRequestsDone = true;
|
| 370 |
response = _this.checkMediaResponse(response, currentFeed);
|
| 371 |
+
currentFeed.dataLoaded = 1;
|
| 372 |
if ( response != false ) {
|
| 373 |
_this.saveUserData(response, currentFeed.feed_users[id], currentFeed);
|
| 374 |
}
|
| 387 |
user_name: feed_users[id].username,
|
| 388 |
success: function (response) {
|
| 389 |
if ( typeof response.meta != 'undefined' && typeof response.meta.error == true ) {
|
| 390 |
+
currentFeed.dataLoaded = 1;
|
| 391 |
wdi_front.show_alert(false, response, currentFeed);
|
| 392 |
return false;
|
| 393 |
}
|
| 394 |
currentFeed.mediaRequestsDone = true;
|
| 395 |
+
currentFeed.dataLoaded = 1;
|
| 396 |
response = _this.checkMediaResponse(response, currentFeed);
|
| 397 |
if ( response != false ) {
|
| 398 |
_this.saveUserData(response, currentFeed.feed_users[id], currentFeed);
|
| 399 |
+
} else {
|
| 400 |
+
wdi_front.allImagesLoaded(currentFeed);
|
| 401 |
}
|
| 402 |
}
|
| 403 |
}, '', 0);
|
| 547 |
* also checks if one request is not enough for displaying all images user wanted
|
| 548 |
* it recursively calls wdi_front.loadMore() until the desired number of photos is reached
|
| 549 |
*/
|
| 550 |
+
wdi_front.displayFeed = function (currentFeed, page_number) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 551 |
|
| 552 |
+
if( typeof page_number === 'undefined') {
|
| 553 |
+
page_number = 1;
|
| 554 |
+
}
|
| 555 |
|
| 556 |
+
for( var i = 0; i < currentFeed['usersData'].length; i++ ) {
|
| 557 |
+
currentFeed['dataStorageList'] = currentFeed['usersData'][i]['data'];
|
| 558 |
+
/* Using in parsed lightbox function */
|
| 559 |
+
currentFeed['dataStorage'][i] = currentFeed['usersData'][i]['data'];
|
| 560 |
}
|
| 561 |
+
var first_page_img_count = currentFeed['feed_row']['number_of_photos'];
|
| 562 |
+
var load_more_count = currentFeed['feed_row']['load_more_number'];
|
| 563 |
+
|
| 564 |
+
var start_index = 0;
|
| 565 |
+
var end_index = first_page_img_count;
|
| 566 |
+
var data = '';
|
| 567 |
|
| 568 |
+
/* Type of simple pagination */
|
| 569 |
+
if (currentFeed.feed_row.feed_display_view == 'pagination') {
|
| 570 |
+
currentFeed.feed_row.number_of_photos = currentFeed.allResponseLength;
|
| 571 |
+
if(currentFeed.feed_row.feed_type == 'image_browser') {
|
| 572 |
+
currentFeed.paginator = parseInt(currentFeed.feed_row.number_of_photos);
|
| 573 |
+
} else {
|
| 574 |
+
currentFeed.paginator = Math.ceil(parseInt(currentFeed.feed_row.number_of_photos) / parseInt(load_more_count));
|
| 575 |
+
}
|
| 576 |
+
if(page_number === 1) {
|
| 577 |
+
start_index = 0;
|
| 578 |
+
if(currentFeed.feed_row.feed_type == 'image_browser') {
|
| 579 |
+
end_index = 1;
|
| 580 |
+
} else {
|
| 581 |
+
end_index = load_more_count;
|
| 582 |
+
}
|
| 583 |
+
data = currentFeed['dataStorageList'].slice(start_index, end_index);
|
| 584 |
+
} else {
|
| 585 |
+
if(currentFeed.feed_row.feed_type == 'image_browser') {
|
| 586 |
+
start_index = (page_number-1);
|
| 587 |
+
end_index = start_index+1;
|
| 588 |
+
data = currentFeed['dataStorageList'].slice(start_index, end_index);
|
| 589 |
+
} else {
|
| 590 |
+
start_index = (page_number-1)*load_more_count;
|
| 591 |
+
end_index = start_index+load_more_count;
|
| 592 |
+
data = currentFeed['dataStorageList'].slice(start_index, end_index);
|
| 593 |
+
}
|
| 594 |
}
|
| 595 |
} else {
|
| 596 |
+
if (typeof currentFeed['already_loaded_count'] !== 'undefined') {
|
| 597 |
+
start_index = parseInt(currentFeed['already_loaded_count']);
|
| 598 |
+
end_index = currentFeed['already_loaded_count'] + parseInt(load_more_count);
|
| 599 |
+
data = currentFeed['dataStorageList'].slice(start_index, end_index);
|
| 600 |
+
currentFeed['already_loaded_count'] += data.length;
|
| 601 |
+
}
|
| 602 |
+
else {
|
| 603 |
+
data = currentFeed['dataStorageList'].slice(start_index, end_index);
|
| 604 |
+
currentFeed['already_loaded_count'] = data.length;
|
| 605 |
}
|
| 606 |
}
|
| 607 |
|
| 608 |
+
//parsing data for lightbox
|
| 609 |
+
currentFeed.parsedData = wdi_front.parseLighboxData(currentFeed, true);
|
| 610 |
+
|
| 611 |
//checking feed_type and calling proper rendering functions
|
| 612 |
if (currentFeed.feed_row.feed_type == 'masonry') {
|
| 613 |
wdi_front.masonryDisplayFeedItems(data, currentFeed);
|
| 617 |
wdi_front.displayFeedItems(data, currentFeed);
|
| 618 |
}
|
| 619 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 620 |
|
| 621 |
//checking if display_view is pagination and we are not on the last page then enable
|
| 622 |
//last page button
|
| 624 |
jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter).find('#wdi_last_page').removeClass('wdi_disabled');
|
| 625 |
}
|
| 626 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 627 |
//if there are any missing images in header then replace them with new ones if possible
|
| 628 |
wdi_front.updateUsersImages(currentFeed);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 629 |
}
|
| 630 |
|
| 631 |
/**
|
| 652 |
});
|
| 653 |
}
|
| 654 |
|
| 655 |
+
wdi_front.checkLoaded = function (currentFeed) {
|
| 656 |
+
var wdi_feed_counter = currentFeed.feed_row['wdi_feed_counter'];
|
| 657 |
+
|
| 658 |
+
var feed_container = jQuery('#wdi_feed_' + wdi_feed_counter);
|
| 659 |
+
/* if there are images which can be loaded */
|
| 660 |
+
if( currentFeed['dataStorageList'].length > (currentFeed['already_loaded_count']) ) {
|
| 661 |
+
feed_container.find('.wdi_load_more').removeClass('wdi_hidden');
|
| 662 |
+
feed_container.find('.wdi_spinner').addClass('wdi_hidden');
|
| 663 |
+
} else {
|
| 664 |
+
feed_container.find('.wdi_load_more').addClass('wdi_hidden');
|
| 665 |
+
feed_container.find('.wdi_spinner').addClass('wdi_hidden');
|
| 666 |
+
}
|
| 667 |
+
setTimeout(function () {
|
| 668 |
+
feed_container.find('.wdi_ajax_loading').addClass('wdi_hidden');
|
| 669 |
+
}, 500);
|
| 670 |
+
}
|
| 671 |
+
|
| 672 |
+
|
| 673 |
/**
|
| 674 |
* Displays data in masonry layout
|
| 675 |
* @param {Object} data data to be displayed
|
| 759 |
}
|
| 760 |
}
|
| 761 |
|
| 762 |
+
|
| 763 |
+
|
| 764 |
//binding onload event for ajax loader
|
| 765 |
currentFeed.wdi_loadedImages = 0;
|
| 766 |
var columnFlag = false;
|
| 767 |
currentFeed.wdi_load_count = i;
|
| 768 |
var wdi_feed_counter = currentFeed.feed_row['wdi_feed_counter'];
|
| 769 |
+
var feed_wrapper = jQuery('#wdi_feed_' + wdi_feed_counter + ' .wdi_img').on('load', function () {
|
| 770 |
currentFeed.wdi_loadedImages++;
|
| 771 |
+
|
| 772 |
|
| 773 |
//calls wdi_responsive.columnControl() which calculates column number on page
|
| 774 |
//and gives feed_wrapper proper column class
|
| 776 |
wdi_responsive.columnControl(currentFeed, 1);
|
| 777 |
columnFlag = true;
|
| 778 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 779 |
});
|
| 780 |
|
| 781 |
+
wdi_front.checkLoaded(currentFeed);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 782 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 783 |
|
| 784 |
//checking if pagination next button was clicked then change page
|
| 785 |
if (currentFeed.paginatorNextFlag == true) {
|
| 842 |
//no feed in DOM, ignore
|
| 843 |
return;
|
| 844 |
}
|
|
|
|
| 845 |
//gets ready data, gets data template, and appens it into feed_wrapper
|
| 846 |
var wdi_feed_counter = currentFeed.feed_row['wdi_feed_counter'];
|
| 847 |
var feed_wrapper = jQuery('#wdi_feed_' + wdi_feed_counter + ' .wdi_feed_wrapper');
|
| 848 |
+
/*
|
| 849 |
+
/!**
|
| 850 |
+
* if feed display view is set to pagination then check if the current page has not enough photos to be a complete page then
|
| 851 |
+
* --currentPage so that after loading new images we stay on the same page and see new images which will be located in that page
|
| 852 |
+
* also do the same thing when recievied data has lenght equal to zero
|
| 853 |
+
*!/
|
| 854 |
+
if (currentFeed.feed_row.feed_display_view == 'pagination') {
|
| 855 |
+
var local_load_more_number = currentFeed.feed_row.load_more_number;
|
| 856 |
+
if(currentFeed.feed_row.feed_type == 'image_browser') {
|
| 857 |
+
local_load_more_number = 1;
|
| 858 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 859 |
}
|
| 860 |
+
*/
|
|
|
|
|
|
|
| 861 |
for (var i = 0; i < data.length; i++) {
|
| 862 |
+
if (typeof data[i] == 'undefined') {
|
| 863 |
return;
|
| 864 |
}
|
| 865 |
+
if (typeof data[i]['videos'] === 'object') {
|
| 866 |
+
if (data[i]['videos'].standard_resolution == null) {
|
| 867 |
continue;
|
| 868 |
}
|
| 869 |
}
|
| 870 |
var wdi_media_type = "";
|
| 871 |
+
currentFeed['imageIndex'] = i;
|
| 872 |
+
if (typeof data[i]["wdi_hashtag"] != "undefined") {
|
| 873 |
wdi_media_type = data[i]["wdi_hashtag"];
|
| 874 |
}
|
| 875 |
if (data[i]['type'] == 'image') {
|
| 876 |
var photoTemplate = wdi_front.getPhotoTemplate(currentFeed, wdi_media_type);
|
| 877 |
+
}
|
| 878 |
+
else if (data[i].hasOwnProperty('videos')) {
|
| 879 |
var photoTemplate = wdi_front.getVideoTemplate(currentFeed, wdi_media_type);
|
| 880 |
}
|
| 881 |
+
else {
|
| 882 |
var photoTemplate = wdi_front.getSliderTemplate(currentFeed, wdi_media_type);
|
| 883 |
}
|
|
|
|
| 884 |
var rawItem = data[i];
|
| 885 |
var item = wdi_front.createObject(rawItem, currentFeed);
|
|
|
|
| 886 |
var html = '';
|
| 887 |
/* undefined when carousel media not defined */
|
| 888 |
+
if (typeof item !== 'undefined') {
|
| 889 |
html = photoTemplate(item);
|
| 890 |
}
|
| 891 |
feed_wrapper.html(feed_wrapper.html() + html);
|
|
|
|
| 892 |
currentFeed.imageIndex++;
|
| 893 |
//changing responsive indexes for pagination
|
| 894 |
if (currentFeed.feed_row.feed_display_view == 'pagination') {
|
| 895 |
if ((i + 1) % currentFeed.feed_row.pagination_per_page_number === 0) {
|
| 896 |
currentFeed.resIndex += currentFeed.freeSpaces + 1;
|
| 897 |
+
}
|
| 898 |
+
else {
|
| 899 |
currentFeed.resIndex++;
|
| 900 |
}
|
| 901 |
}
|
| 902 |
}
|
| 903 |
+
checkLoaded();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 904 |
|
| 905 |
//checks if all iamges have been succesfully loaded then it updates variables for next time use
|
| 906 |
function checkLoaded()
|
| 907 |
{
|
| 908 |
+
var wdi_feed_counter = currentFeed.feed_row['wdi_feed_counter'];
|
|
|
|
|
|
|
|
|
|
| 909 |
|
| 910 |
+
var feed_container = jQuery('#wdi_feed_' + wdi_feed_counter);
|
| 911 |
+
/* if there are images which can be loaded */
|
| 912 |
+
if( currentFeed['dataStorageList'].length > (currentFeed['already_loaded_count']) ) {
|
| 913 |
+
feed_container.find('.wdi_load_more').removeClass('wdi_hidden');
|
| 914 |
+
feed_container.find('.wdi_spinner').addClass('wdi_hidden');
|
| 915 |
+
} else {
|
| 916 |
+
feed_container.find('.wdi_load_more').addClass('wdi_hidden');
|
| 917 |
+
feed_container.find('.wdi_spinner').addClass('wdi_hidden');
|
| 918 |
}
|
| 919 |
+
setTimeout(function () {
|
| 920 |
+
feed_container.find('.wdi_ajax_loading').addClass('wdi_hidden');
|
| 921 |
+
}, 500);
|
| 922 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 923 |
}
|
| 924 |
|
| 925 |
wdi_front.checkFeedFinished = function (currentFeed) {
|
| 931 |
return true;
|
| 932 |
}
|
| 933 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 934 |
|
| 935 |
/*
|
| 936 |
* returns json object for inserting photo template
|
| 998 |
'thumbType': thumbType,
|
| 999 |
'caption': wdi_front.escape_tags(caption),
|
| 1000 |
'image_url': image_url,
|
| 1001 |
+
'likes': ( typeof obj['likes']['count'] !== 'undefined' ) ? obj['likes']['count'] : obj['likes'],
|
| 1002 |
+
'comments': ( typeof obj['comments']['count'] !== 'undefined' ) ? obj['comments']['count'] : obj['comments'],
|
| 1003 |
'wdi_index': imageIndex,
|
| 1004 |
'wdi_res_index': currentFeed.resIndex,
|
| 1005 |
'wdi_media_user': obj_user_name,
|
| 1011 |
return photoObject;
|
| 1012 |
}
|
| 1013 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1014 |
|
| 1015 |
/*
|
| 1016 |
* Template for all feed items which have type=image
|
| 1017 |
*/
|
| 1018 |
wdi_front.getPhotoTemplate = function (currentFeed , type) {
|
|
|
|
| 1019 |
var customClass = '';
|
| 1020 |
var pagination = '';
|
| 1021 |
var onclick = '';
|
| 1022 |
var overlayCustomClass = '';
|
| 1023 |
var thumbClass = 'tenweb-i-arrows-out';
|
| 1024 |
var showUsernameOnThumb = '';
|
| 1025 |
+
var sourceAttr = 'src';
|
| 1026 |
if (currentFeed.feed_row.feed_type == 'blog_style' || currentFeed.feed_row.feed_type == 'image_browser') {
|
| 1027 |
thumbClass = '';
|
| 1028 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1029 |
|
| 1030 |
|
| 1031 |
if (currentFeed.feed_row.show_username_on_thumb == '1' && currentFeed.data.length && currentFeed.data[0].user.username !== "") {
|
| 1096 |
var imageIndex = currentFeed['imageIndex'];
|
| 1097 |
if (currentFeed['feed_row']['show_likes'] === '1' || currentFeed['feed_row']['show_comments'] === '1' || currentFeed['feed_row']['show_description'] === '1') {
|
| 1098 |
source += '<div class="wdi_photo_meta">';
|
| 1099 |
+
var likes_count = ( typeof currentFeed['dataStorageList'][imageIndex]['likes']['count'] !== 'undefined' ) ? currentFeed['dataStorageList'][imageIndex]['likes']['count'] : currentFeed['dataStorageList'][imageIndex]['likes'];
|
| 1100 |
+
if (currentFeed['feed_row']['show_likes'] === '1' && likes_count !== 0) {
|
| 1101 |
source += '<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o"> <%= likes%></i></div>';
|
| 1102 |
}
|
| 1103 |
+
var comments_count = ( typeof currentFeed['dataStorageList'][imageIndex]['comments']['count'] !== 'undefined' ) ? currentFeed['dataStorageList'][imageIndex]['comments']['count'] : currentFeed['dataStorageList'][imageIndex]['comments'];
|
| 1104 |
+
if (currentFeed['feed_row']['show_comments'] === '1' && comments_count !== 0) {
|
| 1105 |
source += '<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square"> <%= comments%></i></div>';
|
| 1106 |
}
|
| 1107 |
source += '<div class="wdi_clear"></div>';
|
| 1122 |
* Template for all feed items which have type=image
|
| 1123 |
*/
|
| 1124 |
wdi_front.getSliderTemplate = function (currentFeed, type) {
|
|
|
|
| 1125 |
var customClass = '';
|
| 1126 |
var pagination = '';
|
| 1127 |
var onclick = '';
|
| 1128 |
var overlayCustomClass = '';
|
| 1129 |
var thumbClass = 'tenweb-i-clone';
|
| 1130 |
var showUsernameOnThumb = '';
|
| 1131 |
+
var sourceAttr = 'src';
|
| 1132 |
if (currentFeed.feed_row.feed_type == 'blog_style' || currentFeed.feed_row.feed_type == 'image_browser') {
|
| 1133 |
thumbClass = '';
|
| 1134 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1135 |
|
| 1136 |
if (currentFeed.feed_row.show_username_on_thumb == '1' && currentFeed.data.length && currentFeed.data[0].user.username !== "") {
|
| 1137 |
showUsernameOnThumb = '<span class="wdi_media_user">@<%= wdi_username%></span>';
|
| 1207 |
var imageIndex = currentFeed['imageIndex'];
|
| 1208 |
if (currentFeed['feed_row']['show_likes'] === '1' || currentFeed['feed_row']['show_comments'] === '1' || currentFeed['feed_row']['show_description'] === '1') {
|
| 1209 |
source += '<div class="wdi_photo_meta">';
|
| 1210 |
+
var likes_count = ( typeof currentFeed['dataStorageList'][imageIndex]['likes']['count'] !== 'undefined' ) ? currentFeed['dataStorageList'][imageIndex]['likes']['count'] : currentFeed['dataStorageList'][imageIndex]['likes'];
|
| 1211 |
+
if (currentFeed['feed_row']['show_likes'] === '1' && likes_count !== 0) {
|
| 1212 |
source += '<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o"> <%= likes%></i></div>';
|
| 1213 |
}
|
| 1214 |
+
var comments_count = ( typeof currentFeed['dataStorageList'][imageIndex]['comments']['count'] !== 'undefined' ) ? currentFeed['dataStorageList'][imageIndex]['comments']['count'] : currentFeed['dataStorageList'][imageIndex]['comments'];
|
| 1215 |
+
if (currentFeed['feed_row']['show_comments'] === '1' && comments_count !== 0) {
|
| 1216 |
source += '<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square"> <%= comments%></i></div>';
|
| 1217 |
}
|
| 1218 |
source += '<div class="wdi_clear"></div>';
|
| 1243 |
* Template for all feed items which have type=video
|
| 1244 |
*/
|
| 1245 |
wdi_front.getVideoTemplate = function (currentFeed, type) {
|
|
|
|
| 1246 |
var customClass = '';
|
| 1247 |
var pagination = '';
|
| 1248 |
var thumbClass = 'tenweb-i-play';
|
| 1249 |
var onclick = '';
|
| 1250 |
var overlayCustomClass = '';
|
| 1251 |
+
var sourceAttr = 'src';;
|
| 1252 |
var showUsernameOnThumb = '';
|
| 1253 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1254 |
if (currentFeed.feed_row.show_username_on_thumb == '1' && currentFeed.data.length && currentFeed.data[0].user.username !== "") {
|
| 1255 |
showUsernameOnThumb = '<span class="wdi_media_user">@<%= wdi_username%></span>';
|
| 1256 |
}
|
| 1323 |
var imageIndex = currentFeed['imageIndex'];
|
| 1324 |
if (currentFeed['feed_row']['show_likes'] === '1' || currentFeed['feed_row']['show_comments'] === '1' || currentFeed['feed_row']['show_description'] === '1') {
|
| 1325 |
source += '<div class="wdi_photo_meta">';
|
| 1326 |
+
var likes_count = ( typeof currentFeed['dataStorageList'][imageIndex]['likes']['count'] !== 'undefined' ) ? currentFeed['dataStorageList'][imageIndex]['likes']['count'] : currentFeed['dataStorageList'][imageIndex]['likes'];
|
| 1327 |
+
if (currentFeed['feed_row']['show_likes'] === '1' && likes_count !== 0) {
|
| 1328 |
source += '<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o"> <%= likes%></i></div>';
|
| 1329 |
}
|
| 1330 |
+
var comments_count = ( typeof currentFeed['dataStorageList'][imageIndex]['comments']['count'] !== 'undefined' ) ? currentFeed['dataStorageList'][imageIndex]['comments']['count'] : currentFeed['dataStorageList'][imageIndex]['comments'];
|
| 1331 |
+
if (currentFeed['feed_row']['show_comments'] === '1' && comments_count !== 0) {
|
| 1332 |
source += '<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square"> <%= comments%></i></div>';
|
| 1333 |
}
|
| 1334 |
source += '<div class="wdi_clear"></div>';
|
| 1353 |
if (currentFeed.feed_row.feed_display_view == 'load_more_btn') {
|
| 1354 |
//binding load more event
|
| 1355 |
jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' .wdi_load_more_container').on(wdi_front.clickOrTouch, function () {
|
| 1356 |
+
jQuery(document).find('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' .wdi_load_more').addClass('wdi_hidden');
|
| 1357 |
+
jQuery(document).find('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' .wdi_spinner').removeClass('wdi_hidden');
|
| 1358 |
+
|
| 1359 |
//do the actual load more operation
|
| 1360 |
+
setTimeout(function () {
|
| 1361 |
+
wdi_front.loadMore(jQuery(this).find('.wdi_load_more_wrap'), currentFeed);
|
| 1362 |
+
},1000)
|
| 1363 |
});
|
| 1364 |
}
|
| 1365 |
|
| 1367 |
//binding pagination events
|
| 1368 |
jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' #wdi_next').on(wdi_front.clickOrTouch, function ()
|
| 1369 |
{
|
| 1370 |
+
//wdi_front.paginatorNext(jQuery(this), currentFeed)
|
| 1371 |
+
if( (parseInt(jQuery("#wdi_current_page").text()) + 1) > currentFeed.paginator ) {
|
| 1372 |
+
return;
|
| 1373 |
+
}
|
| 1374 |
+
currentFeed.currentPage = (parseInt(jQuery("#wdi_current_page").text()) + 1);
|
| 1375 |
+
wdi_front.changePage(jQuery(this), currentFeed);
|
| 1376 |
});
|
| 1377 |
jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' #wdi_prev').on(wdi_front.clickOrTouch, function ()
|
| 1378 |
{
|
| 1379 |
+
|
| 1380 |
+
if( (parseInt(jQuery("#wdi_current_page").text()) - 1) <= 0 ) {
|
| 1381 |
+
return;
|
| 1382 |
+
}
|
| 1383 |
+
currentFeed.currentPage = (parseInt(jQuery("#wdi_current_page").text()) - 1);
|
| 1384 |
+
wdi_front.changePage(jQuery(this), currentFeed);
|
| 1385 |
});
|
| 1386 |
jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' #wdi_last_page').on(wdi_front.clickOrTouch, function ()
|
| 1387 |
{
|
| 1388 |
+
currentFeed.currentPage = currentFeed.paginator;
|
| 1389 |
+
wdi_front.changePage(jQuery(this), currentFeed);
|
| 1390 |
});
|
| 1391 |
jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' #wdi_first_page').on(wdi_front.clickOrTouch, function ()
|
| 1392 |
{
|
| 1393 |
+
currentFeed.currentPage = 1;
|
| 1394 |
+
wdi_front.changePage(jQuery(this), currentFeed);
|
| 1395 |
});
|
| 1396 |
//setting pagiantion flags
|
| 1397 |
currentFeed.paginatorNextFlag = false;
|
| 1408 |
}
|
| 1409 |
|
| 1410 |
wdi_front.infiniteScroll = function (currentFeed) {
|
| 1411 |
+
|
| 1412 |
if ((jQuery(window).scrollTop() + jQuery(window).height() - 100) >= jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' #wdi_infinite_scroll').offset().top) {
|
| 1413 |
+
if ((currentFeed['dataStorageList'].length > (currentFeed['already_loaded_count']) || typeof currentFeed['already_loaded_count'] === 'undefined')) {
|
| 1414 |
currentFeed.infiniteScrollFlag = true;
|
| 1415 |
wdi_front.loadMore(jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' #wdi_infinite_scroll'), currentFeed);
|
| 1416 |
} else
|
|
|
|
| 1417 |
wdi_front.allImagesLoaded(currentFeed);
|
|
|
|
| 1418 |
|
| 1419 |
}
|
| 1420 |
}
|
| 1421 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1422 |
|
| 1423 |
+
wdi_front.changePage = function (btn, currentFeed) {
|
| 1424 |
+
var feed_container = btn.closest(".wdi_feed_container");
|
| 1425 |
+
feed_container.find(".wdi_page_loading").removeClass("wdi_hidden");
|
| 1426 |
|
| 1427 |
+
new_page_number = currentFeed.currentPage;
|
| 1428 |
+
if( new_page_number > 1 ) {
|
| 1429 |
+
jQuery("#wdi_first_page").removeClass("wdi_disabled");
|
| 1430 |
+
} else if( new_page_number === 1 ) {
|
| 1431 |
+
jQuery("#wdi_first_page").addClass("wdi_disabled");
|
|
|
|
|
|
|
| 1432 |
}
|
| 1433 |
+
if( new_page_number == parseInt(currentFeed.paginator) ) {
|
| 1434 |
+
jQuery("#wdi_last_page").addClass("wdi_disabled");
|
| 1435 |
+
} else if( new_page_number < parseInt(currentFeed.paginator) ) {
|
| 1436 |
+
jQuery("#wdi_last_page").removeClass("wdi_disabled");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1437 |
}
|
| 1438 |
+
if (currentFeed.feed_row.feed_type == 'masonry') {
|
| 1439 |
+
btn.parent().parent().parent().find(".wdi_feed_wrapper .wdi_masonry_column").empty();
|
| 1440 |
+
} else {
|
| 1441 |
+
btn.parent().parent().parent().find(".wdi_feed_wrapper").empty();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1442 |
}
|
| 1443 |
+
btn.parent().find("#wdi_current_page").empty().text(new_page_number);
|
| 1444 |
+
wdi_front.displayFeed(currentFeed, new_page_number);
|
| 1445 |
+
feed_container.find(".wdi_page_loading").addClass("wdi_hidden")
|
| 1446 |
}
|
| 1447 |
|
| 1448 |
+
|
| 1449 |
//displays proper images for specific page after pagination buttons click event
|
| 1450 |
wdi_front.updatePagination = function (currentFeed, dir, oldPage)
|
| 1451 |
{
|
| 1452 |
+
|
| 1453 |
var currentFeedString = '#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'];
|
| 1454 |
jQuery(currentFeedString + ' [wdi_page="' + currentFeed.currentPage + '"]').each(function ()
|
| 1455 |
{
|
| 1504 |
if ( typeof _currentFeed != 'undefined' ) {
|
| 1505 |
var currentFeed = _currentFeed;
|
| 1506 |
}
|
| 1507 |
+
|
| 1508 |
wdi_front.ajaxLoader(currentFeed);
|
| 1509 |
if ( this.isJsonString(currentFeed.feed_row.feed_users) ) {
|
| 1510 |
json_feed_users = JSON.parse(currentFeed.feed_row.feed_users);
|
| 1515 |
}
|
| 1516 |
}
|
| 1517 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1518 |
|
| 1519 |
//check if masonry view is on and and feed display type is pagination then
|
| 1520 |
//close all captions before loading more pages for porper pagination rendering
|
| 1524 |
});
|
| 1525 |
}
|
| 1526 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1527 |
currentFeed.loadMoreDataCount = currentFeed.feed_users.length;
|
| 1528 |
+
wdi_front.displayFeed(currentFeed);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1529 |
}
|
| 1530 |
|
| 1531 |
/*
|
| 1714 |
//ajax loading
|
| 1715 |
wdi_front.ajaxLoader = function (currentFeed) {
|
| 1716 |
var wdi_feed_counter = currentFeed.feed_row['wdi_feed_counter'];
|
| 1717 |
+
var feed_container = jQuery(document).find('#wdi_feed_' + wdi_feed_counter);
|
|
|
|
| 1718 |
if (currentFeed.feed_row.feed_display_view == 'load_more_btn') {
|
| 1719 |
feed_container.find('.wdi_load_more').addClass('wdi_hidden');
|
| 1720 |
feed_container.find('.wdi_spinner').removeClass('wdi_hidden');
|
| 1724 |
var loadingDiv;
|
| 1725 |
if (feed_container.find('.wdi_ajax_loading').length == 0) {
|
| 1726 |
loadingDiv = 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>');
|
| 1727 |
+
feed_container.find(".wdi_feed_container").append(loadingDiv);
|
| 1728 |
} else {
|
| 1729 |
loadingDiv = feed_container.find('.wdi_ajax_loading');
|
| 1730 |
}
|
| 1731 |
loadingDiv.removeClass('wdi_hidden');
|
| 1732 |
}
|
| 1733 |
+
return 1;
|
| 1734 |
}
|
| 1735 |
|
| 1736 |
//if all images loaded then clicking load more causes it's removal
|
| 1741 |
jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter + " .wdi_feed_wrapper").remove("wdi_nomedia");
|
| 1742 |
}
|
| 1743 |
/* display message if feed contains no image at all */
|
| 1744 |
+
if (currentFeed.allResponseLength == 0 && currentFeed.dataLoaded === 1) {
|
| 1745 |
jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter + " .wdi_feed_wrapper").append("<p class='wdi_nomedia'>" + wdi_front_messages.feed_nomedia + "</p>");
|
| 1746 |
}
|
| 1747 |
|
| 1750 |
var feed_container = jQuery('#wdi_feed_' + wdi_feed_counter);
|
| 1751 |
|
| 1752 |
if (currentFeed.feed_row.feed_display_view == 'load_more_btn') {
|
| 1753 |
+
if(parseInt(currentFeed.allResponseLength) > parseInt(currentFeed.feed_row.number_of_photos)) {
|
| 1754 |
+
feed_container.find('.wdi_load_more').removeClass('wdi_hidden');
|
| 1755 |
+
}
|
| 1756 |
feed_container.find('.wdi_spinner').addClass('wdi_hidden');
|
| 1757 |
}
|
| 1758 |
|
| 1789 |
containerHtml = feed_container.find('.wdi_feed_header').html();
|
| 1790 |
feed_container.find('.wdi_feed_header').html(containerHtml + html);
|
| 1791 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1792 |
}
|
| 1793 |
|
| 1794 |
wdi_front.getUserTemplate = function (currentFeed, username) {
|
| 1968 |
// parses image data for lightbox popup
|
| 1969 |
wdi_front.parseLighboxData = function (currentFeed, filterFlag) {
|
| 1970 |
var dataStorage = currentFeed.dataStorage;
|
|
|
|
|
|
|
|
|
|
| 1971 |
var data = [];
|
| 1972 |
|
| 1973 |
var popupData = [];
|
| 1975 |
|
| 1976 |
//if filterFlag is true, it means that some filter for frontend content is enabled so give
|
| 1977 |
//lightbox only those images which are visible at that moment else give all avialable
|
| 1978 |
+
for (var i = 0; i < dataStorage.length; i++) {
|
| 1979 |
+
for (var j = 0; j < dataStorage[i].length; j++) {
|
| 1980 |
+
data.push(dataStorage[i][j]);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1981 |
}
|
|
|
|
| 1982 |
}
|
| 1983 |
for (i = 0; i < data.length; i++) {
|
| 1984 |
if( typeof data[i] === 'undefined' ) {
|
| 1997 |
}
|
| 1998 |
}
|
| 1999 |
var comment_count = 0;
|
| 2000 |
+
var comments = ( typeof data[i]['comments']['count'] !== 'undefined' ) ? data[i]['comments']['count'] : data[i]['comments'];
|
| 2001 |
+
if( typeof data[i] !== 'undefined' && typeof comments !== "undefined" ) {
|
| 2002 |
+
comment_count = comments;
|
| 2003 |
}
|
| 2004 |
obj = {
|
| 2005 |
'alt': '',
|
js/wdi_frontend.min.js
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
"undefined"==typeof wdi_front&&(wdi_front={type:"not_declared"});var wdi_error_show=!(wdi_front.detectEvent=function(){var e="click";return/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())&&(e="touchend"),e}),wdi_error_init=!1;function wdi_baseName(e){var i=e.substr(e.lastIndexOf("/"));return e.replace(i,"")}wdi_front.escape_tags=function(e){return void 0===e&&(e=""),e=e.toString().replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")},wdi_front.show_alert=function(e,i,r){var t,d;void 0!==(r=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter))&&(wdi_error_show=!0,r.find(".wdi_spinner").remove(),t=r.find(".wdi_js_error"),d=r.find(".wdi_token_error"),0!=i&&(void 0!==i.meta&&1==i.meta.error&&"OAuthException"===i.meta.error_type||void 0!==i.error&&"OAuthException"===i.error.type)?(r.find(".wdi_single_user").remove(),d.removeClass("wdi_hidden"),"1"!=wdi_front_messages.wdi_token_error_flag&&jQuery.ajax({type:"POST",url:wdi_url.ajax_url,dataType:"json",data:{action:"wdi_token_flag",wdi_token_flag_nonce:wdi_front_messages.wdi_token_flag_nonce},success:function(e){}})):void 0!==i.error&&void 0!==i.error.message&&(t.html(i.error.message),r.find(".wdi_single_user").remove(),t.removeClass("wdi_js_error"),t.addClass("wdi_js_error_no_animate"),jQuery(".wdi_js_error_no_animate").show()),wdi_front_messages.show_alerts||console.log("%c"+e,"color:#cc0000;")),wdi_error_show=!0},wdi_front.globalInit=function(){var e=wdi_front.feed_counter,i=0;void 0!==wdi_ajax.ajax_response&&(i=wdi_feed_counter_init.wdi_feed_counter_init);for(var r,t=i;t<=e;t++)0!==jQuery("#wdi_feed_"+t).length&&((r=new WDIFeed(window["wdi_feed_"+t])).instagram=new WDIInstagram,r.instagram.filterArguments={feed:r},r.instagram.addToken(r.feed_row.access_token),wdi_front.access_token=r.feed_row.access_token,r.dataStorageRaw=[],r.dataStorage=[],r.dataStorageList=[],r.allResponseLength=0,r.currentResponseLength=0,r.temproraryUsersData=[],r.removedUsers=0,r.nowLoadingImages=!0,r.imageIndex=0,r.resIndex=0,r.currentPage=1,r.currentPageLoadMore=0,r.userSortFlags=[],r.customFilterChanged=!1,r.maxConditionalFiltersRequestCount=10,r.instagramRequestCounter=0,r.mediaRequestsDone=!1,r.conditionalFilterBuffer=[],r.stopInfiniteScrollFlag=!1,"masonry"==r.feed_row.feed_type&&(r.displayedData=[]),"pagination"==r.feed_row.feed_display_view?(r.feed_row.resort_after_load_more=0,"image_browser"!=r.feed_row.feed_type?(r.feed_row.load_more_number=parseInt(r.feed_row.pagination_per_page_number),r.feed_row.number_of_photos=(1+parseInt(r.feed_row.pagination_preload_number))*r.feed_row.load_more_number):(r.feed_row.number_of_photos=1+parseInt(r.feed_row.image_browser_preload_number),r.feed_row.load_more_number=parseInt(r.feed_row.image_browser_load_number)),r.freeSpaces=(Math.floor(r.feed_row.pagination_per_page_number/r.feed_row.number_of_columns)+1)*r.feed_row.number_of_columns-r.feed_row.pagination_per_page_number):r.freeSpaces=0,r.galleryBox=function(e){wdi_spider_createpopup(wdi_url.ajax_url+"?gallery_id="+this.feed_row.id+"&image_id="+e,this.feed_row.wdi_feed_counter,this.feed_row.lightbox_width,this.feed_row.lightbox_height,1,"testpopup",5,this,e)},wdi_responsive.columnControl(r),"masonry"==r.feed_row.feed_type&&jQuery(window).trigger("resize"),wdi_front.bindEvents(r),window["wdi_feed_"+t]=r,wdi_front.init(r))},wdi_front.init=function(e){if(jQuery(".wdi_js_error").hide(),e.photoCounter=e.feed_row.number_of_photos,"liked"==e.feed_row.liked_feed)e.feed_users=["self"];else{if(!wdi_front.isJsonString(e.feed_row.feed_users))return void wdi_front.show_alert(wdi_front_messages.invalid_users_format,!1,e);e.feed_users=JSON.parse(e.feed_row.feed_users)}var i=[],r=[],t=[];void 0!==window.wdi_all_tags&&(i=window.wdi_all_tags);for(var d=0;d<e.feed_users.length;d++)"#"===e.feed_users[d].username[0]&&void 0!==e.feed_users[d].tag_id?(i[e.feed_users[d].tag_id]=e.feed_users[d],t[d]=e.feed_users[d]):r[0]=e.feed_users[d];window.wdi_all_tags=i,e.feed_users=void 0===t||wdi_front.isEmpty(t)?r:t;var a=wdi_front.getFeedItemResolution(e);e.feedImageResolution=a.image,e.feedVideoResolution=a.video,e.dataCount=e.feed_users.length;for(var o=0;o<e.dataCount;o++)wdi_front.instagramRequest(o,e);0<e.feed_row.number_of_photos&&wdi_front.ajaxLoader(e),"1"===e.feed_row.display_header&&wdi_front.show("header",e),"1"===e.feed_row.show_usernames&&wdi_front.show("users",e)},wdi_front.getFeedItemResolution=function(e){var i={image:"standard_resolution",video:"standard_resolution"};if("thumbnail"===e.feed_row.feed_resolution)return{image:"thumbnail",video:"low_bandwidth"};if("low"===e.feed_row.feed_resolution)return{image:"low_resolution",video:"low_resolution"};if("standard"===e.feed_row.feed_resolution)return{image:"standard_resolution",video:"standard_resolution"};var r=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter).find(".wdi_feed_wrapper");r.append('<div class="wdi_feed_item" id="wdi_feed_item_example"></div>'),wdi_responsive.columnControl(e,1);e=r.attr("wdi-res").split("wdi_col_");if(r.find("#wdi_feed_item_example").remove(),2!==e.length)return i;e=parseInt(e[1]);if(e<=0)return i;e=r.width()/e-10;return e<=150?(i.image="thumbnail",i.video="low_bandwidth"):150<e&&e<=320?(i.image="low_resolution",i.video="low_resolution"):(i.image="standard_resolution",i.video="standard_resolution"),i},wdi_front.isJsonString=function(e){try{JSON.parse(e)}catch(e){return!1}return!0},wdi_front.instagramRequest=function(i,r){var t=this,e=r.feed_users;if("string"==typeof e[i]&&"self"===e[i])r.instagram.getRecentLikedMedia({success:function(e){void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,r),r.mediaRequestsDone=!0,0!=(e=t.checkMediaResponse(e,r))&&t.saveSelfUserData(e,r)}});else if("hashtag"==this.getInputType(e[i].username)){if(this.isJsonString(r.feed_row.feed_users))for(var d in json_feed_users=JSON.parse(r.feed_row.feed_users),json_feed_users)"#"!==json_feed_users[d].username.charAt(0)&&(user=json_feed_users[d]);r.instagram.getTagRecentMedia(this.stripHashtag(e[i].username),{feed_id:r.feed_row.id,user_id:user.id,user_name:user.username,success:function(e){if(void 0!==e.error&&"undefined"!=e.error.type||void 0!==e.meta&&1==e.meta.error)return wdi_front.show_alert(!1,e,r),!1;r.mediaRequestsDone=!0,0!=(e=t.checkMediaResponse(e,r))&&t.saveUserData(e,r.feed_users[i],r)}},null,r.feed_row.hashtag_top_recent,0)}else"user"==this.getInputType(e[i].username)&&r.instagram.getUserMedia({feed_id:r.feed_row.id,user_id:e[i].id,user_name:e[i].username,success:function(e){if(void 0!==e.meta&&1==typeof e.meta.error)return wdi_front.show_alert(!1,e,r),!1;r.mediaRequestsDone=!0,0!=(e=t.checkMediaResponse(e,r))&&t.saveUserData(e,r.feed_users[i],r)}},"",0)},wdi_front.isHashtag=function(e){return"#"===e[0]},wdi_front.saveUserData=function(e,i,r){e.user_id=i.id,e.username=i.username,"#"===e.user_id[0]&&(e.data=wdi_front.appendRequestHashtag(e.data,e.user_id)),r.usersData.push(e),r.currentResponseLength=wdi_front.getArrayContentLength(r.usersData,"data"),r.allResponseLength+=r.currentResponseLength,r.dataCount==r.usersData.length&&(r.currentResponseLength<r.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(r)?wdi_front.loadMore("initial-keep",r):(wdi_front.displayFeed(r),wdi_front.applyFilters(r),wdi_front.activeUsersCount(r)||"load_more_btn"==r.feed_row.feed_display_view&&((r=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter)).find(".wdi_load_more").addClass("wdi_hidden"),r.find(".wdi_spinner").addClass("wdi_hidden"))))},wdi_front.saveSelfUserData=function(e,i){e.user_id="",e.username="",i.usersData.push(e),i.currentResponseLength=wdi_front.getArrayContentLength(i.usersData,"data"),i.allResponseLength+=i.currentResponseLength,i.dataCount==i.usersData.length&&(i.currentResponseLength<i.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(i)?wdi_front.loadMore("initial-keep",i):(wdi_front.displayFeed(i),wdi_front.applyFilters(i),wdi_front.activeUsersCount(i)||"load_more_btn"==i.feed_row.feed_display_view&&((i=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter)).find(".wdi_load_more").addClass("wdi_hidden"),i.find(".wdi_spinner").addClass("wdi_hidden"))))},wdi_front.userHasNoPhoto=function(e,i){var r=0,t=e.usersData;void 0!==i&&(t=i);for(var d=0;d<t.length;d++)void 0===t[d].pagination&&(t[d].pagination=[]),"liked"===e.feed_row.liked_feed?void 0===t[d].pagination.next_max_like_id&&r++:void 0===t[d].pagination.next_max_id&&r++;return r==t.length?1:0},wdi_front.appendRequestHashtag=function(e,i){for(var r=0;r<e.length;r++)e[r].wdi_hashtag=i;return e},wdi_front.displayFeed=function(e,i){var r,t;e.data.length>=e.allResponseLength?"load_more_btn"==e.feed_row.feed_display_view&&(r=e.feed_row.wdi_feed_counter,jQuery("#wdi_feed_"+r).find(".wdi_load_more").remove(),jQuery("#wdi_feed_"+r).find(".wdi_spinner").remove()):(0==e.customFilterChanged&&(t=wdi_front.feedSort(e,i)),i=e.customFilterChanged,1==e.customFilterChanged&&(t=e.customFilteredData,e.parsedData=wdi_front.parseLighboxData(e,!0)),"1"!=e.feed_row.resort_after_load_more?0==e.customFilterChanged&&(e.dataStorageList=e.dataStorageList.concat(t)):0==e.customFilterChanged&&(e.dataStorageList=t),"masonry"==e.feed_row.feed_type&&wdi_front.masonryDisplayFeedItems(t,e),"thumbnails"!=e.feed_row.feed_type&&"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||wdi_front.displayFeedItems(t,e),wdi_front.getDataLength(e)<parseInt(e.feed_row.number_of_photos)+parseInt(e.feed_row.load_more_number*e.currentPageLoadMore)&&!i&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount&&!wdi_front.allDataHasFinished(e)?wdi_front.loadMore("",e):(e.currentPageLoadMore++,wdi_front.allImagesLoaded(e)),e.instagramRequestCounter>e.maxConditionalFiltersRequestCount&&(wdi_front.allImagesLoaded(e),0==t.length&&(e.stopInfiniteScrollFlag=!0)),"pagination"==e.feed_row.feed_display_view&&e.currentPage<e.paginator&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter).find("#wdi_last_page").removeClass("wdi_disabled"),e.instagramRequestCounter=0,e.conditionalFilterBuffer=[],wdi_front.updateUsersImages(e))},wdi_front.updateUsersImages=function(i){jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter).find(".wdi_single_user .wdi_user_img_wrap img").each(function(){if((jQuery(this).attr("src")==wdi_url.plugin_url+"images/missing.png"||""==jQuery(this).attr("src"))&&"liked"!=i.feed_row.liked_feed)for(var e=0;e<i.usersData.length;e++)i.usersData[e].username==jQuery(this).parent().parent().find("h3").text()&&0!=i.usersData[e].data.length&&jQuery(this).attr("src",i.usersData[e].data[0].images.thumbnail.url)})},wdi_front.masonryDisplayFeedItems=function(e,i){var r=[],t=[];if(0!=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length){jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_masonry_column").each(function(){1==i.feed_row.resort_after_load_more&&(jQuery(this).html(""),i.imageIndex=0),1==i.customFilterChanged&&(jQuery(this).html(""),i.imageIndex=0),"pagination"==i.feed_row.feed_display_view?r.push(0):r.push(jQuery(this).height()),t.push(jQuery(this))}),1==i.customFilterChanged&&(i.customFilterChanged=!1);for(var d,a,o,n=0;n<e.length;n++)"object"==typeof e[n].videos&&null==e[n].videos.standard_resolution||(i.displayedData.push(e[n]),d="",void 0!==e[n].wdi_hashtag&&(d=e[n].wdi_hashtag),a="image"==e[n].type?wdi_front.getPhotoTemplate(i,d):e[n].hasOwnProperty("videos")||"video"==e[n].type?wdi_front.getVideoTemplate(i,d):wdi_front.getSliderTemplate(i,d),o=e[n],d=a(wdi_front.createObject(o,i)),a=wdi_front.array_min(r),o=wdi_front.getImageResolution(e[n]),t[a.index].html(t[a.index].html()+d),r[a.index]+=t[a.index].width()*o,i.imageIndex++,"pagination"==i.feed_row.feed_display_view&&((n+1)%i.feed_row.pagination_per_page_number==0?i.resIndex+=i.freeSpaces+1:i.resIndex++));i.wdi_loadedImages=0;var s=!1;i.wdi_load_count=n;var _=i.feed_row.wdi_feed_counter;jQuery("#wdi_feed_"+_+" img.wdi_img").on("load",function(){i.wdi_loadedImages++,w(),!1===s&&(wdi_responsive.columnControl(i,1),s=!0)});w(),1==i.paginatorNextFlag&&wdi_front.updatePagination(i,"next"),i.infiniteScrollFlag=!1}function w(){i.wdi_load_count===i.wdi_loadedImages&&0!=i.wdi_loadedImages&&(i.loadedImages=0,i.wdi_load_count=0,wdi_front.allImagesLoaded(i))}},wdi_front.getImageResolution=function(e){var i=e.images.standard_resolution.width;return e.images.standard_resolution.height/i},wdi_front.getDataLength=function(e,i){var r=0;if(void 0===i)for(var t=0;t<e.dataStorage.length;t++)r+=e.dataStorage[t].length;else for(t=0;t<i.length;t++)r+=i[t].length;return r},wdi_front.getArrayContentLength=function(e,i){for(var r=0,t=0;t<e.length;t++)"finished"!=e[t].finished&&void 0===e[t].error&&(r+=e[t][i].length);return r},wdi_front.displayFeedItems=function(e,i){if(0!=jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length){var r=i.feed_row.wdi_feed_counter,t=jQuery("#wdi_feed_"+r+" .wdi_feed_wrapper");"1"===i.feed_row.resort_after_load_more&&(t.html(""),i.imageIndex=0),1==i.customFilterChanged&&(t.html(""),i.imageIndex=0,i.customFilterChanged=!1);var d;wdi_front.getImgCount(i),e.length;"pagination"==i.feed_row.feed_display_view&&(d=i.feed_row.load_more_number,"image_browser"==i.feed_row.feed_type&&(d=1),(jQuery("#wdi_feed_"+i.feed_row.wdi_feed_counter+' [wdi_page="'+(i.currentPage-1)+'"]').length<d||0==e.length)&&(i.currentPage=--i.currentPage<=1?1:i.currentPage));for(var a,o,n,s=0;s<e.length;s++){if(void 0===e[s])return;"object"==typeof e[s].videos&&null==e[s].videos.standard_resolution||(n="",void 0!==e[s].wdi_hashtag&&(n=e[s].wdi_hashtag),a="image"==e[s].type?wdi_front.getPhotoTemplate(i,n):e[s].hasOwnProperty("videos")?wdi_front.getVideoTemplate(i,n):wdi_front.getSliderTemplate(i,n),o=e[s],n="",void 0!==(o=wdi_front.createObject(o,i))&&(n=a(o)),t.html(t.html()+n),i.imageIndex++,"pagination"==i.feed_row.feed_display_view&&((s+1)%i.feed_row.pagination_per_page_number==0?i.resIndex+=i.freeSpaces+1:i.resIndex++))}i.wdi_loadedImages=0;var _=!1;i.wdi_load_count=s;r=i.feed_row.wdi_feed_counter,t=jQuery("#wdi_feed_"+r+" img.wdi_img").on("load",function(){i.wdi_loadedImages++,i.wdi_load_count===i.wdi_loadedImages&&0!=i.wdi_loadedImages&&(i.loadedImages=0,i.wdi_load_count=0,wdi_front.allImagesLoaded(i)),!1===_&&(wdi_responsive.columnControl(i,1),_=!0)});1==i.paginatorNextFlag&&wdi_front.updatePagination(i,"next"),i.infiniteScrollFlag=!1}},wdi_front.checkFeedFinished=function(e){for(var i=0;i<e.usersData.length;i++)if(void 0===e.usersData[i].finished)return!1;return!0},wdi_front.sortingOperator=function(e,i){var r;switch(e){case"date":switch(i){case"asc":r=function(e,i){return e.created_time>i.created_time?1:-1};break;case"desc":r=function(e,i){return e.created_time>i.created_time?-1:1}}break;case"likes":switch(i){case"asc":r=function(e,i){return e.likes.count<i.likes.count?-1:1};break;case"desc":r=function(e,i){return e.likes.count<i.likes.count?1:-1}}break;case"comments":switch(i){case"asc":r=function(e,i){return e.comments.count<i.comments.count?-1:1};break;case"desc":r=function(e,i){return e.comments.count<i.comments.count?1:-1}}break;case"random":r=function(e,i){return.5<Math.random()?1:-1}}return r},wdi_front.feedSort=function(e,i){var r=e.feed_row.sort_images_by,t=e.feed_row.display_order;"1"===e.feed_row.resort_after_load_more?e.data=e.data.concat(wdi_front.smartPicker(e,i)):e.data=wdi_front.smartPicker(e,i);t=wdi_front.sortingOperator(r,t);return e.data.sort(t),e.data},wdi_front.smartPicker=function(e,i){var r=[],t=0,d=[],a=parseInt(e.feed_row.number_of_photos),o=Math.ceil(a/e.usersData.length),n=0;""!=i&&void 0!==i&&null!=i&&(a=parseInt(i),o=Math.ceil(a/wdi_front.activeUsersCount(e)));e.storeRawData(e.usersData,"dataStorageRaw");for(var s,_=e.dataStorageRaw.sort(function(e,i){return e.length()>i.length()?1:-1}),w=e.usersData.sort(function(e,i){return e.data.length>i.data.length?1:-1}),f=0;f<w.length;f++)n+=o,_[f].length()<=n?(n-=_[f].length(),r.push(_[f].getData(_[f].length())),t+=r[r.length-1].length):(a<t+n&&(n=a-t),(!(s=[])===e.auto_trigger||s.length+wdi_front.getDataLength(e)+wdi_front.getDataLength(e,r)<e.feed_row.number_of_photos)&&(s=s.concat(_[f].getData(n))),n=0,t+=s.length,r.push(s));for(f=0;f<r.length;f++)void 0===e.dataStorage[f]?e.dataStorage.push(r[f]):e.dataStorage[f]=e.dataStorage[f].concat(r[f]);for(e.parsedData=wdi_front.parseLighboxData(e),f=0;f<r.length;f++)d=d.concat(r[f]);return d},wdi_front.createObject=function(e,i){var r=null!=e.caption?e.caption.text:" ";switch(e.type){case"image":var t=e.images[i.feedImageResolution].url,d=void 0,a="image";break;case"video":t=void 0,d=e.hasOwnProperty("videos")?e.videos[i.feedVideoResolution].url:wdi_url.plugin_url+"images/video_missing.png",a="video";break;case"carousel":if(0===e.carousel_media.length)t=wdi_url.plugin_url+"images/missing.png",d=void 0,a="image";else switch(e.carousel_media[0].type){case"image":t=e.carousel_media[0].images[i.feedImageResolution].url,d=void 0,a="image";break;case"video":t=void 0,d=e.carousel_media[0].videos[i.feedVideoResolution].url,a="video";break;default:t=wdi_url.plugin_url+"images/missing.png",d=wdi_url.plugin_url+"images/video_missing.png",a="image"}break;default:t=wdi_url.plugin_url+"images/missing.png",d=wdi_url.plugin_url+"images/video_missing.png",a="image"}var o=i.imageIndex,n="square",s=e.images.standard_resolution.height,_=e.images.standard_resolution.width;_<s?n="portrait":s<_&&(n="landscape");_=e.user.username;return""===_&&(_="no_user"),{id:e.id,thumbType:a,caption:wdi_front.escape_tags(r),image_url:t,likes:e.likes.count,comments:e.comments.count,wdi_index:o,wdi_res_index:i.resIndex,wdi_media_user:_,link:e.link,video_url:d,wdi_username:_,wdi_shape:n}},wdi_front.setPage=function(e){var i=e.feed_row.feed_display_view,r=e.feed_row.feed_type;if("pagination"!=i)return"";i=e.imageIndex;return r="image_browser"==r?1:Math.abs(e.feed_row.pagination_per_page_number),e.paginator=Math.ceil((i+1)/r),e.paginator},wdi_front.getPhotoTemplate=function(e,i){var r=wdi_front.setPage(e),t="",d="",a="",o="",n="tenweb-i-arrows-out",s="";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(n=""),sourceAttr=(""!=r&&(d='wdi_page="'+r+'"'),"src"),""!=r&&1!=r&&(t="wdi_hidden"),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(s='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(t+=" wdi_full_caption");r="";switch("blog_style"!==e.feed_row.feed_type&&(r="masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":a="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":a="onclick=\"window.open ('<%= link%>','_blank')\"",o="wdi_hover_off",n="";break;case"custom_redirect":a="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",o="wdi_hover_off",n="";break;case"none":o="wdi_cursor_off wdi_hover_off",n=a=""}d='<div class="wdi_feed_item '+t+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+d+' wdi_type="image" id="wdi_'+e.feed_row.wdi_feed_counter+"_<%=id%>\"><div class=\"wdi_photo_wrap\"><div class=\"wdi_photo_wrap_inner\"><div class=\"wdi_photo_img <%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>\"><img class=\"wdi_img\" "+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+o+'" >'+s+'<div class="wdi_thumb_icon" '+a+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+n+'"></i></div></div></div></div></div></div>',s=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(d+='<div class="wdi_photo_meta">',"1"===e.feed_row.show_likes&&0!=e.dataStorageList[s].likes.count&&(d+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o"> <%= likes%></i></div>'),"1"===e.feed_row.show_comments&&0!=e.dataStorageList[s].comments.count&&(d+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square"> <%= comments%></i></div>'),d+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(d+='<div class="wdi_photo_title" onclick='+r+" ><%=caption%></div>"),d+="</div>"),d+="</div>",_.template(d)},wdi_front.getSliderTemplate=function(e,i){var r=wdi_front.setPage(e),t="",d="",a="",o="",n="tenweb-i-clone",s="";"blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(n=""),sourceAttr=(""!=r&&(d='wdi_page="'+r+'"'),"src"),""!=r&&1!=r&&(t="wdi_hidden"),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(s='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(t+=" wdi_full_caption");r="";switch("blog_style"!==e.feed_row.feed_type&&(r="masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":a="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":a="onclick=\"window.open ('<%= link%>','_blank')\"",o="wdi_hover_off",n="tenweb-i-clone";break;case"custom_redirect":a="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",o="wdi_hover_off",n="";break;case"none":o="wdi_cursor_off wdi_hover_off",n=a=""}d='<div class="wdi_feed_item '+t+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+d+' wdi_type="slideshow" id="wdi_'+e.feed_row.wdi_feed_counter+"_<%=id%>\"><div class=\"wdi_photo_wrap\"><div class=\"wdi_photo_wrap_inner\"><div class=\"wdi_photo_img <%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>\"><% if (thumbType === 'video') { %><video class=\"wdi_img\" "+sourceAttr+'="<%=video_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"></video><% } else {%><img class="wdi_img" '+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><% }%><div class="wdi_photo_overlay '+o+'" >'+s+'<div class="wdi_thumb_icon" '+a+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+n+'"></i></div></div></div></div></div></div>',s=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(d+='<div class="wdi_photo_meta">',"1"===e.feed_row.show_likes&&0!=e.dataStorageList[s].likes.count&&(d+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o"> <%= likes%></i></div>'),"1"===e.feed_row.show_comments&&0!=e.dataStorageList[s].comments.count&&(d+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square"> <%= comments%></i></div>'),d+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(d+='<div class="wdi_photo_title" onclick='+r+" ><%=caption%></div>"),d+="</div>"),d+="</div>",_.template(d)},wdi_front.replaceToVideo=function(e,i,r){overlayHtml="<video style='width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;' controls=''><source src='"+e+"' type='video/mp4'>Your browser does not support the video tag. </video>",jQuery("#wdi_feed_"+r+' [wdi_index="'+i+'"] .wdi_photo_wrap_inner').html(overlayHtml),jQuery("#wdi_feed_"+r+' [wdi_index="'+i+'"] .wdi_photo_wrap_inner video').get(0).play()},wdi_front.getVideoTemplate=function(e,i){var r=wdi_front.setPage(e),t="",d="",a="tenweb-i-play",o="",n="",s="",w=(""!=r&&(d='wdi_page="'+r+'"'),"src");""!=r&&1!=r&&(t="wdi_hidden"),"1"==e.feed_row.show_username_on_thumb&&e.data.length&&""!==e.data[0].user.username&&(s='<span class="wdi_media_user">@<%= wdi_username%></span>'),1==e.feed_row.show_full_description&&"masonry"==e.feed_row.feed_type&&(t+=" wdi_full_caption");r="";switch("blog_style"!==e.feed_row.feed_type&&(r="masonry"==e.feed_row.feed_type?"wdi_responsive.showMasonryCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");":"wdi_responsive.showCaption(jQuery(this),"+e.feed_row.wdi_feed_counter+");"),e.feed_row.feed_item_onclick){case"lightbox":o="onclick=wdi_feed_"+e.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":o="onclick=\"window.open ('<%= link%>','_blank')\"",n="wdi_hover_off",a="tenweb-i-play";break;case"custom_redirect":o="onclick=\"window.open ('"+e.feed_row.redirect_url+"','_self')\"",n="wdi_hover_off",a="";break;case"none":n="wdi_cursor_off wdi_hover_off",a="","blog_style"!=e.feed_row.feed_type&&"image_browser"!=e.feed_row.feed_type||(o="onclick=wdi_front.replaceToVideo('<%= video_url%>','<%= wdi_index%>',"+e.feed_row.wdi_feed_counter+")",n="",a="tenweb-i-play")}w='<div class="wdi_feed_item '+t+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+d+' wdi_type="image" id="wdi_'+e.feed_row.wdi_feed_counter+"_<%=id%>\"><div class=\"wdi_photo_wrap\"><div class=\"wdi_photo_wrap_inner\"><div class=\"wdi_photo_img <%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>\"><video class=\"wdi_img\" "+w+'="<%=video_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"></video><div class="wdi_photo_overlay '+n+'" '+o+">"+s+'<div class="wdi_thumb_icon" style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="tenweb-i '+a+'"></i></div></div></div></div></div></div>',s=e.imageIndex;return"1"!==e.feed_row.show_likes&&"1"!==e.feed_row.show_comments&&"1"!==e.feed_row.show_description||(w+='<div class="wdi_photo_meta">',"1"===e.feed_row.show_likes&&0!=e.dataStorageList[s].likes.count&&(w+='<div class="wdi_thumb_likes"><i class="tenweb-i tenweb-i-heart-o"> <%= likes%></i></div>'),"1"===e.feed_row.show_comments&&0!=e.dataStorageList[s].comments.count&&(w+='<div class="wdi_thumb_comments"><i class="tenweb-i tenweb-i-comment-square"> <%= comments%></i></div>'),w+='<div class="wdi_clear"></div>',"1"===e.feed_row.show_description&&(w+='<div class="wdi_photo_title" onclick='+r+" ><%=caption%></div>"),w+="</div>"),w+="</div>",_.template(w)},wdi_front.bindEvents=function(e){0!=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length&&("load_more_btn"==e.feed_row.feed_display_view&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_load_more_container").on(wdi_front.clickOrTouch,function(){wdi_front.loadMore(jQuery(this).find(".wdi_load_more_wrap"))}),"pagination"==e.feed_row.feed_display_view&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_next").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorNext(jQuery(this),e)}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_prev").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorPrev(jQuery(this),e)}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_last_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationLastPage(jQuery(this),e)}),jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_first_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationFirstPage(jQuery(this),e)}),e.paginatorNextFlag=!1),"infinite_scroll"==e.feed_row.feed_display_view&&(jQuery(window).on("scroll",function(){wdi_front.infiniteScroll(e)}),e.infiniteScrollFlag=!1))},wdi_front.infiniteScroll=function(e){jQuery(window).scrollTop()+jQuery(window).height()-100>=jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_infinite_scroll").offset().top&&(!1===e.infiniteScrollFlag&&0==e.stopInfiniteScrollFlag?(e.infiniteScrollFlag=!0,wdi_front.loadMore(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" #wdi_infinite_scroll"),e)):e.stopInfiniteScrollFlag&&wdi_front.allImagesLoaded(e))},wdi_front.paginationFirstPage=function(e,i){var r;1!=i.paginator&&1!=i.currentPage&&(r=i.currentPage,i.currentPage=1,wdi_front.updatePagination(i,"custom",r),e.parent().find("#wdi_last_page").removeClass("wdi_disabled")),e.addClass("wdi_disabled")},wdi_front.paginationLastPage=function(e,i){var r;1!=i.paginator&&i.currentPage!=i.paginator&&(r=i.currentPage,i.currentPage=i.paginator,wdi_front.updatePagination(i,"custom",r),e.addClass("wdi_disabled"),e.parent().find("#wdi_first_page").removeClass("wdi_disabled"))},wdi_front.paginatorNext=function(e,i){var r,t=e.parent().find("#wdi_last_page"),d=e.parent().find("#wdi_first_page");i.paginatorNextFlag=!0,i.paginator!=i.currentPage||wdi_front.checkFeedFinished(i)?i.paginator>i.currentPage&&(i.currentPage++,wdi_front.updatePagination(i,"next"),i.paginator>i.currentPage?t.removeClass("wdi_disabled"):t.addClass("wdi_disabled")):(i.currentPage++,r=i.feed_row.number_of_photos,wdi_front.loadMore(e,i,r),t.addClass("wdi_disabled")),d.removeClass("wdi_disabled")},wdi_front.paginatorPrev=function(e,i){var r=e.parent().find("#wdi_last_page"),e=e.parent().find("#wdi_first_page");1!=i.currentPage?(i.currentPage--,wdi_front.updatePagination(i,"prev"),r.removeClass("wdi_disabled"),1==i.currentPage&&e.addClass("wdi_disabled")):e.addClass("wdi_disabled")},wdi_front.updatePagination=function(e,i,r){var t="#wdi_feed_"+e.feed_row.wdi_feed_counter;switch(jQuery(t+' [wdi_page="'+e.currentPage+'"]').each(function(){jQuery(this).removeClass("wdi_hidden")}),i){case"next":var r=e.currentPage-1;jQuery(t+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(t+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"prev":r=e.currentPage+1;jQuery(t+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(t+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"custom":(r=r)!=e.currentPage&&(jQuery(t+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height()),jQuery(t+' [wdi_page="'+r+'"]').each(function(){jQuery(this).addClass("wdi_hidden")}))}e.paginatorNextFlag=!1,jQuery(t+" .wdi_feed_wrapper").css("height","auto"),jQuery(t+" #wdi_current_page").text(e.currentPage)},wdi_front.loadMore=function(e,i){var r,t=0;if(""!=e&&void 0!==e&&"initial"!=e&&"initial-keep"!=e&&(r=window[e.parent().parent().parent().parent().attr("id")]),void 0!==i&&(r=i),wdi_front.ajaxLoader(r),this.isJsonString(r.feed_row.feed_users))for(var d in json_feed_users=JSON.parse(r.feed_row.feed_users),json_feed_users)iuser=json_feed_users[d],"#"!==json_feed_users[d].username.charAt(0)&&(iuser=json_feed_users[d]);for(var a=0,o=0,d=0;d<r.userSortFlags.length;d++)if(!0===r.userSortFlags[d].flag){a++;for(var n=0;n<r.usersData.length;n++)r.userSortFlags[d].id===r.usersData[n].user_id&&"finished"===r.usersData[n].finished&&o++}if(a!==o||0==a){r.auto_trigger=!1,""===e&&(r.auto_trigger=!0),"masonry"===r.feed_row.feed_type&&"pagination"==r.feed_row.feed_display_view&&jQuery("#wdi_feed_"+wdi_front.feed_counter+" .wdi_full_caption").each(function(){jQuery(this).find(".wdi_photo_title").trigger(wdi_front.clickOrTouch)});for(d=0;d<r.usersData.length;d++)"finished"===r.usersData[d].finished&&t++;t===r.usersData.length&&(wdi_front.allImagesLoaded(r),jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter+" .wdi_load_more").remove());var s=r.usersData;r.loadMoreDataCount=r.feed_users.length;for(d=0;d<s.length;d++){s[d].pagination;var _=void 0!==s[d].tag_id?s[d].tag_id:"",w=void 0!==s[d].username&&_?s[d].username:"";s[d].user_id,s[d].username,iuser.id,iuser.username;"initial-keep"==e&&(r.temproraryUsersData[d]=r.usersData[d]),0<r.loadMoreDataCount&&r.loadMoreDataCount--,wdi_front.checkForLoadMoreDone(r,e)}}},wdi_front.loadMoreRequest=function(e,i,r,t){r.mediaRequestsDone&&""!=i&&r.usersData},wdi_front.checkForLoadMoreDone=function(e,i){var r,t=e.feed_row.load_more_number,d=e.feed_row.number_of_photos;0==e.loadMoreDataCount&&(e.temproraryUsersData=wdi_front.mergeData(e.temproraryUsersData,e.usersData),r=wdi_front.getArrayContentLength(e.temproraryUsersData,"data"),"initial-keep"==i&&(i="initial"),"initial"==i?r<d&&!wdi_front.userHasNoPhoto(e,e.temproraryUsersData)&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount?wdi_front.loadMore("initial",e):(e.usersData=e.temproraryUsersData,wdi_front.displayFeed(e),wdi_front.applyFilters(e),e.temproraryUsersData=[]):r<t&&!wdi_front.userHasNoPhoto(e,e.temproraryUsersData)&&e.instagramRequestCounter<=e.maxConditionalFiltersRequestCount?wdi_front.loadMore(void 0,e):(e.usersData=e.temproraryUsersData,wdi_front.activeUsersCount(e)&&(wdi_front.displayFeed(e,t),wdi_front.applyFilters(e),e.temproraryUsersData=[])))},wdi_front.allDataHasFinished=function(e){for(var i=0,r=0;r<e.dataStorageRaw.length;r++)""==e.usersData[r].pagination.next_url&&(i++,e.usersData[r].finished="finished");return i==e.dataStorageRaw.length&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_load_more").remove(),!0)},wdi_front.mergeData=function(e,i){for(var r=0;r<i.length;r++)void 0!==e[r]?"finished"!=i[r].finished&&(void 0===e[r].pagination.next_max_id&&void 0===e[r].pagination.next_max_like_id||(e[r].data=e[r].data.concat(i[r].data),e[r].pagination=i[r].pagination,e[r].user_id=i[r].user_id,e[r].username=i[r].username,e[r].meta=i[r].meta)):e.push(i[r]);return e},wdi_front.brokenImageHandler=function(e){return!0},wdi_front.ajaxLoader=function(e){var i,r=e.feed_row.wdi_feed_counter,r=jQuery("#wdi_feed_"+r);"load_more_btn"==e.feed_row.feed_display_view&&(r.find(".wdi_load_more").addClass("wdi_hidden"),r.find(".wdi_spinner").removeClass("wdi_hidden")),"infinite_scroll"==e.feed_row.feed_display_view&&(0==r.find(".wdi_ajax_loading").length?(i=jQuery('<div class="wdi_ajax_loading"><div><div><img class="wdi_load_more_spinner" src="'+wdi_url.plugin_url+'images/ajax_loader.png"></div></div></div>'),r.append(i)):i=r.find(".wdi_ajax_loading"),i.removeClass("wdi_hidden"))},wdi_front.allImagesLoaded=function(e){var i=wdi_front.getDataLength(e);e.mediaRequestsDone||jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").remove("wdi_nomedia"),0!=i||!e.mediaRequestsDone||0!=e.feed_row.conditional_filters.length&&0!=e.feed_row.conditional_filter_enable||jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").append("<p class='wdi_nomedia'>"+wdi_front_messages.feed_nomedia+"</p>");i=e.feed_row.wdi_feed_counter,i=jQuery("#wdi_feed_"+i);"load_more_btn"==e.feed_row.feed_display_view&&(i.find(".wdi_load_more").removeClass("wdi_hidden"),i.find(".wdi_spinner").addClass("wdi_hidden")),"infinite_scroll"==e.feed_row.feed_display_view&&jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+" .wdi_ajax_loading").addClass("wdi_hidden")},wdi_front.show=function(e,i){var r,t,d=i.feed_row.wdi_feed_counter,a=jQuery("#wdi_feed_"+d+" .wdi_feed_container");"header"===e&&(r={feed_thumb:i.feed_row.feed_thumb,feed_name:i.feed_row.feed_name},t=wdi_front.getHeaderTemplate()(r),r=a.find(".wdi_feed_header").html(),a.find(".wdi_feed_header").html(r+t))},wdi_front.getUserTemplate=function(e,i){var r=e.dataCount,t="#"===i[0]?"//instagram.com/explore/tags/"+i.substr(1,i.length):"//instagram.com/"+i,d="onclick='"+('window.open("'+t+'","_blank")')+"'",t='<div class="wdi_single_user" user_index="<%=user_index%>"><div class="wdi_header_user_text <%=hashtagClass%>"><div class="wdi_user_img_wrap"><img onerror="wdi_front.brokenImageHandler(this);" src="<%= user_img_url%>">';return 1<r&&(t+='<div title="'+wdi_front_messages.filter_title+'" class="wdi_filter_overlay"><div class="wdi_filter_icon"><span onclick="wdi_front.addFilter(<%=user_index%>,<%=feed_counter%>);" class="tenweb-i tenweb-i-filter"></span></div></div>'),t+="</div>",t+="<h3 "+d+"><%= user_name%></h3>","#"!==i[0]?("1"==e.feed_row.follow_on_instagram_btn&&(t+='<div class="wdi_user_controls"><div class="wdi_follow_btn" onclick="window.open(\'//instagram.com/<%= user_name%>\',\'_blank\')"><span> '+wdi_front_messages.follow+"</span></div></div>"),t+='<div class="wdi_media_info"><p class="wdi_posts"><span class="tenweb-i tenweb-i-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span class="tenweb-i tenweb-i-user"></span><%= counts.followed_by%></p></div>'):t+='<div class="wdi_user_controls"></div><div class="wdi_media_info"><p class="wdi_posts"><span class="tenweb-i tenweb-i-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span></span></p></div>',t+='<div class="wdi_clear"></div>',1==r&&"#"!==i[0]&&"1"==e.feed_row.display_user_info&&(t+='<div class="wdi_bio"><%= bio%></div>',t+='<div class="wdi_website"><a target="_blank" href="<%= website_url%>" ><%= website%></a></div>'),t+="</div></div>",_.template(t)},wdi_front.getHeaderTemplate=function(){return _.template('<div class="wdi_header_wrapper"><div class="wdi_header_img_wrap"><img src="<%=feed_thumb%>"></div><div class="wdi_header_text"><%=feed_name%></div><div class="wdi_clear"></div>')},wdi_front.addFilter=function(e,i){var r=window["wdi_feed_"+i],i=r.dataCount;if(!(i<2)&&0==r.nowLoadingImages){i=jQuery("#wdi_feed_"+r.feed_row.wdi_feed_counter+'_users [user_index="'+e+'"]');i.find(".wdi_filter_overlay").toggleClass("wdi_filter_active_bg"),i.find(".wdi_header_user_text h3").toggleClass("wdi_filter_active_col"),i.find(".wdi_media_info").toggleClass("wdi_filter_active_col"),i.find(".wdi_follow_btn").toggleClass("wdi_filter_active_col"),r.customFilterChanged=!0,0==r.userSortFlags[e].flag?r.userSortFlags[e].flag=!0:r.userSortFlags[e].flag=!1;for(var t=0,d=0;d<r.userSortFlags.length;d++)1==r.userSortFlags[d].flag&&t++;"pagination"==r.feed_row.feed_display_view&&(r.resIndex=0),0!=t?wdi_front.filterData(r):r.customFilteredData=r.dataStorageList,wdi_front.displayFeed(r),"pagination"==r.feed_row.feed_display_view&&(r.paginator=Math.ceil(r.imageIndex/parseInt(r.feed_row.pagination_per_page_number)),r.currentPage=r.paginator,wdi_front.updatePagination(r,"custom",1),jQuery("#wdi_first_page").removeClass("wdi_disabled"),jQuery("#wdi_last_page").addClass("wdi_disabled"))}},wdi_front.filterData=function(e){var i=e.userSortFlags;e.customFilteredData=[];for(var r=0;r<e.dataStorageList.length;r++)for(var t=0;t<i.length;t++)(void 0!==e.dataStorageList[r].user.id&&e.dataStorageList[r].user.id==i[t].id||e.dataStorageList[r].wdi_hashtag==i[t].name)&&1==i[t].flag&&e.customFilteredData.push(e.dataStorageList[r])},wdi_front.applyFilters=function(e){for(var i=0;i<e.userSortFlags.length;i++)1==e.userSortFlags[i].flag&&(jQuery("#wdi_feed_"+e.feed_row.wdi_feed_counter+'[user_index="'+i+'"]'),wdi_front.addFilter(i,e.feed_row.wdi_feed_counter),wdi_front.addFilter(i,e.feed_row.wdi_feed_counter))},wdi_front.getImgCount=function(e){for(var i=e.dataStorage,r=0,t=0;t<i.length;t++)r+=i[t].length;return r},wdi_front.parseLighboxData=function(e,i){var r,t,d,a=e.dataStorage,o=e.feed_row.sort_images_by,n=e.feed_row.display_order,n=wdi_front.sortingOperator(o,n),s=[],_=[];if(1==i)s=e.customFilteredData;else{for(var w=0;w<a.length;w++)for(var f=0;f<a[w].length;f++)s.push(a[w][f]);s.sort(n)}for(w=0;w<s.length;w++)void 0!==s[w]&&(t=void 0!==s[w]&&void 0!==s[w].media_url?s[w].media_url:wdi_url.plugin_url+"images/video_missing.png",void 0!==s[w]&&void 0===s[w].media_url&&"carousel"===s[w].type&&(void 0!==(d=s[w].carousel_media[0])&&void 0!==d.images?t=d.images.standard_resolution.url:void 0!==d&&void 0!==d.videos&&(t=d.videos.standard_resolution.url)),void(d=0)!==s[w]&&void 0!==s[w].comments&&(d=s[w].comments.count),r={alt:"",avg_rating:"",comment_count:d,date:wdi_front.convertUnixDate(s[w].created_time),description:wdi_front.getDescription(void 0!==s[w].caption&&null!==s[w].caption?wdi_front.escape_tags(s[w].caption.text):""),filename:wdi_front.getFileName(s[w]),filetype:wdi_front.getFileType(s[w]),hit_count:"0",id:s[w].id,image_url:s[w].link,number:0,rate:"",rate_count:"0",username:void 0!==s[w].user?s[w].user.username:"",profile_picture:void 0!==s[w].user?s[w].user.profile_picture:"",thumb_url:t,comments_data:void 0!==s[w].comments?s[w].comments.data:"",images:s[w].images,carousel_media:void 0!==s[w].carousel_media?s[w].carousel_media:null},_.push(r));return _},wdi_front.convertUnixDate=function(e){var i=new Date(e).getTime()/1e3,e=new Date(0);e.setUTCSeconds(i);i=e.getFullYear()+"-"+(e.getMonth()+1)+"-"+e.getDate();return i+=" "+e.getHours()+":"+e.getMinutes()},wdi_front.getDescription=function(e){return e=e.replace(/\r?\n|\r/g," ")},wdi_front.getFileName=function(e){if(void 0!==e){var i=e.link;if("video"===e.type&&e.hasOwnProperty("videos")&&null!=e.videos.standard_resolution)return e.videos.standard_resolution.url;if(void 0===i)return"";i=i.split("/");return i[i.length-2]}},wdi_front.getFileType=function(e){return"video"==e.type&&e.hasOwnProperty("videos")?"EMBED_OEMBED_INSTAGRAM_VIDEO":"carousel"==e.type&&e.hasOwnProperty("carousel_media")?"EMBED_OEMBED_INSTAGRAM_CAROUSEL":"EMBED_OEMBED_INSTAGRAM_IMAGE"},wdi_front.array_max=function(e){for(var i=e[0],r=0,t=1;t<e.length;t++)i<e[t]&&(i=e[t],r=t);return{value:i,index:r}},wdi_front.array_min=function(e){for(var i=e[0],r=0,t=1;t<e.length;t++)i>e[t]&&(i=e[t],r=t);return{value:i,index:r}},wdi_front.activeUsersCount=function(e){for(var i=0,r=0;r<e.usersData.length;r++)"finished"!=e.usersData[r].finished&&i++;return i},wdi_front.checkMediaResponse=function(e,i){return""==e||void 0===e||null==e||void 0!==e.error?(errorMessage=wdi_front_messages.connection_error,wdi_front.show_alert(errorMessage,e,i),!1):""!=e&&void 0!==e&&null!=e&&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 r=!1,t=!1,d=i.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&"),i=new RegExp("(?:^|\\s)"+d+"(?:^|\\s)"),a=new RegExp("(?:^|\\s)"+d,"g");for(null!=i.exec(e)&&(r=!0);null!=(match=a.exec(e));)t=!0;return 1==r||1==t},wdi_front.replaceNewLines=function(e){var i,r="vUkCJvN2ps3t",t=[];for(e=e.replace(/\r?\n|\r/g,r),i=new RegExp(r,"g");null!=(match=i.exec(e));)t.push(match.index);for(var d=e.split(r),a=0,o=0;o<d.length;o++)""==d[o]?a++:a=0,0<a&&(d.splice(o,1),a--,o--);return e=d.join(" ")},wdi_front.isEmptyObject=function(e){for(var i in e)if(e.hasOwnProperty(i))return!1;return!0},wdi_front.isEmpty=function(e){return!e||0===e.length};var WDIFeed=function(e){this.data=e.data,this.dataCount=e.dataCount,this.feed_row=e.feed_row,this.usersData=e.usersData,(_this=this).set_images_loading_flag=function(e){window.addEventListener("load",function(){e.nowLoadingImages=!1})},this.set_images_loading_flag(_this)};function wdi_extractHostname(e){return void 0===e||""===e?"":e.replace(/(^\w+:|^)\/\//,"")}WDIFeed.prototype.mediaExists=function(e,i){for(var r=0;r<i.length;r++)if(e.id==i[r].id)return!0;return!1},WDIFeed.prototype.getIdFromUrl=function(e){for(var i=e.split("/"),r=!1,t=0;t<i.length;t++)if("p"==i[t]&&void 0!==i[t+1]){r=i[t+1];break}return r},WDIFeed.prototype.avoidDuplicateMedia=function(e){var i=e.data,r=[];void 0===i&&(i=[]);for(var t=0;t<i.length;t++)this.mediaExists(i[t],this.dataStorageList)||this.mediaExists(i[t],r)||this.mediaExists(i[t],this.conditionalFilterBuffer)||r.push(i[t]);return this.conditionalFilterBuffer=this.conditionalFilterBuffer.concat(r),{data:r,meta:e.meta,pagination:e.pagination}},WDIFeed.prototype.storeRawData=function(e,i){var t=this;if("object"==typeof this[i]&&"number"==typeof this[i].length)for(var r=0;r<e.length;r++){var d="";wdi_front.isHashtag(e[r].user_id)?void 0!==e[r].pagination.cursors&&(d=e[r].pagination.cursors.after):"liked"==t.feed_row.liked_feed?void 0===(d=e[r].pagination.next_max_like_id)&&(d=""):(null==e[r].pagination&&(e[r].pagination=[]),void 0===(d=e[r].pagination.next_max_id)&&(d="")),void 0===this[i][r]?this[i].push({data:e[r].data,index:0,locked:!1,hash_id:d,usersDataFinished:!1,userId:e[r].user_id,length:function(){return this.data.length-this.index},getData:function(e){var i=this.data.slice(this.index,this.index+e);if(this.index+=Math.min(e,this.length()),this.index==this.data.length&&1==this.locked&&0==this.usersDataFinished)for(var r=0;r<t.usersData.length;r++)if(t.usersData[r].user_id==this.userId){this.usersDataFinished=!0;break}return i}}):0==this[i][r].locked&&(d!=this[i][r].hash_id?(this[i][r].data=this[i][r].data.concat(e[r].data),this[i][r].hash_id=d):this[i][r].locked=!0)}},wdi_front.updateUsersIfNecessary=function(o){for(var n=o.feed_users,e=!1,i=0;i<n.length;i++)"#"!=n[i].username.substr(0,1)?""!=n[i].id&&"username"!=n[i].id||(e=!0,o.instagram.searchForUsersByName(n[i].username,{success:function(e){if(void 0!==e.meta&&void 0!==e.meta.error_type&&wdi_front.show_alert(!1,e,o),200==e.meta.code&&0<e.data.length){for(var i=!1,r=0;r<e.data.length;r++)if(e.data[r].username==e.args.username){i=!0;break}if(i)for(var t=0;t<n.length;t++)e.data[r].username==n[t].username&&(n[t].id=e.data[r].id)}for(var d=!1,a=0;a<n.length;a++)if(""==n[a].id||"username"==n[a].id){d=!0;break}d||(o.feed_row.feed_users=JSON.stringify(n),wdi_front.init(o))},username:n[i].username})):n[i].id=n[i].username;return e},void 0!==wdi_ajax.ajax_response?jQuery(document).one("ajaxStop",function(){"not_declared"!=wdi_front.type&&(wdi_front.clickOrTouch=wdi_front.detectEvent(),wdi_front.globalInit())}):jQuery(document).ready(function(){"not_declared"!=wdi_front.type&&(wdi_front.clickOrTouch=wdi_front.detectEvent(),wdi_front.globalInit())}),jQuery(document).ready(function(){setTimeout(function(){"1"===wdi_front_messages.show_alerts&&"I"!==jQuery(".wdi_check_fontawesome .tenweb-i-instagram").prop("tagName")&&console.log("Font Awesome is not loaded properly. Please ask for support https://wordpress.org/support/plugin/wd-instagram-feed/")},2e3)});
|
| 1 |
+
"undefined"==typeof wdi_front&&(wdi_front={type:"not_declared"});var wdi_error_show=!(wdi_front.detectEvent=function(){var e="click";return/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())&&(e="touchend"),e}),wdi_error_init=!1;function wdi_baseName(e){var i=e.substr(e.lastIndexOf("/"));return e.replace(i,"")}wdi_front.escape_tags=function(e){return void 0===e&&(e=""),e=e.toString().replace(/</g,"<").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?(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=e.images.standard_resolution.width;return e.images.standard_resolution.height/i},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="image";break;case"video":r=void 0,t=e.hasOwnProperty("videos")?e.videos[i.feedVideoResolution].url:wdi_url.plugin_url+"images/video_missing.png",a="video";break;case"carousel":if(0===e.carousel_media.length)r=wdi_url.plugin_url+"images/missing.png",t=void 0,a="image";else switch(e.carousel_media[0].type){case"image":r=e.carousel_media[0].images[i.feedImageResolution].url,t=void 0,a="image";break;case"video":r=void 0,t=e.carousel_media[0].videos[i.feedVideoResolution].url,a="video";break;default:r=wdi_url.plugin_url+"images/missing.png",t=wdi_url.plugin_url+"images/video_missing.png",a="image"}break;default:r=wdi_url.plugin_url+"images/missing.png",t=wdi_url.plugin_url+"images/video_missing.png",a="image"}var o=i.imageIndex,n="square",s=e.images.standard_resolution.height,_=e.images.standard_resolution.width;_<s?n="portrait":s<_&&(n="landscape");_=e.user.username;return""===_&&(_="no_user"),{id:e.id,thumbType:a,caption:wdi_front.escape_tags(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:o,wdi_res_index:i.resIndex,wdi_media_user:_,link:e.link,video_url:t,wdi_username:_,wdi_shape:n}},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="<%=image_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\') ) %>"><% if (thumbType === \'video\') { %><video class="wdi_img" src="<%=video_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"></video><% } else {%><img class="wdi_img" src="<%=image_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\') ) %>"><video class="wdi_img" src="<%=video_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"></video><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",void 0!==n[_]&&void 0===n[_].media_url&&"carousel"===n[_].type&&(void 0!==(a=n[_].carousel_media[0])&&void 0!==a.images?r=a.images.standard_resolution.url:void 0!==a&&void 0!==a.videos&&(r=a.videos.standard_resolution.url)),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,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
|
@@ -1071,7 +1071,6 @@ function WDIInstagram(args) {
|
|
| 1071 |
type: "POST",
|
| 1072 |
url: wdi_ajax.ajax_url,
|
| 1073 |
dataType: 'json',
|
| 1074 |
-
async : false,
|
| 1075 |
data: {
|
| 1076 |
action: 'wdi_set_preload_cache_data',
|
| 1077 |
tag_id: tag_id,
|
| 1071 |
type: "POST",
|
| 1072 |
url: wdi_ajax.ajax_url,
|
| 1073 |
dataType: 'json',
|
|
|
|
| 1074 |
data: {
|
| 1075 |
action: 'wdi_set_preload_cache_data',
|
| 1076 |
tag_id: tag_id,
|
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",async:!1,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
|
@@ -1,10 +1,10 @@
|
|
| 1 |
-
|
| 2 |
Contributors: webdorado,10web,progmastery
|
| 3 |
Tags: custom instagram feed, feed, instagram, hashtag, Instagram feed, instagram gallery, instagram posts, Instagram images, Instagram photos, lightbox, photos,instagram account
|
| 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,10 +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.15 =
|
| 509 |
Improved: Decreased load time on front end.
|
| 510 |
|
| 511 |
-
== Changelog ==
|
| 512 |
= 1.4.14 =
|
| 513 |
Fixed: Removing feed.
|
| 514 |
Fixed: Deactivation after uninstall.
|
| 1 |
+
=== 10Web Social Photo Feed ===
|
| 2 |
Contributors: webdorado,10web,progmastery
|
| 3 |
Tags: custom instagram feed, feed, instagram, hashtag, Instagram feed, instagram gallery, instagram posts, Instagram images, Instagram photos, lightbox, photos,instagram account
|
| 4 |
Requires at least: 3.9
|
| 5 |
Requires PHP: 5.2
|
| 6 |
Tested up to: 5.7
|
| 7 |
+
Stable tag: 1.4.16
|
| 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.16 =
|
| 509 |
+
Improved: Pagination logic.
|
| 510 |
+
Fixed: Compatibility with PHP8.
|
| 511 |
+
|
| 512 |
= 1.4.15 =
|
| 513 |
Improved: Decreased load time on front end.
|
| 514 |
|
|
|
|
| 515 |
= 1.4.14 =
|
| 516 |
Fixed: Removing feed.
|
| 517 |
Fixed: Deactivation after uninstall.
|
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.16
|
| 7 |
* Author: 10Web
|
| 8 |
* Author URI: https://10Web.io/plugins/?utm_source=instagram_feed&utm_medium=free_plugin
|
| 9 |
* License: GPLv2 or later
|
