Version Description
New: message displayed on frontend if feed has no media
Fixed: JS errors for media with Instagram's new "Slideshow" feature. This feature is not supported by Instagram's API yet.
Changed: Errors by plugin and Instagram API are alerted in frontend only for admins, otherwise output the message to the Web Console
Changed: Custom attribute "wdi_media_user" added to media containers in frontend. Useful for adding different event listeners, e.g. custom redirects for every user's media.
Changed: Minor style conflicts fixed
Download this release
Release Info
Developer | webdorado |
Plugin | WD Instagram Feed – Instagram Gallery |
Version | 1.1.22 |
Comparing to | |
See all releases |
Code changes from version 1.1.21 to 1.1.22
- admin/views/WDIViewFeeds_wdi.php +2 -2
- css/wdi_backend.css +1 -1
- css/wdi_frontend.css +10 -1
- frontend/shortcode.php +20 -5
- frontend/views/WDIViewImageBrowser_view.php +1 -1
- frontend/views/WDIViewThumbnails_view.php +1 -1
- js/gallerybox/wdi_gallery_box.js +168 -134
- js/wdi_frontend.js +2661 -2521
- js/wdi_responsive.js +4 -1
- readme.txt +8 -1
- wd-instagram-feed.php +2 -2
admin/views/WDIViewFeeds_wdi.php
CHANGED
@@ -297,7 +297,7 @@ public function genarateFeedViews(){
|
|
297 |
<label for="image_browser"><img src="<?php echo plugins_url('../../images/feed_views/image_browser.png',__FILE__);?>"></label>
|
298 |
</div>
|
299 |
|
300 |
-
<br class="
|
301 |
<?php
|
302 |
}
|
303 |
public function generateTabs(){
|
@@ -306,7 +306,7 @@ public function generateTabs(){
|
|
306 |
<div class="wdi_feed_tabs" id="wdi_feed_settings" onclick="wdi_controller.switchFeedTabs('feed_settings');"><?php _e('Feed Settings',"wdi")?></div>
|
307 |
<div class="wdi_feed_tabs" id="wdi_lightbox_settings" onclick="wdi_controller.switchFeedTabs('lightbox_settings');"><?php _e('Lightbox Settings',"wdi")?></div>
|
308 |
<div class="wdi_feed_tabs" id="wdi_conditional_filters" onclick="wdi_controller.switchFeedTabs('conditional_filters');"><?php _e('Conditional Filters',"wdi")?></div>
|
309 |
-
<br class="
|
310 |
</div>
|
311 |
<?php
|
312 |
}
|
297 |
<label for="image_browser"><img src="<?php echo plugins_url('../../images/feed_views/image_browser.png',__FILE__);?>"></label>
|
298 |
</div>
|
299 |
|
300 |
+
<br class="wdi_clear">
|
301 |
<?php
|
302 |
}
|
303 |
public function generateTabs(){
|
306 |
<div class="wdi_feed_tabs" id="wdi_feed_settings" onclick="wdi_controller.switchFeedTabs('feed_settings');"><?php _e('Feed Settings',"wdi")?></div>
|
307 |
<div class="wdi_feed_tabs" id="wdi_lightbox_settings" onclick="wdi_controller.switchFeedTabs('lightbox_settings');"><?php _e('Lightbox Settings',"wdi")?></div>
|
308 |
<div class="wdi_feed_tabs" id="wdi_conditional_filters" onclick="wdi_controller.switchFeedTabs('conditional_filters');"><?php _e('Conditional Filters',"wdi")?></div>
|
309 |
+
<br class="wdi_clear">
|
310 |
</div>
|
311 |
<?php
|
312 |
}
|
css/wdi_backend.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
.
|
2 |
clear: both;
|
3 |
}
|
4 |
#wdi_unistall{
|
1 |
+
.wdi_clear{
|
2 |
clear: both;
|
3 |
}
|
4 |
#wdi_unistall{
|
css/wdi_frontend.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
.
|
2 |
clear: both;
|
3 |
}
|
4 |
.table{
|
@@ -305,4 +305,13 @@ div[id^="wdi_container"] p {
|
|
305 |
|
306 |
.wdi_photo_wrap_inner {
|
307 |
text-align: center;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
}
|
1 |
+
.wdi_clear{
|
2 |
clear: both;
|
3 |
}
|
4 |
.table{
|
305 |
|
306 |
.wdi_photo_wrap_inner {
|
307 |
text-align: center;
|
308 |
+
}
|
309 |
+
|
310 |
+
.wdi_feed_item[wdi_type="slideshow"] .fa-clone{
|
311 |
+
|
312 |
+
-webkit-transform: rotate(180deg);
|
313 |
+
-moz-transform: rotate(180deg);
|
314 |
+
-o-transform: rotate(180deg);
|
315 |
+
-ms-transform: rotate(180deg);
|
316 |
+
transform: rotate(180deg);
|
317 |
}
|
frontend/shortcode.php
CHANGED
@@ -148,12 +148,20 @@ function wdi_load_frontend_scripts()
|
|
148 |
wp_localize_script("wdi_frontend", 'wdi_ajax', array('ajax_url' => admin_url('admin-ajax.php')), WDI_VERSION);
|
149 |
wp_localize_script("wdi_frontend", 'wdi_url', array('plugin_url' => plugin_dir_url(__FILE__),
|
150 |
'ajax_url' => admin_url('admin-ajax.php')), WDI_VERSION);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
wp_localize_script("wdi_frontend", 'wdi_front_messages',
|
152 |
array('connection_error' => __('Connection Error, try again later :(', 'wdi'),
|
153 |
'user_not_found' => __('Username not found', 'wdi'),
|
154 |
'network_error' => __('Network error, please try again later :(', 'wdi'),
|
155 |
'hashtag_nodata' => __('There is no data for that hashtag', 'wdi'),
|
156 |
-
'filter_title' => __('Click to filter images by this user', 'wdi')
|
|
|
157 |
), WDI_VERSION);
|
158 |
|
159 |
|
@@ -204,15 +212,14 @@ function wdi_load_frontend_scripts_styles_ajax()
|
|
204 |
{
|
205 |
|
206 |
wp_dequeue_script('jquery');
|
207 |
-
|
208 |
wp_enqueue_script('wdi_instagram', plugins_url('../js/wdi_instagram.js', __FILE__), array(), WDI_VERSION, true);
|
209 |
|
210 |
wp_enqueue_script('underscore');
|
211 |
-
wp_enqueue_script('wdi_frontend', plugins_url('../js/wdi_frontend.js', __FILE__), array('wdi_instagram',
|
212 |
wp_enqueue_script('wdi_responsive', plugins_url('../js/wdi_responsive.js', __FILE__), array("wdi_instagram"), WDI_VERSION, true);
|
213 |
|
214 |
|
215 |
-
|
216 |
global $wdi_feed_counter_init;
|
217 |
$wdi_feed_counter_init = isset($wdi_feed_counter_init) ? $wdi_feed_counter_init : 0;
|
218 |
wp_localize_script("wdi_frontend", 'wdi_feed_counter_init', array('wdi_feed_counter_init' => $wdi_feed_counter_init), WDI_VERSION);
|
@@ -220,12 +227,20 @@ function wdi_load_frontend_scripts_styles_ajax()
|
|
220 |
wp_localize_script("wdi_frontend", 'wdi_ajax', array('ajax_url' => admin_url('admin-ajax.php'), 'ajax_response' => 1), WDI_VERSION);
|
221 |
wp_localize_script("wdi_frontend", 'wdi_url', array('plugin_url' => plugin_dir_url(__FILE__),
|
222 |
'ajax_url' => admin_url('admin-ajax.php')), WDI_VERSION);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
wp_localize_script("wdi_frontend", 'wdi_front_messages',
|
224 |
array('connection_error' => __('Connection Error, try again later :(', 'wdi'),
|
225 |
'user_not_found' => __('Username not found', 'wdi'),
|
226 |
'network_error' => __('Network error, please try again later :(', 'wdi'),
|
227 |
'hashtag_nodata' => __('There is no data for that hashtag', 'wdi'),
|
228 |
-
'filter_title' => __('Click to filter images by this user', 'wdi')
|
|
|
229 |
), WDI_VERSION);
|
230 |
|
231 |
// Styles/Scripts for popup.
|
148 |
wp_localize_script("wdi_frontend", 'wdi_ajax', array('ajax_url' => admin_url('admin-ajax.php')), WDI_VERSION);
|
149 |
wp_localize_script("wdi_frontend", 'wdi_url', array('plugin_url' => plugin_dir_url(__FILE__),
|
150 |
'ajax_url' => admin_url('admin-ajax.php')), WDI_VERSION);
|
151 |
+
|
152 |
+
$user_is_admin = false;
|
153 |
+
$user = wp_get_current_user();
|
154 |
+
if (in_array('administrator', (array)$user->roles)) {
|
155 |
+
$user_is_admin = true;
|
156 |
+
}
|
157 |
+
|
158 |
wp_localize_script("wdi_frontend", 'wdi_front_messages',
|
159 |
array('connection_error' => __('Connection Error, try again later :(', 'wdi'),
|
160 |
'user_not_found' => __('Username not found', 'wdi'),
|
161 |
'network_error' => __('Network error, please try again later :(', 'wdi'),
|
162 |
'hashtag_nodata' => __('There is no data for that hashtag', 'wdi'),
|
163 |
+
'filter_title' => __('Click to filter images by this user', 'wdi'),
|
164 |
+
'show_alerts' => $user_is_admin,
|
165 |
), WDI_VERSION);
|
166 |
|
167 |
|
212 |
{
|
213 |
|
214 |
wp_dequeue_script('jquery');
|
215 |
+
|
216 |
wp_enqueue_script('wdi_instagram', plugins_url('../js/wdi_instagram.js', __FILE__), array(), WDI_VERSION, true);
|
217 |
|
218 |
wp_enqueue_script('underscore');
|
219 |
+
wp_enqueue_script('wdi_frontend', plugins_url('../js/wdi_frontend.js', __FILE__), array('wdi_instagram', 'underscore'), WDI_VERSION, true);
|
220 |
wp_enqueue_script('wdi_responsive', plugins_url('../js/wdi_responsive.js', __FILE__), array("wdi_instagram"), WDI_VERSION, true);
|
221 |
|
222 |
|
|
|
223 |
global $wdi_feed_counter_init;
|
224 |
$wdi_feed_counter_init = isset($wdi_feed_counter_init) ? $wdi_feed_counter_init : 0;
|
225 |
wp_localize_script("wdi_frontend", 'wdi_feed_counter_init', array('wdi_feed_counter_init' => $wdi_feed_counter_init), WDI_VERSION);
|
227 |
wp_localize_script("wdi_frontend", 'wdi_ajax', array('ajax_url' => admin_url('admin-ajax.php'), 'ajax_response' => 1), WDI_VERSION);
|
228 |
wp_localize_script("wdi_frontend", 'wdi_url', array('plugin_url' => plugin_dir_url(__FILE__),
|
229 |
'ajax_url' => admin_url('admin-ajax.php')), WDI_VERSION);
|
230 |
+
|
231 |
+
$user_is_admin = false;
|
232 |
+
$user = wp_get_current_user();
|
233 |
+
if (in_array('administrator', (array)$user->roles)) {
|
234 |
+
$user_is_admin = true;
|
235 |
+
}
|
236 |
+
|
237 |
wp_localize_script("wdi_frontend", 'wdi_front_messages',
|
238 |
array('connection_error' => __('Connection Error, try again later :(', 'wdi'),
|
239 |
'user_not_found' => __('Username not found', 'wdi'),
|
240 |
'network_error' => __('Network error, please try again later :(', 'wdi'),
|
241 |
'hashtag_nodata' => __('There is no data for that hashtag', 'wdi'),
|
242 |
+
'filter_title' => __('Click to filter images by this user', 'wdi'),
|
243 |
+
'show_alerts' => $user_is_admin,
|
244 |
), WDI_VERSION);
|
245 |
|
246 |
// Styles/Scripts for popup.
|
frontend/views/WDIViewImageBrowser_view.php
CHANGED
@@ -40,7 +40,7 @@ public function display(){
|
|
40 |
}
|
41 |
?>
|
42 |
<div class="wdi_feed_wrapper <?php echo 'wdi_col_'.$feed_row['number_of_columns']?>" wdi-res='<?php echo 'wdi_col_'.$feed_row['number_of_columns']?>'></div>
|
43 |
-
<div class="
|
44 |
<?php switch($feed_row['feed_display_view']){
|
45 |
case 'load_more_btn':{
|
46 |
?><div class="wdi_load_more"><div class="wdi_load_more_container"><div class="wdi_load_more_wrap"><div class="wdi_load_more_wrap_inner"><div class="wdi_load_more_text"><?php echo __('Load More',"wdi");?></div></div></div></div></div><?php
|
40 |
}
|
41 |
?>
|
42 |
<div class="wdi_feed_wrapper <?php echo 'wdi_col_'.$feed_row['number_of_columns']?>" wdi-res='<?php echo 'wdi_col_'.$feed_row['number_of_columns']?>'></div>
|
43 |
+
<div class="wdi_clear"></div>
|
44 |
<?php switch($feed_row['feed_display_view']){
|
45 |
case 'load_more_btn':{
|
46 |
?><div class="wdi_load_more"><div class="wdi_load_more_container"><div class="wdi_load_more_wrap"><div class="wdi_load_more_wrap_inner"><div class="wdi_load_more_text"><?php echo __('Load More',"wdi");?></div></div></div></div></div><?php
|
frontend/views/WDIViewThumbnails_view.php
CHANGED
@@ -43,7 +43,7 @@ public function display(){
|
|
43 |
}
|
44 |
?>
|
45 |
<div class="wdi_feed_wrapper <?php echo 'wdi_col_'.$feed_row['number_of_columns']?>" wdi-res='<?php echo 'wdi_col_'.$feed_row['number_of_columns']?>'></div>
|
46 |
-
<div class="
|
47 |
|
48 |
<?php switch($feed_row['feed_display_view']){
|
49 |
case 'load_more_btn':{
|
43 |
}
|
44 |
?>
|
45 |
<div class="wdi_feed_wrapper <?php echo 'wdi_col_'.$feed_row['number_of_columns']?>" wdi-res='<?php echo 'wdi_col_'.$feed_row['number_of_columns']?>'></div>
|
46 |
+
<div class="wdi_clear"></div>
|
47 |
|
48 |
<?php switch($feed_row['feed_display_view']){
|
49 |
case 'load_more_btn':{
|
js/gallerybox/wdi_gallery_box.js
CHANGED
@@ -1,10 +1,13 @@
|
|
1 |
-
|
2 |
var isPopUpOpened = false;
|
3 |
|
4 |
-
function wdi_spider_createpopup(url, current_view, width, height, duration, description, lifetime, currentFeed)
|
|
|
5 |
|
6 |
url = url.replace(/&/g, '&');
|
7 |
-
if (isPopUpOpened) {
|
|
|
|
|
|
|
8 |
isPopUpOpened = true;
|
9 |
if (wdi_spider_hasalreadyreceivedpopup(description) || wdi_spider_isunsupporteduseragent()) {
|
10 |
return;
|
@@ -14,82 +17,88 @@ function wdi_spider_createpopup(url, current_view, width, height, duration, desc
|
|
14 |
jQuery("#wdi_spider_popup_loading_" + current_view).css({display: "block"});
|
15 |
jQuery("#wdi_spider_popup_overlay_" + current_view).css({display: "block"});
|
16 |
|
17 |
-
|
18 |
-
|
19 |
// var popup = jQuery(
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
// .hide()
|
28 |
// .appendTo("body");
|
29 |
-
|
30 |
// wdi_spider_showpopup(description, lifetime, popup, duration);
|
31 |
// }).success(function(jqXHR, textStatus, errorThrown) {
|
32 |
-
|
33 |
-
|
34 |
///////////////////////////////////////
|
35 |
|
36 |
jQuery.ajax({
|
37 |
type: 'POST',
|
38 |
url: url,
|
39 |
dataType: 'text',
|
40 |
-
data:{
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
},
|
46 |
-
success:function(response)
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
|
|
61 |
}
|
62 |
-
|
63 |
/////////////////////////////////////////
|
64 |
}
|
65 |
|
66 |
-
function wdi_spider_showpopup(description, lifetime, popup, duration)
|
|
|
67 |
isPopUpOpened = true;
|
68 |
popup.show();
|
69 |
|
70 |
wdi_spider_receivedpopup(description, lifetime);
|
71 |
}
|
72 |
|
73 |
-
function wdi_spider_hasalreadyreceivedpopup(description)
|
|
|
74 |
if (document.cookie.indexOf(description) > -1) {
|
75 |
delete document.cookie[document.cookie.indexOf(description)];
|
76 |
}
|
77 |
-
return false;
|
78 |
}
|
79 |
|
80 |
-
function wdi_spider_receivedpopup(description, lifetime)
|
81 |
-
|
|
|
82 |
date.setDate(date.getDate() + lifetime);
|
83 |
-
document.cookie = description + "=true;expires=" + date.toUTCString() + ";path=/";
|
84 |
}
|
85 |
|
86 |
-
function wdi_spider_isunsupporteduseragent()
|
87 |
-
|
|
|
88 |
}
|
89 |
|
90 |
-
function wdi_spider_destroypopup(duration)
|
91 |
-
|
92 |
-
|
|
|
93 |
if (document.getElementById("wdi_spider_popup_wrap") != null) {
|
94 |
wdi_comments_manager.popup_destroyed();
|
95 |
|
@@ -101,7 +110,8 @@ function wdi_spider_destroypopup(duration) {
|
|
101 |
if (typeof enable_addthis != "undefined" && enable_addthis) {
|
102 |
jQuery(".at4-share-outer").hide();
|
103 |
}
|
104 |
-
setTimeout(function ()
|
|
|
105 |
jQuery(".wdi_spider_popup_wrap").remove();
|
106 |
jQuery(".wdi_spider_popup_loading").css({display: "none"});
|
107 |
jQuery(".wdi_spider_popup_overlay").css({display: "none"});
|
@@ -122,19 +132,21 @@ function wdi_spider_destroypopup(duration) {
|
|
122 |
}
|
123 |
|
124 |
|
125 |
-
Object.size = function(obj)
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
|
|
131 |
};
|
132 |
-
function wdi_spider_ajax_save(form_id,image_id)
|
|
|
|
|
133 |
|
134 |
-
|
135 |
wdi_comments_manager.init(image_id);
|
136 |
-
|
137 |
-
|
138 |
// var post_data = {};
|
139 |
// post_wdi_data["wdi_name"] = jQuery("#wdi_name").val();
|
140 |
// post_wdi_data["wdi_comment"] = jQuery("#wdi_comment").val();
|
@@ -169,34 +181,36 @@ function wdi_spider_ajax_save(form_id,image_id) {
|
|
169 |
// });
|
170 |
|
171 |
// if (event.preventDefault) {
|
172 |
-
|
173 |
// }
|
174 |
// else {
|
175 |
-
|
176 |
// }
|
177 |
return false;
|
178 |
}
|
179 |
|
180 |
|
181 |
wdi_comments_manager = {
|
182 |
-
media_id
|
183 |
-
mediaComments
|
184 |
-
load_more_count
|
185 |
-
commentCounter
|
186 |
-
currentKey
|
187 |
-
init
|
188 |
-
|
189 |
-
|
|
|
190 |
this.currentKey = image_id;
|
191 |
|
192 |
this.reset_comments();
|
193 |
}
|
194 |
-
else{
|
195 |
/*open close*/
|
196 |
/*do nothing*/
|
197 |
}
|
198 |
},
|
199 |
-
reset_comments
|
|
|
200 |
jQuery('#wdi_load_more_comments').remove();
|
201 |
jQuery('#wdi_added_comments').html('');
|
202 |
//currentImage = wdi_data[this.currentKey];
|
@@ -207,46 +221,51 @@ wdi_comments_manager = {
|
|
207 |
|
208 |
//this.showComments(currentImage['comments_data']);
|
209 |
|
210 |
-
|
211 |
},
|
212 |
-
popup_destroyed
|
|
|
213 |
this.media_id = '';
|
214 |
-
this.mediaComments =[];
|
215 |
-
|
|
|
|
|
216 |
this.currentKey = -1;
|
217 |
|
218 |
},
|
219 |
|
220 |
//function for dispaying comments
|
221 |
-
showComments: function (comments,count)
|
222 |
-
|
223 |
-
|
224 |
-
|
|
|
225 |
}
|
226 |
var counter = this.commentCounter;
|
227 |
-
for(i=Object.size(comments)-counter-1;i>=Object.size(comments)-counter-count;i--){
|
228 |
this.commentCounter++;
|
229 |
var commentText = (comments[i]['text']);
|
230 |
commentText = this.filterCommentText(commentText);
|
231 |
var username = (comments[i]['from']['username']);
|
232 |
var profile_picture = (comments[i]['from']['profile_picture']);
|
233 |
var singleComment = jQuery('<div class="wdi_single_comment"></div>');
|
234 |
-
singleComment.append(jQuery('<p class="wdi_comment_header_p"><span class="wdi_comment_header"><a target="_blank" href="//instagram.com/'+username+'"><img style="height:25px;width:25px;border-radius:25px" src="'+profile_picture+'"> '+username+'</a></span><span class="wdi_comment_date">'+wdi_front.convertUnixDate(comments[i]['created_time'])+'</span></p>'));
|
235 |
-
singleComment.append(jQuery('<div class="wdi_comment_body_p"><span class="wdi_comment_body"><p>'+commentText+'</p></span></div>'));
|
236 |
jQuery('#wdi_added_comments').prepend(singleComment);
|
237 |
}
|
238 |
this.updateScrollbar();
|
239 |
-
|
240 |
},
|
241 |
|
242 |
//function for updating scrollbar
|
243 |
-
updateScrollbar
|
|
|
244 |
var wdi_comments = jQuery('#wdi_comments');
|
245 |
var wdi_added_comments = jQuery('#wdi_added_comments');
|
246 |
//jQuery('#wdi_load_more_comments').remove();
|
247 |
-
jQuery('.wdi_comments').attr('class','wdi_comments');
|
248 |
jQuery('.wdi_comments').html('');
|
249 |
-
|
250 |
/*restore load more button*/
|
251 |
|
252 |
// if(jQuery('#wdi_load_more_comments').length===0){
|
@@ -260,53 +279,58 @@ wdi_comments_manager = {
|
|
260 |
jQuery('.wdi_comments').append(wdi_added_comments);
|
261 |
|
262 |
if (typeof jQuery().mCustomScrollbar !== 'undefined') {
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
////
|
269 |
-
jQuery('.wdi_comments_close_btn').on('click',wdi_comment);
|
270 |
//binding click event for loading more commetn by ajax
|
271 |
-
|
272 |
|
273 |
},
|
274 |
//get recent media comments
|
275 |
-
getAjaxComments: function ()
|
276 |
-
|
277 |
-
|
|
|
278 |
type: "POST",
|
279 |
-
url: 'https://api.instagram.com/v1/media/'+this.media_id+'/comments?access_token='+access_token,
|
280 |
dataType: 'jsonp',
|
281 |
-
success: function(response)
|
282 |
-
|
|
|
283 |
errorMessage = 'Network Error, please try again later :(';
|
284 |
-
|
285 |
return;
|
286 |
}
|
287 |
-
if(response['meta']['code']!=200){
|
288 |
errorMessage = response['meta']['error_message'];
|
289 |
-
|
290 |
return;
|
291 |
}
|
292 |
-
|
293 |
wdi_comments_manager.mediaComments = response['data'];
|
294 |
//ttt
|
295 |
var currentImage = wdi_data[wdi_comments_manager.currentKey];
|
296 |
currentImage['comments_data'] = response['data'];
|
297 |
-
|
298 |
wdi_comments_manager.showComments(currentImage['comments_data'], wdi_comments_manager.load_more_count);
|
299 |
wdi_comments_manager.ajax_comments_ready(response['data']);
|
300 |
-
|
301 |
}
|
302 |
});
|
303 |
},
|
304 |
-
ajax_comments_ready:function (response)
|
305 |
-
|
|
|
306 |
},
|
307 |
-
createLoadMoreAndBindEvent:function()
|
308 |
-
|
309 |
-
|
|
|
|
|
310 |
jQuery(this).remove();
|
311 |
wdi_comments_manager.showComments(wdi_comments_manager.mediaComments, wdi_comments_manager.load_more_count);
|
312 |
wdi_comments_manager.createLoadMoreAndBindEvent();
|
@@ -315,25 +339,29 @@ wdi_comments_manager = {
|
|
315 |
/*
|
316 |
* Filtesrs comment text and makes it instagram like comments
|
317 |
*/
|
318 |
-
filterCommentText: function(comment)
|
|
|
319 |
var commentArray = comment.split(' ');
|
320 |
var commStr = '';
|
321 |
-
for(var i=0;i<commentArray.length;i++){
|
322 |
-
switch(commentArray[i][0]){
|
323 |
-
case '@':
|
324 |
-
|
|
|
325 |
break;
|
326 |
}
|
327 |
-
case '#':
|
328 |
-
|
|
|
329 |
break;
|
330 |
}
|
331 |
-
default:
|
332 |
-
|
|
|
333 |
}
|
334 |
-
}
|
335 |
}
|
336 |
-
commStr = commStr.substring(0,commStr.length-1);
|
337 |
return commStr;
|
338 |
}
|
339 |
|
@@ -367,14 +395,16 @@ wdi_comments_manager = {
|
|
367 |
// }
|
368 |
|
369 |
// Set value by ID.
|
370 |
-
function wdi_spider_set_input_value(input_id, input_value)
|
|
|
371 |
if (document.getElementById(input_id)) {
|
372 |
document.getElementById(input_id).value = input_value;
|
373 |
}
|
374 |
}
|
375 |
|
376 |
// Submit form by ID.
|
377 |
-
function wdi_spider_form_submit(event, form_id)
|
|
|
378 |
if (document.getElementById(form_id)) {
|
379 |
document.getElementById(form_id).submit();
|
380 |
}
|
@@ -387,9 +417,10 @@ function wdi_spider_form_submit(event, form_id) {
|
|
387 |
}
|
388 |
|
389 |
// Check if required field is empty.
|
390 |
-
function wdi_spider_check_required(id, name)
|
|
|
391 |
if (jQuery('#' + id).val() == '') {
|
392 |
-
|
393 |
jQuery('#' + id).attr('style', 'border-color: #FF0000;');
|
394 |
jQuery('#' + id).focus();
|
395 |
return true;
|
@@ -400,11 +431,12 @@ function wdi_spider_check_required(id, name) {
|
|
400 |
}
|
401 |
|
402 |
// Check Email.
|
403 |
-
function wdi_spider_check_email(id)
|
|
|
404 |
if (jQuery('#' + id).val() != '') {
|
405 |
var email = jQuery('#' + id).val().replace(/^\s+|\s+$/g, '');
|
406 |
if (email.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) {
|
407 |
-
|
408 |
return true;
|
409 |
}
|
410 |
return false;
|
@@ -412,7 +444,8 @@ function wdi_spider_check_email(id) {
|
|
412 |
}
|
413 |
|
414 |
// Refresh captcha.
|
415 |
-
function wdi_captcha_refresh(id)
|
|
|
416 |
if (document.getElementById(id + "_img") && document.getElementById(id + "_input")) {
|
417 |
srcArr = document.getElementById(id + "_img").src.split("&r=");
|
418 |
document.getElementById(id + "_img").src = srcArr[0] + '&r=' + Math.floor(Math.random() * 100);
|
@@ -421,20 +454,21 @@ function wdi_captcha_refresh(id) {
|
|
421 |
}
|
422 |
}
|
423 |
|
424 |
-
function wdi_play_pause($this)
|
|
|
425 |
var video = $this.get(0);
|
426 |
var regex = /firefox/i;
|
427 |
var firefox = false;
|
428 |
-
if(navigator.userAgent.match(regex)){
|
429 |
firefox = true;
|
430 |
}
|
431 |
-
if(!firefox){
|
432 |
if (!video.paused) {
|
433 |
-
|
434 |
-
}else{
|
435 |
-
|
436 |
}
|
437 |
}
|
438 |
-
|
439 |
|
440 |
}
|
|
|
1 |
var isPopUpOpened = false;
|
2 |
|
3 |
+
function wdi_spider_createpopup(url, current_view, width, height, duration, description, lifetime, currentFeed)
|
4 |
+
{
|
5 |
|
6 |
url = url.replace(/&/g, '&');
|
7 |
+
if (isPopUpOpened) {
|
8 |
+
return
|
9 |
+
}
|
10 |
+
;
|
11 |
isPopUpOpened = true;
|
12 |
if (wdi_spider_hasalreadyreceivedpopup(description) || wdi_spider_isunsupporteduseragent()) {
|
13 |
return;
|
17 |
jQuery("#wdi_spider_popup_loading_" + current_view).css({display: "block"});
|
18 |
jQuery("#wdi_spider_popup_overlay_" + current_view).css({display: "block"});
|
19 |
|
20 |
+
// jQuery.get(url, function(data) {
|
21 |
+
// ;
|
22 |
// var popup = jQuery(
|
23 |
+
// '<div id="wdi_spider_popup_wrap" class="wdi_spider_popup_wrap" style="' +
|
24 |
+
// ' width:' + width + 'px;' +
|
25 |
+
// ' height:' + height + 'px;' +
|
26 |
+
// ' margin-top:-' + height / 2 + 'px;' +
|
27 |
+
// ' margin-left: -' + width / 2 + 'px; ">' +
|
28 |
+
// data +
|
29 |
+
// '</div>')
|
30 |
// .hide()
|
31 |
// .appendTo("body");
|
32 |
+
|
33 |
// wdi_spider_showpopup(description, lifetime, popup, duration);
|
34 |
// }).success(function(jqXHR, textStatus, errorThrown) {
|
35 |
+
// jQuery("#wdi_spider_popup_loading_" + current_view).css({display: "none !important;"});
|
36 |
+
// });
|
37 |
///////////////////////////////////////
|
38 |
|
39 |
jQuery.ajax({
|
40 |
type: 'POST',
|
41 |
url: url,
|
42 |
dataType: 'text',
|
43 |
+
data: {
|
44 |
+
action: 'WDIGalleryBox',
|
45 |
+
image_rows: JSON.stringify(currentFeed.parsedData),
|
46 |
+
feed_id: currentFeed.feed_row['id'],
|
47 |
+
feed_counter: currentFeed.feed_row['wdi_feed_counter'],
|
48 |
},
|
49 |
+
success: function (response)
|
50 |
+
{
|
51 |
+
|
52 |
+
|
53 |
+
var popup = jQuery(
|
54 |
+
'<div id="wdi_spider_popup_wrap" class="wdi_spider_popup_wrap" style="' +
|
55 |
+
' width:' + width + 'px;' +
|
56 |
+
' height:' + height + 'px;' +
|
57 |
+
' margin-top:-' + height / 2 + 'px;' +
|
58 |
+
' margin-left: -' + width / 2 + 'px; ">' +
|
59 |
+
response +
|
60 |
+
'</div>')
|
61 |
+
.hide()
|
62 |
+
.appendTo("body");
|
63 |
+
wdi_spider_showpopup(description, lifetime, popup, duration);
|
64 |
+
jQuery("#wdi_spider_popup_loading_" + current_view).css({display: "none !important;"});
|
65 |
}
|
66 |
+
});
|
67 |
/////////////////////////////////////////
|
68 |
}
|
69 |
|
70 |
+
function wdi_spider_showpopup(description, lifetime, popup, duration)
|
71 |
+
{
|
72 |
isPopUpOpened = true;
|
73 |
popup.show();
|
74 |
|
75 |
wdi_spider_receivedpopup(description, lifetime);
|
76 |
}
|
77 |
|
78 |
+
function wdi_spider_hasalreadyreceivedpopup(description)
|
79 |
+
{
|
80 |
if (document.cookie.indexOf(description) > -1) {
|
81 |
delete document.cookie[document.cookie.indexOf(description)];
|
82 |
}
|
83 |
+
return false;
|
84 |
}
|
85 |
|
86 |
+
function wdi_spider_receivedpopup(description, lifetime)
|
87 |
+
{
|
88 |
+
var date = new Date();
|
89 |
date.setDate(date.getDate() + lifetime);
|
90 |
+
document.cookie = description + "=true;expires=" + date.toUTCString() + ";path=/";
|
91 |
}
|
92 |
|
93 |
+
function wdi_spider_isunsupporteduseragent()
|
94 |
+
{
|
95 |
+
return (!window.XMLHttpRequest);
|
96 |
}
|
97 |
|
98 |
+
function wdi_spider_destroypopup(duration)
|
99 |
+
{
|
100 |
+
|
101 |
+
|
102 |
if (document.getElementById("wdi_spider_popup_wrap") != null) {
|
103 |
wdi_comments_manager.popup_destroyed();
|
104 |
|
110 |
if (typeof enable_addthis != "undefined" && enable_addthis) {
|
111 |
jQuery(".at4-share-outer").hide();
|
112 |
}
|
113 |
+
setTimeout(function ()
|
114 |
+
{
|
115 |
jQuery(".wdi_spider_popup_wrap").remove();
|
116 |
jQuery(".wdi_spider_popup_loading").css({display: "none"});
|
117 |
jQuery(".wdi_spider_popup_overlay").css({display: "none"});
|
132 |
}
|
133 |
|
134 |
|
135 |
+
Object.size = function (obj)
|
136 |
+
{
|
137 |
+
var size = 0, key;
|
138 |
+
for (key in obj) {
|
139 |
+
if (obj.hasOwnProperty(key)) size++;
|
140 |
+
}
|
141 |
+
return size;
|
142 |
};
|
143 |
+
function wdi_spider_ajax_save(form_id, image_id)
|
144 |
+
{
|
145 |
+
|
146 |
|
|
|
147 |
wdi_comments_manager.init(image_id);
|
148 |
+
|
149 |
+
|
150 |
// var post_data = {};
|
151 |
// post_wdi_data["wdi_name"] = jQuery("#wdi_name").val();
|
152 |
// post_wdi_data["wdi_comment"] = jQuery("#wdi_comment").val();
|
181 |
// });
|
182 |
|
183 |
// if (event.preventDefault) {
|
184 |
+
// event.preventDefault();
|
185 |
// }
|
186 |
// else {
|
187 |
+
// event.returnValue = false;
|
188 |
// }
|
189 |
return false;
|
190 |
}
|
191 |
|
192 |
|
193 |
wdi_comments_manager = {
|
194 |
+
media_id: '',
|
195 |
+
mediaComments: [], /*all comments*/
|
196 |
+
load_more_count: 10,
|
197 |
+
commentCounter: 0, /* current comments counter*/
|
198 |
+
currentKey: -1, /*iamge id*/
|
199 |
+
init: function (image_id)
|
200 |
+
{
|
201 |
+
|
202 |
+
if (this.currentKey != image_id) {
|
203 |
this.currentKey = image_id;
|
204 |
|
205 |
this.reset_comments();
|
206 |
}
|
207 |
+
else {
|
208 |
/*open close*/
|
209 |
/*do nothing*/
|
210 |
}
|
211 |
},
|
212 |
+
reset_comments: function ()
|
213 |
+
{
|
214 |
jQuery('#wdi_load_more_comments').remove();
|
215 |
jQuery('#wdi_added_comments').html('');
|
216 |
//currentImage = wdi_data[this.currentKey];
|
221 |
|
222 |
//this.showComments(currentImage['comments_data']);
|
223 |
|
224 |
+
|
225 |
},
|
226 |
+
popup_destroyed: function ()
|
227 |
+
{
|
228 |
this.media_id = '';
|
229 |
+
this.mediaComments = [];
|
230 |
+
/*all comments*/
|
231 |
+
this.commentCounter = 0;
|
232 |
+
/* current comments counter**/
|
233 |
this.currentKey = -1;
|
234 |
|
235 |
},
|
236 |
|
237 |
//function for dispaying comments
|
238 |
+
showComments: function (comments, count)
|
239 |
+
{
|
240 |
+
|
241 |
+
if (Object.size(comments) - this.commentCounter - count < 0 || count === undefined) {
|
242 |
+
count = Object.size(comments) - this.commentCounter;
|
243 |
}
|
244 |
var counter = this.commentCounter;
|
245 |
+
for (i = Object.size(comments) - counter - 1; i >= Object.size(comments) - counter - count; i--) {
|
246 |
this.commentCounter++;
|
247 |
var commentText = (comments[i]['text']);
|
248 |
commentText = this.filterCommentText(commentText);
|
249 |
var username = (comments[i]['from']['username']);
|
250 |
var profile_picture = (comments[i]['from']['profile_picture']);
|
251 |
var singleComment = jQuery('<div class="wdi_single_comment"></div>');
|
252 |
+
singleComment.append(jQuery('<p class="wdi_comment_header_p"><span class="wdi_comment_header"><a target="_blank" href="//instagram.com/' + username + '"><img style="height:25px;width:25px;border-radius:25px" src="' + profile_picture + '"> ' + username + '</a></span><span class="wdi_comment_date">' + wdi_front.convertUnixDate(comments[i]['created_time']) + '</span></p>'));
|
253 |
+
singleComment.append(jQuery('<div class="wdi_comment_body_p"><span class="wdi_comment_body"><p>' + commentText + '</p></span></div>'));
|
254 |
jQuery('#wdi_added_comments').prepend(singleComment);
|
255 |
}
|
256 |
this.updateScrollbar();
|
257 |
+
|
258 |
},
|
259 |
|
260 |
//function for updating scrollbar
|
261 |
+
updateScrollbar: function ()
|
262 |
+
{
|
263 |
var wdi_comments = jQuery('#wdi_comments');
|
264 |
var wdi_added_comments = jQuery('#wdi_added_comments');
|
265 |
//jQuery('#wdi_load_more_comments').remove();
|
266 |
+
jQuery('.wdi_comments').attr('class', 'wdi_comments');
|
267 |
jQuery('.wdi_comments').html('');
|
268 |
+
|
269 |
/*restore load more button*/
|
270 |
|
271 |
// if(jQuery('#wdi_load_more_comments').length===0){
|
279 |
jQuery('.wdi_comments').append(wdi_added_comments);
|
280 |
|
281 |
if (typeof jQuery().mCustomScrollbar !== 'undefined') {
|
282 |
+
if (jQuery.isFunction(jQuery().mCustomScrollbar)) {
|
283 |
+
jQuery(".wdi_comments").mCustomScrollbar({scrollInertia: 250});
|
284 |
+
}
|
285 |
+
}
|
286 |
+
|
287 |
////
|
288 |
+
jQuery('.wdi_comments_close_btn').on('click', wdi_comment);
|
289 |
//binding click event for loading more commetn by ajax
|
290 |
+
|
291 |
|
292 |
},
|
293 |
//get recent media comments
|
294 |
+
getAjaxComments: function ()
|
295 |
+
{
|
296 |
+
var access_token = wdi_front.access_token;
|
297 |
+
jQuery.ajax({
|
298 |
type: "POST",
|
299 |
+
url: 'https://api.instagram.com/v1/media/' + this.media_id + '/comments?access_token=' + access_token,
|
300 |
dataType: 'jsonp',
|
301 |
+
success: function (response)
|
302 |
+
{
|
303 |
+
if (response == '' || response == undefined || response == null) {
|
304 |
errorMessage = 'Network Error, please try again later :(';
|
305 |
+
wdi_front.show_alert(errorMessage);
|
306 |
return;
|
307 |
}
|
308 |
+
if (response['meta']['code'] != 200) {
|
309 |
errorMessage = response['meta']['error_message'];
|
310 |
+
wdi_front.show_alert(errorMessage);
|
311 |
return;
|
312 |
}
|
313 |
+
|
314 |
wdi_comments_manager.mediaComments = response['data'];
|
315 |
//ttt
|
316 |
var currentImage = wdi_data[wdi_comments_manager.currentKey];
|
317 |
currentImage['comments_data'] = response['data'];
|
318 |
+
|
319 |
wdi_comments_manager.showComments(currentImage['comments_data'], wdi_comments_manager.load_more_count);
|
320 |
wdi_comments_manager.ajax_comments_ready(response['data']);
|
321 |
+
|
322 |
}
|
323 |
});
|
324 |
},
|
325 |
+
ajax_comments_ready: function (response)
|
326 |
+
{
|
327 |
+
this.createLoadMoreAndBindEvent();
|
328 |
},
|
329 |
+
createLoadMoreAndBindEvent: function ()
|
330 |
+
{
|
331 |
+
jQuery('#wdi_added_comments').prepend(jQuery('<p id="wdi_load_more_comments" class="wdi_load_more_comments">load more comments</p>'));
|
332 |
+
jQuery('.wdi_comment_container #wdi_load_more_comments').on('click', function ()
|
333 |
+
{
|
334 |
jQuery(this).remove();
|
335 |
wdi_comments_manager.showComments(wdi_comments_manager.mediaComments, wdi_comments_manager.load_more_count);
|
336 |
wdi_comments_manager.createLoadMoreAndBindEvent();
|
339 |
/*
|
340 |
* Filtesrs comment text and makes it instagram like comments
|
341 |
*/
|
342 |
+
filterCommentText: function (comment)
|
343 |
+
{
|
344 |
var commentArray = comment.split(' ');
|
345 |
var commStr = '';
|
346 |
+
for (var i = 0; i < commentArray.length; i++) {
|
347 |
+
switch (commentArray[i][0]) {
|
348 |
+
case '@':
|
349 |
+
{
|
350 |
+
commStr += '<a target="blank" class="wdi_comm_text_link" href="//instagram.com/' + commentArray[i].substring(1, commentArray[i].length) + '">' + commentArray[i] + '</a> ';
|
351 |
break;
|
352 |
}
|
353 |
+
case '#':
|
354 |
+
{
|
355 |
+
commStr += '<a target="blank" class="wdi_comm_text_link" href="//instagram.com/explore/tags/' + commentArray[i].substring(1, commentArray[i].length) + '">' + commentArray[i] + '</a> ';
|
356 |
break;
|
357 |
}
|
358 |
+
default:
|
359 |
+
{
|
360 |
+
commStr += commentArray[i] + ' ';
|
361 |
}
|
362 |
+
}
|
363 |
}
|
364 |
+
commStr = commStr.substring(0, commStr.length - 1);
|
365 |
return commStr;
|
366 |
}
|
367 |
|
395 |
// }
|
396 |
|
397 |
// Set value by ID.
|
398 |
+
function wdi_spider_set_input_value(input_id, input_value)
|
399 |
+
{
|
400 |
if (document.getElementById(input_id)) {
|
401 |
document.getElementById(input_id).value = input_value;
|
402 |
}
|
403 |
}
|
404 |
|
405 |
// Submit form by ID.
|
406 |
+
function wdi_spider_form_submit(event, form_id)
|
407 |
+
{
|
408 |
if (document.getElementById(form_id)) {
|
409 |
document.getElementById(form_id).submit();
|
410 |
}
|
417 |
}
|
418 |
|
419 |
// Check if required field is empty.
|
420 |
+
function wdi_spider_check_required(id, name)
|
421 |
+
{
|
422 |
if (jQuery('#' + id).val() == '') {
|
423 |
+
wdi_front.show_alert(name + '* ' + wdi_objectL10n.wdi_field_required);
|
424 |
jQuery('#' + id).attr('style', 'border-color: #FF0000;');
|
425 |
jQuery('#' + id).focus();
|
426 |
return true;
|
431 |
}
|
432 |
|
433 |
// Check Email.
|
434 |
+
function wdi_spider_check_email(id)
|
435 |
+
{
|
436 |
if (jQuery('#' + id).val() != '') {
|
437 |
var email = jQuery('#' + id).val().replace(/^\s+|\s+$/g, '');
|
438 |
if (email.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) {
|
439 |
+
wdi_front.show_alert(wdi_objectL10n.wdi_mail_validation);
|
440 |
return true;
|
441 |
}
|
442 |
return false;
|
444 |
}
|
445 |
|
446 |
// Refresh captcha.
|
447 |
+
function wdi_captcha_refresh(id)
|
448 |
+
{
|
449 |
if (document.getElementById(id + "_img") && document.getElementById(id + "_input")) {
|
450 |
srcArr = document.getElementById(id + "_img").src.split("&r=");
|
451 |
document.getElementById(id + "_img").src = srcArr[0] + '&r=' + Math.floor(Math.random() * 100);
|
454 |
}
|
455 |
}
|
456 |
|
457 |
+
function wdi_play_pause($this)
|
458 |
+
{
|
459 |
var video = $this.get(0);
|
460 |
var regex = /firefox/i;
|
461 |
var firefox = false;
|
462 |
+
if (navigator.userAgent.match(regex)) {
|
463 |
firefox = true;
|
464 |
}
|
465 |
+
if (!firefox) {
|
466 |
if (!video.paused) {
|
467 |
+
video.pause();
|
468 |
+
} else {
|
469 |
+
video.play();
|
470 |
}
|
471 |
}
|
472 |
+
|
473 |
|
474 |
}
|
js/wdi_frontend.js
CHANGED
@@ -1,185 +1,195 @@
|
|
1 |
if (typeof wdi_front == 'undefined') {
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
}
|
6 |
|
7 |
|
8 |
-
|
9 |
wdi_front.detectEvent = function ()
|
10 |
{
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
}
|
18 |
|
|
|
19 |
wdi_front.globalInit = function ()
|
20 |
{
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
|
161 |
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
|
175 |
-
|
176 |
|
177 |
-
|
178 |
|
179 |
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
|
184 |
}
|
185 |
|
@@ -187,60 +197,60 @@ wdi_front.init = function (currentFeed)
|
|
187 |
{
|
188 |
|
189 |
|
190 |
-
|
191 |
-
|
192 |
|
193 |
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
|
215 |
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
|
221 |
|
222 |
-
|
223 |
|
224 |
-
|
225 |
|
226 |
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
|
231 |
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
|
236 |
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
|
245 |
|
246 |
}
|
@@ -253,12 +263,12 @@ wdi_front.init = function (currentFeed)
|
|
253 |
*/
|
254 |
wdi_front.isJsonString = function (str)
|
255 |
{
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
}
|
263 |
|
264 |
|
@@ -272,43 +282,43 @@ wdi_front.isJsonString = function (str)
|
|
272 |
wdi_front.instagramRequest = function (id, currentFeed)
|
273 |
{
|
274 |
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
|
313 |
}
|
314 |
|
@@ -319,7 +329,7 @@ wdi_front.instagramRequest = function (id, currentFeed)
|
|
319 |
*/
|
320 |
wdi_front.isHashtag = function (str)
|
321 |
{
|
322 |
-
|
323 |
}
|
324 |
|
325 |
|
@@ -330,56 +340,56 @@ wdi_front.isHashtag = function (str)
|
|
330 |
wdi_front.saveUserData = function (data, user, currentFeed)
|
331 |
{
|
332 |
|
333 |
-
|
334 |
-
|
335 |
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
|
342 |
|
343 |
-
|
344 |
|
345 |
|
346 |
-
|
347 |
-
|
348 |
|
349 |
|
350 |
-
|
351 |
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
|
359 |
-
|
360 |
-
|
361 |
|
362 |
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
|
368 |
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
|
379 |
-
|
380 |
|
381 |
|
382 |
-
|
383 |
|
384 |
}
|
385 |
|
@@ -391,51 +401,51 @@ wdi_front.saveUserData = function (data, user, currentFeed)
|
|
391 |
wdi_front.saveSelfUserData = function (data, currentFeed)
|
392 |
{
|
393 |
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
|
398 |
-
|
399 |
|
400 |
|
401 |
-
|
402 |
-
|
403 |
|
404 |
|
405 |
-
|
406 |
|
407 |
-
|
408 |
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
|
415 |
-
|
416 |
-
|
417 |
|
418 |
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
|
424 |
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
|
435 |
-
|
436 |
|
437 |
|
438 |
-
|
439 |
|
440 |
}
|
441 |
|
@@ -445,29 +455,29 @@ wdi_front.saveSelfUserData = function (data, currentFeed)
|
|
445 |
wdi_front.userHasNoPhoto = function (currentFeed, cstData)
|
446 |
{
|
447 |
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
}
|
472 |
|
473 |
/*
|
@@ -475,10 +485,10 @@ wdi_front.userHasNoPhoto = function (currentFeed, cstData)
|
|
475 |
*/
|
476 |
wdi_front.appendRequestHashtag = function (data, hashtag)
|
477 |
{
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
}
|
483 |
|
484 |
|
@@ -491,110 +501,110 @@ wdi_front.displayFeed = function (currentFeed, load_more_number)
|
|
491 |
{
|
492 |
|
493 |
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
|
499 |
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
|
504 |
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
|
513 |
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
|
539 |
|
540 |
-
|
541 |
-
|
542 |
|
543 |
|
544 |
-
|
545 |
-
|
546 |
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
|
551 |
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
|
574 |
|
575 |
-
|
576 |
-
|
577 |
|
578 |
-
|
579 |
-
|
580 |
|
581 |
-
|
582 |
-
|
583 |
|
584 |
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
|
597 |
-
|
598 |
|
599 |
}
|
600 |
|
@@ -605,26 +615,26 @@ wdi_front.displayFeed = function (currentFeed, load_more_number)
|
|
605 |
*/
|
606 |
wdi_front.updateUsersImages = function (currentFeed)
|
607 |
{
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
|
618 |
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
}
|
629 |
|
630 |
|
@@ -635,137 +645,141 @@ wdi_front.updateUsersImages = function (currentFeed)
|
|
635 |
*/
|
636 |
wdi_front.masonryDisplayFeedItems = function (data, currentFeed)
|
637 |
{
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
|
|
|
|
|
|
|
|
761 |
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
|
770 |
|
771 |
}
|
@@ -777,10 +791,10 @@ wdi_front.masonryDisplayFeedItems = function (data, currentFeed)
|
|
777 |
wdi_front.getImageResolution = function (data)
|
778 |
{
|
779 |
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
}
|
785 |
|
786 |
/*
|
@@ -790,30 +804,30 @@ wdi_front.getImageResolution = function (data)
|
|
790 |
wdi_front.getDataLength = function (currentFeed, customStorage)
|
791 |
{
|
792 |
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
|
804 |
-
|
805 |
}
|
806 |
|
807 |
wdi_front.getArrayContentLength = function (array, data)
|
808 |
{
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
}
|
818 |
|
819 |
|
@@ -824,233 +838,237 @@ wdi_front.getArrayContentLength = function (array, data)
|
|
824 |
*/
|
825 |
wdi_front.displayFeedItems = function (data, currentFeed)
|
826 |
{
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
//if resort_after_pagination is on then rewrite feed data
|
837 |
-
if (currentFeed.feed_row['resort_after_load_more'] === '1') {
|
838 |
-
feed_wrapper.html('');
|
839 |
-
currentFeed.imageIndex = 0;
|
840 |
-
}
|
841 |
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
* --currentPage so that after loading new images we stay on the same page and see new images which will be located in that page
|
855 |
-
* also do the same thing when recievied data has lenght equal to zero
|
856 |
-
*/
|
857 |
-
if (currentFeed.feed_row.feed_display_view == 'pagination') {
|
858 |
-
if (jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter + ' [wdi_page="' + (currentFeed.currentPage - 1) + '"]').length < currentFeed.feed_row.load_more_number || data.length == 0) {
|
859 |
-
currentFeed.currentPage = (--currentFeed.currentPage <= 1) ? 1 : currentFeed.currentPage;
|
860 |
-
}
|
861 |
-
}
|
862 |
|
863 |
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
870 |
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
|
876 |
-
|
877 |
|
878 |
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
|
887 |
-
|
888 |
|
889 |
-
|
890 |
|
891 |
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
|
898 |
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
|
913 |
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
|
918 |
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
|
925 |
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
|
939 |
-
|
940 |
|
941 |
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
|
950 |
-
|
951 |
-
|
952 |
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
|
958 |
-
|
959 |
-
|
960 |
|
961 |
}
|
962 |
|
963 |
wdi_front.checkFeedFinished = function (currentFeed)
|
964 |
{
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
}
|
972 |
|
973 |
wdi_front.sortingOperator = function (sortImagesBy, sortOrder)
|
974 |
{
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
}
|
1055 |
|
1056 |
/*
|
@@ -1059,19 +1077,19 @@ wdi_front.sortingOperator = function (sortImagesBy, sortOrder)
|
|
1059 |
wdi_front.feedSort = function (currentFeed, load_more_number)
|
1060 |
{
|
1061 |
|
1062 |
-
|
1063 |
-
|
1064 |
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
|
1071 |
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
|
1076 |
}
|
1077 |
|
@@ -1082,155 +1100,155 @@ wdi_front.feedSort = function (currentFeed, load_more_number)
|
|
1082 |
wdi_front.smartPicker = function (currentFeed, load_more_number)
|
1083 |
{
|
1084 |
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
|
1098 |
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
|
1109 |
|
1110 |
-
|
1111 |
-
|
1112 |
|
1113 |
-
|
1114 |
-
|
1115 |
|
1116 |
-
|
1117 |
-
|
1118 |
|
1119 |
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
|
1124 |
-
|
1125 |
|
1126 |
-
|
1127 |
-
|
1128 |
|
1129 |
-
|
1130 |
-
|
1131 |
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
|
1137 |
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
|
1143 |
-
|
1144 |
|
1145 |
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
|
1154 |
-
|
1155 |
|
1156 |
-
|
1157 |
-
|
1158 |
|
1159 |
|
1160 |
-
|
1161 |
|
1162 |
|
1163 |
-
|
1164 |
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
|
1198 |
-
|
1199 |
-
|
1200 |
|
1201 |
-
|
1202 |
|
1203 |
|
1204 |
|
1205 |
-
|
1206 |
|
1207 |
|
1208 |
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
|
1225 |
-
|
1226 |
-
|
1227 |
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
|
1233 |
-
|
1234 |
}
|
1235 |
|
1236 |
/*
|
@@ -1239,55 +1257,59 @@ wdi_front.smartPicker = function (currentFeed, load_more_number)
|
|
1239 |
wdi_front.createObject = function (obj, currentFeed)
|
1240 |
{
|
1241 |
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
|
|
|
|
|
|
|
|
1291 |
}
|
1292 |
|
1293 |
/*
|
@@ -1295,22 +1317,22 @@ wdi_front.createObject = function (obj, currentFeed)
|
|
1295 |
*/
|
1296 |
wdi_front.setPage = function (currentFeed)
|
1297 |
{
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
|
1310 |
-
|
1311 |
|
1312 |
|
1313 |
-
|
1314 |
}
|
1315 |
|
1316 |
/*
|
@@ -1318,117 +1340,225 @@ wdi_front.setPage = function (currentFeed)
|
|
1318 |
*/
|
1319 |
wdi_front.getPhotoTemplate = function (currentFeed)
|
1320 |
{
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1421 |
}
|
1422 |
|
1423 |
wdi_front.replaceToVideo = function (url, index, feed_counter)
|
1424 |
{
|
1425 |
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
|
1430 |
-
|
1431 |
-
|
1432 |
}
|
1433 |
|
1434 |
/*
|
@@ -1436,158 +1566,158 @@ wdi_front.replaceToVideo = function (url, index, feed_counter)
|
|
1436 |
*/
|
1437 |
wdi_front.getVideoTemplate = function (currentFeed)
|
1438 |
{
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
}
|
1542 |
|
1543 |
wdi_front.bindEvents = function (currentFeed)
|
1544 |
{
|
1545 |
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
|
1569 |
-
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
-
|
1574 |
-
|
1575 |
-
|
1576 |
-
|
1577 |
-
|
1578 |
-
|
1579 |
-
|
1580 |
-
|
1581 |
-
|
1582 |
-
|
1583 |
-
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
|
1592 |
|
1593 |
}
|
@@ -1595,152 +1725,152 @@ wdi_front.bindEvents = function (currentFeed)
|
|
1595 |
wdi_front.infiniteScroll = function (currentFeed)
|
1596 |
{
|
1597 |
|
1598 |
-
|
1599 |
-
|
1600 |
-
|
1601 |
-
|
1602 |
-
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
|
1607 |
-
|
1608 |
}
|
1609 |
|
1610 |
|
1611 |
wdi_front.paginationFirstPage = function (btn, currentFeed)
|
1612 |
{
|
1613 |
-
|
1614 |
-
|
1615 |
-
|
1616 |
-
|
1617 |
-
|
1618 |
-
|
1619 |
-
|
1620 |
|
1621 |
-
|
1622 |
-
|
1623 |
-
|
1624 |
|
1625 |
-
|
1626 |
-
|
1627 |
|
1628 |
}
|
1629 |
|
1630 |
wdi_front.paginationLastPage = function (btn, currentFeed)
|
1631 |
{
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
|
1639 |
-
|
1640 |
-
|
1641 |
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
1645 |
}
|
1646 |
|
1647 |
wdi_front.paginatorNext = function (btn, currentFeed)
|
1648 |
{
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
|
1653 |
-
|
1654 |
-
|
1655 |
-
|
1656 |
-
|
1657 |
-
|
1658 |
-
|
1659 |
-
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
-
|
1666 |
-
|
1667 |
-
|
1668 |
-
|
1669 |
-
|
1670 |
-
|
1671 |
-
|
1672 |
|
1673 |
|
1674 |
}
|
1675 |
|
1676 |
wdi_front.paginatorPrev = function (btn, currentFeed)
|
1677 |
{
|
1678 |
-
|
1679 |
-
|
1680 |
-
|
1681 |
-
|
1682 |
-
|
1683 |
-
|
1684 |
|
1685 |
-
|
1686 |
-
|
1687 |
|
1688 |
-
|
1689 |
-
|
1690 |
|
1691 |
-
|
1692 |
-
|
1693 |
-
|
1694 |
|
1695 |
}
|
1696 |
|
1697 |
//displays proper images for specific page after pagination buttons click event
|
1698 |
wdi_front.updatePagination = function (currentFeed, dir, oldPage)
|
1699 |
{
|
1700 |
-
|
1701 |
-
|
1702 |
-
|
1703 |
-
|
1704 |
-
|
1705 |
-
|
1706 |
-
|
1707 |
-
|
1708 |
-
|
1709 |
-
|
1710 |
-
|
1711 |
-
|
1712 |
-
|
1713 |
-
|
1714 |
-
|
1715 |
-
|
1716 |
-
|
1717 |
-
|
1718 |
-
|
1719 |
-
|
1720 |
-
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
1727 |
-
|
1728 |
-
|
1729 |
-
|
1730 |
-
|
1731 |
-
|
1732 |
-
|
1733 |
-
|
1734 |
-
|
1735 |
-
|
1736 |
-
|
1737 |
-
|
1738 |
-
|
1739 |
-
|
1740 |
-
|
1741 |
-
|
1742 |
-
|
1743 |
-
|
1744 |
}
|
1745 |
|
1746 |
|
@@ -1748,94 +1878,94 @@ wdi_front.loadMore = function (button, _currentFeed)
|
|
1748 |
{
|
1749 |
|
1750 |
|
1751 |
-
|
1752 |
-
|
1753 |
-
|
1754 |
-
|
1755 |
-
|
1756 |
-
|
1757 |
-
|
1758 |
-
|
1759 |
-
|
1760 |
-
|
1761 |
-
|
1762 |
-
|
1763 |
-
|
1764 |
-
|
1765 |
-
|
1766 |
-
|
1767 |
-
|
1768 |
-
|
1769 |
-
|
1770 |
-
|
1771 |
-
|
1772 |
-
|
1773 |
-
|
1774 |
-
|
1775 |
-
|
1776 |
-
|
1777 |
-
|
1778 |
-
|
1779 |
-
|
1780 |
-
|
1781 |
-
|
1782 |
-
|
1783 |
-
|
1784 |
-
|
1785 |
-
|
1786 |
-
|
1787 |
-
|
1788 |
-
|
1789 |
-
|
1790 |
-
|
1791 |
-
|
1792 |
-
|
1793 |
-
|
1794 |
-
|
1795 |
-
|
1796 |
-
|
1797 |
-
|
1798 |
-
|
1799 |
-
|
1800 |
-
|
1801 |
-
|
1802 |
-
|
1803 |
-
|
1804 |
-
|
1805 |
-
|
1806 |
-
|
1807 |
-
|
1808 |
-
|
1809 |
-
|
1810 |
-
|
1811 |
-
|
1812 |
-
|
1813 |
-
|
1814 |
-
|
1815 |
-
|
1816 |
-
|
1817 |
-
|
1818 |
-
|
1819 |
-
|
1820 |
-
|
1821 |
-
|
1822 |
-
|
1823 |
-
|
1824 |
-
|
1825 |
-
|
1826 |
-
|
1827 |
-
|
1828 |
-
|
1829 |
-
|
1830 |
-
|
1831 |
-
|
1832 |
-
|
1833 |
-
|
1834 |
-
|
1835 |
-
|
1836 |
-
|
1837 |
-
|
1838 |
-
|
1839 |
|
1840 |
|
1841 |
}
|
@@ -1846,136 +1976,136 @@ wdi_front.loadMore = function (button, _currentFeed)
|
|
1846 |
wdi_front.loadMoreRequest = function (user, next_url, currentFeed, button)
|
1847 |
{
|
1848 |
|
1849 |
-
|
1850 |
-
|
1851 |
-
|
1852 |
-
|
1853 |
-
|
1854 |
-
|
1855 |
-
|
1856 |
-
|
1857 |
-
|
1858 |
-
|
1859 |
-
|
1860 |
-
|
1861 |
-
|
1862 |
-
|
1863 |
-
|
1864 |
-
|
1865 |
-
|
1866 |
-
|
1867 |
-
|
1868 |
-
|
1869 |
-
|
1870 |
-
|
1871 |
-
|
1872 |
-
|
1873 |
-
|
1874 |
-
|
1875 |
-
|
1876 |
-
|
1877 |
-
|
1878 |
-
|
1879 |
-
|
1880 |
-
|
1881 |
-
|
1882 |
-
|
1883 |
-
|
1884 |
-
|
1885 |
-
|
1886 |
-
|
1887 |
-
|
1888 |
-
|
1889 |
-
|
1890 |
-
|
1891 |
-
|
1892 |
-
|
1893 |
-
|
1894 |
-
|
1895 |
-
|
1896 |
-
|
1897 |
-
|
1898 |
|
1899 |
}
|
1900 |
|
1901 |
wdi_front.checkForLoadMoreDone = function (currentFeed, button)
|
1902 |
{
|
1903 |
-
|
1904 |
-
|
1905 |
|
1906 |
-
|
1907 |
|
1908 |
-
|
1909 |
-
|
1910 |
-
|
1911 |
-
|
1912 |
-
|
1913 |
-
|
1914 |
-
|
1915 |
-
|
1916 |
-
|
1917 |
-
|
1918 |
-
|
1919 |
|
1920 |
-
|
1921 |
-
|
1922 |
-
|
1923 |
-
|
1924 |
-
|
1925 |
|
1926 |
-
|
1927 |
-
|
1928 |
|
1929 |
-
|
1930 |
|
1931 |
-
|
1932 |
-
|
1933 |
-
|
1934 |
|
1935 |
-
|
1936 |
-
|
1937 |
|
1938 |
|
1939 |
-
|
1940 |
|
1941 |
-
|
1942 |
-
|
1943 |
-
|
1944 |
|
1945 |
-
|
1946 |
-
|
1947 |
-
|
1948 |
-
|
1949 |
|
1950 |
-
|
1951 |
|
1952 |
-
|
1953 |
-
|
1954 |
-
|
1955 |
|
1956 |
-
|
1957 |
-
|
1958 |
-
|
1959 |
|
1960 |
-
|
1961 |
-
|
1962 |
-
|
1963 |
-
|
1964 |
|
1965 |
|
1966 |
-
|
1967 |
}
|
1968 |
|
1969 |
wdi_front.allDataHasFinished = function (currentFeed)
|
1970 |
{
|
1971 |
-
|
1972 |
-
|
1973 |
-
|
1974 |
-
|
1975 |
-
|
1976 |
-
|
1977 |
|
1978 |
-
|
1979 |
}
|
1980 |
|
1981 |
|
@@ -1983,37 +2113,37 @@ wdi_front.mergeData = function (array1, array2)
|
|
1983 |
{
|
1984 |
|
1985 |
|
1986 |
-
|
1987 |
-
|
1988 |
-
|
1989 |
-
|
1990 |
-
|
1991 |
|
1992 |
-
|
1993 |
-
|
1994 |
-
|
1995 |
-
|
1996 |
-
|
1997 |
-
|
1998 |
-
|
1999 |
-
|
2000 |
-
|
2001 |
-
|
2002 |
-
|
2003 |
-
|
2004 |
-
|
2005 |
-
|
2006 |
-
|
2007 |
-
|
2008 |
}
|
2009 |
|
2010 |
|
2011 |
//broken image handling
|
2012 |
wdi_front.brokenImageHandler = function (source)
|
2013 |
{
|
2014 |
-
|
2015 |
-
|
2016 |
-
|
2017 |
|
2018 |
}
|
2019 |
|
@@ -2021,57 +2151,61 @@ wdi_front.brokenImageHandler = function (source)
|
|
2021 |
//ajax loading
|
2022 |
wdi_front.ajaxLoader = function (currentFeed)
|
2023 |
{
|
2024 |
-
|
2025 |
|
2026 |
-
|
2027 |
-
|
2028 |
-
|
2029 |
-
|
2030 |
-
|
2031 |
-
|
2032 |
-
|
2033 |
-
|
2034 |
-
|
2035 |
-
|
2036 |
-
|
2037 |
-
|
2038 |
-
|
2039 |
-
|
2040 |
-
|
2041 |
-
|
2042 |
|
2043 |
|
2044 |
-
|
2045 |
|
2046 |
}
|
2047 |
|
2048 |
//if all images loaded then clicking load more causes it's removal
|
2049 |
wdi_front.allImagesLoaded = function (currentFeed)
|
2050 |
{
|
2051 |
-
|
2052 |
-
|
2053 |
-
|
2054 |
-
//jQuery('#wdi_feed_'+currentFeed.feed_row['wdi_feed_counter']+' .wdi_ajax_loading').remove();
|
2055 |
|
2056 |
-
|
2057 |
|
|
|
|
|
|
|
|
|
|
|
2058 |
|
2059 |
-
|
2060 |
-
|
2061 |
-
|
2062 |
|
2063 |
-
|
2064 |
-
|
2065 |
-
|
2066 |
-
|
2067 |
|
2068 |
-
|
2069 |
-
|
2070 |
-
|
2071 |
|
2072 |
|
2073 |
-
|
2074 |
-
|
2075 |
|
2076 |
|
2077 |
}
|
@@ -2080,190 +2214,190 @@ wdi_front.allImagesLoaded = function (currentFeed)
|
|
2080 |
//shows different parts of the feed based user choice
|
2081 |
wdi_front.show = function (name, currentFeed)
|
2082 |
{
|
2083 |
-
|
2084 |
-
|
2085 |
-
|
2086 |
-
|
2087 |
-
|
2088 |
-
|
2089 |
-
|
2090 |
-
|
2091 |
-
|
2092 |
-
|
2093 |
-
|
2094 |
-
|
2095 |
-
|
2096 |
-
|
2097 |
-
|
2098 |
-
|
2099 |
-
|
2100 |
-
|
2101 |
-
|
2102 |
-
|
2103 |
-
|
2104 |
-
|
2105 |
-
|
2106 |
-
|
2107 |
-
|
2108 |
-
|
2109 |
-
|
2110 |
-
|
2111 |
-
|
2112 |
-
|
2113 |
-
|
2114 |
-
|
2115 |
-
|
2116 |
-
|
2117 |
-
|
2118 |
-
|
2119 |
-
|
2120 |
-
|
2121 |
-
|
2122 |
-
|
2123 |
-
|
2124 |
-
|
2125 |
-
|
2126 |
-
|
2127 |
-
|
2128 |
-
|
2129 |
-
|
2130 |
-
|
2131 |
-
|
2132 |
-
|
2133 |
-
|
2134 |
-
|
2135 |
-
|
2136 |
-
|
2137 |
-
|
2138 |
-
|
2139 |
-
|
2140 |
-
|
2141 |
-
|
2142 |
-
|
2143 |
-
|
2144 |
-
|
2145 |
-
|
2146 |
-
|
2147 |
-
|
2148 |
-
|
2149 |
-
|
2150 |
-
|
2151 |
-
|
2152 |
-
|
2153 |
-
|
2154 |
-
|
2155 |
-
|
2156 |
-
|
2157 |
-
|
2158 |
-
|
2159 |
-
|
2160 |
-
|
2161 |
-
|
2162 |
-
|
2163 |
-
|
2164 |
-
|
2165 |
-
|
2166 |
-
|
2167 |
-
|
2168 |
-
|
2169 |
-
|
2170 |
-
|
2171 |
-
|
2172 |
-
|
2173 |
-
|
2174 |
-
|
2175 |
-
|
2176 |
-
|
2177 |
-
|
2178 |
-
|
2179 |
-
|
2180 |
-
|
2181 |
-
|
2182 |
-
|
2183 |
-
|
2184 |
-
|
2185 |
-
|
2186 |
-
|
2187 |
-
|
2188 |
-
|
2189 |
-
|
2190 |
-
|
2191 |
-
|
2192 |
-
|
2193 |
-
|
2194 |
-
|
2195 |
-
|
2196 |
-
|
2197 |
-
|
2198 |
-
|
2199 |
-
|
2200 |
-
|
2201 |
-
|
2202 |
-
|
2203 |
-
|
2204 |
-
|
2205 |
-
|
2206 |
-
|
2207 |
-
|
2208 |
-
|
2209 |
-
|
2210 |
-
|
2211 |
-
|
2212 |
-
|
2213 |
-
|
2214 |
-
|
2215 |
-
|
2216 |
-
|
2217 |
-
|
2218 |
-
|
2219 |
-
|
2220 |
-
|
2221 |
-
|
2222 |
-
|
2223 |
-
|
2224 |
-
|
2225 |
-
|
2226 |
-
|
2227 |
-
|
2228 |
-
|
2229 |
-
|
2230 |
-
|
2231 |
-
|
2232 |
-
|
2233 |
-
|
2234 |
-
|
2235 |
-
|
2236 |
-
|
2237 |
-
|
2238 |
-
|
2239 |
-
|
2240 |
-
|
2241 |
-
|
2242 |
-
|
2243 |
-
|
2244 |
-
|
2245 |
-
|
2246 |
-
|
2247 |
-
|
2248 |
-
|
2249 |
-
|
2250 |
-
|
2251 |
-
|
2252 |
-
|
2253 |
-
|
2254 |
-
|
2255 |
-
|
2256 |
-
|
2257 |
-
|
2258 |
-
|
2259 |
-
|
2260 |
-
|
2261 |
-
|
2262 |
-
|
2263 |
-
|
2264 |
-
|
2265 |
-
|
2266 |
-
|
2267 |
|
2268 |
}
|
2269 |
|
@@ -2271,316 +2405,323 @@ wdi_front.show = function (name, currentFeed)
|
|
2271 |
wdi_front.getUserTemplate = function (currentFeed, username)
|
2272 |
{
|
2273 |
|
2274 |
-
|
2275 |
-
|
2276 |
-
|
2277 |
-
|
2278 |
-
|
2279 |
-
|
2280 |
-
|
2281 |
-
|
2282 |
-
|
2283 |
-
|
2284 |
-
|
2285 |
-
|
2286 |
-
|
2287 |
-
|
2288 |
-
|
2289 |
-
|
2290 |
-
|
2291 |
-
|
2292 |
-
|
2293 |
-
|
2294 |
-
|
2295 |
-
|
2296 |
-
|
2297 |
-
|
2298 |
-
|
2299 |
-
|
2300 |
-
|
2301 |
-
|
2302 |
-
|
2303 |
-
|
2304 |
-
|
2305 |
-
|
2306 |
-
|
2307 |
-
|
2308 |
-
|
2309 |
-
|
2310 |
-
|
2311 |
-
|
2312 |
-
|
2313 |
-
|
2314 |
-
|
2315 |
-
|
2316 |
-
|
2317 |
-
|
2318 |
-
|
2319 |
-
|
2320 |
-
|
2321 |
-
|
2322 |
-
|
2323 |
-
|
2324 |
-
|
2325 |
-
|
2326 |
-
|
2327 |
-
|
2328 |
-
|
2329 |
-
|
2330 |
-
|
2331 |
-
|
2332 |
-
|
2333 |
-
|
2334 |
-
|
2335 |
-
|
2336 |
-
|
2337 |
-
|
2338 |
}
|
2339 |
|
2340 |
|
2341 |
wdi_front.getHeaderTemplate = function ()
|
2342 |
{
|
2343 |
-
|
2344 |
-
|
2345 |
-
|
2346 |
-
|
2347 |
-
|
2348 |
-
|
2349 |
-
|
2350 |
-
|
2351 |
-
|
2352 |
}
|
2353 |
|
2354 |
|
2355 |
//sets user filter to true and applys filter to feed
|
2356 |
wdi_front.addFilter = function (index, feed_counter)
|
2357 |
{
|
2358 |
-
|
2359 |
-
|
2360 |
-
|
2361 |
-
|
2362 |
-
|
2363 |
-
|
2364 |
-
|
2365 |
-
|
2366 |
-
|
2367 |
-
|
2368 |
-
|
2369 |
-
|
2370 |
-
|
2371 |
-
|
2372 |
-
|
2373 |
-
|
2374 |
-
|
2375 |
-
|
2376 |
-
|
2377 |
-
|
2378 |
-
|
2379 |
-
|
2380 |
-
|
2381 |
-
|
2382 |
-
|
2383 |
-
|
2384 |
-
|
2385 |
-
|
2386 |
-
|
2387 |
-
|
2388 |
-
|
2389 |
-
|
2390 |
-
|
2391 |
-
|
2392 |
-
|
2393 |
-
|
2394 |
-
|
2395 |
-
|
2396 |
-
|
2397 |
-
|
2398 |
-
|
2399 |
-
|
2400 |
-
|
2401 |
-
|
2402 |
-
|
2403 |
-
|
2404 |
-
|
2405 |
-
|
2406 |
-
|
2407 |
-
|
2408 |
-
|
2409 |
-
|
2410 |
-
|
2411 |
-
|
2412 |
-
|
2413 |
-
|
2414 |
-
|
2415 |
-
|
2416 |
-
|
2417 |
-
|
2418 |
-
|
2419 |
}
|
2420 |
|
2421 |
wdi_front.filterData = function (currentFeed)
|
2422 |
{
|
2423 |
|
2424 |
-
|
2425 |
-
|
2426 |
-
|
2427 |
-
|
2428 |
-
|
2429 |
-
|
2430 |
-
|
2431 |
|
2432 |
-
|
2433 |
-
|
2434 |
|
2435 |
}
|
2436 |
|
2437 |
wdi_front.applyFilters = function (currentFeed)
|
2438 |
{
|
2439 |
-
|
2440 |
-
|
2441 |
-
|
2442 |
-
|
2443 |
-
|
2444 |
-
|
2445 |
-
|
2446 |
|
2447 |
}
|
2448 |
|
2449 |
//gets data Count from global storage
|
2450 |
wdi_front.getImgCount = function (currentFeed)
|
2451 |
{
|
2452 |
-
|
2453 |
-
|
2454 |
-
|
2455 |
-
|
2456 |
-
|
2457 |
-
|
2458 |
}
|
2459 |
|
2460 |
//parses image data for lightbox popup
|
2461 |
wdi_front.parseLighboxData = function (currentFeed, filterFlag)
|
2462 |
{
|
2463 |
|
2464 |
-
|
2465 |
-
|
2466 |
-
|
2467 |
-
|
2468 |
-
|
2469 |
-
|
2470 |
-
|
2471 |
-
|
2472 |
-
|
2473 |
-
|
2474 |
-
|
2475 |
-
|
2476 |
-
|
2477 |
-
|
2478 |
-
|
2479 |
-
|
2480 |
-
|
2481 |
-
|
2482 |
-
|
2483 |
-
|
2484 |
-
|
2485 |
-
|
2486 |
-
|
2487 |
-
|
2488 |
-
|
2489 |
-
|
2490 |
-
|
2491 |
-
|
2492 |
-
|
2493 |
-
|
2494 |
-
|
2495 |
-
|
2496 |
-
|
2497 |
-
|
2498 |
-
|
2499 |
-
|
2500 |
-
|
2501 |
-
|
2502 |
-
|
2503 |
-
|
2504 |
-
|
2505 |
-
|
2506 |
-
|
2507 |
-
|
2508 |
-
|
2509 |
-
|
2510 |
}
|
2511 |
|
2512 |
wdi_front.convertUnixDate = function (date)
|
2513 |
{
|
2514 |
-
|
2515 |
-
|
2516 |
-
|
2517 |
-
|
2518 |
-
|
2519 |
-
|
2520 |
}
|
2521 |
|
2522 |
wdi_front.getDescription = function (desc)
|
2523 |
{
|
2524 |
-
|
2525 |
|
2526 |
|
2527 |
-
|
2528 |
}
|
2529 |
|
|
|
|
|
|
|
|
|
|
|
2530 |
wdi_front.getFileName = function (data)
|
2531 |
{
|
2532 |
-
|
2533 |
-
|
2534 |
-
|
2535 |
-
|
2536 |
-
|
2537 |
-
|
2538 |
-
|
2539 |
-
|
|
|
2540 |
|
2541 |
}
|
2542 |
|
2543 |
-
wdi_front.getFileType = function (
|
2544 |
{
|
2545 |
-
|
2546 |
-
|
2547 |
-
|
2548 |
-
|
2549 |
-
|
2550 |
-
|
|
|
2551 |
}
|
2552 |
|
2553 |
|
2554 |
wdi_front.array_max = function (array)
|
2555 |
{
|
2556 |
-
|
2557 |
-
|
2558 |
-
|
2559 |
-
|
2560 |
-
|
2561 |
-
|
2562 |
-
|
2563 |
-
|
2564 |
-
|
2565 |
-
|
2566 |
-
|
2567 |
-
|
2568 |
}
|
2569 |
|
2570 |
wdi_front.array_min = function (array)
|
2571 |
{
|
2572 |
-
|
2573 |
-
|
2574 |
-
|
2575 |
-
|
2576 |
-
|
2577 |
-
|
2578 |
-
|
2579 |
-
|
2580 |
-
|
2581 |
-
|
2582 |
-
|
2583 |
-
|
2584 |
}
|
2585 |
|
2586 |
/*
|
@@ -2588,13 +2729,13 @@ wdi_front.array_min = function (array)
|
|
2588 |
*/
|
2589 |
wdi_front.activeUsersCount = function (currentFeed)
|
2590 |
{
|
2591 |
-
|
2592 |
-
|
2593 |
-
|
2594 |
-
|
2595 |
-
|
2596 |
-
|
2597 |
-
|
2598 |
}
|
2599 |
|
2600 |
|
@@ -2606,17 +2747,17 @@ wdi_front.activeUsersCount = function (currentFeed)
|
|
2606 |
wdi_front.checkMediaResponse = function (response)
|
2607 |
{
|
2608 |
|
2609 |
-
|
2610 |
-
|
2611 |
-
|
2612 |
-
|
2613 |
-
|
2614 |
-
|
2615 |
-
|
2616 |
-
|
2617 |
-
|
2618 |
-
|
2619 |
-
|
2620 |
}
|
2621 |
|
2622 |
|
@@ -2627,18 +2768,18 @@ wdi_front.checkMediaResponse = function (response)
|
|
2627 |
*/
|
2628 |
wdi_front.stripHashtag = function (hashtag)
|
2629 |
{
|
2630 |
-
|
2631 |
-
|
2632 |
-
|
2633 |
-
|
2634 |
-
|
2635 |
-
|
2636 |
-
|
2637 |
-
|
2638 |
-
|
2639 |
-
|
2640 |
-
|
2641 |
-
|
2642 |
}
|
2643 |
|
2644 |
/**
|
@@ -2649,24 +2790,24 @@ wdi_front.stripHashtag = function (hashtag)
|
|
2649 |
wdi_front.getInputType = function (input)
|
2650 |
{
|
2651 |
|
2652 |
-
|
2653 |
-
|
2654 |
-
|
2655 |
-
|
2656 |
-
|
2657 |
-
|
2658 |
-
|
2659 |
-
|
2660 |
-
|
2661 |
-
|
2662 |
-
|
2663 |
-
|
2664 |
-
|
2665 |
-
|
2666 |
-
|
2667 |
-
|
2668 |
|
2669 |
-
|
2670 |
}
|
2671 |
|
2672 |
/**
|
@@ -2678,27 +2819,27 @@ wdi_front.getInputType = function (input)
|
|
2678 |
*/
|
2679 |
wdi_front.regexpTestCaption = function (captionText, searchkey)
|
2680 |
{
|
2681 |
-
|
2682 |
-
|
2683 |
-
|
2684 |
-
|
2685 |
-
|
2686 |
-
|
2687 |
-
|
2688 |
-
|
2689 |
-
|
2690 |
|
2691 |
-
|
2692 |
-
|
2693 |
-
|
2694 |
-
|
2695 |
-
|
2696 |
|
2697 |
-
|
2698 |
-
|
2699 |
-
|
2700 |
-
|
2701 |
-
|
2702 |
|
2703 |
}
|
2704 |
|
@@ -2711,55 +2852,55 @@ wdi_front.regexpTestCaption = function (captionText, searchkey)
|
|
2711 |
*/
|
2712 |
wdi_front.replaceNewLines = function (string)
|
2713 |
{
|
2714 |
-
|
2715 |
-
|
2716 |
-
|
2717 |
-
|
2718 |
|
2719 |
-
|
2720 |
-
|
2721 |
-
|
2722 |
-
|
2723 |
|
2724 |
-
|
2725 |
-
|
2726 |
|
2727 |
-
|
2728 |
|
2729 |
-
|
2730 |
-
|
2731 |
-
|
2732 |
-
|
2733 |
-
|
2734 |
|
2735 |
-
|
2736 |
-
|
2737 |
-
|
2738 |
-
|
2739 |
-
|
2740 |
|
2741 |
-
|
2742 |
-
|
2743 |
-
|
2744 |
}
|
2745 |
|
2746 |
|
2747 |
wdi_front.isEmptyObject = function (obj)
|
2748 |
{
|
2749 |
-
|
2750 |
-
|
2751 |
-
|
2752 |
-
|
2753 |
-
|
2754 |
}
|
2755 |
|
2756 |
|
2757 |
var WDIFeed = function (obj)
|
2758 |
{
|
2759 |
-
|
2760 |
-
|
2761 |
-
|
2762 |
-
|
2763 |
};
|
2764 |
|
2765 |
/**
|
@@ -2771,67 +2912,67 @@ var WDIFeed = function (obj)
|
|
2771 |
WDIFeed.prototype.conditionalFilter = function (response, args)
|
2772 |
{
|
2773 |
|
2774 |
-
|
2775 |
-
|
2776 |
-
|
2777 |
|
2778 |
|
2779 |
-
|
2780 |
|
2781 |
-
|
2782 |
|
2783 |
-
|
2784 |
-
|
2785 |
-
|
2786 |
-
|
2787 |
-
|
2788 |
|
2789 |
|
2790 |
-
|
2791 |
-
|
2792 |
-
|
2793 |
-
|
2794 |
-
|
2795 |
-
|
2796 |
-
|
2797 |
-
|
2798 |
-
|
2799 |
|
2800 |
|
2801 |
-
|
2802 |
-
|
2803 |
-
|
2804 |
|
2805 |
|
2806 |
-
|
2807 |
-
|
2808 |
-
|
2809 |
-
|
2810 |
|
2811 |
-
|
2812 |
-
|
2813 |
-
|
2814 |
-
|
2815 |
-
|
2816 |
-
|
2817 |
-
|
2818 |
-
|
2819 |
-
|
2820 |
-
|
2821 |
-
|
2822 |
-
|
2823 |
-
|
2824 |
-
|
2825 |
-
|
2826 |
-
|
2827 |
-
|
2828 |
-
|
2829 |
-
|
2830 |
-
|
2831 |
-
|
2832 |
|
2833 |
|
2834 |
-
|
2835 |
}
|
2836 |
|
2837 |
|
@@ -2843,12 +2984,12 @@ WDIFeed.prototype.conditionalFilter = function (response, args)
|
|
2843 |
*/
|
2844 |
WDIFeed.prototype.applyANDLogic = function (response, filters)
|
2845 |
{
|
2846 |
-
|
2847 |
-
|
2848 |
-
|
2849 |
-
|
2850 |
|
2851 |
-
|
2852 |
}
|
2853 |
|
2854 |
/**
|
@@ -2859,32 +3000,32 @@ WDIFeed.prototype.applyANDLogic = function (response, filters)
|
|
2859 |
*/
|
2860 |
WDIFeed.prototype.applyORLogic = function (response, filters)
|
2861 |
{
|
2862 |
-
|
2863 |
-
|
2864 |
-
|
2865 |
-
|
2866 |
-
|
2867 |
-
|
2868 |
|
2869 |
-
|
2870 |
-
|
2871 |
-
|
2872 |
-
|
2873 |
-
|
2874 |
|
2875 |
-
|
2876 |
-
|
2877 |
-
|
2878 |
-
|
2879 |
-
|
2880 |
-
|
2881 |
|
2882 |
-
|
2883 |
-
|
2884 |
-
|
2885 |
-
|
2886 |
-
|
2887 |
-
|
2888 |
}
|
2889 |
|
2890 |
|
@@ -2897,36 +3038,36 @@ WDIFeed.prototype.applyORLogic = function (response, filters)
|
|
2897 |
WDIFeed.prototype.applyNORLogic = function (response, filters)
|
2898 |
{
|
2899 |
|
2900 |
-
|
2901 |
-
|
2902 |
-
|
2903 |
-
|
2904 |
-
|
2905 |
|
2906 |
-
|
2907 |
-
|
2908 |
-
|
2909 |
-
|
2910 |
-
|
2911 |
|
2912 |
-
|
2913 |
-
|
2914 |
-
|
2915 |
-
|
2916 |
-
|
2917 |
-
|
2918 |
}
|
2919 |
|
2920 |
|
2921 |
WDIFeed.prototype.mediaExists = function (media, array)
|
2922 |
{
|
2923 |
|
2924 |
-
|
2925 |
-
|
2926 |
-
|
2927 |
-
|
2928 |
-
|
2929 |
-
|
2930 |
}
|
2931 |
|
2932 |
|
@@ -2939,38 +3080,38 @@ WDIFeed.prototype.mediaExists = function (media, array)
|
|
2939 |
WDIFeed.prototype.filterResponse = function (response, filter)
|
2940 |
{
|
2941 |
|
2942 |
-
|
2943 |
-
|
2944 |
-
|
2945 |
-
|
2946 |
-
|
2947 |
-
|
2948 |
-
|
2949 |
-
|
2950 |
-
|
2951 |
-
|
2952 |
-
|
2953 |
-
|
2954 |
-
|
2955 |
-
|
2956 |
-
|
2957 |
-
|
2958 |
-
|
2959 |
-
|
2960 |
-
|
2961 |
-
|
2962 |
-
|
2963 |
-
|
2964 |
-
|
2965 |
-
|
2966 |
-
|
2967 |
-
|
2968 |
-
|
2969 |
-
|
2970 |
-
|
2971 |
-
|
2972 |
-
|
2973 |
-
|
2974 |
}
|
2975 |
|
2976 |
|
@@ -2982,29 +3123,29 @@ WDIFeed.prototype.filterResponse = function (response, filter)
|
|
2982 |
*/
|
2983 |
WDIFeed.prototype.filterByHashtag = function (response, filter)
|
2984 |
{
|
2985 |
-
|
2986 |
-
|
2987 |
-
|
2988 |
-
|
2989 |
|
2990 |
-
|
2991 |
-
|
2992 |
-
|
2993 |
-
|
2994 |
-
|
2995 |
|
2996 |
-
|
2997 |
-
|
2998 |
-
|
2999 |
-
|
3000 |
|
3001 |
|
3002 |
-
|
3003 |
-
|
3004 |
-
|
3005 |
-
|
3006 |
-
|
3007 |
-
|
3008 |
}
|
3009 |
|
3010 |
/**
|
@@ -3015,24 +3156,24 @@ WDIFeed.prototype.filterByHashtag = function (response, filter)
|
|
3015 |
*/
|
3016 |
WDIFeed.prototype.filterByUsername = function (response, filter)
|
3017 |
{
|
3018 |
-
|
3019 |
-
|
3020 |
-
|
3021 |
|
3022 |
-
|
3023 |
-
|
3024 |
-
|
3025 |
-
|
3026 |
-
|
3027 |
-
|
3028 |
|
3029 |
|
3030 |
-
|
3031 |
-
|
3032 |
-
|
3033 |
-
|
3034 |
-
|
3035 |
-
|
3036 |
}
|
3037 |
|
3038 |
|
@@ -3044,25 +3185,25 @@ WDIFeed.prototype.filterByUsername = function (response, filter)
|
|
3044 |
*/
|
3045 |
WDIFeed.prototype.filterByMention = function (response, filter)
|
3046 |
{
|
3047 |
-
|
3048 |
-
|
3049 |
-
|
3050 |
-
|
3051 |
-
|
3052 |
-
|
3053 |
-
|
3054 |
|
3055 |
-
|
3056 |
-
|
3057 |
-
|
3058 |
-
|
3059 |
|
3060 |
-
|
3061 |
-
|
3062 |
-
|
3063 |
-
|
3064 |
-
|
3065 |
-
|
3066 |
}
|
3067 |
|
3068 |
|
@@ -3074,30 +3215,30 @@ WDIFeed.prototype.filterByMention = function (response, filter)
|
|
3074 |
*/
|
3075 |
WDIFeed.prototype.filterByDescription = function (response, filter)
|
3076 |
{
|
3077 |
-
|
3078 |
-
|
3079 |
|
3080 |
-
|
3081 |
-
|
3082 |
-
|
3083 |
|
3084 |
-
|
3085 |
-
|
3086 |
-
|
3087 |
|
3088 |
-
|
3089 |
-
|
3090 |
-
|
3091 |
-
|
3092 |
-
|
3093 |
|
3094 |
-
|
3095 |
-
|
3096 |
-
|
3097 |
-
|
3098 |
-
|
3099 |
|
3100 |
-
|
3101 |
}
|
3102 |
|
3103 |
|
@@ -3109,25 +3250,25 @@ WDIFeed.prototype.filterByDescription = function (response, filter)
|
|
3109 |
*/
|
3110 |
WDIFeed.prototype.filterByLocation = function (response, filter)
|
3111 |
{
|
3112 |
-
|
3113 |
-
|
3114 |
-
|
3115 |
-
|
3116 |
|
3117 |
-
|
3118 |
-
|
3119 |
-
|
3120 |
-
|
3121 |
-
|
3122 |
-
|
3123 |
-
|
3124 |
|
3125 |
-
|
3126 |
-
|
3127 |
-
|
3128 |
-
|
3129 |
-
|
3130 |
-
|
3131 |
}
|
3132 |
|
3133 |
|
@@ -3140,28 +3281,28 @@ WDIFeed.prototype.filterByLocation = function (response, filter)
|
|
3140 |
|
3141 |
WDIFeed.prototype.filterByUrl = function (response, filter)
|
3142 |
{
|
3143 |
-
|
3144 |
-
|
3145 |
|
3146 |
-
|
3147 |
|
3148 |
-
|
3149 |
-
|
3150 |
|
3151 |
-
|
3152 |
-
|
3153 |
-
|
3154 |
-
|
3155 |
-
|
3156 |
-
|
3157 |
-
|
3158 |
|
3159 |
-
|
3160 |
-
|
3161 |
-
|
3162 |
-
|
3163 |
-
|
3164 |
-
|
3165 |
}
|
3166 |
|
3167 |
/**
|
@@ -3171,18 +3312,18 @@ WDIFeed.prototype.filterByUrl = function (response, filter)
|
|
3171 |
*/
|
3172 |
WDIFeed.prototype.getIdFromUrl = function (url)
|
3173 |
{
|
3174 |
-
|
3175 |
-
|
3176 |
-
|
3177 |
-
|
3178 |
-
|
3179 |
-
|
3180 |
-
|
3181 |
-
|
3182 |
-
|
3183 |
-
|
3184 |
-
|
3185 |
-
|
3186 |
}
|
3187 |
|
3188 |
|
@@ -3193,25 +3334,28 @@ WDIFeed.prototype.getIdFromUrl = function (url)
|
|
3193 |
*/
|
3194 |
WDIFeed.prototype.avoidDuplicateMedia = function (response)
|
3195 |
{
|
3196 |
-
|
3197 |
-
|
3198 |
-
|
|
|
|
|
|
|
3199 |
|
3200 |
-
|
3201 |
-
|
3202 |
-
|
3203 |
-
|
3204 |
-
|
3205 |
|
3206 |
-
|
3207 |
|
3208 |
-
|
3209 |
-
|
3210 |
-
|
3211 |
-
|
3212 |
-
|
3213 |
|
3214 |
-
|
3215 |
|
3216 |
}
|
3217 |
|
@@ -3219,182 +3363,178 @@ WDIFeed.prototype.avoidDuplicateMedia = function (response)
|
|
3219 |
/* stores data from objects array into global variable */
|
3220 |
WDIFeed.prototype.storeRawData = function (objects, variable)
|
3221 |
{
|
3222 |
-
|
3223 |
-
|
3224 |
-
|
3225 |
-
|
3226 |
-
|
3227 |
-
|
3228 |
-
|
3229 |
-
|
3230 |
-
|
3231 |
-
|
3232 |
-
|
3233 |
-
|
3234 |
-
|
3235 |
-
|
3236 |
-
|
3237 |
-
|
3238 |
-
|
3239 |
-
|
3240 |
-
|
3241 |
-
|
3242 |
-
|
3243 |
-
|
3244 |
-
|
3245 |
-
|
3246 |
-
|
3247 |
-
|
3248 |
-
|
3249 |
-
|
3250 |
-
|
3251 |
-
|
3252 |
-
|
3253 |
-
|
3254 |
-
|
3255 |
-
|
3256 |
-
|
3257 |
-
|
3258 |
-
|
3259 |
-
|
3260 |
-
|
3261 |
-
|
3262 |
-
|
3263 |
-
|
3264 |
-
|
3265 |
-
|
3266 |
-
|
3267 |
-
|
3268 |
-
|
3269 |
-
|
3270 |
-
|
3271 |
-
|
3272 |
-
|
3273 |
-
|
3274 |
-
|
3275 |
-
|
3276 |
-
|
3277 |
-
|
3278 |
-
|
3279 |
-
|
3280 |
-
|
3281 |
-
|
3282 |
-
|
3283 |
-
|
3284 |
-
|
3285 |
-
|
3286 |
-
|
3287 |
-
|
3288 |
-
|
3289 |
-
|
3290 |
-
|
3291 |
-
|
3292 |
-
|
3293 |
-
|
3294 |
-
|
3295 |
-
|
3296 |
-
|
3297 |
-
|
3298 |
-
|
3299 |
-
|
3300 |
|
3301 |
}
|
3302 |
|
3303 |
|
3304 |
wdi_front.updateUsersIfNecessary = function (currentFeed)
|
3305 |
{
|
3306 |
-
|
3307 |
-
|
3308 |
|
3309 |
-
|
3310 |
-
|
3311 |
-
|
3312 |
-
|
3313 |
-
|
3314 |
-
|
3315 |
|
3316 |
-
|
3317 |
-
|
3318 |
-
|
3319 |
-
|
3320 |
-
|
3321 |
|
3322 |
-
|
3323 |
|
3324 |
-
|
3325 |
-
|
3326 |
-
|
3327 |
-
|
3328 |
-
|
3329 |
-
|
3330 |
|
3331 |
-
|
3332 |
-
|
3333 |
-
|
3334 |
-
|
3335 |
-
|
3336 |
-
|
3337 |
-
|
3338 |
|
3339 |
|
3340 |
-
|
3341 |
|
3342 |
-
|
3343 |
-
|
3344 |
-
|
3345 |
-
|
3346 |
-
|
3347 |
-
|
3348 |
-
|
3349 |
-
|
3350 |
-
|
3351 |
-
|
3352 |
-
|
3353 |
|
3354 |
-
|
3355 |
-
|
3356 |
-
|
3357 |
-
|
3358 |
-
|
3359 |
|
3360 |
-
|
3361 |
}
|
3362 |
|
3363 |
|
|
|
|
|
|
|
3364 |
|
|
|
3365 |
|
3366 |
-
|
3367 |
-
|
3368 |
-
|
3369 |
-
|
3370 |
-
|
3371 |
-
|
3372 |
-
|
3373 |
-
if (wdi_front['type'] != 'not_declared') {
|
3374 |
-
|
3375 |
-
wdi_front.clickOrTouch = wdi_front.detectEvent();
|
3376 |
-
//initializing all feeds in the page
|
3377 |
-
wdi_front.globalInit();
|
3378 |
-
} else {
|
3379 |
-
return;
|
3380 |
-
}
|
3381 |
-
});
|
3382 |
|
3383 |
|
3384 |
}
|
3385 |
-
else{
|
3386 |
-
|
3387 |
-
|
3388 |
|
3389 |
|
3390 |
-
|
3391 |
-
|
3392 |
-
|
3393 |
-
|
3394 |
-
|
3395 |
-
|
3396 |
-
|
3397 |
|
3398 |
-
|
3399 |
}
|
3400 |
|
|
1 |
if (typeof wdi_front == 'undefined') {
|
2 |
+
wdi_front = {
|
3 |
+
type: 'not_declared'
|
4 |
+
};
|
5 |
}
|
6 |
|
7 |
|
|
|
8 |
wdi_front.detectEvent = function ()
|
9 |
{
|
10 |
+
var isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
|
11 |
+
if (isMobile) {
|
12 |
+
return "touchend";
|
13 |
+
} else {
|
14 |
+
return 'click';
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
wdi_front.show_alert = function (message)
|
19 |
+
{
|
20 |
+
if (wdi_front_messages.show_alerts) {
|
21 |
+
alert(message);
|
22 |
+
}
|
23 |
+
else {
|
24 |
+
console.log('%c' + message, "color:#cc0000;");
|
25 |
+
}
|
26 |
}
|
27 |
|
28 |
+
|
29 |
wdi_front.globalInit = function ()
|
30 |
{
|
31 |
+
var num = wdi_front['feed_counter'];
|
32 |
+
|
33 |
+
if (typeof wdi_ajax.ajax_response != "undefined") {
|
34 |
+
var init_feed_counter = wdi_feed_counter_init.wdi_feed_counter_init;
|
35 |
+
}
|
36 |
+
else {
|
37 |
+
var init_feed_counter = 0;
|
38 |
+
}
|
39 |
+
for (var i = init_feed_counter; i <= num; i++) {
|
40 |
+
|
41 |
+
var currentFeed = new WDIFeed(window['wdi_feed_' + i]);
|
42 |
+
|
43 |
+
/*initializing instagram object which will handle all instagram api requests*/
|
44 |
+
currentFeed.instagram = new WDIInstagram();
|
45 |
+
|
46 |
+
/**
|
47 |
+
* this object will be passed to filtering function of currentFeed.instagram as second parameter
|
48 |
+
* @type {Object}
|
49 |
+
*/
|
50 |
+
currentFeed.instagram.filterArguments = {
|
51 |
+
feed: currentFeed
|
52 |
+
};
|
53 |
+
|
54 |
+
currentFeed.instagram.filters = [
|
55 |
+
{
|
56 |
+
'where': 'getUserRecentMedia',
|
57 |
+
'what': function (response, args, cArgs)
|
58 |
+
{
|
59 |
+
return args.feed.conditionalFilter(response, cArgs);
|
60 |
+
}
|
61 |
+
},
|
62 |
+
{
|
63 |
+
'where': 'getTagRecentMedia',
|
64 |
+
'what': function (response, args, cArgs)
|
65 |
+
{
|
66 |
+
return args.feed.conditionalFilter(response, cArgs);
|
67 |
+
}
|
68 |
+
},
|
69 |
+
{
|
70 |
+
'where': 'getRecentLikedMedia',
|
71 |
+
'what': function (response, args, cArgs)
|
72 |
+
{
|
73 |
+
return args.feed.conditionalFilter(response, cArgs);
|
74 |
+
}
|
75 |
+
},
|
76 |
+
|
77 |
+
|
78 |
+
{
|
79 |
+
'where': 'requestByUrl',
|
80 |
+
'what': function (response, args, cArgs)
|
81 |
+
{
|
82 |
+
return args.feed.conditionalFilter(response, cArgs);
|
83 |
+
}
|
84 |
+
},];
|
85 |
+
|
86 |
+
|
87 |
+
currentFeed.instagram.addToken(currentFeed['feed_row']['access_token']);
|
88 |
+
|
89 |
+
wdi_front.access_token = currentFeed['feed_row']['access_token'];
|
90 |
+
|
91 |
+
currentFeed.dataStorageRaw = []; //stores all getted data from instagram api
|
92 |
+
|
93 |
+
currentFeed.dataStorage = []; //stores all avialable data
|
94 |
+
currentFeed.dataStorageList = []; //?
|
95 |
+
currentFeed.allResponseLength = 0; //?
|
96 |
+
//number of instagram objects which has been got by single request
|
97 |
+
currentFeed.currentResponseLength = 0;
|
98 |
+
|
99 |
+
//temprorary usersData which is uses in case when getted data is smaller then needed
|
100 |
+
currentFeed.temproraryUsersData = [];
|
101 |
+
|
102 |
+
currentFeed.removedUsers = 0;
|
103 |
+
currentFeed.nowLoadingImages = true;
|
104 |
+
currentFeed.imageIndex = 0; //index for image indexes
|
105 |
+
currentFeed.resIndex = 0; //responsive indexes used for pagination
|
106 |
+
currentFeed.currentPage = 1; //pagination page number
|
107 |
+
currentFeed.userSortFlags = []; //array for descripbing user based filter options
|
108 |
+
currentFeed.customFilterChanged = false; //flag to notice filter change, onclick on username
|
109 |
+
|
110 |
+
|
111 |
+
/**
|
112 |
+
* This variable describes after how many requests program will stop searching for content
|
113 |
+
* this number is very important and should not be set too high, because when feed has conditional filter
|
114 |
+
* and filtered items are rare then the program will recursively request new photos and will filter them
|
115 |
+
* if no image was fount it will go into infinite loop if feed images are "infinite" ( very huge number )
|
116 |
+
* and if requests count in 1 hour exeed 5000 instagram will block access token for one hour
|
117 |
+
*
|
118 |
+
* @type {Number}
|
119 |
+
*/
|
120 |
+
currentFeed.maxConditionalFiltersRequestCount = 10;
|
121 |
+
|
122 |
+
/**
|
123 |
+
* This variable shows us how many times program has been recursively called,
|
124 |
+
* it changes it value within filtering function, and resets itself to 0 when feed is being displayed
|
125 |
+
*
|
126 |
+
* @type {Number}
|
127 |
+
*/
|
128 |
+
currentFeed.instagramRequestCounter = 0;
|
129 |
+
|
130 |
+
/**
|
131 |
+
* This array stores data from each request,
|
132 |
+
* it is used to determine and remove duplicate photos caused by multiple hashtags
|
133 |
+
* it is resetted to its inital [] value after displaying feed
|
134 |
+
*
|
135 |
+
* @type {Array}
|
136 |
+
*/
|
137 |
+
currentFeed.conditionalFilterBuffer = [];
|
138 |
+
|
139 |
+
|
140 |
+
currentFeed.stopInfiniteScrollFlag = false;
|
141 |
+
|
142 |
+
window.onload = function ()
|
143 |
+
{
|
144 |
+
for (var i = init_feed_counter; i <= wdi_front.feed_counter; i++) {
|
145 |
+
window['wdi_feed_' + i]['nowLoadingImages'] = false;
|
146 |
+
}
|
147 |
+
}
|
148 |
+
|
149 |
+
if (currentFeed.feed_row.feed_type == 'masonry') {
|
150 |
+
currentFeed.displayedData = [];
|
151 |
+
}
|
152 |
+
|
153 |
+
|
154 |
+
//if pagination is on then set pagination parameters
|
155 |
+
if (currentFeed.feed_row.feed_display_view == 'pagination') {
|
156 |
+
currentFeed.feed_row.resort_after_load_more = 0;
|
157 |
+
if (currentFeed.feed_row.feed_type != 'image_browser') {
|
158 |
+
currentFeed.feed_row.load_more_number = parseInt(currentFeed.feed_row.pagination_per_page_number);
|
159 |
+
currentFeed.feed_row.number_of_photos = (1 + parseInt(currentFeed.feed_row.pagination_preload_number)) * currentFeed.feed_row.load_more_number;
|
160 |
+
} else {
|
161 |
+
currentFeed.feed_row.number_of_photos = 1 + parseInt(currentFeed.feed_row.image_browser_preload_number);
|
162 |
+
currentFeed.feed_row.load_more_number = parseInt(currentFeed.feed_row.image_browser_load_number);
|
163 |
+
}
|
164 |
+
|
165 |
+
|
166 |
+
currentFeed.freeSpaces = (Math.floor(currentFeed.feed_row.pagination_per_page_number / currentFeed.feed_row.number_of_columns) + 1) * currentFeed.feed_row.number_of_columns - currentFeed.feed_row.pagination_per_page_number;
|
167 |
+
} else {
|
168 |
+
currentFeed.freeSpaces = 0;
|
169 |
+
}
|
170 |
|
171 |
|
172 |
+
//initializing function for lightbox
|
173 |
+
currentFeed.galleryBox = function (image_id)
|
174 |
+
{
|
175 |
+
wdi_spider_createpopup(wdi_url.ajax_url + '?gallery_id=' + this.feed_row['id'] + '&image_id=' + image_id, wdi_front.feed_counter, this.feed_row['lightbox_width'], this.feed_row['lightbox_height'], 1, 'testpopup', 5, this);
|
176 |
+
}
|
177 |
+
//calling responive javascript
|
178 |
+
wdi_responsive.columnControl(currentFeed);
|
179 |
|
180 |
+
//if feed type is masonry then trigger resize event for building proper column layout
|
181 |
+
if (currentFeed.feed_row.feed_type == 'masonry') {
|
182 |
+
jQuery(window).trigger('resize');
|
183 |
+
}
|
184 |
|
185 |
+
wdi_front.bindEvents(currentFeed);
|
186 |
|
187 |
+
window['wdi_feed_' + i] = currentFeed;
|
188 |
|
189 |
|
190 |
+
//initializing each feed
|
191 |
+
wdi_front.init(currentFeed);
|
192 |
+
} //endfor
|
193 |
|
194 |
}
|
195 |
|
197 |
{
|
198 |
|
199 |
|
200 |
+
//some varables used in code
|
201 |
+
currentFeed.photoCounter = currentFeed.feed_row["number_of_photos"];
|
202 |
|
203 |
|
204 |
+
if (currentFeed.feed_row.liked_feed == 'liked') {
|
205 |
+
currentFeed.feed_users = ['self'];
|
206 |
+
// do nothing,
|
207 |
+
}
|
208 |
+
else
|
209 |
+
if (wdi_front.isJsonString(currentFeed.feed_row.feed_users)) {
|
210 |
+
/**
|
211 |
+
* Contains username and user_id of each user
|
212 |
+
* @type {[Array}
|
213 |
+
*/
|
214 |
+
currentFeed.feed_users = JSON.parse(currentFeed.feed_row.feed_users);
|
215 |
|
216 |
+
/**
|
217 |
+
* Check if feed user has no id for some reason then update user
|
218 |
+
* and after updating them initialize feed
|
219 |
+
*/
|
220 |
+
if (wdi_front.updateUsersIfNecessary(currentFeed)) {
|
221 |
+
return;
|
222 |
+
}
|
223 |
+
;
|
224 |
|
225 |
|
226 |
+
} else {
|
227 |
+
wdi_front.show_alert('provided feed users are invalid or obsolete for this version of plugin');
|
228 |
+
return;
|
229 |
+
}
|
230 |
|
231 |
|
232 |
+
//wdi_front.loadInstagramMedia( currentFeed, currentFeed.feed_row.number_of_photos);
|
233 |
|
234 |
+
currentFeed.dataCount = currentFeed.feed_users.length; //1 in case of self feed
|
235 |
|
236 |
|
237 |
+
for (var i = 0; i < currentFeed.dataCount; i++) {
|
238 |
+
wdi_front.instagramRequest(i, currentFeed);
|
239 |
+
}
|
240 |
|
241 |
|
242 |
+
if (currentFeed.feed_row["number_of_photos"] > 0) {
|
243 |
+
wdi_front.ajaxLoader(currentFeed);
|
244 |
+
}
|
245 |
|
246 |
|
247 |
+
//setting feed name
|
248 |
+
if (currentFeed['feed_row']['display_header'] === '1') {
|
249 |
+
wdi_front.show('header', currentFeed);
|
250 |
+
}
|
251 |
+
if (currentFeed['feed_row']['show_usernames'] === '1') {
|
252 |
+
wdi_front.show('users', currentFeed);
|
253 |
+
}
|
254 |
|
255 |
|
256 |
}
|
263 |
*/
|
264 |
wdi_front.isJsonString = function (str)
|
265 |
{
|
266 |
+
try {
|
267 |
+
JSON.parse(str);
|
268 |
+
} catch (e) {
|
269 |
+
return false;
|
270 |
+
}
|
271 |
+
return true;
|
272 |
}
|
273 |
|
274 |
|
282 |
wdi_front.instagramRequest = function (id, currentFeed)
|
283 |
{
|
284 |
|
285 |
+
var feed_users = currentFeed.feed_users,
|
286 |
+
_this = this;
|
287 |
+
if (typeof feed_users[id] === 'string' && feed_users[id] === 'self') { // self liked media
|
288 |
+
currentFeed.instagram.getRecentLikedMedia({
|
289 |
+
success: function (response)
|
290 |
+
{
|
291 |
+
response = _this.checkMediaResponse(response);
|
292 |
+
if (response != false) {
|
293 |
+
_this.saveSelfUserData(response, currentFeed);
|
294 |
+
}
|
295 |
+
}
|
296 |
+
});
|
297 |
+
}
|
298 |
+
else
|
299 |
+
if (this.getInputType(feed_users[id]['username']) == 'hashtag') {
|
300 |
+
currentFeed.instagram.getTagRecentMedia(this.stripHashtag(feed_users[id]['username']), {
|
301 |
+
success: function (response)
|
302 |
+
{
|
303 |
+
response = _this.checkMediaResponse(response);
|
304 |
+
if (response != false) {
|
305 |
+
_this.saveUserData(response, currentFeed.feed_users[id], currentFeed);
|
306 |
+
}
|
307 |
+
}
|
308 |
+
});
|
309 |
+
}
|
310 |
+
else
|
311 |
+
if (this.getInputType(feed_users[id]['username']) == 'user') {
|
312 |
+
currentFeed.instagram.getUserRecentMedia(feed_users[id]['id'], {
|
313 |
+
success: function (response)
|
314 |
+
{
|
315 |
+
response = _this.checkMediaResponse(response);
|
316 |
+
if (response != false) {
|
317 |
+
_this.saveUserData(response, currentFeed.feed_users[id], currentFeed);
|
318 |
+
}
|
319 |
+
}
|
320 |
+
});
|
321 |
+
}
|
322 |
|
323 |
}
|
324 |
|
329 |
*/
|
330 |
wdi_front.isHashtag = function (str)
|
331 |
{
|
332 |
+
return (str[0] === '#');
|
333 |
}
|
334 |
|
335 |
|
340 |
wdi_front.saveUserData = function (data, user, currentFeed)
|
341 |
{
|
342 |
|
343 |
+
data['username'] = user.username;
|
344 |
+
data['user_id'] = user.id;
|
345 |
|
346 |
+
//checking if user type is hashtag then manually add hashtag to each object, for later use
|
347 |
+
//hashtag based filters
|
348 |
+
if (data['user_id'][0] === '#') {
|
349 |
+
data['data'] = wdi_front.appendRequestHashtag(data['data'], data['user_id']);
|
350 |
+
}
|
351 |
|
352 |
|
353 |
+
currentFeed.usersData.push(data);
|
354 |
|
355 |
|
356 |
+
currentFeed.currentResponseLength = wdi_front.getArrayContentLength(currentFeed.usersData, 'data');
|
357 |
+
currentFeed.allResponseLength += currentFeed.currentResponseLength;
|
358 |
|
359 |
|
360 |
+
if (currentFeed.dataCount == currentFeed.usersData.length) {
|
361 |
|
362 |
+
//if getted objects is not enough then recuest new ones
|
363 |
+
if (currentFeed.currentResponseLength < currentFeed.feed_row.number_of_photos && !wdi_front.userHasNoPhoto(currentFeed)) {
|
364 |
+
//console.log('initial recursion');
|
365 |
+
/*here we are calling loadMore function out of recursion cylce, after this initial-keep call
|
366 |
+
loadMore will be called with 'initial' recursivly until the desired number of photos is reached
|
367 |
+
if possible*/
|
368 |
|
369 |
+
wdi_front.loadMore('initial-keep', currentFeed);
|
370 |
+
} else {
|
371 |
|
372 |
|
373 |
+
//display feed
|
374 |
+
wdi_front.displayFeed(currentFeed);
|
375 |
+
//when all data us properly displayed check for any active filters and then apply them
|
376 |
+
wdi_front.applyFilters(currentFeed);
|
377 |
|
378 |
|
379 |
+
/*removing load more button of feed has finished*/
|
380 |
+
if (!wdi_front.activeUsersCount(currentFeed)) {
|
381 |
+
if (currentFeed.feed_row.feed_display_view == 'load_more_btn') {
|
382 |
+
var feed_container = jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter);
|
383 |
+
feed_container.find('.wdi_load_more').addClass('wdi_hidden');
|
384 |
+
feed_container.find('.wdi_spinner').addClass('wdi_hidden');
|
385 |
+
}
|
386 |
+
}
|
387 |
+
;
|
388 |
|
389 |
+
}
|
390 |
|
391 |
|
392 |
+
}
|
393 |
|
394 |
}
|
395 |
|
401 |
wdi_front.saveSelfUserData = function (data, currentFeed)
|
402 |
{
|
403 |
|
404 |
+
//keep empty for self feed
|
405 |
+
data['username'] = '';
|
406 |
+
data['user_id'] = '';
|
407 |
|
408 |
+
currentFeed.usersData.push(data);
|
409 |
|
410 |
|
411 |
+
currentFeed.currentResponseLength = wdi_front.getArrayContentLength(currentFeed.usersData, 'data');
|
412 |
+
currentFeed.allResponseLength += currentFeed.currentResponseLength;
|
413 |
|
414 |
|
415 |
+
if (currentFeed.dataCount == currentFeed.usersData.length) {
|
416 |
|
417 |
+
//if retrieved objects are not enough then request new ones
|
418 |
|
419 |
+
if (currentFeed.currentResponseLength < currentFeed.feed_row.number_of_photos && !wdi_front.userHasNoPhoto(currentFeed)) {
|
420 |
+
//console.log('initial recursion');
|
421 |
+
/*here we are calling loadMore function out of recursion cycle, after this initial-keep call
|
422 |
+
loadMore will be called with 'initial' recursively until the desired number of photos is reached
|
423 |
+
if possible*/
|
424 |
|
425 |
+
wdi_front.loadMore('initial-keep', currentFeed);
|
426 |
+
} else {
|
427 |
|
428 |
|
429 |
+
//display feed
|
430 |
+
wdi_front.displayFeed(currentFeed);
|
431 |
+
//when all data us properly displayed check for any active filters and then apply them
|
432 |
+
wdi_front.applyFilters(currentFeed);
|
433 |
|
434 |
|
435 |
+
/*removing load more button of feed has finished*/
|
436 |
+
if (!wdi_front.activeUsersCount(currentFeed)) {
|
437 |
+
if (currentFeed.feed_row.feed_display_view == 'load_more_btn') {
|
438 |
+
var feed_container = jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter);
|
439 |
+
feed_container.find('.wdi_load_more').addClass('wdi_hidden');
|
440 |
+
feed_container.find('.wdi_spinner').addClass('wdi_hidden');
|
441 |
+
}
|
442 |
+
}
|
443 |
+
;
|
444 |
|
445 |
+
}
|
446 |
|
447 |
|
448 |
+
}
|
449 |
|
450 |
}
|
451 |
|
455 |
wdi_front.userHasNoPhoto = function (currentFeed, cstData)
|
456 |
{
|
457 |
|
458 |
+
var counter = 0;
|
459 |
+
var data = currentFeed.usersData;
|
460 |
+
if (typeof cstData != 'undefined') {
|
461 |
+
data = cstData;
|
462 |
+
}
|
463 |
+
for (var i = 0; i < data.length; i++) {
|
464 |
+
if (currentFeed.feed_row.liked_feed === 'liked') {
|
465 |
+
if (typeof data[i]['pagination']['next_max_like_id'] == 'undefined') {
|
466 |
+
counter++
|
467 |
+
}
|
468 |
+
}
|
469 |
+
else {
|
470 |
+
if (typeof data[i]['pagination']['next_max_id'] == 'undefined') {
|
471 |
+
counter++
|
472 |
+
}
|
473 |
+
}
|
474 |
+
|
475 |
+
}
|
476 |
+
if (counter == data.length) {
|
477 |
+
return 1;
|
478 |
+
} else {
|
479 |
+
return 0;
|
480 |
+
}
|
481 |
}
|
482 |
|
483 |
/*
|
485 |
*/
|
486 |
wdi_front.appendRequestHashtag = function (data, hashtag)
|
487 |
{
|
488 |
+
for (var i = 0; i < data.length; i++) {
|
489 |
+
data[i]['wdi_hashtag'] = hashtag;
|
490 |
+
}
|
491 |
+
return data;
|
492 |
}
|
493 |
|
494 |
|
501 |
{
|
502 |
|
503 |
|
504 |
+
if (currentFeed.customFilterChanged == false) {
|
505 |
+
//sorting data...
|
506 |
+
var data = wdi_front.feedSort(currentFeed, load_more_number);
|
507 |
+
}
|
508 |
|
509 |
|
510 |
+
//becomes true when user clicks in frontend filter
|
511 |
+
//if isset to true then loadmore recursion would not start
|
512 |
+
var frontendCustomFilterClicked = currentFeed.customFilterChanged;
|
513 |
|
514 |
|
515 |
+
// if custom filter changed then display custom data
|
516 |
+
if (currentFeed.customFilterChanged == true) {
|
517 |
+
var data = currentFeed.customFilteredData;
|
518 |
|
519 |
+
//parsing data for lightbox
|
520 |
+
currentFeed.parsedData = wdi_front.parseLighboxData(currentFeed, true);
|
521 |
+
}
|
522 |
|
523 |
|
524 |
+
//storing all sorted data in array for later use in user based filters
|
525 |
+
if (currentFeed.feed_row.resort_after_load_more != '1') {
|
526 |
+
// filter changes when user clicks to usernames in header
|
527 |
+
// at that point displayFeed triggers but we don't have any new data so
|
528 |
+
// we are not adding new data to our list
|
529 |
+
if (currentFeed.customFilterChanged == false) {
|
530 |
+
currentFeed.dataStorageList = currentFeed.dataStorageList.concat(data);
|
531 |
+
}
|
532 |
+
} else {
|
533 |
+
// filter changes when user clicks to usernames in header
|
534 |
+
// at that point displayFeed triggers but we don't have any new data so
|
535 |
+
// we are not adding new data to our list
|
536 |
+
if (currentFeed.customFilterChanged == false) {
|
537 |
+
currentFeed.dataStorageList = data;
|
538 |
+
}
|
539 |
+
}
|
540 |
|
541 |
+
//checking feed_type and calling proper rendering functions
|
542 |
+
if (currentFeed.feed_row.feed_type == 'masonry') {
|
543 |
+
wdi_front.masonryDisplayFeedItems(data, currentFeed);
|
544 |
+
}
|
545 |
+
if (currentFeed.feed_row.feed_type == 'thumbnails' || currentFeed.feed_row.feed_type == 'blog_style' || currentFeed.feed_row.feed_type == 'image_browser') {
|
546 |
+
wdi_front.displayFeedItems(data, currentFeed);
|
547 |
+
}
|
548 |
|
549 |
|
550 |
+
//recursively calling load more to get photos
|
551 |
+
var dataLength = wdi_front.getDataLength(currentFeed);
|
552 |
|
553 |
|
554 |
+
if (dataLength < currentFeed.photoCounter && !frontendCustomFilterClicked && currentFeed.instagramRequestCounter <= currentFeed.maxConditionalFiltersRequestCount && !wdi_front.allDataHasFinished(currentFeed)) {
|
555 |
+
wdi_front.loadMore('', currentFeed);
|
556 |
|
557 |
+
} else {
|
558 |
+
wdi_front.allImagesLoaded(currentFeed);
|
559 |
+
}
|
560 |
|
561 |
|
562 |
+
/**
|
563 |
+
* if maximum number of requests are reached then stop laoding more images and show images which are available
|
564 |
+
* @param {Number} currentFeed.instagramRequestCounter > currentFeed.maxConditionalFiltersRequestCount [description]
|
565 |
+
* @return {Boolean}
|
566 |
+
*/
|
567 |
+
if (currentFeed.instagramRequestCounter > currentFeed.maxConditionalFiltersRequestCount) {
|
568 |
+
wdi_front.allImagesLoaded(currentFeed);
|
569 |
|
570 |
+
//if no data was received then
|
571 |
+
if (data.length == 0) {
|
572 |
+
//if feed_display_view is set to infinite scroll then after reaching the limit once set this flag to false
|
573 |
+
//this will stop infinite scrolling and will not load any images even when scrolling
|
574 |
+
currentFeed.stopInfiniteScrollFlag = true;
|
575 |
+
}
|
576 |
+
}
|
577 |
|
578 |
+
//checking if display_view is pagination and we are not on the last page then enable
|
579 |
+
//last page button
|
580 |
+
if (currentFeed.feed_row.feed_display_view == 'pagination' && currentFeed.currentPage < currentFeed.paginator) {
|
581 |
+
jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter).find('#wdi_last_page').removeClass('wdi_disabled');
|
582 |
+
}
|
583 |
|
584 |
|
585 |
+
// reset instagram request counter to zero for next set of requests
|
586 |
+
currentFeed.instagramRequestCounter = 0;
|
587 |
|
588 |
+
//reset conditional filter buffer for the next bunch of requests
|
589 |
+
currentFeed.conditionalFilterBuffer = [];
|
590 |
|
591 |
+
//if there are any missing images in header then replace them with new ones if possible
|
592 |
+
wdi_front.updateUsersImages(currentFeed);
|
593 |
|
594 |
|
595 |
+
// /**
|
596 |
+
// * Enable image lazy laoding if pagination is not enabeled because pagination has option for preloading images
|
597 |
+
// * which is the opposide of lazy load
|
598 |
+
// */
|
599 |
+
// if( currentFeed.feed_row.feed_display_view != 'pagination' ){
|
600 |
+
// jQuery(function() {
|
601 |
+
// jQuery('img.wdi_img').lazyload({
|
602 |
+
// skip_invisible : false,
|
603 |
+
// threshold : 400
|
604 |
+
// });
|
605 |
+
// });
|
606 |
|
607 |
+
// }
|
608 |
|
609 |
}
|
610 |
|
615 |
*/
|
616 |
wdi_front.updateUsersImages = function (currentFeed)
|
617 |
{
|
618 |
+
var elements = jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter).find('.wdi_single_user .wdi_user_img_wrap img');
|
619 |
+
elements.each(function ()
|
620 |
+
{
|
621 |
+
if (jQuery(this).attr('src') == wdi_url.plugin_url + '../images/missing.png' || jQuery(this).attr('src') == '') {
|
622 |
+
//console.log('missing');
|
623 |
|
624 |
+
if (currentFeed.feed_row.liked_feed == 'liked') {
|
625 |
+
return;
|
626 |
+
}
|
627 |
|
628 |
|
629 |
+
for (var j = 0; j < currentFeed.usersData.length; j++) {
|
630 |
+
if (currentFeed.usersData[j]['username'] == jQuery(this).parent().parent().find('h3').text()) {
|
631 |
+
if (currentFeed.usersData[j]['data'].length != 0) {
|
632 |
+
jQuery(this).attr('src', currentFeed.usersData[j]['data'][0]['images']['thumbnail']['url']);
|
633 |
+
}
|
634 |
+
}
|
635 |
+
}
|
636 |
+
}
|
637 |
+
});
|
638 |
}
|
639 |
|
640 |
|
645 |
*/
|
646 |
wdi_front.masonryDisplayFeedItems = function (data, currentFeed)
|
647 |
{
|
648 |
+
var masonryColEnds = [];
|
649 |
+
var masonryColumns = [];
|
650 |
+
if (jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter + " .wdi_feed_wrapper").length == 0) {
|
651 |
+
//no feed in DOM, ignore
|
652 |
+
return;
|
653 |
+
}
|
654 |
+
jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' .wdi_masonry_column').each(function ()
|
655 |
+
{
|
656 |
+
|
657 |
+
//if resorte after load more is on then reset columns on every load more
|
658 |
+
if (currentFeed.feed_row.resort_after_load_more == 1) {
|
659 |
+
jQuery(this).html('');
|
660 |
+
currentFeed.imageIndex = 0;
|
661 |
+
}
|
662 |
+
|
663 |
+
//if custom filter is set or changed then reset masonry columns
|
664 |
+
if (currentFeed.customFilterChanged == true) {
|
665 |
+
jQuery(this).html('');
|
666 |
+
currentFeed.imageIndex = 0;
|
667 |
+
}
|
668 |
+
|
669 |
+
//check if pagination is enabled then each page should have resetted colEnds
|
670 |
+
//else give previous colEnds
|
671 |
+
if (currentFeed.feed_row.feed_display_view == 'pagination') {
|
672 |
+
masonryColEnds.push(0);
|
673 |
+
} else {
|
674 |
+
masonryColEnds.push(jQuery(this).height());
|
675 |
+
}
|
676 |
+
|
677 |
+
masonryColumns.push(jQuery(this));
|
678 |
+
});
|
679 |
+
|
680 |
+
//if custom filter is set or changed then reset masonry columns
|
681 |
+
if (currentFeed.customFilterChanged == true) {
|
682 |
+
currentFeed.customFilterChanged = false;
|
683 |
+
}
|
684 |
+
|
685 |
+
|
686 |
+
//loop for displaying items
|
687 |
+
for (var i = 0; i < data.length; i++) {
|
688 |
+
|
689 |
+
currentFeed.displayedData.push(data[i]);
|
690 |
+
/*carousel feature*/
|
691 |
+
if (data[i]['type'] == 'image') {
|
692 |
+
var photoTemplate = wdi_front.getPhotoTemplate(currentFeed);
|
693 |
+
} else if(data[i].hasOwnProperty('videos')) {
|
694 |
+
var photoTemplate = wdi_front.getVideoTemplate(currentFeed);
|
695 |
+
}
|
696 |
+
else{
|
697 |
+
var photoTemplate = wdi_front.getSliderTemplate(currentFeed);
|
698 |
+
}
|
699 |
+
|
700 |
+
var rawItem = data[i];
|
701 |
+
var item = wdi_front.createObject(rawItem, currentFeed);
|
702 |
+
var html = photoTemplate(item);
|
703 |
+
|
704 |
+
//find column with minumum height and append to it new object
|
705 |
+
var shortCol = wdi_front.array_min(masonryColEnds);
|
706 |
+
var imageResolution = wdi_front.getImageResolution(data[i]);
|
707 |
+
|
708 |
+
masonryColumns[shortCol['index']].html(masonryColumns[shortCol['index']].html() + html);
|
709 |
+
masonryColEnds[shortCol['index']] += masonryColumns[shortCol['index']].width() * imageResolution;
|
710 |
+
currentFeed.imageIndex++;
|
711 |
+
|
712 |
+
|
713 |
+
//changing responsive indexes for pagination
|
714 |
+
if (currentFeed.feed_row.feed_display_view == 'pagination') {
|
715 |
+
if ((i + 1) % currentFeed.feed_row.pagination_per_page_number === 0) {
|
716 |
+
currentFeed.resIndex += currentFeed.freeSpaces + 1;
|
717 |
+
} else {
|
718 |
+
currentFeed.resIndex++;
|
719 |
+
}
|
720 |
+
}
|
721 |
+
}
|
722 |
+
|
723 |
+
|
724 |
+
//binding onload event for ajax loader
|
725 |
+
currentFeed.wdi_loadedImages = 0;
|
726 |
+
var columnFlag = false;
|
727 |
+
currentFeed.wdi_load_count = i;
|
728 |
+
var wdi_feed_counter = currentFeed.feed_row['wdi_feed_counter'];
|
729 |
+
var feed_wrapper = jQuery('#wdi_feed_' + wdi_feed_counter + ' img.wdi_img').on('load', function ()
|
730 |
+
{
|
731 |
+
currentFeed.wdi_loadedImages++;
|
732 |
+
checkLoaded();
|
733 |
+
|
734 |
+
//calls wdi_responsive.columnControl() which calculates column number on page
|
735 |
+
//and gives feed_wrapper proper column class
|
736 |
+
if (columnFlag === false) {
|
737 |
+
wdi_responsive.columnControl(currentFeed, 1);
|
738 |
+
columnFlag = true;
|
739 |
+
}
|
740 |
+
|
741 |
+
//Binds caption opening and closing event to each image photo_title/mmmmmm
|
742 |
+
// if (currentFeed.feed_row.feed_type != 'blog_style') {
|
743 |
+
// wdi_responsive.bindMasonryCaptionEvent(jQuery(this).parent().parent().parent().parent().find('.wdi_photo_title'), currentFeed);
|
744 |
+
// }
|
745 |
+
|
746 |
+
});
|
747 |
+
|
748 |
+
|
749 |
+
/**
|
750 |
+
* if feed type is not blog style then after displaying images assign click evetns to their captions
|
751 |
+
* this part of code is a bit differenet from free version because of image lazy loading feature
|
752 |
+
*
|
753 |
+
* in free version events are assigned directly in onload event, but when lazy loading added it cased duplicate event fireing
|
754 |
+
* so event assigning moved to here
|
755 |
+
*
|
756 |
+
*/
|
757 |
+
// if ( currentFeed.feed_row.feed_type != 'blog_style' ){
|
758 |
+
// jQuery('#wdi_feed_'+currentFeed.feed_row.wdi_feed_counter+' .wdi_photo_title').each(function(){
|
759 |
+
// wdi_responsive.bindMasonryCaptionEvent(jQuery(this),currentFeed);
|
760 |
+
// });
|
761 |
+
// }
|
762 |
+
|
763 |
+
|
764 |
+
//checks if all iamges have been succesfully loaded then it updates variables for next time use
|
765 |
+
function checkLoaded()
|
766 |
+
{
|
767 |
+
|
768 |
+
if (currentFeed.wdi_load_count === currentFeed.wdi_loadedImages && currentFeed.wdi_loadedImages != 0) {
|
769 |
+
currentFeed.loadedImages = 0;
|
770 |
+
currentFeed.wdi_load_count = 0;
|
771 |
+
wdi_front.allImagesLoaded(currentFeed);
|
772 |
+
|
773 |
+
}
|
774 |
+
}
|
775 |
|
776 |
+
//checking if pagination next button was clicked then change page
|
777 |
+
if (currentFeed.paginatorNextFlag == true) {
|
778 |
+
wdi_front.updatePagination(currentFeed, 'next');
|
779 |
+
}
|
780 |
+
|
781 |
+
//check if load more done successfully then set infinite scroll flag to false
|
782 |
+
currentFeed.infiniteScrollFlag = false;
|
783 |
|
784 |
|
785 |
}
|
791 |
wdi_front.getImageResolution = function (data)
|
792 |
{
|
793 |
|
794 |
+
var originalWidth = data['images']['standard_resolution']['width'];
|
795 |
+
var originalHeight = data['images']['standard_resolution']['height'];
|
796 |
+
var resolution = originalHeight / originalWidth;
|
797 |
+
return resolution;
|
798 |
}
|
799 |
|
800 |
/*
|
804 |
wdi_front.getDataLength = function (currentFeed, customStorage)
|
805 |
{
|
806 |
|
807 |
+
var length = 0;
|
808 |
+
if (typeof customStorage === 'undefined') {
|
809 |
+
for (var j = 0; j < currentFeed.dataStorage.length; j++) {
|
810 |
+
length += currentFeed.dataStorage[j].length;
|
811 |
+
}
|
812 |
+
} else {
|
813 |
+
for (var j = 0; j < customStorage.length; j++) {
|
814 |
+
length += customStorage[j].length;
|
815 |
+
}
|
816 |
+
}
|
817 |
|
818 |
+
return length;
|
819 |
}
|
820 |
|
821 |
wdi_front.getArrayContentLength = function (array, data)
|
822 |
{
|
823 |
+
var sum = 0;
|
824 |
+
for (var i = 0; i < array.length; i++) {
|
825 |
+
if (array[i]['finished'] == 'finished') {
|
826 |
+
continue;
|
827 |
+
}
|
828 |
+
sum += array[i][data].length;
|
829 |
+
}
|
830 |
+
return sum;
|
831 |
}
|
832 |
|
833 |
|
838 |
*/
|
839 |
wdi_front.displayFeedItems = function (data, currentFeed)
|
840 |
{
|
841 |
+
if (jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter + " .wdi_feed_wrapper").length == 0) {
|
842 |
+
//no feed in DOM, ignore
|
843 |
+
return;
|
844 |
+
}
|
845 |
|
846 |
+
//gets ready data, gets data template, and appens it into feed_wrapper
|
847 |
+
var wdi_feed_counter = currentFeed.feed_row['wdi_feed_counter'];
|
848 |
+
var feed_wrapper = jQuery('#wdi_feed_' + wdi_feed_counter + ' .wdi_feed_wrapper');
|
|
|
|
|
|
|
|
|
|
|
|
|
849 |
|
850 |
+
//if resort_after_pagination is on then rewrite feed data
|
851 |
+
if (currentFeed.feed_row['resort_after_load_more'] === '1') {
|
852 |
+
feed_wrapper.html('');
|
853 |
+
currentFeed.imageIndex = 0;
|
854 |
+
}
|
855 |
+
|
856 |
+
//if custom filter is set or changed then reset masonry columns
|
857 |
+
if (currentFeed.customFilterChanged == true) {
|
858 |
+
feed_wrapper.html('');
|
859 |
+
currentFeed.imageIndex = 0;
|
860 |
+
currentFeed.customFilterChanged = false;
|
861 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
862 |
|
863 |
|
864 |
+
var lastIndex = wdi_front.getImgCount(currentFeed) - data.length - 1;
|
865 |
+
|
866 |
+
/**
|
867 |
+
* if feed display view is set to pagination then check if the current page has not enough photos to be a complete page then
|
868 |
+
* --currentPage so that after loading new images we stay on the same page and see new images which will be located in that page
|
869 |
+
* also do the same thing when recievied data has lenght equal to zero
|
870 |
+
*/
|
871 |
+
if (currentFeed.feed_row.feed_display_view == 'pagination') {
|
872 |
+
if (jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter + ' [wdi_page="' + (currentFeed.currentPage - 1) + '"]').length < currentFeed.feed_row.load_more_number || data.length == 0) {
|
873 |
+
currentFeed.currentPage = (--currentFeed.currentPage <= 1) ? 1 : currentFeed.currentPage;
|
874 |
+
}
|
875 |
+
}
|
876 |
+
|
877 |
+
|
878 |
+
for (var i = 0; i < data.length; i++) {
|
879 |
+
|
880 |
+
if (data[i]['type'] == 'image') {
|
881 |
+
var photoTemplate = wdi_front.getPhotoTemplate(currentFeed);
|
882 |
+
} else if(data[i].hasOwnProperty('videos')) {
|
883 |
+
var photoTemplate = wdi_front.getVideoTemplate(currentFeed);
|
884 |
+
}
|
885 |
+
else{
|
886 |
+
var photoTemplate = wdi_front.getSliderTemplate(currentFeed);
|
887 |
+
}
|
888 |
|
889 |
+
var rawItem = data[i];
|
890 |
+
var item = wdi_front.createObject(rawItem, currentFeed);
|
891 |
+
var html = photoTemplate(item);
|
892 |
+
feed_wrapper.html(feed_wrapper.html() + html);
|
893 |
|
894 |
+
currentFeed.imageIndex++;
|
895 |
|
896 |
|
897 |
+
//changing responsive indexes for pagination
|
898 |
+
if (currentFeed.feed_row.feed_display_view == 'pagination') {
|
899 |
+
if ((i + 1) % currentFeed.feed_row.pagination_per_page_number === 0) {
|
900 |
+
currentFeed.resIndex += currentFeed.freeSpaces + 1;
|
901 |
+
} else {
|
902 |
+
currentFeed.resIndex++;
|
903 |
+
}
|
904 |
|
905 |
+
}
|
906 |
|
907 |
+
}
|
908 |
|
909 |
|
910 |
+
//fixing last row in case of full caption is open
|
911 |
+
//for that triggering click twice to open and close caption text that will fix last row
|
912 |
+
/*ttt 1.1.12*/
|
913 |
+
//jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' .wdi_feed_wrapper [wdi_index=' + lastIndex + '] .wdi_photo_title').trigger(wdi_front.clickOrTouch);
|
914 |
+
//jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' .wdi_feed_wrapper [wdi_index=' + lastIndex + '] .wdi_photo_title').trigger(wdi_front.clickOrTouch);
|
915 |
|
916 |
|
917 |
+
//binding onload event for ajax loader
|
918 |
+
currentFeed.wdi_loadedImages = 0;
|
919 |
+
var columnFlag = false;
|
920 |
+
currentFeed.wdi_load_count = i;
|
921 |
+
var wdi_feed_counter = currentFeed.feed_row['wdi_feed_counter'];
|
922 |
+
var feed_wrapper = jQuery('#wdi_feed_' + wdi_feed_counter + ' img.wdi_img').on('load', function ()
|
923 |
+
{
|
924 |
+
currentFeed.wdi_loadedImages++;
|
925 |
+
checkLoaded();
|
926 |
|
927 |
+
//calls wdi_responsive.columnControl() which calculates column number on page
|
928 |
+
//and gives feed_wrapper proper column class
|
929 |
+
if (columnFlag === false) {
|
930 |
|
931 |
|
932 |
+
wdi_responsive.columnControl(currentFeed, 1);
|
933 |
+
columnFlag = true;
|
934 |
+
}
|
935 |
|
936 |
|
937 |
+
// //Binds caption opening and closing event to each image photo_title/mmmmmm
|
938 |
+
// if (currentFeed.feed_row.feed_type != 'blog_style') {
|
939 |
+
// wdi_responsive.bindCaptionEvent(jQuery(this).parent().parent().parent().parent().find('.wdi_photo_title'), currentFeed);
|
940 |
+
// }
|
941 |
+
});
|
942 |
|
943 |
|
944 |
+
/**
|
945 |
+
* if feed type is not blog style then after displaying images assign click evetns to their captions
|
946 |
+
* this part of code is a bit differenet from free version because of image lazy loading feature
|
947 |
+
*
|
948 |
+
* in free version events are assigned directly in onload event, but when lazy loading added it cased duplicate event fireing
|
949 |
+
* so event assigning moved to here
|
950 |
+
*
|
951 |
+
*/
|
952 |
+
// if ( currentFeed.feed_row.feed_type != 'blog_style' ){
|
953 |
+
// jQuery('#wdi_feed_'+currentFeed.feed_row.wdi_feed_counter+' .wdi_photo_title').each(function(){
|
954 |
+
// wdi_responsive.bindCaptionEvent(jQuery(this),currentFeed);
|
955 |
+
// });
|
956 |
|
957 |
+
// }
|
958 |
|
959 |
|
960 |
+
//checks if all iamges have been succesfully loaded then it updates variables for next time use
|
961 |
+
function checkLoaded()
|
962 |
+
{
|
963 |
+
if (currentFeed.wdi_load_count === currentFeed.wdi_loadedImages && currentFeed.wdi_loadedImages != 0) {
|
964 |
+
currentFeed.loadedImages = 0;
|
965 |
+
currentFeed.wdi_load_count = 0;
|
966 |
+
wdi_front.allImagesLoaded(currentFeed);
|
967 |
|
968 |
+
}
|
969 |
+
}
|
970 |
|
971 |
+
//checking if pagination next button was clicked then change page
|
972 |
+
if (currentFeed.paginatorNextFlag == true) {
|
973 |
+
wdi_front.updatePagination(currentFeed, 'next');
|
974 |
+
}
|
975 |
|
976 |
+
//check if load more done successfully then set infinite scroll flag to false
|
977 |
+
currentFeed.infiniteScrollFlag = false;
|
978 |
|
979 |
}
|
980 |
|
981 |
wdi_front.checkFeedFinished = function (currentFeed)
|
982 |
{
|
983 |
+
for (var i = 0; i < currentFeed.usersData.length; i++) {
|
984 |
+
if (typeof currentFeed.usersData[i]['finished'] == 'undefined') {
|
985 |
+
return false;
|
986 |
+
}
|
987 |
+
}
|
988 |
+
return true;
|
989 |
}
|
990 |
|
991 |
wdi_front.sortingOperator = function (sortImagesBy, sortOrder)
|
992 |
{
|
993 |
+
var operator;
|
994 |
+
switch (sortImagesBy) {
|
995 |
+
case 'date':
|
996 |
+
{
|
997 |
+
switch (sortOrder) {
|
998 |
+
case 'asc':
|
999 |
+
{
|
1000 |
+
operator = function (a, b)
|
1001 |
+
{
|
1002 |
+
return (a['created_time'] > b['created_time']) ? 1 : -1;
|
1003 |
+
}
|
1004 |
+
break;
|
1005 |
+
}
|
1006 |
+
case 'desc':
|
1007 |
+
{
|
1008 |
+
operator = function (a, b)
|
1009 |
+
{
|
1010 |
+
return (a['created_time'] > b['created_time']) ? -1 : 1;
|
1011 |
+
}
|
1012 |
+
break;
|
1013 |
+
}
|
1014 |
+
}
|
1015 |
+
break;
|
1016 |
+
}
|
1017 |
+
case 'likes':
|
1018 |
+
{
|
1019 |
+
switch (sortOrder) {
|
1020 |
+
case 'asc':
|
1021 |
+
{
|
1022 |
+
operator = function (a, b)
|
1023 |
+
{
|
1024 |
+
return (a['likes']['count'] < b['likes']['count']) ? -1 : 1;
|
1025 |
+
}
|
1026 |
+
break;
|
1027 |
+
}
|
1028 |
+
case 'desc':
|
1029 |
+
{
|
1030 |
+
operator = function (a, b)
|
1031 |
+
{
|
1032 |
+
return (a['likes']['count'] < b['likes']['count']) ? 1 : -1;
|
1033 |
+
}
|
1034 |
+
break;
|
1035 |
+
}
|
1036 |
+
}
|
1037 |
+
break;
|
1038 |
+
}
|
1039 |
+
case 'comments':
|
1040 |
+
{
|
1041 |
+
switch (sortOrder) {
|
1042 |
+
case 'asc':
|
1043 |
+
{
|
1044 |
+
operator = function (a, b)
|
1045 |
+
{
|
1046 |
+
return (a['comments']['count'] < b['comments']['count']) ? -1 : 1;
|
1047 |
+
}
|
1048 |
+
break;
|
1049 |
+
}
|
1050 |
+
case 'desc':
|
1051 |
+
{
|
1052 |
+
operator = function (a, b)
|
1053 |
+
{
|
1054 |
+
return (a['comments']['count'] < b['comments']['count']) ? 1 : -1;
|
1055 |
+
}
|
1056 |
+
break;
|
1057 |
+
}
|
1058 |
+
}
|
1059 |
+
break;
|
1060 |
+
}
|
1061 |
+
case 'random':
|
1062 |
+
{
|
1063 |
+
operator = function (a, b)
|
1064 |
+
{
|
1065 |
+
var num = Math.random();
|
1066 |
+
return (num > 0.5) ? 1 : -1;
|
1067 |
+
}
|
1068 |
+
break;
|
1069 |
+
}
|
1070 |
+
}
|
1071 |
+
return operator;
|
1072 |
}
|
1073 |
|
1074 |
/*
|
1077 |
wdi_front.feedSort = function (currentFeed, load_more_number)
|
1078 |
{
|
1079 |
|
1080 |
+
var sortImagesBy = currentFeed.feed_row['sort_images_by'];
|
1081 |
+
var sortOrder = currentFeed.feed_row['display_order'];
|
1082 |
|
1083 |
+
if (currentFeed.feed_row['resort_after_load_more'] === '1') {
|
1084 |
+
currentFeed['data'] = currentFeed['data'].concat(wdi_front.smartPicker(currentFeed, load_more_number));
|
1085 |
+
} else {
|
1086 |
+
currentFeed['data'] = wdi_front.smartPicker(currentFeed, load_more_number);
|
1087 |
+
}
|
1088 |
|
1089 |
|
1090 |
+
var operator = wdi_front.sortingOperator(sortImagesBy, sortOrder);
|
1091 |
+
currentFeed['data'].sort(operator);
|
1092 |
+
return currentFeed['data'];
|
1093 |
|
1094 |
}
|
1095 |
|
1100 |
wdi_front.smartPicker = function (currentFeed, load_more_number)
|
1101 |
{
|
1102 |
|
1103 |
+
var dataStorage = [];
|
1104 |
+
var dataLength = 0;
|
1105 |
+
var readyData = [];
|
1106 |
+
var perUser = Math.ceil(currentFeed['feed_row']['number_of_photos'] / currentFeed['usersData'].length);
|
1107 |
+
var number_of_photos = parseInt(currentFeed['feed_row']['number_of_photos']);
|
1108 |
+
var remainder = 0;
|
1109 |
|
1110 |
+
//check if loadmore was clicked
|
1111 |
+
if (load_more_number != '' && typeof load_more_number != 'undefined' && load_more_number != null) {
|
1112 |
+
number_of_photos = parseInt(load_more_number);
|
1113 |
+
perUser = Math.ceil(number_of_photos / wdi_front.activeUsersCount(currentFeed));
|
1114 |
+
}
|
1115 |
|
1116 |
|
1117 |
+
var sortOperator = function (a, b)
|
1118 |
+
{
|
1119 |
+
return (a['data'].length > b['data'].length) ? 1 : -1;
|
1120 |
+
}
|
1121 |
|
1122 |
+
var sortOperator1 = function (a, b)
|
1123 |
+
{
|
1124 |
+
return (a.length() > b.length()) ? 1 : -1;
|
1125 |
+
}
|
1126 |
|
1127 |
|
1128 |
+
// storing user data in global dataStoreageRaw variable
|
1129 |
+
currentFeed.storeRawData(currentFeed.usersData, 'dataStorageRaw');
|
1130 |
|
1131 |
+
//dataStorageRaw
|
1132 |
+
var dataStorageRaw = currentFeed['dataStorageRaw'].sort(sortOperator1);
|
1133 |
|
1134 |
+
//sorts user data desc
|
1135 |
+
var usersData = currentFeed['usersData'].sort(sortOperator);
|
1136 |
|
1137 |
|
1138 |
+
//picks data from users and updates pagination in request json
|
1139 |
+
//for next time call
|
1140 |
+
for (var i = 0; i < usersData.length; i++) {
|
1141 |
|
1142 |
+
remainder += perUser;
|
1143 |
|
1144 |
+
/* if data is less then amount for each user then pick all data */
|
1145 |
+
if (dataStorageRaw[i].length() <= remainder) {
|
1146 |
|
1147 |
+
/* update remainder */
|
1148 |
+
remainder -= dataStorageRaw[i].length();
|
1149 |
|
1150 |
+
/* get and store data */
|
1151 |
+
dataStorage.push(dataStorageRaw[i].getData(dataStorageRaw[i].length()));
|
1152 |
+
/* update data length */
|
1153 |
+
dataLength += dataStorage[dataStorage.length - 1].length;
|
1154 |
|
1155 |
|
1156 |
+
} else {
|
1157 |
+
if (dataLength + remainder > number_of_photos) {
|
1158 |
+
remainder = number_of_photos - dataLength;
|
1159 |
+
}
|
1160 |
|
1161 |
+
var pickedData = [];
|
1162 |
|
1163 |
|
1164 |
+
if (currentFeed['auto_trigger'] === false) {
|
1165 |
+
pickedData = pickedData.concat(dataStorageRaw[i].getData(remainder));
|
1166 |
+
} else {
|
1167 |
+
if (pickedData.length + wdi_front.getDataLength(currentFeed) + wdi_front.getDataLength(currentFeed, dataStorage) < currentFeed['feed_row']['number_of_photos']) {
|
1168 |
+
pickedData = pickedData.concat(dataStorageRaw[i].getData(remainder));
|
1169 |
+
}
|
1170 |
+
}
|
1171 |
|
1172 |
+
remainder = 0;
|
1173 |
|
1174 |
+
dataLength += pickedData.length;
|
1175 |
+
dataStorage.push(pickedData);
|
1176 |
|
1177 |
|
1178 |
+
}
|
1179 |
|
1180 |
|
1181 |
+
/*if (usersData[i]['data'].length <= remainder) {
|
1182 |
|
1183 |
+
var pagination = usersData[i]['pagination']['next_url'];
|
1184 |
+
if (usersData[i]['finished'] === undefined) {
|
1185 |
+
dataStorage.push(usersData[i]['data']);
|
1186 |
+
remainder -= usersData[i]['data'].length;
|
1187 |
+
dataLength += usersData[i]['data'].length;
|
1188 |
+
}
|
1189 |
|
1190 |
+
if (usersData[i]['finished'] === undefined) {
|
1191 |
+
if (pagination === undefined || pagination === '' || pagination === null) {
|
1192 |
+
usersData[i]['finished'] = 'finished';
|
1193 |
+
}
|
1194 |
+
}
|
1195 |
+
} else {
|
1196 |
+
if ((dataLength + remainder) > number_of_photos) {
|
1197 |
+
remainder = number_of_photos - dataLength;
|
1198 |
+
}
|
1199 |
+
var pickedData = [];
|
1200 |
+
var indexPuller = 0;
|
1201 |
+
for (var j = 0; j < remainder; j++) {
|
1202 |
+
if (currentFeed['auto_trigger'] === false) {
|
1203 |
+
if (usersData[i]['finished'] === undefined) {
|
1204 |
+
pickedData.push(usersData[i]['data'][j]);
|
1205 |
+
}
|
1206 |
+
} else {
|
1207 |
+
if (pickedData.length + wdi_front.getDataLength(currentFeed) + wdi_front.getDataLength(currentFeed, dataStorage) < currentFeed['feed_row']['number_of_photos']) {
|
1208 |
+
if (usersData[i]['finished'] === undefined) {
|
1209 |
+
pickedData.push(usersData[i]['data'][j]);
|
1210 |
+
}
|
1211 |
+
} else {
|
1212 |
+
indexPuller++;
|
1213 |
+
}
|
1214 |
+
}
|
1215 |
|
1216 |
+
}
|
1217 |
+
j -= indexPuller;
|
1218 |
|
1219 |
+
remainder = 0;
|
1220 |
|
1221 |
|
1222 |
|
1223 |
+
//updating pagination
|
1224 |
|
1225 |
|
1226 |
|
1227 |
+
//pushes picked data into local storage
|
1228 |
+
dataLength += pickedData.length;
|
1229 |
+
dataStorage.push(pickedData);
|
1230 |
|
1231 |
+
}*/
|
1232 |
+
}
|
1233 |
+
//checks if in golbal storage user already exisit then it adds new data to user old data
|
1234 |
+
//else it simple puches new user with it's data to global storage
|
1235 |
+
for (i = 0; i < dataStorage.length; i++) {
|
1236 |
+
if (typeof currentFeed.dataStorage[i] === 'undefined') {
|
1237 |
+
currentFeed.dataStorage.push(dataStorage[i]);
|
1238 |
+
} else {
|
1239 |
+
currentFeed.dataStorage[i] = currentFeed.dataStorage[i].concat(dataStorage[i]);
|
1240 |
+
}
|
1241 |
+
}
|
1242 |
|
1243 |
+
//parsing data for lightbox
|
1244 |
+
currentFeed.parsedData = wdi_front.parseLighboxData(currentFeed);
|
1245 |
|
1246 |
+
//combines together all avialable data in global storage and returns it
|
1247 |
+
for (i = 0; i < dataStorage.length; i++) {
|
1248 |
+
readyData = readyData.concat(dataStorage[i]);
|
1249 |
+
}
|
1250 |
|
1251 |
+
return readyData;
|
1252 |
}
|
1253 |
|
1254 |
/*
|
1257 |
wdi_front.createObject = function (obj, currentFeed)
|
1258 |
{
|
1259 |
|
1260 |
+
var caption = (obj['caption'] != null) ? obj['caption']['text'] : ' ';
|
1261 |
+
|
1262 |
+
var image_url = '';
|
1263 |
+
var videoUrl = '';
|
1264 |
+
|
1265 |
+
if (window.innerWidth >= currentFeed.feed_row.mobile_breakpoint) {
|
1266 |
+
image_url = obj['images']['standard_resolution']['url'];
|
1267 |
+
if (currentFeed.feed_row.feed_type == 'blog_style' || currentFeed.feed_row.feed_type == 'image_browser') {
|
1268 |
+
image_url = obj['link'] + 'media?size=l';
|
1269 |
+
}
|
1270 |
+
if (obj['type'] == 'video') {
|
1271 |
+
/*if pure video, not carousel*/
|
1272 |
+
videoUrl = obj.hasOwnProperty('videos') ? obj['videos']['standard_resolution']['url'] : '';
|
1273 |
+
}
|
1274 |
+
}
|
1275 |
+
if (window.innerWidth >= currentFeed.feed_row.mobile_breakpoint / 4 && window.innerWidth < currentFeed.feed_row.mobile_breakpoint) {
|
1276 |
+
image_url = obj['images']['low_resolution']['url'];
|
1277 |
+
if (currentFeed.feed_row.feed_type == 'blog_style' || currentFeed.feed_row.feed_type == 'image_browser') {
|
1278 |
+
image_url = obj['link'] + 'media?size=l';
|
1279 |
+
}
|
1280 |
+
if (obj['type'] == 'video') {
|
1281 |
+
/*if pure video, not carousel*/
|
1282 |
+
videoUrl = obj.hasOwnProperty('videos') ? obj['videos']['low_bandwidth']['url'] : '';
|
1283 |
+
}
|
1284 |
+
}
|
1285 |
+
if (window.innerWidth < currentFeed.feed_row.mobile_breakpoint / 4) {
|
1286 |
+
image_url = obj['images']['thumbnail']['url'];
|
1287 |
+
if (currentFeed.feed_row.feed_type == 'blog_style' || currentFeed.feed_row.feed_type == 'image_browser') {
|
1288 |
+
image_url = obj['link'] + 'media?size=m';
|
1289 |
+
}
|
1290 |
+
if (obj['type'] == 'video') {
|
1291 |
+
/*if pure video, not carousel*/
|
1292 |
+
videoUrl = obj.hasOwnProperty('videos') ? obj['videos']['low_resolution']['url'] : '';
|
1293 |
+
}
|
1294 |
+
}
|
1295 |
+
|
1296 |
+
|
1297 |
+
var imageIndex = currentFeed.imageIndex;
|
1298 |
+
|
1299 |
+
var photoObject = {
|
1300 |
+
'id': obj['id'],
|
1301 |
+
'caption': caption,
|
1302 |
+
'image_url': image_url,
|
1303 |
+
'likes': obj['likes']['count'],
|
1304 |
+
'comments': obj['comments']['count'],
|
1305 |
+
'wdi_index': imageIndex,
|
1306 |
+
'wdi_res_index': currentFeed.resIndex,
|
1307 |
+
'wdi_media_user': obj['user']['username'],
|
1308 |
+
'link': obj['link'],
|
1309 |
+
'video_url': videoUrl,
|
1310 |
+
'wdi_username': obj['user']['username']
|
1311 |
+
};
|
1312 |
+
return photoObject;
|
1313 |
}
|
1314 |
|
1315 |
/*
|
1317 |
*/
|
1318 |
wdi_front.setPage = function (currentFeed)
|
1319 |
{
|
1320 |
+
var display_type = currentFeed.feed_row.feed_display_view;
|
1321 |
+
var feed_type = currentFeed.feed_row.feed_type;
|
1322 |
+
if (display_type != 'pagination') {
|
1323 |
+
return '';
|
1324 |
+
}
|
1325 |
+
var imageIndex = currentFeed.imageIndex;
|
1326 |
+
if (feed_type == 'image_browser') {
|
1327 |
+
var divider = 1;
|
1328 |
+
} else {
|
1329 |
+
var divider = Math.abs(currentFeed.feed_row.pagination_per_page_number);
|
1330 |
+
}
|
1331 |
|
1332 |
+
currentFeed.paginator = Math.ceil((imageIndex + 1) / divider);
|
1333 |
|
1334 |
|
1335 |
+
return currentFeed.paginator;
|
1336 |
}
|
1337 |
|
1338 |
/*
|
1340 |
*/
|
1341 |
wdi_front.getPhotoTemplate = function (currentFeed)
|
1342 |
{
|
1343 |
+
var page = wdi_front.setPage(currentFeed);
|
1344 |
+
var customClass = '';
|
1345 |
+
var pagination = '';
|
1346 |
+
var onclick = '';
|
1347 |
+
var overlayCustomClass = '';
|
1348 |
+
var thumbClass = 'fa-arrows-alt';
|
1349 |
+
var showUsernameOnThumb = '';
|
1350 |
+
if (currentFeed.feed_row.feed_type == 'blog_style' || currentFeed.feed_row.feed_type == 'image_browser') {
|
1351 |
+
thumbClass = '';
|
1352 |
+
}
|
1353 |
+
if (page != '') {
|
1354 |
+
pagination = 'wdi_page="' + page + '"';
|
1355 |
+
sourceAttr = 'src';
|
1356 |
+
} else {
|
1357 |
+
sourceAttr = 'src';
|
1358 |
+
}
|
1359 |
+
|
1360 |
+
if (page != '' && page != 1) {
|
1361 |
+
customClass = 'wdi_hidden';
|
1362 |
+
}
|
1363 |
+
|
1364 |
+
|
1365 |
+
if (currentFeed.feed_row.show_username_on_thumb == '1') {
|
1366 |
+
showUsernameOnThumb = '<span class="wdi_media_user">@<%= wdi_username%></span>';
|
1367 |
+
}
|
1368 |
+
|
1369 |
+
//checking if caption is opend by default then add wdi_full_caption class
|
1370 |
+
//only in masonry
|
1371 |
+
if (currentFeed.feed_row.show_full_description == 1 && currentFeed.feed_row.feed_type == 'masonry') {
|
1372 |
+
customClass += ' wdi_full_caption';
|
1373 |
+
}
|
1374 |
+
|
1375 |
+
var onclickevent = "";
|
1376 |
+
if (currentFeed.feed_row.feed_type !== "blog_style") {
|
1377 |
+
if (currentFeed.feed_row.feed_type == 'masonry') {
|
1378 |
+
onclickevent = "wdi_responsive.showMasonryCaption(jQuery(this)," + currentFeed.feed_row.wdi_feed_counter + ");"
|
1379 |
+
} else {
|
1380 |
+
onclickevent = "wdi_responsive.showCaption(jQuery(this)," + currentFeed.feed_row.wdi_feed_counter + ");";
|
1381 |
+
}
|
1382 |
+
|
1383 |
+
}
|
1384 |
+
|
1385 |
+
|
1386 |
+
//creating onclick string for different options
|
1387 |
+
switch (currentFeed.feed_row.feed_item_onclick) {
|
1388 |
+
case 'lightbox':
|
1389 |
+
{
|
1390 |
+
onclick = "onclick=wdi_feed_" + currentFeed.feed_row.wdi_feed_counter + ".galleryBox('<%=id%>')";
|
1391 |
+
break;
|
1392 |
+
}
|
1393 |
+
case 'instagram':
|
1394 |
+
{
|
1395 |
+
onclick = 'onclick="window.open (\'<%= link%>\',\'_blank\')"';
|
1396 |
+
overlayCustomClass = 'wdi_hover_off';
|
1397 |
+
thumbClass = '';
|
1398 |
+
break;
|
1399 |
+
}
|
1400 |
+
case 'none':
|
1401 |
+
{
|
1402 |
+
onclick = '';
|
1403 |
+
overlayCustomClass = 'wdi_cursor_off wdi_hover_off';
|
1404 |
+
thumbClass = '';
|
1405 |
+
}
|
1406 |
+
}
|
1407 |
+
var wdi_feed_counter = currentFeed.feed_row['wdi_feed_counter'];
|
1408 |
+
var source = '<div class="wdi_feed_item ' + customClass + '" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> ' + pagination + ' wdi_type="image" id="wdi_' + wdi_feed_counter + '_<%=id%>">' +
|
1409 |
+
'<div class="wdi_photo_wrap">' +
|
1410 |
+
'<div class="wdi_photo_wrap_inner">' +
|
1411 |
+
'<div class="wdi_photo_img">' +
|
1412 |
+
'<img class="wdi_img" ' + sourceAttr + '="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);">' +
|
1413 |
+
'<div class="wdi_photo_overlay ' + overlayCustomClass + '" >' + showUsernameOnThumb +
|
1414 |
+
'<div class="wdi_thumb_icon" ' + onclick + ' style="display:table;width:100%;height:100%;">' +
|
1415 |
+
'<div style="display:table-cell;vertical-align:middle;text-align:center;color:white;">' +
|
1416 |
+
'<i class="fa ' + thumbClass + '"></i>' +
|
1417 |
+
'</div>' +
|
1418 |
+
'</div>' +
|
1419 |
+
'</div>' +
|
1420 |
+
'</div>' +
|
1421 |
+
'</div>' +
|
1422 |
+
'</div>';
|
1423 |
+
if (currentFeed['feed_row']['show_likes'] === '1' || currentFeed['feed_row']['show_comments'] === '1' || currentFeed['feed_row']['show_description'] === '1') {
|
1424 |
+
source += '<div class="wdi_photo_meta">';
|
1425 |
+
if (currentFeed['feed_row']['show_likes'] === '1') {
|
1426 |
+
source += '<div class="wdi_thumb_likes"><i class="fa fa-heart-o"> <%= likes%></i></div>';
|
1427 |
+
}
|
1428 |
+
if (currentFeed['feed_row']['show_comments'] === '1') {
|
1429 |
+
source += '<div class="wdi_thumb_comments"><i class="fa fa-comment-o"> <%= comments%></i></div>';
|
1430 |
+
}
|
1431 |
+
source += '<div class="wdi_clear"></div>';
|
1432 |
+
if (currentFeed['feed_row']['show_description'] === '1') {
|
1433 |
+
source += '<div class="wdi_photo_title" onclick=' + onclickevent + ' >' +
|
1434 |
+
'<%=caption%>' +
|
1435 |
+
'</div>';
|
1436 |
+
}
|
1437 |
+
source += '</div>';
|
1438 |
+
}
|
1439 |
+
|
1440 |
+
source += '</div>';
|
1441 |
+
var template = _.template(source);
|
1442 |
+
return template;
|
1443 |
+
}
|
1444 |
+
|
1445 |
+
|
1446 |
+
/*
|
1447 |
+
* Template for all feed items which have type=image
|
1448 |
+
*/
|
1449 |
+
wdi_front.getSliderTemplate = function (currentFeed)
|
1450 |
+
{
|
1451 |
+
var page = wdi_front.setPage(currentFeed);
|
1452 |
+
var customClass = '';
|
1453 |
+
var pagination = '';
|
1454 |
+
var onclick = '';
|
1455 |
+
var overlayCustomClass = '';
|
1456 |
+
var thumbClass = 'fa-clone';
|
1457 |
+
var showUsernameOnThumb = '';
|
1458 |
+
if (currentFeed.feed_row.feed_type == 'blog_style' || currentFeed.feed_row.feed_type == 'image_browser') {
|
1459 |
+
thumbClass = '';
|
1460 |
+
}
|
1461 |
+
if (page != '') {
|
1462 |
+
pagination = 'wdi_page="' + page + '"';
|
1463 |
+
sourceAttr = 'src';
|
1464 |
+
} else {
|
1465 |
+
sourceAttr = 'src';
|
1466 |
+
}
|
1467 |
+
|
1468 |
+
if (page != '' && page != 1) {
|
1469 |
+
customClass = 'wdi_hidden';
|
1470 |
+
}
|
1471 |
+
|
1472 |
+
|
1473 |
+
if (currentFeed.feed_row.show_username_on_thumb == '1') {
|
1474 |
+
showUsernameOnThumb = '<span class="wdi_media_user">@<%= wdi_username%></span>';
|
1475 |
+
}
|
1476 |
+
|
1477 |
+
//checking if caption is opend by default then add wdi_full_caption class
|
1478 |
+
//only in masonry
|
1479 |
+
if (currentFeed.feed_row.show_full_description == 1 && currentFeed.feed_row.feed_type == 'masonry') {
|
1480 |
+
customClass += ' wdi_full_caption';
|
1481 |
+
}
|
1482 |
+
|
1483 |
+
var onclickevent = "";
|
1484 |
+
if (currentFeed.feed_row.feed_type !== "blog_style") {
|
1485 |
+
if (currentFeed.feed_row.feed_type == 'masonry') {
|
1486 |
+
onclickevent = "wdi_responsive.showMasonryCaption(jQuery(this)," + currentFeed.feed_row.wdi_feed_counter + ");"
|
1487 |
+
} else {
|
1488 |
+
onclickevent = "wdi_responsive.showCaption(jQuery(this)," + currentFeed.feed_row.wdi_feed_counter + ");";
|
1489 |
+
}
|
1490 |
+
|
1491 |
+
}
|
1492 |
+
|
1493 |
+
|
1494 |
+
//creating onclick string for different options
|
1495 |
+
switch (currentFeed.feed_row.feed_item_onclick) {
|
1496 |
+
case 'lightbox':
|
1497 |
+
{
|
1498 |
+
onclick = "onclick=wdi_feed_" + currentFeed.feed_row.wdi_feed_counter + ".galleryBox('<%=id%>')";
|
1499 |
+
break;
|
1500 |
+
}
|
1501 |
+
case 'instagram':
|
1502 |
+
{
|
1503 |
+
onclick = 'onclick="window.open (\'<%= link%>\',\'_blank\')"';
|
1504 |
+
overlayCustomClass = 'wdi_hover_off';
|
1505 |
+
thumbClass = 'fa-clone';
|
1506 |
+
break;
|
1507 |
+
}
|
1508 |
+
case 'none':
|
1509 |
+
{
|
1510 |
+
onclick = '';
|
1511 |
+
overlayCustomClass = 'wdi_cursor_off wdi_hover_off';
|
1512 |
+
thumbClass = '';
|
1513 |
+
}
|
1514 |
+
}
|
1515 |
+
var wdi_feed_counter = currentFeed.feed_row['wdi_feed_counter'];
|
1516 |
+
var source = '<div class="wdi_feed_item ' + customClass + '" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> ' + pagination + ' wdi_type="slideshow" id="wdi_' + wdi_feed_counter + '_<%=id%>">' +
|
1517 |
+
'<div class="wdi_photo_wrap">' +
|
1518 |
+
'<div class="wdi_photo_wrap_inner">' +
|
1519 |
+
'<div class="wdi_photo_img">' +
|
1520 |
+
'<img class="wdi_img" ' + sourceAttr + '="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);">' +
|
1521 |
+
'<div class="wdi_photo_overlay ' + overlayCustomClass + '" >' + showUsernameOnThumb +
|
1522 |
+
'<div class="wdi_thumb_icon" ' + onclick + ' style="display:table;width:100%;height:100%;">' +
|
1523 |
+
'<div style="display:table-cell;vertical-align:middle;text-align:center;color:white;">' +
|
1524 |
+
'<i class="fa ' + thumbClass + '"></i>' +
|
1525 |
+
'</div>' +
|
1526 |
+
'</div>' +
|
1527 |
+
'</div>' +
|
1528 |
+
'</div>' +
|
1529 |
+
'</div>' +
|
1530 |
+
'</div>';
|
1531 |
+
if (currentFeed['feed_row']['show_likes'] === '1' || currentFeed['feed_row']['show_comments'] === '1' || currentFeed['feed_row']['show_description'] === '1') {
|
1532 |
+
source += '<div class="wdi_photo_meta">';
|
1533 |
+
if (currentFeed['feed_row']['show_likes'] === '1') {
|
1534 |
+
source += '<div class="wdi_thumb_likes"><i class="fa fa-heart-o"> <%= likes%></i></div>';
|
1535 |
+
}
|
1536 |
+
if (currentFeed['feed_row']['show_comments'] === '1') {
|
1537 |
+
source += '<div class="wdi_thumb_comments"><i class="fa fa-comment-o"> <%= comments%></i></div>';
|
1538 |
+
}
|
1539 |
+
source += '<div class="wdi_clear"></div>';
|
1540 |
+
if (currentFeed['feed_row']['show_description'] === '1') {
|
1541 |
+
source += '<div class="wdi_photo_title" onclick=' + onclickevent + ' >' +
|
1542 |
+
'<%=caption%>' +
|
1543 |
+
'</div>';
|
1544 |
+
}
|
1545 |
+
source += '</div>';
|
1546 |
+
}
|
1547 |
+
|
1548 |
+
source += '</div>';
|
1549 |
+
var template = _.template(source);
|
1550 |
+
return template;
|
1551 |
}
|
1552 |
|
1553 |
wdi_front.replaceToVideo = function (url, index, feed_counter)
|
1554 |
{
|
1555 |
|
1556 |
+
overlayHtml = "<video style='width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;' controls=''>" +
|
1557 |
+
"<source src='" + url + "' type='video/mp4'>" +
|
1558 |
+
"Your browser does not support the video tag. </video>";
|
1559 |
|
1560 |
+
jQuery('#wdi_feed_' + feed_counter + ' [wdi_index="' + index + '"] .wdi_photo_wrap_inner').html(overlayHtml);
|
1561 |
+
jQuery('#wdi_feed_' + feed_counter + ' [wdi_index="' + index + '"] .wdi_photo_wrap_inner video').get(0).play();
|
1562 |
}
|
1563 |
|
1564 |
/*
|
1566 |
*/
|
1567 |
wdi_front.getVideoTemplate = function (currentFeed)
|
1568 |
{
|
1569 |
+
var page = wdi_front.setPage(currentFeed);
|
1570 |
+
var customClass = '';
|
1571 |
+
var pagination = '';
|
1572 |
+
var thumbClass = 'fa-play';
|
1573 |
+
var onclick = '';
|
1574 |
+
var overlayCustomClass = '';
|
1575 |
+
var sourceAttr;
|
1576 |
+
var showUsernameOnThumb = '';
|
1577 |
+
|
1578 |
+
|
1579 |
+
if (page != '') {
|
1580 |
+
pagination = 'wdi_page="' + page + '"';
|
1581 |
+
sourceAttr = 'src';
|
1582 |
+
} else {
|
1583 |
+
sourceAttr = 'src';
|
1584 |
+
}
|
1585 |
+
if (page != '' && page != 1) {
|
1586 |
+
customClass = 'wdi_hidden';
|
1587 |
+
}
|
1588 |
+
|
1589 |
+
if (currentFeed.feed_row.show_username_on_thumb == '1') {
|
1590 |
+
showUsernameOnThumb = '<span class="wdi_media_user">@<%= wdi_username%></span>';
|
1591 |
+
}
|
1592 |
+
|
1593 |
+
//checking if caption is opend by default then add wdi_full_caption class
|
1594 |
+
//only in masonry
|
1595 |
+
if (currentFeed.feed_row.show_full_description == 1 && currentFeed.feed_row.feed_type == 'masonry') {
|
1596 |
+
customClass += ' wdi_full_caption';
|
1597 |
+
}
|
1598 |
+
|
1599 |
+
var onclickevent = "";
|
1600 |
+
if (currentFeed.feed_row.feed_type !== "blog_style") {
|
1601 |
+
if (currentFeed.feed_row.feed_type == 'masonry') {
|
1602 |
+
onclickevent = "wdi_responsive.showMasonryCaption(jQuery(this)," + currentFeed.feed_row.wdi_feed_counter + ");"
|
1603 |
+
} else {
|
1604 |
+
onclickevent = "wdi_responsive.showCaption(jQuery(this)," + currentFeed.feed_row.wdi_feed_counter + ");";
|
1605 |
+
}
|
1606 |
+
|
1607 |
+
}
|
1608 |
+
|
1609 |
+
//creating onclick string for different options
|
1610 |
+
switch (currentFeed.feed_row.feed_item_onclick) {
|
1611 |
+
case 'lightbox':
|
1612 |
+
{
|
1613 |
+
onclick = "onclick=wdi_feed_" + currentFeed.feed_row.wdi_feed_counter + ".galleryBox('<%=id%>')";
|
1614 |
+
break;
|
1615 |
+
}
|
1616 |
+
case 'instagram':
|
1617 |
+
{
|
1618 |
+
onclick = 'onclick="window.open (\'<%= link%>\',\'_blank\')"';
|
1619 |
+
overlayCustomClass = 'wdi_hover_off';
|
1620 |
+
thumbClass = 'fa-play';
|
1621 |
+
break;
|
1622 |
+
}
|
1623 |
+
case 'none':
|
1624 |
+
{
|
1625 |
+
overlayCustomClass = 'wdi_cursor_off wdi_hover_off';
|
1626 |
+
thumbClass = '';
|
1627 |
+
if (currentFeed.feed_row.feed_type == 'blog_style' || currentFeed.feed_row.feed_type == 'image_browser') {
|
1628 |
+
onclick = "onclick=wdi_front.replaceToVideo('<%= video_url%>','<%= wdi_index%>'," + currentFeed.feed_row.wdi_feed_counter + ")";
|
1629 |
+
overlayCustomClass = '';
|
1630 |
+
thumbClass = 'fa-play';
|
1631 |
+
}
|
1632 |
+
}
|
1633 |
+
}
|
1634 |
+
|
1635 |
+
|
1636 |
+
var wdi_feed_counter = currentFeed.feed_row['wdi_feed_counter'];
|
1637 |
+
var source = '<div class="wdi_feed_item ' + customClass + '" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> ' + pagination + ' wdi_type="image" id="wdi_' + wdi_feed_counter + '_<%=id%>">' +
|
1638 |
+
'<div class="wdi_photo_wrap">' +
|
1639 |
+
'<div class="wdi_photo_wrap_inner">' +
|
1640 |
+
'<div class="wdi_photo_img">' +
|
1641 |
+
'<img class="wdi_img" ' + sourceAttr + '="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);">' +
|
1642 |
+
'<div class="wdi_photo_overlay ' + overlayCustomClass + '" ' + onclick + '>' + showUsernameOnThumb +
|
1643 |
+
'<div class="wdi_thumb_icon" style="display:table;width:100%;height:100%;">' +
|
1644 |
+
'<div style="display:table-cell;vertical-align:middle;text-align:center;color:white;">' +
|
1645 |
+
'<i class="fa ' + thumbClass + '"></i>' +
|
1646 |
+
'</div>' +
|
1647 |
+
'</div>' +
|
1648 |
+
'</div>' +
|
1649 |
+
'</div>' +
|
1650 |
+
'</div>' +
|
1651 |
+
'</div>';
|
1652 |
+
if (currentFeed['feed_row']['show_likes'] === '1' || currentFeed['feed_row']['show_comments'] === '1' || currentFeed['feed_row']['show_description'] === '1') {
|
1653 |
+
source += '<div class="wdi_photo_meta">';
|
1654 |
+
if (currentFeed['feed_row']['show_likes'] === '1') {
|
1655 |
+
source += '<div class="wdi_thumb_likes"><i class="fa fa-heart-o"> <%= likes%></i></div>';
|
1656 |
+
}
|
1657 |
+
if (currentFeed['feed_row']['show_comments'] === '1') {
|
1658 |
+
source += '<div class="wdi_thumb_comments"><i class="fa fa-comment-o"> <%= comments%></i></div>';
|
1659 |
+
}
|
1660 |
+
source += '<div class="wdi_clear"></div>';
|
1661 |
+
if (currentFeed['feed_row']['show_description'] === '1') {
|
1662 |
+
source += '<div class="wdi_photo_title" onclick=' + onclickevent + ' >' +
|
1663 |
+
'<%=caption%>' +
|
1664 |
+
'</div>';
|
1665 |
+
}
|
1666 |
+
source += '</div>';
|
1667 |
+
}
|
1668 |
+
source += '</div>';
|
1669 |
+
var template = _.template(source);
|
1670 |
+
return template;
|
1671 |
}
|
1672 |
|
1673 |
wdi_front.bindEvents = function (currentFeed)
|
1674 |
{
|
1675 |
|
1676 |
+
if (jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter + " .wdi_feed_wrapper").length == 0) {
|
1677 |
+
//no feed in DOM, ignore
|
1678 |
+
return;
|
1679 |
+
}
|
1680 |
+
|
1681 |
+
if (currentFeed.feed_row.feed_display_view == 'load_more_btn') {
|
1682 |
+
//binding load more event
|
1683 |
+
jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' .wdi_load_more_container').on(wdi_front.clickOrTouch, function ()
|
1684 |
+
{
|
1685 |
+
//do the actual load more operation
|
1686 |
+
wdi_front.loadMore(jQuery(this).find('.wdi_load_more_wrap'));
|
1687 |
+
|
1688 |
+
});
|
1689 |
+
}
|
1690 |
+
|
1691 |
+
if (currentFeed.feed_row.feed_display_view == 'pagination') {
|
1692 |
+
//binding pagination events
|
1693 |
+
jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' #wdi_next').on(wdi_front.clickOrTouch, function ()
|
1694 |
+
{
|
1695 |
+
wdi_front.paginatorNext(jQuery(this), currentFeed);
|
1696 |
+
});
|
1697 |
+
jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' #wdi_prev').on(wdi_front.clickOrTouch, function ()
|
1698 |
+
{
|
1699 |
+
wdi_front.paginatorPrev(jQuery(this), currentFeed);
|
1700 |
+
});
|
1701 |
+
jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' #wdi_last_page').on(wdi_front.clickOrTouch, function ()
|
1702 |
+
{
|
1703 |
+
wdi_front.paginationLastPage(jQuery(this), currentFeed);
|
1704 |
+
});
|
1705 |
+
jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' #wdi_first_page').on(wdi_front.clickOrTouch, function ()
|
1706 |
+
{
|
1707 |
+
wdi_front.paginationFirstPage(jQuery(this), currentFeed);
|
1708 |
+
});
|
1709 |
+
//setting pagiantion flags
|
1710 |
+
currentFeed.paginatorNextFlag = false;
|
1711 |
+
}
|
1712 |
+
if (currentFeed.feed_row.feed_display_view == 'infinite_scroll') {
|
1713 |
+
//binding infinite scroll Events
|
1714 |
+
jQuery(window).on('scroll', function ()
|
1715 |
+
{
|
1716 |
+
wdi_front.infiniteScroll(currentFeed);
|
1717 |
+
});
|
1718 |
+
//infinite scroll flags
|
1719 |
+
currentFeed.infiniteScrollFlag = false;
|
1720 |
+
}
|
1721 |
|
1722 |
|
1723 |
}
|
1725 |
wdi_front.infiniteScroll = function (currentFeed)
|
1726 |
{
|
1727 |
|
1728 |
+
if (jQuery(window).scrollTop() <= jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' #wdi_infinite_scroll').offset().top) {
|
1729 |
+
if (currentFeed.infiniteScrollFlag === false && currentFeed.stopInfiniteScrollFlag == false) {
|
1730 |
+
currentFeed.infiniteScrollFlag = true;
|
1731 |
+
wdi_front.loadMore(jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' #wdi_infinite_scroll'), currentFeed);
|
1732 |
+
} else
|
1733 |
+
if (currentFeed.stopInfiniteScrollFlag) {
|
1734 |
+
wdi_front.allImagesLoaded(currentFeed);
|
1735 |
+
}
|
1736 |
|
1737 |
+
}
|
1738 |
}
|
1739 |
|
1740 |
|
1741 |
wdi_front.paginationFirstPage = function (btn, currentFeed)
|
1742 |
{
|
1743 |
+
if (currentFeed.paginator == 1 || currentFeed.currentPage == 1) {
|
1744 |
+
btn.addClass('wdi_disabled');
|
1745 |
+
return;
|
1746 |
+
}
|
1747 |
+
var oldPage = currentFeed.currentPage;
|
1748 |
+
currentFeed.currentPage = 1;
|
1749 |
+
wdi_front.updatePagination(currentFeed, 'custom', oldPage);
|
1750 |
|
1751 |
+
//enable last page button
|
1752 |
+
var last_page_btn = btn.parent().find('#wdi_last_page');
|
1753 |
+
last_page_btn.removeClass('wdi_disabled');
|
1754 |
|
1755 |
+
//disabling first page button
|
1756 |
+
btn.addClass('wdi_disabled');
|
1757 |
|
1758 |
}
|
1759 |
|
1760 |
wdi_front.paginationLastPage = function (btn, currentFeed)
|
1761 |
{
|
1762 |
+
if (currentFeed.paginator == 1 || currentFeed.currentPage == currentFeed.paginator) {
|
1763 |
+
return;
|
1764 |
+
}
|
1765 |
+
var oldPage = currentFeed.currentPage;
|
1766 |
+
currentFeed.currentPage = currentFeed.paginator;
|
1767 |
+
wdi_front.updatePagination(currentFeed, 'custom', oldPage);
|
1768 |
|
1769 |
+
//disableing last page button
|
1770 |
+
btn.addClass('wdi_disabled');
|
1771 |
|
1772 |
+
//enabling first page button
|
1773 |
+
var first_page_btn = btn.parent().find('#wdi_first_page');
|
1774 |
+
first_page_btn.removeClass('wdi_disabled');
|
1775 |
}
|
1776 |
|
1777 |
wdi_front.paginatorNext = function (btn, currentFeed)
|
1778 |
{
|
1779 |
+
var last_page_btn = btn.parent().find('#wdi_last_page');
|
1780 |
+
var first_page_btn = btn.parent().find('#wdi_first_page');
|
1781 |
+
currentFeed.paginatorNextFlag = true;
|
1782 |
+
if (currentFeed.paginator == currentFeed.currentPage && !wdi_front.checkFeedFinished(currentFeed)) {
|
1783 |
+
currentFeed.currentPage++;
|
1784 |
+
var number_of_photos = currentFeed.feed_row.number_of_photos;
|
1785 |
+
wdi_front.loadMore(btn, currentFeed, number_of_photos);
|
1786 |
+
//on the last page don't show got to last page button
|
1787 |
+
last_page_btn.addClass('wdi_disabled');
|
1788 |
+
} else
|
1789 |
+
if (currentFeed.paginator > currentFeed.currentPage) {
|
1790 |
+
currentFeed.currentPage++;
|
1791 |
+
wdi_front.updatePagination(currentFeed, 'next');
|
1792 |
+
//check if new page isn't the last one then enable last page button
|
1793 |
+
if (currentFeed.paginator > currentFeed.currentPage) {
|
1794 |
+
last_page_btn.removeClass('wdi_disabled');
|
1795 |
+
} else {
|
1796 |
+
last_page_btn.addClass('wdi_disabled');
|
1797 |
+
}
|
1798 |
+
}
|
1799 |
+
|
1800 |
+
//enable first page button
|
1801 |
+
first_page_btn.removeClass('wdi_disabled');
|
1802 |
|
1803 |
|
1804 |
}
|
1805 |
|
1806 |
wdi_front.paginatorPrev = function (btn, currentFeed)
|
1807 |
{
|
1808 |
+
var last_page_btn = btn.parent().find('#wdi_last_page');
|
1809 |
+
var first_page_btn = btn.parent().find('#wdi_first_page');
|
1810 |
+
if (currentFeed.currentPage == 1) {
|
1811 |
+
first_page_btn.addClass('wdi_disabled');
|
1812 |
+
return;
|
1813 |
+
}
|
1814 |
|
1815 |
+
currentFeed.currentPage--;
|
1816 |
+
wdi_front.updatePagination(currentFeed, 'prev');
|
1817 |
|
1818 |
+
//enable last page button
|
1819 |
+
last_page_btn.removeClass('wdi_disabled');
|
1820 |
|
1821 |
+
if (currentFeed.currentPage == 1) {
|
1822 |
+
first_page_btn.addClass('wdi_disabled');
|
1823 |
+
}
|
1824 |
|
1825 |
}
|
1826 |
|
1827 |
//displays proper images for specific page after pagination buttons click event
|
1828 |
wdi_front.updatePagination = function (currentFeed, dir, oldPage)
|
1829 |
{
|
1830 |
+
var currentFeedString = '#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'];
|
1831 |
+
jQuery(currentFeedString + ' [wdi_page="' + currentFeed.currentPage + '"]').each(function ()
|
1832 |
+
{
|
1833 |
+
jQuery(this).removeClass('wdi_hidden');
|
1834 |
+
});
|
1835 |
+
switch (dir) {
|
1836 |
+
case 'next':
|
1837 |
+
{
|
1838 |
+
var oldPage = currentFeed.currentPage - 1;
|
1839 |
+
jQuery(currentFeedString + ' .wdi_feed_wrapper').height(jQuery('.wdi_feed_wrapper').height());
|
1840 |
+
jQuery(currentFeedString + ' [wdi_page="' + oldPage + '"]').each(function ()
|
1841 |
+
{
|
1842 |
+
jQuery(this).addClass('wdi_hidden');
|
1843 |
+
});
|
1844 |
+
break;
|
1845 |
+
}
|
1846 |
+
case 'prev':
|
1847 |
+
{
|
1848 |
+
var oldPage = currentFeed.currentPage + 1;
|
1849 |
+
jQuery(currentFeedString + ' .wdi_feed_wrapper').height(jQuery('.wdi_feed_wrapper').height());
|
1850 |
+
jQuery(currentFeedString + ' [wdi_page="' + oldPage + '"]').each(function ()
|
1851 |
+
{
|
1852 |
+
jQuery(this).addClass('wdi_hidden');
|
1853 |
+
});
|
1854 |
+
break;
|
1855 |
+
}
|
1856 |
+
case 'custom':
|
1857 |
+
{
|
1858 |
+
var oldPage = oldPage;
|
1859 |
+
if (oldPage != currentFeed.currentPage) {
|
1860 |
+
jQuery(currentFeedString + ' .wdi_feed_wrapper').height(jQuery('.wdi_feed_wrapper').height());
|
1861 |
+
jQuery(currentFeedString + ' [wdi_page="' + oldPage + '"]').each(function ()
|
1862 |
+
{
|
1863 |
+
jQuery(this).addClass('wdi_hidden');
|
1864 |
+
});
|
1865 |
+
}
|
1866 |
+
|
1867 |
+
break;
|
1868 |
+
}
|
1869 |
+
}
|
1870 |
+
currentFeed.paginatorNextFlag = false;
|
1871 |
+
|
1872 |
+
jQuery(currentFeedString + ' .wdi_feed_wrapper').css('height', 'auto');
|
1873 |
+
jQuery(currentFeedString + ' #wdi_current_page').text(currentFeed.currentPage);
|
1874 |
}
|
1875 |
|
1876 |
|
1878 |
{
|
1879 |
|
1880 |
|
1881 |
+
var dataCounter = 0;
|
1882 |
+
if (button != '' && typeof button != 'undefined' && button != 'initial' && button != 'initial-keep') {
|
1883 |
+
var currentFeed = window[button.parent().parent().parent().parent().attr('id')];
|
1884 |
+
}
|
1885 |
+
if (typeof _currentFeed != 'undefined') {
|
1886 |
+
var currentFeed = _currentFeed;
|
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 |
+
|
1908 |
+
|
1909 |
+
//if button is not provided than it enables auto_tiggering and recursively loads images
|
1910 |
+
if (button === '') {
|
1911 |
+
currentFeed['auto_trigger'] = true;
|
1912 |
+
} else {
|
1913 |
+
currentFeed['auto_trigger'] = false;
|
1914 |
+
}
|
1915 |
+
//ading ajax loading
|
1916 |
+
wdi_front.ajaxLoader(currentFeed);
|
1917 |
+
|
1918 |
+
|
1919 |
+
//check if masonry view is on and and feed display type is pagination then
|
1920 |
+
//close all captions before loading more pages for porper pagination rendering
|
1921 |
+
if (currentFeed.feed_row.feed_type === 'masonry' && currentFeed.feed_row.feed_display_view == 'pagination') {
|
1922 |
+
jQuery('#wdi_feed_' + wdi_front.feed_counter + ' .wdi_full_caption').each(function ()
|
1923 |
+
{
|
1924 |
+
jQuery(this).find('.wdi_photo_title').trigger(wdi_front.clickOrTouch);
|
1925 |
+
});
|
1926 |
+
}
|
1927 |
+
|
1928 |
+
|
1929 |
+
//check if all data loaded then remove ajaxLoader
|
1930 |
+
for (var i = 0; i < currentFeed.usersData.length; i++) {
|
1931 |
+
if (currentFeed.usersData[i]['finished'] === 'finished') {
|
1932 |
+
dataCounter++;
|
1933 |
+
}
|
1934 |
+
}
|
1935 |
+
if (dataCounter === currentFeed.usersData.length) {
|
1936 |
+
wdi_front.allImagesLoaded(currentFeed);
|
1937 |
+
jQuery('#wdi_feed_' + currentFeed['feed_row']['wdi_feed_counter'] + ' .wdi_load_more').remove();
|
1938 |
+
|
1939 |
+
}
|
1940 |
+
|
1941 |
+
var usersData = currentFeed['usersData'];
|
1942 |
+
|
1943 |
+
currentFeed.loadMoreDataCount = currentFeed.feed_users.length;
|
1944 |
+
|
1945 |
+
for (var i = 0; i < usersData.length; i++) {
|
1946 |
+
|
1947 |
+
var pagination = usersData[i]['pagination'];
|
1948 |
+
var user = {
|
1949 |
+
user_id: usersData[i]['user_id'],
|
1950 |
+
username: usersData[i]['username']
|
1951 |
+
}
|
1952 |
+
|
1953 |
+
//checking if pagination url exists then load images, else skip
|
1954 |
+
if (pagination['next_url'] != '' && pagination['next_url'] != null && typeof pagination['next_url'] != 'undefined') {
|
1955 |
+
var next_url = pagination['next_url'];
|
1956 |
+
wdi_front.loadMoreRequest(user, next_url, currentFeed, button);
|
1957 |
+
} else {
|
1958 |
+
|
1959 |
+
if (button == 'initial-keep') {
|
1960 |
+
currentFeed.temproraryUsersData[i] = currentFeed.usersData[i];
|
1961 |
+
}
|
1962 |
+
currentFeed.loadMoreDataCount--;
|
1963 |
+
|
1964 |
+
|
1965 |
+
wdi_front.checkForLoadMoreDone(currentFeed, button);
|
1966 |
+
continue;
|
1967 |
+
}
|
1968 |
+
}
|
1969 |
|
1970 |
|
1971 |
}
|
1976 |
wdi_front.loadMoreRequest = function (user, next_url, currentFeed, button)
|
1977 |
{
|
1978 |
|
1979 |
+
var usersData = currentFeed['usersData'];
|
1980 |
+
var errorMessage = '';
|
1981 |
+
|
1982 |
+
currentFeed.instagram.requestByUrl(next_url, {
|
1983 |
+
success: function (response)
|
1984 |
+
{
|
1985 |
+
if (response === '' || typeof response == 'undefined' || response == null) {
|
1986 |
+
errorMessage = wdi_front_messages.network_error;
|
1987 |
+
currentFeed.loadMoreDataCount--;
|
1988 |
+
wdi_front.show_alert(errorMessage);
|
1989 |
+
return;
|
1990 |
+
}
|
1991 |
+
if (response['meta']['code'] != 200) {
|
1992 |
+
errorMessage = response['meta']['error_message'];
|
1993 |
+
currentFeed.loadMoreDataCount--;
|
1994 |
+
wdi_front.show_alert(errorMessage);
|
1995 |
+
return;
|
1996 |
+
}
|
1997 |
+
|
1998 |
+
response['user_id'] = user.user_id;
|
1999 |
+
response['username'] = user.username;
|
2000 |
+
|
2001 |
+
for (var i = 0; i < currentFeed['usersData'].length; i++) {
|
2002 |
+
if (response['user_id'] === currentFeed['usersData'][i]['user_id']) {
|
2003 |
+
|
2004 |
+
///mmm!!!
|
2005 |
+
if (response['user_id'][0] === '#') {
|
2006 |
+
response['data'] = wdi_front.appendRequestHashtag(response['data'], response['user_id']);
|
2007 |
+
}
|
2008 |
+
////////////////
|
2009 |
+
/*if button is initial-keep then we will lose currentFeed['usersData'][i]
|
2010 |
+
for not loosing it we keep it in currentFeed.temproraryUsersData, which value will be
|
2011 |
+
used later in wdi_front.checkForLoadMoreDone(), in other cases when button is set to
|
2012 |
+
initial we already keep data in that variable, so we don't deed to keep it again, it will give us duplicate value
|
2013 |
+
*/
|
2014 |
+
|
2015 |
+
if (button == 'initial-keep') {
|
2016 |
+
currentFeed.temproraryUsersData[i] = currentFeed.usersData[i];
|
2017 |
+
}
|
2018 |
+
currentFeed['usersData'][i] = response;
|
2019 |
+
|
2020 |
+
currentFeed.loadMoreDataCount--;
|
2021 |
+
}
|
2022 |
+
}
|
2023 |
+
|
2024 |
+
//checks if load more done then displays feed
|
2025 |
+
wdi_front.checkForLoadMoreDone(currentFeed, button);
|
2026 |
+
}
|
2027 |
+
})
|
2028 |
|
2029 |
}
|
2030 |
|
2031 |
wdi_front.checkForLoadMoreDone = function (currentFeed, button)
|
2032 |
{
|
2033 |
+
var load_more_number = currentFeed.feed_row['load_more_number'];
|
2034 |
+
var number_of_photos = currentFeed.feed_row['number_of_photos'];
|
2035 |
|
2036 |
+
if (currentFeed.loadMoreDataCount == 0) {
|
2037 |
|
2038 |
+
currentFeed.temproraryUsersData = wdi_front.mergeData(currentFeed.temproraryUsersData, currentFeed.usersData);
|
2039 |
+
var gettedDataLength = wdi_front.getArrayContentLength(currentFeed.temproraryUsersData, 'data');
|
2040 |
+
/*this will happen when we call loadMore first time
|
2041 |
+
initial-keep is the same as initial except that if loadMore is called
|
2042 |
+
with initial-keep we store data on currentFeed.temproraryUsersData before checkLoadMoreDone()
|
2043 |
+
function call*/
|
2044 |
+
if (button == 'initial-keep') {
|
2045 |
+
button = 'initial';
|
2046 |
+
}
|
2047 |
+
//if button is set to inital load number_of_photos photos
|
2048 |
+
if (button == 'initial') {
|
2049 |
|
2050 |
+
/*if existing data length is smaller then load_more_number then get more objects until desired number is reached
|
2051 |
+
also if it is not possible to reach the desired number (this will happen when all users has no more photos) then
|
2052 |
+
displayFeed()*/
|
2053 |
+
if (gettedDataLength < number_of_photos && !wdi_front.userHasNoPhoto(currentFeed, currentFeed.temproraryUsersData) && currentFeed.instagramRequestCounter <= currentFeed.maxConditionalFiltersRequestCount) {
|
2054 |
+
//console.log('checkForLoadMoreDone recursion');
|
2055 |
|
2056 |
+
wdi_front.loadMore('initial', currentFeed);
|
2057 |
+
} else {
|
2058 |
|
2059 |
+
currentFeed.usersData = currentFeed.temproraryUsersData;
|
2060 |
|
2061 |
+
wdi_front.displayFeed(currentFeed);
|
2062 |
+
//when all data us properly displayed check for any active filters and then apply them
|
2063 |
+
wdi_front.applyFilters(currentFeed);
|
2064 |
|
2065 |
+
//resetting temprorary users data array for the next loadmoer call
|
2066 |
+
currentFeed.temproraryUsersData = [];
|
2067 |
|
2068 |
|
2069 |
+
}
|
2070 |
|
2071 |
+
} else {
|
2072 |
+
//else load load_more_number photos
|
2073 |
+
//if existing data length is smaller then load_more_number then get more objects until desired number is reached
|
2074 |
|
2075 |
+
if (gettedDataLength < load_more_number && !wdi_front.userHasNoPhoto(currentFeed, currentFeed.temproraryUsersData) && currentFeed.instagramRequestCounter <= currentFeed.maxConditionalFiltersRequestCount) {
|
2076 |
+
//console.log('load more recursion');
|
2077 |
+
wdi_front.loadMore(undefined, currentFeed);
|
2078 |
+
} else {
|
2079 |
|
2080 |
+
currentFeed.usersData = currentFeed.temproraryUsersData;
|
2081 |
|
2082 |
+
if (!wdi_front.activeUsersCount(currentFeed)) {
|
2083 |
+
return;
|
2084 |
+
}
|
2085 |
|
2086 |
+
wdi_front.displayFeed(currentFeed, load_more_number);
|
2087 |
+
//when all data us properly displayed check for any active filters and then apply them
|
2088 |
+
wdi_front.applyFilters(currentFeed);
|
2089 |
|
2090 |
+
//resetting temprorary users data array for the next loadmoer call
|
2091 |
+
currentFeed.temproraryUsersData = [];
|
2092 |
+
}
|
2093 |
+
}
|
2094 |
|
2095 |
|
2096 |
+
}
|
2097 |
}
|
2098 |
|
2099 |
wdi_front.allDataHasFinished = function (currentFeed)
|
2100 |
{
|
2101 |
+
var c = 0;
|
2102 |
+
for (var j = 0; j < currentFeed.dataStorageRaw.length; j++) {
|
2103 |
+
if (currentFeed.dataStorageRaw[j].length() == 0 && currentFeed.dataStorageRaw[j].locked == true) {
|
2104 |
+
c++;
|
2105 |
+
}
|
2106 |
+
}
|
2107 |
|
2108 |
+
return (c == currentFeed.dataStorageRaw.length);
|
2109 |
}
|
2110 |
|
2111 |
|
2113 |
{
|
2114 |
|
2115 |
|
2116 |
+
for (var i = 0; i < array2.length; i++) {
|
2117 |
+
if (typeof array1[i] != 'undefined') {
|
2118 |
+
if (array2[i]['finished'] == 'finished') {
|
2119 |
+
continue;
|
2120 |
+
}
|
2121 |
|
2122 |
+
//if user data is finished then dont add duplicate data
|
2123 |
+
if (typeof array1[i]['pagination']['next_max_id'] == 'undefined' &&
|
2124 |
+
typeof array1[i]['pagination']['next_max_like_id'] == 'undefined') {
|
2125 |
+
continue;
|
2126 |
+
}
|
2127 |
+
//extend data
|
2128 |
+
array1[i]['data'] = array1[i]['data'].concat(array2[i]['data']);
|
2129 |
+
array1[i]['pagination'] = array2[i]['pagination'];
|
2130 |
+
array1[i]['user_id'] = array2[i]['user_id'];
|
2131 |
+
array1[i]['username'] = array2[i]['username'];
|
2132 |
+
array1[i]['meta'] = array2[i]['meta'];
|
2133 |
+
} else {
|
2134 |
+
array1.push(array2[i]);
|
2135 |
+
}
|
2136 |
+
}
|
2137 |
+
return array1;
|
2138 |
}
|
2139 |
|
2140 |
|
2141 |
//broken image handling
|
2142 |
wdi_front.brokenImageHandler = function (source)
|
2143 |
{
|
2144 |
+
source.src = wdi_url.plugin_url + "../images/missing.png";
|
2145 |
+
source.onerror = "";
|
2146 |
+
return true;
|
2147 |
|
2148 |
}
|
2149 |
|
2151 |
//ajax loading
|
2152 |
wdi_front.ajaxLoader = function (currentFeed)
|
2153 |
{
|
2154 |
+
var wdi_feed_counter = currentFeed.feed_row['wdi_feed_counter'];
|
2155 |
|
2156 |
+
var feed_container = jQuery('#wdi_feed_' + wdi_feed_counter);
|
2157 |
+
if (currentFeed.feed_row.feed_display_view == 'load_more_btn') {
|
2158 |
+
feed_container.find('.wdi_load_more').addClass('wdi_hidden');
|
2159 |
+
feed_container.find('.wdi_spinner').removeClass('wdi_hidden');
|
2160 |
+
}
|
2161 |
+
/////////////////////////////////////////////////////
|
2162 |
+
if (currentFeed.feed_row.feed_display_view == 'infinite_scroll') {
|
2163 |
+
var loadingDiv;
|
2164 |
+
if (feed_container.find('.wdi_ajax_loading').length == 0) {
|
2165 |
+
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>');
|
2166 |
+
feed_container.append(loadingDiv);
|
2167 |
+
} else {
|
2168 |
+
loadingDiv = feed_container.find('.wdi_ajax_loading');
|
2169 |
+
}
|
2170 |
+
loadingDiv.removeClass('wdi_hidden');
|
2171 |
+
}
|
2172 |
|
2173 |
|
2174 |
+
////////////////////////////////////////////////////
|
2175 |
|
2176 |
}
|
2177 |
|
2178 |
//if all images loaded then clicking load more causes it's removal
|
2179 |
wdi_front.allImagesLoaded = function (currentFeed)
|
2180 |
{
|
2181 |
+
////////////////////////////////////////////////////////////////////
|
2182 |
+
//clearInterval(currentFeed.loadingInterval);
|
2183 |
+
//jQuery('#wdi_feed_'+currentFeed.feed_row['wdi_feed_counter']+' .wdi_ajax_loading').remove();
|
|
|
2184 |
|
2185 |
+
////////////////////////////////////////////////////
|
2186 |
|
2187 |
+
var dataLength = wdi_front.getDataLength(currentFeed);
|
2188 |
+
/* display message if feed contains no image at all */
|
2189 |
+
if (dataLength == 0 && (currentFeed.feed_row.conditional_filters.length == 0 || currentFeed.feed_row.conditional_filter_enable == 0)) {
|
2190 |
+
jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter + " .wdi_feed_wrapper").append("<p>There is no media in this feed</p>");
|
2191 |
+
}
|
2192 |
|
2193 |
+
//if all images loaded then enable load more button and hide spinner
|
2194 |
+
var wdi_feed_counter = currentFeed.feed_row['wdi_feed_counter'];
|
2195 |
+
var feed_container = jQuery('#wdi_feed_' + wdi_feed_counter);
|
2196 |
|
2197 |
+
if (currentFeed.feed_row.feed_display_view == 'load_more_btn') {
|
2198 |
+
feed_container.find('.wdi_load_more').removeClass('wdi_hidden');
|
2199 |
+
feed_container.find('.wdi_spinner').addClass('wdi_hidden');
|
2200 |
+
}
|
2201 |
|
2202 |
+
if (currentFeed.feed_row.feed_display_view == 'infinite_scroll') {
|
2203 |
+
jQuery('#wdi_feed_' + currentFeed.feed_row['wdi_feed_counter'] + ' .wdi_ajax_loading').addClass('wdi_hidden');
|
2204 |
+
}
|
2205 |
|
2206 |
|
2207 |
+
//custom event fired for user based custom js
|
2208 |
+
feed_container.trigger('wdi_feed_loaded');
|
2209 |
|
2210 |
|
2211 |
}
|
2214 |
//shows different parts of the feed based user choice
|
2215 |
wdi_front.show = function (name, currentFeed)
|
2216 |
{
|
2217 |
+
var wdi_feed_counter = currentFeed.feed_row['wdi_feed_counter'];
|
2218 |
+
var feed_container = jQuery('#wdi_feed_' + wdi_feed_counter + ' .wdi_feed_container');
|
2219 |
+
var _this = this;
|
2220 |
+
switch (name) {
|
2221 |
+
case 'header':
|
2222 |
+
{
|
2223 |
+
show_header();
|
2224 |
+
break;
|
2225 |
+
}
|
2226 |
+
case 'users':
|
2227 |
+
{
|
2228 |
+
show_users(currentFeed);
|
2229 |
+
break;
|
2230 |
+
}
|
2231 |
+
|
2232 |
+
}
|
2233 |
+
|
2234 |
+
function show_header()
|
2235 |
+
{
|
2236 |
+
|
2237 |
+
var templateData = {
|
2238 |
+
'feed_thumb': currentFeed['feed_row']['feed_thumb'],
|
2239 |
+
'feed_name': currentFeed['feed_row']['feed_name'],
|
2240 |
+
};
|
2241 |
+
|
2242 |
+
var headerTemplate = wdi_front.getHeaderTemplate(),
|
2243 |
+
html = headerTemplate(templateData),
|
2244 |
+
containerHtml = feed_container.find('.wdi_feed_header').html();
|
2245 |
+
|
2246 |
+
feed_container.find('.wdi_feed_header').html(containerHtml + html);
|
2247 |
+
|
2248 |
+
|
2249 |
+
}
|
2250 |
+
|
2251 |
+
function show_users(currentFeed)
|
2252 |
+
{
|
2253 |
+
feed_container.find('.wdi_feed_users').html('');
|
2254 |
+
var users = currentFeed['feed_users'];
|
2255 |
+
var access_token = currentFeed['feed_row']['access_token'];
|
2256 |
+
var i = 0;
|
2257 |
+
currentFeed.headerUserinfo = [];
|
2258 |
+
getThumb();
|
2259 |
+
//recursively calls itself until all user data is ready then displyes it with escapeRequest
|
2260 |
+
function getThumb()
|
2261 |
+
{
|
2262 |
+
|
2263 |
+
if (currentFeed.headerUserinfo.length == users.length) {
|
2264 |
+
escapeRequest(currentFeed.headerUserinfo, currentFeed);
|
2265 |
+
return;
|
2266 |
+
}
|
2267 |
+
var _user = users[currentFeed.headerUserinfo.length];
|
2268 |
+
|
2269 |
+
|
2270 |
+
if (typeof _user === 'string' && _user === 'self') {
|
2271 |
+
currentFeed.instagram.getSelfInfo({
|
2272 |
+
success: function (response)
|
2273 |
+
{
|
2274 |
+
response = _this.checkMediaResponse(response);
|
2275 |
+
if (response != false) {
|
2276 |
+
var obj = {
|
2277 |
+
id: response['data']['id'],
|
2278 |
+
name: response['data']['username'],
|
2279 |
+
url: response['data']['profile_picture'],
|
2280 |
+
bio: response['data']['bio'],
|
2281 |
+
counts: response['data']['counts'],
|
2282 |
+
website: response['data']['website'],
|
2283 |
+
full_name: response['data']['full_name']
|
2284 |
+
}
|
2285 |
+
currentFeed.headerUserinfo.push(obj);
|
2286 |
+
i++;
|
2287 |
+
getThumb();
|
2288 |
+
}
|
2289 |
+
},
|
2290 |
+
args: {
|
2291 |
+
ignoreFiltering: true,
|
2292 |
+
}
|
2293 |
+
});
|
2294 |
+
}
|
2295 |
+
else
|
2296 |
+
if (_this.getInputType(_user.username) == 'hashtag') {
|
2297 |
+
currentFeed.instagram.searchForTagsByName(_this.stripHashtag(_user.username), {
|
2298 |
+
/*currentFeed.instagram.getTagRecentMedia(_this.stripHashtag(_user.username), {*/
|
2299 |
+
success: function (response)
|
2300 |
+
{
|
2301 |
+
response = _this.checkMediaResponse(response);
|
2302 |
+
if (response != false) {
|
2303 |
+
if (response['data'].length == 0) {
|
2304 |
+
var thumb_img = '';
|
2305 |
+
var counts = {media: ''};
|
2306 |
+
} else {
|
2307 |
+
var thumb_img = '';// we will get image src later when will have all the sources
|
2308 |
+
//thumb_img = response['data'][0]['images']['thumbnail']['url'];
|
2309 |
+
var counts = {media: response['data'][0]['media_count']};
|
2310 |
+
}
|
2311 |
+
|
2312 |
+
var obj = {
|
2313 |
+
name: users[i]['username'],
|
2314 |
+
url: thumb_img,
|
2315 |
+
counts: counts,
|
2316 |
+
};
|
2317 |
+
i++;
|
2318 |
+
currentFeed.headerUserinfo.push(obj);
|
2319 |
+
getThumb();
|
2320 |
+
}
|
2321 |
+
},
|
2322 |
+
args: {
|
2323 |
+
ignoreFiltering: true,
|
2324 |
+
}
|
2325 |
+
});
|
2326 |
+
}
|
2327 |
+
else
|
2328 |
+
if (_this.getInputType(_user.username) == 'user') {
|
2329 |
+
currentFeed.instagram.getUserInfo(_user.id, {
|
2330 |
+
success: function (response)
|
2331 |
+
{
|
2332 |
+
response = _this.checkMediaResponse(response);
|
2333 |
+
if (response != false) {
|
2334 |
+
var obj = {
|
2335 |
+
id: response['data']['id'],
|
2336 |
+
name: response['data']['username'],
|
2337 |
+
url: response['data']['profile_picture'],
|
2338 |
+
bio: response['data']['bio'],
|
2339 |
+
counts: response['data']['counts'],
|
2340 |
+
website: response['data']['website'],
|
2341 |
+
full_name: response['data']['full_name']
|
2342 |
+
}
|
2343 |
+
currentFeed.headerUserinfo.push(obj);
|
2344 |
+
i++;
|
2345 |
+
getThumb();
|
2346 |
+
}
|
2347 |
+
},
|
2348 |
+
args: {
|
2349 |
+
ignoreFiltering: true,
|
2350 |
+
}
|
2351 |
+
});
|
2352 |
+
}
|
2353 |
+
|
2354 |
+
}
|
2355 |
+
|
2356 |
+
//when all user data is ready break recursion and create user elements
|
2357 |
+
function escapeRequest(info, currentFeed)
|
2358 |
+
{
|
2359 |
+
feed_container.find('.wdi_feed_users').html('');
|
2360 |
+
for (var k = 0; k < info.length; k++) {
|
2361 |
+
//setting all user filters to false
|
2362 |
+
|
2363 |
+
var userFilter = {
|
2364 |
+
'flag': false,
|
2365 |
+
'id': info[k]['id'],
|
2366 |
+
'name': info[k]['name']
|
2367 |
+
};
|
2368 |
+
|
2369 |
+
|
2370 |
+
//user inforamtion
|
2371 |
+
var hashtagClass = (info[k]['name'][0] == '#') ? 'wdi_header_hashtag' : '';
|
2372 |
+
|
2373 |
+
var templateData = {
|
2374 |
+
'user_index': k,
|
2375 |
+
'user_img_url': info[k]['url'],
|
2376 |
+
'counts': info[k]["counts"],
|
2377 |
+
'feed_counter': currentFeed.feed_row.wdi_feed_counter,
|
2378 |
+
'user_name': info[k]['name'],
|
2379 |
+
'bio': info[k]['bio'],
|
2380 |
+
'usersCount': currentFeed.feed_row.feed_users.length,
|
2381 |
+
'hashtagClass': hashtagClass
|
2382 |
+
|
2383 |
+
};
|
2384 |
+
|
2385 |
+
var userTemplate = wdi_front.getUserTemplate(currentFeed, info[k]['name']),
|
2386 |
+
html = userTemplate(templateData),
|
2387 |
+
containerHtml = feed_container.find('.wdi_feed_users').html();
|
2388 |
+
|
2389 |
+
feed_container.find('.wdi_feed_users').html(containerHtml + html);
|
2390 |
+
|
2391 |
+
|
2392 |
+
currentFeed.userSortFlags.push(userFilter);
|
2393 |
+
|
2394 |
+
var clearFloat = jQuery('<div class="wdi_clear"></div>');
|
2395 |
+
|
2396 |
+
}
|
2397 |
+
feed_container.find('.wdi_feed_users').append(clearFloat);
|
2398 |
+
wdi_front.updateUsersImages(currentFeed);
|
2399 |
+
};
|
2400 |
+
}
|
2401 |
|
2402 |
}
|
2403 |
|
2405 |
wdi_front.getUserTemplate = function (currentFeed, username)
|
2406 |
{
|
2407 |
|
2408 |
+
var usersCount = currentFeed.dataCount,
|
2409 |
+
instagramLink, instagramLinkOnClick, js;
|
2410 |
+
|
2411 |
+
switch (username[0]) {
|
2412 |
+
case '#':
|
2413 |
+
{
|
2414 |
+
instagramLink = '//instagram.com/explore/tags/' + username.substr(1, username.length);
|
2415 |
+
break;
|
2416 |
+
}
|
2417 |
+
default:
|
2418 |
+
{
|
2419 |
+
instagramLink = '//instagram.com/' + username;
|
2420 |
+
break;
|
2421 |
+
}
|
2422 |
+
}
|
2423 |
+
js = 'window.open("' + instagramLink + '","_blank")';
|
2424 |
+
instagramLinkOnClick = "onclick='" + js + "'";
|
2425 |
+
|
2426 |
+
var source = '<div class="wdi_single_user" user_index="<%=user_index%>">' +
|
2427 |
+
'<div class="wdi_header_user_text <%=hashtagClass%>">' +
|
2428 |
+
|
2429 |
+
'<div class="wdi_user_img_wrap">' +
|
2430 |
+
'<img onerror="wdi_front.brokenImageHandler(this);" src="<%= user_img_url%>">';
|
2431 |
+
if (usersCount > 1) {
|
2432 |
+
source += '<div title="' + wdi_front_messages.filter_title + '" class="wdi_filter_overlay">' +
|
2433 |
+
'<div class="wdi_filter_icon">' +
|
2434 |
+
'<span onclick="wdi_front.addFilter(<%=user_index%>,<%=feed_counter%>);" class="fa fa-filter"></span>' +
|
2435 |
+
'</div>' +
|
2436 |
+
'</div>';
|
2437 |
+
}
|
2438 |
+
source += '</div>';
|
2439 |
+
source += '<h3 ' + instagramLinkOnClick + '><%= user_name%></h3>';
|
2440 |
+
|
2441 |
+
if (username[0] !== '#') {
|
2442 |
+
if (currentFeed.feed_row.follow_on_instagram_btn == '1') {
|
2443 |
+
source += '<div class="wdi_user_controls">' +
|
2444 |
+
'<div class="wdi_follow_btn" onclick="window.open(\'//instagram.com/<%= user_name%>\',\'_blank\')"><span> Follow</span></div>' +
|
2445 |
+
'</div>';
|
2446 |
+
}
|
2447 |
+
source += '<div class="wdi_media_info">' +
|
2448 |
+
'<p class="wdi_posts"><span class="fa fa-camera-retro"><%= counts.media%></span></p>' +
|
2449 |
+
'<p class="wdi_followers"><span class="fa fa-user"><%= counts.followed_by%></span></p>' +
|
2450 |
+
'</div>';
|
2451 |
+
} else {
|
2452 |
+
source += '<div class="wdi_user_controls">' +
|
2453 |
+
'</div>' +
|
2454 |
+
'<div class="wdi_media_info">' +
|
2455 |
+
'<p class="wdi_posts"><span class="fa fa-camera-retro"><%= counts.media%></span></p>' +
|
2456 |
+
'<p class="wdi_followers"><span></span></p>' +
|
2457 |
+
'</div>';
|
2458 |
+
}
|
2459 |
+
source += '<div class="wdi_clear"></div>';
|
2460 |
+
|
2461 |
+
if (usersCount == 1 && username[0] !== '#' && currentFeed.feed_row.display_user_info == '1') {
|
2462 |
+
source += '<div class="wdi_bio"><%= bio%></div>';
|
2463 |
+
|
2464 |
+
}
|
2465 |
+
|
2466 |
+
|
2467 |
+
source += '</div>' +
|
2468 |
+
'</div>';
|
2469 |
+
|
2470 |
+
var template = _.template(source);
|
2471 |
+
return template;
|
2472 |
}
|
2473 |
|
2474 |
|
2475 |
wdi_front.getHeaderTemplate = function ()
|
2476 |
{
|
2477 |
+
var source = '<div class="wdi_header_wrapper">' +
|
2478 |
+
'<div class="wdi_header_img_wrap">' +
|
2479 |
+
'<img src="<%=feed_thumb%>">' +
|
2480 |
+
'</div>' +
|
2481 |
+
'<div class="wdi_header_text"><%=feed_name%></div>' +
|
2482 |
+
'<div class="wdi_clear">' +
|
2483 |
+
'</div>';
|
2484 |
+
var template = _.template(source);
|
2485 |
+
return template;
|
2486 |
}
|
2487 |
|
2488 |
|
2489 |
//sets user filter to true and applys filter to feed
|
2490 |
wdi_front.addFilter = function (index, feed_counter)
|
2491 |
{
|
2492 |
+
var currentFeed = window['wdi_feed_' + feed_counter];
|
2493 |
+
var usersCount = currentFeed.dataCount;
|
2494 |
+
if (usersCount < 2) {
|
2495 |
+
return;
|
2496 |
+
}
|
2497 |
+
|
2498 |
+
if (currentFeed.nowLoadingImages != false) {
|
2499 |
+
return;
|
2500 |
+
} else {
|
2501 |
+
|
2502 |
+
var userDiv = jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter + '_users [user_index="' + index + '"]');
|
2503 |
+
userDiv.find('.wdi_filter_overlay').toggleClass('wdi_filter_active_bg');
|
2504 |
+
userDiv.find('.wdi_header_user_text h3').toggleClass('wdi_filter_active_col');
|
2505 |
+
userDiv.find('.wdi_media_info').toggleClass('wdi_filter_active_col');
|
2506 |
+
userDiv.find('.wdi_follow_btn').toggleClass('wdi_filter_active_col');
|
2507 |
+
|
2508 |
+
currentFeed.customFilterChanged = true;
|
2509 |
+
//setting filter flag to true
|
2510 |
+
if (currentFeed.userSortFlags[index]['flag'] == false) {
|
2511 |
+
currentFeed.userSortFlags[index]['flag'] = true;
|
2512 |
+
} else {
|
2513 |
+
currentFeed.userSortFlags[index]['flag'] = false;
|
2514 |
+
}
|
2515 |
+
//getting active filter count
|
2516 |
+
var activeFilterCount = 0;
|
2517 |
+
for (var j = 0; j < currentFeed.userSortFlags.length; j++) {
|
2518 |
+
if (currentFeed.userSortFlags[j]['flag'] == true) {
|
2519 |
+
activeFilterCount++;
|
2520 |
+
}
|
2521 |
+
}
|
2522 |
+
|
2523 |
+
|
2524 |
+
if (currentFeed.feed_row.feed_display_view == 'pagination') {
|
2525 |
+
//reset responsive indexes because number of feed images may change after using filter
|
2526 |
+
currentFeed.resIndex = 0;
|
2527 |
+
}
|
2528 |
+
|
2529 |
+
//applying filters
|
2530 |
+
if (activeFilterCount != 0) {
|
2531 |
+
wdi_front.filterData(currentFeed);
|
2532 |
+
wdi_front.displayFeed(currentFeed);
|
2533 |
+
} else {
|
2534 |
+
currentFeed.customFilteredData = currentFeed.dataStorageList;
|
2535 |
+
wdi_front.displayFeed(currentFeed);
|
2536 |
+
}
|
2537 |
+
|
2538 |
+
|
2539 |
+
if (currentFeed.feed_row.feed_display_view == 'pagination') {
|
2540 |
+
//reset paginator because while filtering images become more or less so pages also become more or less
|
2541 |
+
currentFeed.paginator = Math.ceil((currentFeed.imageIndex) / parseInt(currentFeed.feed_row.pagination_per_page_number));
|
2542 |
+
//setting current page as the last loaded page when filter is active
|
2543 |
+
currentFeed.currentPage = currentFeed.paginator; //pagination page number
|
2544 |
+
//when feed is displayed we are by default in the first page
|
2545 |
+
//so we are navigating from page 1 to current page using custom navigation method
|
2546 |
+
wdi_front.updatePagination(currentFeed, 'custom', 1);
|
2547 |
+
|
2548 |
+
jQuery('#wdi_first_page').removeClass('wdi_disabled');
|
2549 |
+
jQuery('#wdi_last_page').addClass('wdi_disabled');
|
2550 |
+
}
|
2551 |
+
|
2552 |
+
}
|
2553 |
}
|
2554 |
|
2555 |
wdi_front.filterData = function (currentFeed)
|
2556 |
{
|
2557 |
|
2558 |
+
var users = currentFeed.userSortFlags;
|
2559 |
+
currentFeed.customFilteredData = [];
|
2560 |
+
for (var i = 0; i < currentFeed.dataStorageList.length; i++) {
|
2561 |
+
for (var j = 0; j < users.length; j++) {
|
2562 |
+
if ((currentFeed.dataStorageList[i]['user']['id'] == users[j]['id'] || currentFeed.dataStorageList[i]['wdi_hashtag'] == users[j]['name']) && users[j]['flag'] == true) {
|
2563 |
+
currentFeed.customFilteredData.push(currentFeed.dataStorageList[i]);
|
2564 |
+
}
|
2565 |
|
2566 |
+
}
|
2567 |
+
}
|
2568 |
|
2569 |
}
|
2570 |
|
2571 |
wdi_front.applyFilters = function (currentFeed)
|
2572 |
{
|
2573 |
+
for (var i = 0; i < currentFeed.userSortFlags.length; i++) {
|
2574 |
+
if (currentFeed.userSortFlags[i]['flag'] == true) {
|
2575 |
+
var userDiv = jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter + '[user_index="' + i + '"]');
|
2576 |
+
wdi_front.addFilter(i, currentFeed.feed_row.wdi_feed_counter);
|
2577 |
+
wdi_front.addFilter(i, currentFeed.feed_row.wdi_feed_counter);
|
2578 |
+
}
|
2579 |
+
}
|
2580 |
|
2581 |
}
|
2582 |
|
2583 |
//gets data Count from global storage
|
2584 |
wdi_front.getImgCount = function (currentFeed)
|
2585 |
{
|
2586 |
+
var dataStorage = currentFeed.dataStorage;
|
2587 |
+
var count = 0;
|
2588 |
+
for (var i = 0; i < dataStorage.length; i++) {
|
2589 |
+
count += dataStorage[i].length;
|
2590 |
+
}
|
2591 |
+
return count;
|
2592 |
}
|
2593 |
|
2594 |
//parses image data for lightbox popup
|
2595 |
wdi_front.parseLighboxData = function (currentFeed, filterFlag)
|
2596 |
{
|
2597 |
|
2598 |
+
var dataStorage = currentFeed.dataStorage;
|
2599 |
+
var sortImagesBy = currentFeed.feed_row['sort_images_by'];
|
2600 |
+
var sortOrder = currentFeed.feed_row['display_order'];
|
2601 |
+
var sortOperator = wdi_front.sortingOperator(sortImagesBy, sortOrder);
|
2602 |
+
var data = [];
|
2603 |
+
|
2604 |
+
var popupData = [];
|
2605 |
+
var obj = {};
|
2606 |
+
|
2607 |
+
//if filterFlag is true, it means that some filter for frontend content is enabled so give
|
2608 |
+
//lightbox only those images which are visible at that moment else give all avialable
|
2609 |
+
if (filterFlag == true) {
|
2610 |
+
data = currentFeed.customFilteredData;
|
2611 |
+
} else {
|
2612 |
+
for (var i = 0; i < dataStorage.length; i++) {
|
2613 |
+
for (var j = 0; j < dataStorage[i].length; j++) {
|
2614 |
+
data.push(dataStorage[i][j]);
|
2615 |
+
}
|
2616 |
+
}
|
2617 |
+
data.sort(sortOperator);
|
2618 |
+
}
|
2619 |
+
|
2620 |
+
|
2621 |
+
for (i = 0; i < data.length; i++) {
|
2622 |
+
obj = {
|
2623 |
+
'alt': '',
|
2624 |
+
'avg_rating': '',
|
2625 |
+
'comment_count': data[i]['comments']['count'],
|
2626 |
+
'date': wdi_front.convertUnixDate(data[i]['created_time']),
|
2627 |
+
'description': wdi_front.getDescription((data[i]['caption'] !== null) ? data[i]['caption']['text'] : ''),
|
2628 |
+
'filename': wdi_front.getFileName(data[i]),
|
2629 |
+
'filetype': wdi_front.getFileType(data[i]),
|
2630 |
+
'hit_count': '0',
|
2631 |
+
'id': data[i]['id'],
|
2632 |
+
'image_url': data[i]['link'],
|
2633 |
+
'number': 0,
|
2634 |
+
'rate': '',
|
2635 |
+
'rate_count': '0',
|
2636 |
+
'username': data[i]['user']['username'],
|
2637 |
+
'profile_picture': data[i]['user']['profile_picture'],
|
2638 |
+
'thumb_url': data[i]['link'] + 'media/?size=t',
|
2639 |
+
'comments_data': data[i]['comments']['data']
|
2640 |
+
}
|
2641 |
+
popupData.push(obj);
|
2642 |
+
}
|
2643 |
+
return popupData;
|
2644 |
}
|
2645 |
|
2646 |
wdi_front.convertUnixDate = function (date)
|
2647 |
{
|
2648 |
+
var utcSeconds = parseInt(date);
|
2649 |
+
var newDate = new Date(0);
|
2650 |
+
newDate.setUTCSeconds(utcSeconds);
|
2651 |
+
var str = newDate.getFullYear() + '-' + newDate.getMonth() + '-' + newDate.getDate();
|
2652 |
+
str += ' ' + newDate.getHours() + ':' + newDate.getMinutes();
|
2653 |
+
return str;
|
2654 |
}
|
2655 |
|
2656 |
wdi_front.getDescription = function (desc)
|
2657 |
{
|
2658 |
+
desc = desc.replace(/\r?\n|\r/g, ' ');
|
2659 |
|
2660 |
|
2661 |
+
return desc;
|
2662 |
}
|
2663 |
|
2664 |
+
|
2665 |
+
/**
|
2666 |
+
* use this data for lightbox
|
2667 |
+
* **/
|
2668 |
+
|
2669 |
wdi_front.getFileName = function (data)
|
2670 |
{
|
2671 |
+
var link = data['link'];
|
2672 |
+
var type = data['type'];
|
2673 |
+
/*if pure video, not carousel*/
|
2674 |
+
if (type === 'video' && data.hasOwnProperty('videos')) {
|
2675 |
+
return data['videos']['standard_resolution']['url'];
|
2676 |
+
} else {
|
2677 |
+
var linkFragments = link.split('/');
|
2678 |
+
return linkFragments[linkFragments.length - 2];
|
2679 |
+
}
|
2680 |
|
2681 |
}
|
2682 |
|
2683 |
+
wdi_front.getFileType = function (data)
|
2684 |
{
|
2685 |
+
/*if pure video, not carousel*/
|
2686 |
+
if (data['type'] == 'video' && data.hasOwnProperty('videos')) {
|
2687 |
+
return "EMBED_OEMBED_INSTAGRAM_VIDEO";
|
2688 |
+
}
|
2689 |
+
else {
|
2690 |
+
return "EMBED_OEMBED_INSTAGRAM_IMAGE";
|
2691 |
+
}
|
2692 |
}
|
2693 |
|
2694 |
|
2695 |
wdi_front.array_max = function (array)
|
2696 |
{
|
2697 |
+
var max = array[0];
|
2698 |
+
var minIndex = 0;
|
2699 |
+
for (var i = 1; i < array.length; i++) {
|
2700 |
+
if (max < array[i]) {
|
2701 |
+
max = array[i];
|
2702 |
+
minIndex = i;
|
2703 |
+
}
|
2704 |
+
}
|
2705 |
+
return {
|
2706 |
+
'value': max,
|
2707 |
+
'index': minIndex
|
2708 |
+
};
|
2709 |
}
|
2710 |
|
2711 |
wdi_front.array_min = function (array)
|
2712 |
{
|
2713 |
+
var min = array[0];
|
2714 |
+
var minIndex = 0;
|
2715 |
+
for (var i = 1; i < array.length; i++) {
|
2716 |
+
if (min > array[i]) {
|
2717 |
+
min = array[i];
|
2718 |
+
minIndex = i;
|
2719 |
+
}
|
2720 |
+
}
|
2721 |
+
return {
|
2722 |
+
'value': min,
|
2723 |
+
'index': minIndex
|
2724 |
+
};
|
2725 |
}
|
2726 |
|
2727 |
/*
|
2729 |
*/
|
2730 |
wdi_front.activeUsersCount = function (currentFeed)
|
2731 |
{
|
2732 |
+
var counter = 0;
|
2733 |
+
for (var i = 0; i < currentFeed.usersData.length; i++) {
|
2734 |
+
if (currentFeed.usersData[i].finished != 'finished') {
|
2735 |
+
counter++;
|
2736 |
+
}
|
2737 |
+
}
|
2738 |
+
return counter;
|
2739 |
}
|
2740 |
|
2741 |
|
2747 |
wdi_front.checkMediaResponse = function (response)
|
2748 |
{
|
2749 |
|
2750 |
+
if (response == '' || typeof response == 'undefined' || response == null) {
|
2751 |
+
errorMessage = wdi_front_messages.connection_error;
|
2752 |
+
wdi_front.show_alert(errorMessage);
|
2753 |
+
return false;
|
2754 |
+
}
|
2755 |
+
if (response['meta']['code'] != 200) {
|
2756 |
+
errorMessage = response['meta']['error_message'];
|
2757 |
+
wdi_front.show_alert(errorMessage);
|
2758 |
+
return false;
|
2759 |
+
}
|
2760 |
+
return response;
|
2761 |
}
|
2762 |
|
2763 |
|
2768 |
*/
|
2769 |
wdi_front.stripHashtag = function (hashtag)
|
2770 |
{
|
2771 |
+
switch (hashtag[0]) {
|
2772 |
+
case '#':
|
2773 |
+
{
|
2774 |
+
return hashtag.substr(1, hashtag.length);
|
2775 |
+
break;
|
2776 |
+
}
|
2777 |
+
default:
|
2778 |
+
{
|
2779 |
+
return hashtag;
|
2780 |
+
break;
|
2781 |
+
}
|
2782 |
+
}
|
2783 |
}
|
2784 |
|
2785 |
/**
|
2790 |
wdi_front.getInputType = function (input)
|
2791 |
{
|
2792 |
|
2793 |
+
switch (input[0]) {
|
2794 |
+
case '#':
|
2795 |
+
{
|
2796 |
+
return 'hashtag';
|
2797 |
+
break;
|
2798 |
+
}
|
2799 |
+
case '%':
|
2800 |
+
{
|
2801 |
+
return 'location';
|
2802 |
+
break;
|
2803 |
+
}
|
2804 |
+
default:
|
2805 |
+
{
|
2806 |
+
return 'user';
|
2807 |
+
break;
|
2808 |
+
}
|
2809 |
|
2810 |
+
}
|
2811 |
}
|
2812 |
|
2813 |
/**
|
2819 |
*/
|
2820 |
wdi_front.regexpTestCaption = function (captionText, searchkey)
|
2821 |
{
|
2822 |
+
var flag1 = false,
|
2823 |
+
flag2 = false,
|
2824 |
+
matchIndexes = [],
|
2825 |
+
escKey = searchkey.replace(/[-[\]{}()*+?.,\\^$|]/g, "\\$&"),
|
2826 |
+
regexp1 = new RegExp("(?:^|\\s)" + escKey + "(?:^|\\s)"),
|
2827 |
+
regexp2 = new RegExp("(?:^|\\s)" + escKey, 'g');
|
2828 |
+
if (regexp1.exec(captionText) != null) {
|
2829 |
+
flag1 = true;
|
2830 |
+
}
|
2831 |
|
2832 |
+
while (( match = regexp2.exec(captionText) ) != null) {
|
2833 |
+
if (match.index == captionText.length - searchkey.length - 1) {
|
2834 |
+
flag2 = true;
|
2835 |
+
}
|
2836 |
+
}
|
2837 |
|
2838 |
+
if (flag1 == true || flag2 == true) {
|
2839 |
+
return true;
|
2840 |
+
} else {
|
2841 |
+
return false;
|
2842 |
+
}
|
2843 |
|
2844 |
}
|
2845 |
|
2852 |
*/
|
2853 |
wdi_front.replaceNewLines = function (string)
|
2854 |
{
|
2855 |
+
var delimeter = "vUkCJvN2ps3t",
|
2856 |
+
matchIndexes = [],
|
2857 |
+
regexp;
|
2858 |
+
string = string.replace(/\r?\n|\r/g, delimeter);
|
2859 |
|
2860 |
+
regexp = new RegExp(delimeter, 'g');
|
2861 |
+
while (( match = regexp.exec(string) ) != null) {
|
2862 |
+
matchIndexes.push(match.index);
|
2863 |
+
}
|
2864 |
|
2865 |
+
var pieces = string.split(delimeter);
|
2866 |
+
var foundFlag = 0;
|
2867 |
|
2868 |
+
for (var i = 0; i < pieces.length; i++) {
|
2869 |
|
2870 |
+
if (pieces[i] == '') {
|
2871 |
+
foundFlag++;
|
2872 |
+
} else {
|
2873 |
+
foundFlag = 0;
|
2874 |
+
}
|
2875 |
|
2876 |
+
if (foundFlag > 0) {
|
2877 |
+
pieces.splice(i, 1);
|
2878 |
+
foundFlag--;
|
2879 |
+
i--;
|
2880 |
+
}
|
2881 |
|
2882 |
+
}
|
2883 |
+
string = pieces.join(' ');
|
2884 |
+
return string;
|
2885 |
}
|
2886 |
|
2887 |
|
2888 |
wdi_front.isEmptyObject = function (obj)
|
2889 |
{
|
2890 |
+
for (var prop in obj) {
|
2891 |
+
if (obj.hasOwnProperty(prop))
|
2892 |
+
return false;
|
2893 |
+
}
|
2894 |
+
return true
|
2895 |
}
|
2896 |
|
2897 |
|
2898 |
var WDIFeed = function (obj)
|
2899 |
{
|
2900 |
+
this['data'] = obj['data']
|
2901 |
+
this['dataCount'] = obj['dataCount']
|
2902 |
+
this['feed_row'] = obj['feed_row']
|
2903 |
+
this['usersData'] = obj['usersData']
|
2904 |
};
|
2905 |
|
2906 |
/**
|
2912 |
WDIFeed.prototype.conditionalFilter = function (response, args)
|
2913 |
{
|
2914 |
|
2915 |
+
var currentFeed = this,
|
2916 |
+
conditional_filter_type = currentFeed.feed_row.conditional_filter_type,
|
2917 |
+
filters = currentFeed.feed_row.conditional_filters;
|
2918 |
|
2919 |
|
2920 |
+
if (args.ignoreFiltering == true) {
|
2921 |
|
2922 |
+
} else {
|
2923 |
|
2924 |
+
/**
|
2925 |
+
* Get rid of duplicate media
|
2926 |
+
*/
|
2927 |
+
response = this.avoidDuplicateMedia(response);
|
2928 |
+
}
|
2929 |
|
2930 |
|
2931 |
+
//if filters json is invalid then return response without filtering
|
2932 |
+
if (!wdi_front.isJsonString(filters)) {
|
2933 |
+
return response;
|
2934 |
+
} else {
|
2935 |
+
filters = JSON.parse(filters);
|
2936 |
+
if (filters.length == 0) {
|
2937 |
+
return response;
|
2938 |
+
}
|
2939 |
+
}
|
2940 |
|
2941 |
|
2942 |
+
if (currentFeed.feed_row.conditional_filter_enable == '0') {
|
2943 |
+
return response;
|
2944 |
+
}
|
2945 |
|
2946 |
|
2947 |
+
//console.log('filtering');
|
2948 |
+
//increase counter for determing request count if this counter is more then
|
2949 |
+
//currentFeed.maxConditionalFiltersRequestCount then program will terminate recursion loop
|
2950 |
+
currentFeed.instagramRequestCounter++;
|
2951 |
|
2952 |
+
switch (conditional_filter_type) {
|
2953 |
+
case 'AND':
|
2954 |
+
{
|
2955 |
+
response = this.applyANDLogic(response, filters, currentFeed);
|
2956 |
+
break;
|
2957 |
+
}
|
2958 |
+
case 'OR':
|
2959 |
+
{
|
2960 |
+
response = this.applyORLogic(response, filters, currentFeed)
|
2961 |
+
break;
|
2962 |
+
}
|
2963 |
+
case 'NOR':
|
2964 |
+
{
|
2965 |
+
response = this.applyNORLogic(response, filters, currentFeed)
|
2966 |
+
break;
|
2967 |
+
}
|
2968 |
+
default:
|
2969 |
+
{
|
2970 |
+
break;
|
2971 |
+
}
|
2972 |
+
}
|
2973 |
|
2974 |
|
2975 |
+
return response;
|
2976 |
}
|
2977 |
|
2978 |
|
2984 |
*/
|
2985 |
WDIFeed.prototype.applyANDLogic = function (response, filters)
|
2986 |
{
|
2987 |
+
var currentFeed = this;
|
2988 |
+
for (var i = 0; i < filters.length; i++) {
|
2989 |
+
response = this.filterResponse(response, filters[i]);
|
2990 |
+
}
|
2991 |
|
2992 |
+
return response;
|
2993 |
}
|
2994 |
|
2995 |
/**
|
3000 |
*/
|
3001 |
WDIFeed.prototype.applyORLogic = function (response, filters)
|
3002 |
{
|
3003 |
+
var currentFeed = this;
|
3004 |
+
var allData = [],
|
3005 |
+
res,
|
3006 |
+
mergedData = [],
|
3007 |
+
returnObject,
|
3008 |
+
media;
|
3009 |
|
3010 |
+
for (var i = 0; i < filters.length; i++) {
|
3011 |
+
res = this.filterResponse(response, filters[i]);
|
3012 |
+
allData = allData.concat(res['data']);
|
3013 |
+
res = {};
|
3014 |
+
}
|
3015 |
|
3016 |
+
for (i = 0; i < allData.length; i++) {
|
3017 |
+
media = allData[i];
|
3018 |
+
if (!this.mediaExists(media, mergedData) && !this.mediaExists(media, currentFeed.dataStorageList)) {
|
3019 |
+
mergedData.push(media);
|
3020 |
+
}
|
3021 |
+
}
|
3022 |
|
3023 |
+
returnObject = {
|
3024 |
+
data: mergedData,
|
3025 |
+
meta: response['meta'],
|
3026 |
+
pagination: response['pagination']
|
3027 |
+
}
|
3028 |
+
return returnObject;
|
3029 |
}
|
3030 |
|
3031 |
|
3038 |
WDIFeed.prototype.applyNORLogic = function (response, filters)
|
3039 |
{
|
3040 |
|
3041 |
+
var res = response,
|
3042 |
+
currentFeed = this,
|
3043 |
+
matchedData = this.applyORLogic(response, filters, currentFeed),
|
3044 |
+
mergedData = [],
|
3045 |
+
returnObject;
|
3046 |
|
3047 |
+
for (var i = 0; i < res['data'].length; i++) {
|
3048 |
+
if (!this.mediaExists(res['data'][i], matchedData['data'])) {
|
3049 |
+
mergedData.push(res['data'][i]);
|
3050 |
+
}
|
3051 |
+
}
|
3052 |
|
3053 |
+
returnObject = {
|
3054 |
+
data: mergedData,
|
3055 |
+
meta: res['meta'],
|
3056 |
+
pagination: res['pagination']
|
3057 |
+
}
|
3058 |
+
return returnObject;
|
3059 |
}
|
3060 |
|
3061 |
|
3062 |
WDIFeed.prototype.mediaExists = function (media, array)
|
3063 |
{
|
3064 |
|
3065 |
+
for (var i = 0; i < array.length; i++) {
|
3066 |
+
if (media['id'] == array[i]['id']) {
|
3067 |
+
return true;
|
3068 |
+
}
|
3069 |
+
}
|
3070 |
+
return false;
|
3071 |
}
|
3072 |
|
3073 |
|
3080 |
WDIFeed.prototype.filterResponse = function (response, filter)
|
3081 |
{
|
3082 |
|
3083 |
+
switch (filter.filter_type) {
|
3084 |
+
case 'hashtag':
|
3085 |
+
{
|
3086 |
+
return this.filterByHashtag(response, filter);
|
3087 |
+
break;
|
3088 |
+
}
|
3089 |
+
case 'username':
|
3090 |
+
{
|
3091 |
+
return this.filterByUsername(response, filter);
|
3092 |
+
break;
|
3093 |
+
}
|
3094 |
+
case 'mention':
|
3095 |
+
{
|
3096 |
+
return this.filterByMention(response, filter);
|
3097 |
+
break;
|
3098 |
+
}
|
3099 |
+
case 'description':
|
3100 |
+
{
|
3101 |
+
return this.filterByDescription(response, filter);
|
3102 |
+
break;
|
3103 |
+
}
|
3104 |
+
case 'location':
|
3105 |
+
{
|
3106 |
+
return this.filterByLocation(response, filter);
|
3107 |
+
break;
|
3108 |
+
}
|
3109 |
+
case 'url':
|
3110 |
+
{
|
3111 |
+
return this.filterByUrl(response, filter);
|
3112 |
+
break;
|
3113 |
+
}
|
3114 |
+
}
|
3115 |
}
|
3116 |
|
3117 |
|
3123 |
*/
|
3124 |
WDIFeed.prototype.filterByHashtag = function (response, filter)
|
3125 |
{
|
3126 |
+
var filteredResponse = [],
|
3127 |
+
currentTag,
|
3128 |
+
media,
|
3129 |
+
returnObject;
|
3130 |
|
3131 |
+
for (var i = 0; i < response['data'].length; i++) {
|
3132 |
+
media = response['data'][i];
|
3133 |
+
for (var j = 0; j < media['tags'].length; j++) {
|
3134 |
+
tag = media['tags'][j];
|
3135 |
+
if (tag.toLowerCase() == filter.filter_by.toLowerCase()) {
|
3136 |
|
3137 |
+
filteredResponse.push(media);
|
3138 |
+
}
|
3139 |
+
}
|
3140 |
+
}
|
3141 |
|
3142 |
|
3143 |
+
returnObject = {
|
3144 |
+
data: filteredResponse,
|
3145 |
+
meta: response['meta'],
|
3146 |
+
pagination: response['pagination']
|
3147 |
+
}
|
3148 |
+
return returnObject;
|
3149 |
}
|
3150 |
|
3151 |
/**
|
3156 |
*/
|
3157 |
WDIFeed.prototype.filterByUsername = function (response, filter)
|
3158 |
{
|
3159 |
+
var filteredResponse = [],
|
3160 |
+
media,
|
3161 |
+
returnObject;
|
3162 |
|
3163 |
+
for (var i = 0; i < response['data'].length; i++) {
|
3164 |
+
media = response['data'][i];
|
3165 |
+
if (media.user.username.toLowerCase() == filter.filter_by.toLowerCase()) {
|
3166 |
+
filteredResponse.push(media);
|
3167 |
+
}
|
3168 |
+
}
|
3169 |
|
3170 |
|
3171 |
+
returnObject = {
|
3172 |
+
data: filteredResponse,
|
3173 |
+
meta: response['meta'],
|
3174 |
+
pagination: response['pagination']
|
3175 |
+
}
|
3176 |
+
return returnObject;
|
3177 |
}
|
3178 |
|
3179 |
|
3185 |
*/
|
3186 |
WDIFeed.prototype.filterByMention = function (response, filter)
|
3187 |
{
|
3188 |
+
var filteredResponse = [],
|
3189 |
+
media, captionText, returnObject;
|
3190 |
+
for (var i = 0; i < response['data'].length; i++) {
|
3191 |
+
media = response['data'][i];
|
3192 |
+
if (media['caption'] !== null) {
|
3193 |
+
captionText = media['caption']['text'].toLowerCase();
|
3194 |
+
if (captionText.indexOf('@' + filter.filter_by.toLowerCase()) != -1) {
|
3195 |
|
3196 |
+
filteredResponse.push(media);
|
3197 |
+
}
|
3198 |
+
}
|
3199 |
+
}
|
3200 |
|
3201 |
+
returnObject = {
|
3202 |
+
data: filteredResponse,
|
3203 |
+
meta: response['meta'],
|
3204 |
+
pagination: response['pagination']
|
3205 |
+
}
|
3206 |
+
return returnObject;
|
3207 |
}
|
3208 |
|
3209 |
|
3215 |
*/
|
3216 |
WDIFeed.prototype.filterByDescription = function (response, filter)
|
3217 |
{
|
3218 |
+
var filteredResponse = [],
|
3219 |
+
media, captionText, returnObject;
|
3220 |
|
3221 |
+
for (var i = 0; i < response['data'].length; i++) {
|
3222 |
+
media = response['data'][i];
|
3223 |
+
if (media['caption'] !== null) {
|
3224 |
|
3225 |
+
captionText = media['caption']['text'].toLowerCase();
|
3226 |
+
captionText = wdi_front.replaceNewLines(captionText);
|
3227 |
+
var searchkey = filter.filter_by.toLowerCase();
|
3228 |
|
3229 |
+
if (wdi_front.regexpTestCaption(captionText, searchkey)) {
|
3230 |
+
filteredResponse.push(media);
|
3231 |
+
}
|
3232 |
+
}
|
3233 |
+
}
|
3234 |
|
3235 |
+
returnObject = {
|
3236 |
+
data: filteredResponse,
|
3237 |
+
meta: response['meta'],
|
3238 |
+
pagination: response['pagination']
|
3239 |
+
}
|
3240 |
|
3241 |
+
return returnObject;
|
3242 |
}
|
3243 |
|
3244 |
|
3250 |
*/
|
3251 |
WDIFeed.prototype.filterByLocation = function (response, filter)
|
3252 |
{
|
3253 |
+
var filteredResponse = [],
|
3254 |
+
media, locationId, returnObject;
|
3255 |
+
for (var i = 0; i < response['data'].length; i++) {
|
3256 |
+
media = response['data'][i];
|
3257 |
|
3258 |
+
if (media['location'] !== null) {
|
3259 |
+
locationId = media['location']['id'];
|
3260 |
+
if (locationId == filter.filter_by) {
|
3261 |
+
filteredResponse.push(media);
|
3262 |
+
}
|
3263 |
+
}
|
3264 |
+
}
|
3265 |
|
3266 |
+
returnObject = {
|
3267 |
+
data: filteredResponse,
|
3268 |
+
meta: response['meta'],
|
3269 |
+
pagination: response['pagination']
|
3270 |
+
}
|
3271 |
+
return returnObject;
|
3272 |
}
|
3273 |
|
3274 |
|
3281 |
|
3282 |
WDIFeed.prototype.filterByUrl = function (response, filter)
|
3283 |
{
|
3284 |
+
var filteredResponse = [],
|
3285 |
+
media, id, returnObject, filter_by;
|
3286 |
|
3287 |
+
filter.filter_by = this.getIdFromUrl(filter.filter_by);
|
3288 |
|
3289 |
+
for (var i = 0; i < response['data'].length; i++) {
|
3290 |
+
media = response['data'][i];
|
3291 |
|
3292 |
+
if (media['link'] !== null) {
|
3293 |
+
id = this.getIdFromUrl(media['link']);
|
3294 |
+
if (id == filter.filter_by) {
|
3295 |
+
filteredResponse.push(media);
|
3296 |
+
}
|
3297 |
+
}
|
3298 |
+
}
|
3299 |
|
3300 |
+
returnObject = {
|
3301 |
+
data: filteredResponse,
|
3302 |
+
meta: response['meta'],
|
3303 |
+
pagination: response['pagination']
|
3304 |
+
}
|
3305 |
+
return returnObject;
|
3306 |
}
|
3307 |
|
3308 |
/**
|
3312 |
*/
|
3313 |
WDIFeed.prototype.getIdFromUrl = function (url)
|
3314 |
{
|
3315 |
+
var url_parts = url.split('/'),
|
3316 |
+
id = false;
|
3317 |
+
for (var i = 0; i < url_parts.length; i++) {
|
3318 |
+
if (url_parts[i] == 'p') {
|
3319 |
+
if (typeof url_parts[i + 1] != 'undefined') {
|
3320 |
+
id = url_parts[i + 1];
|
3321 |
+
break;
|
3322 |
+
}
|
3323 |
+
}
|
3324 |
+
}
|
3325 |
+
;
|
3326 |
+
return id;
|
3327 |
}
|
3328 |
|
3329 |
|
3334 |
*/
|
3335 |
WDIFeed.prototype.avoidDuplicateMedia = function (response)
|
3336 |
{
|
3337 |
+
var data = response['data'],
|
3338 |
+
uniqueData = [],
|
3339 |
+
returnObject = {};
|
3340 |
+
if (typeof data == "undefined") {
|
3341 |
+
data = [];
|
3342 |
+
}
|
3343 |
|
3344 |
+
for (var i = 0; i < data.length; i++) {
|
3345 |
+
if (!this.mediaExists(data[i], this.dataStorageList) && !this.mediaExists(data[i], uniqueData) && !this.mediaExists(data[i], this.conditionalFilterBuffer)) {
|
3346 |
+
uniqueData.push(data[i]);
|
3347 |
+
}
|
3348 |
+
}
|
3349 |
|
3350 |
+
this.conditionalFilterBuffer = this.conditionalFilterBuffer.concat(uniqueData);
|
3351 |
|
3352 |
+
returnObject = {
|
3353 |
+
data: uniqueData,
|
3354 |
+
meta: response['meta'],
|
3355 |
+
pagination: response['pagination']
|
3356 |
+
}
|
3357 |
|
3358 |
+
return returnObject;
|
3359 |
|
3360 |
}
|
3361 |
|
3363 |
/* stores data from objects array into global variable */
|
3364 |
WDIFeed.prototype.storeRawData = function (objects, variable)
|
3365 |
{
|
3366 |
+
var _this = this;
|
3367 |
+
if (typeof this[variable] == "object" && typeof this[variable].length == "number") {
|
3368 |
+
//checks if in golbal storage user already exisit then it adds new data to user old data
|
3369 |
+
//else it simple puches new user with it's data to global storage
|
3370 |
+
for (var i = 0; i < objects.length; i++) {
|
3371 |
+
|
3372 |
+
|
3373 |
+
var hash_id = "";
|
3374 |
+
if (wdi_front.isHashtag(objects[i].user_id)) {
|
3375 |
+
hash_id = objects[i].pagination.next_max_tag_id;
|
3376 |
+
}
|
3377 |
+
else
|
3378 |
+
if (_this.feed_row.liked_feed == 'liked') {
|
3379 |
+
hash_id = objects[i].pagination.next_max_like_id;
|
3380 |
+
if (typeof hash_id == "undefined") {
|
3381 |
+
hash_id = "";
|
3382 |
+
}
|
3383 |
+
}
|
3384 |
+
else {
|
3385 |
+
|
3386 |
+
/*strange bug sometimes happening in instagram API when user feed pagination is null*/
|
3387 |
+
if (objects[i].pagination == null) {
|
3388 |
+
objects[i].pagination = [];
|
3389 |
+
}
|
3390 |
+
|
3391 |
+
hash_id = objects[i].pagination.next_max_id;
|
3392 |
+
if (typeof hash_id == "undefined") {
|
3393 |
+
hash_id = "";
|
3394 |
+
}
|
3395 |
+
|
3396 |
+
|
3397 |
+
}
|
3398 |
+
|
3399 |
+
if (typeof this[variable][i] == "undefined") {
|
3400 |
+
this[variable].push({
|
3401 |
+
data: objects[i].data,
|
3402 |
+
index: 0,
|
3403 |
+
locked: false,
|
3404 |
+
hash_id: hash_id,
|
3405 |
+
usersDataFinished: false,
|
3406 |
+
userId: objects[i].user_id,
|
3407 |
+
length: function ()
|
3408 |
+
{
|
3409 |
+
return this.data.length - this.index;
|
3410 |
+
},
|
3411 |
+
getData: function (num)
|
3412 |
+
{
|
3413 |
+
var data = this.data.slice(this.index, this.index + num);
|
3414 |
+
this.index += Math.min(num, this.length());
|
3415 |
+
|
3416 |
+
if (this.index == this.data.length && this.locked == true && this.usersDataFinished == false) {
|
3417 |
+
|
3418 |
+
for (var j = 0; j < _this.usersData.length; j++) {
|
3419 |
+
if (_this.usersData[j]['user_id'] == this.userId) {
|
3420 |
+
_this.usersData[j].finished = "finished";
|
3421 |
+
this.usersDataFinished = true;
|
3422 |
+
break;
|
3423 |
+
}
|
3424 |
+
}
|
3425 |
+
}
|
3426 |
+
return data;
|
3427 |
+
}
|
3428 |
+
});
|
3429 |
+
} else {
|
3430 |
+
if (this[variable][i].locked == false) {
|
3431 |
+
|
3432 |
+
if (hash_id != this[variable][i].hash_id) {
|
3433 |
+
this[variable][i].data = this[variable][i].data.concat(objects[i].data);
|
3434 |
+
this[variable][i].hash_id = hash_id;
|
3435 |
+
} else {
|
3436 |
+
this[variable][i].locked = true;
|
3437 |
+
|
3438 |
+
}
|
3439 |
+
}
|
3440 |
+
|
3441 |
+
}
|
3442 |
+
}
|
3443 |
+
}
|
3444 |
|
3445 |
}
|
3446 |
|
3447 |
|
3448 |
wdi_front.updateUsersIfNecessary = function (currentFeed)
|
3449 |
{
|
3450 |
+
var users = currentFeed.feed_users;
|
3451 |
+
var ifUpdateNecessary = false;
|
3452 |
|
3453 |
+
for (var i = 0; i < users.length; i++) {
|
3454 |
+
if ("#" == users[i].username.substr(0, 1)) {
|
3455 |
+
users[i].id = users[i].username;
|
3456 |
+
continue;
|
3457 |
+
}
|
3458 |
+
if ("" == users[i].id || 'username' == users[i].id) {
|
3459 |
|
3460 |
+
ifUpdateNecessary = true;
|
3461 |
+
currentFeed.instagram.searchForUsersByName(users[i].username, {
|
3462 |
+
success: function (res)
|
3463 |
+
{
|
3464 |
+
if (res.meta.code == 200 && res.data.length > 0) {
|
3465 |
|
3466 |
+
var found = false;
|
3467 |
|
3468 |
+
for (var k = 0; k < res.data.length; k++) {
|
3469 |
+
if (res.data[k].username == res.args.username) {
|
3470 |
+
found = true;
|
3471 |
+
break;
|
3472 |
+
}
|
3473 |
+
}
|
3474 |
|
3475 |
+
if (found) {
|
3476 |
+
for (var j = 0; j < users.length; j++) {
|
3477 |
+
if (res.data[k].username == users[j].username) {
|
3478 |
+
users[j].id = res.data[k].id;
|
3479 |
+
}
|
3480 |
+
}
|
3481 |
+
}
|
3482 |
|
3483 |
|
3484 |
+
}
|
3485 |
|
3486 |
+
var noid_user_left = false;
|
3487 |
+
for (var m = 0; m < users.length; m++) {
|
3488 |
+
if (users[m].id == "" || users[m].id == "username") {
|
3489 |
+
noid_user_left = true;
|
3490 |
+
break;
|
3491 |
+
}
|
3492 |
+
}
|
3493 |
+
if (!noid_user_left) {
|
3494 |
+
currentFeed.feed_row.feed_users = JSON.stringify(users);
|
3495 |
+
wdi_front.init(currentFeed);
|
3496 |
+
}
|
3497 |
|
3498 |
+
},
|
3499 |
+
username: users[i].username
|
3500 |
+
});
|
3501 |
+
}
|
3502 |
+
}
|
3503 |
|
3504 |
+
return ifUpdateNecessary;
|
3505 |
}
|
3506 |
|
3507 |
|
3508 |
+
if (typeof wdi_ajax.ajax_response != "undefined") {
|
3509 |
+
jQuery(document).one('ajaxStop', function ()
|
3510 |
+
{
|
3511 |
|
3512 |
+
if (wdi_front['type'] != 'not_declared') {
|
3513 |
|
3514 |
+
wdi_front.clickOrTouch = wdi_front.detectEvent();
|
3515 |
+
//initializing all feeds in the page
|
3516 |
+
wdi_front.globalInit();
|
3517 |
+
} else {
|
3518 |
+
return;
|
3519 |
+
}
|
3520 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3521 |
|
3522 |
|
3523 |
}
|
3524 |
+
else {
|
3525 |
+
jQuery(document).ready(function ()
|
3526 |
+
{
|
3527 |
|
3528 |
|
3529 |
+
if (wdi_front['type'] != 'not_declared') {
|
3530 |
+
wdi_front.clickOrTouch = wdi_front.detectEvent();
|
3531 |
+
//initializing all feeds in the page
|
3532 |
+
wdi_front.globalInit();
|
3533 |
+
} else {
|
3534 |
+
return;
|
3535 |
+
}
|
3536 |
|
3537 |
+
});
|
3538 |
}
|
3539 |
|
3540 |
+
|
js/wdi_responsive.js
CHANGED
@@ -3,6 +3,7 @@ jQuery(document).ready(function ()
|
|
3 |
{
|
4 |
|
5 |
});
|
|
|
6 |
function wdi_responsive()
|
7 |
{
|
8 |
};
|
@@ -113,7 +114,7 @@ wdi_responsive.columnControl = function (currentFeed, load, customWidth)
|
|
113 |
for (var i = 0; i < colNum; i++) {
|
114 |
newCols += '<div class="wdi_masonry_column" wdi_mas_col="' + i + '"></div>';
|
115 |
}
|
116 |
-
newCols += '<div class="
|
117 |
wrapper.html(newCols);
|
118 |
|
119 |
//resetting index variables
|
@@ -219,6 +220,8 @@ wdi_responsive.showCaption = function (caption, currentFeedCounter)
|
|
219 |
|
220 |
//find maximum height in row
|
221 |
var maxHeight = 0;
|
|
|
|
|
222 |
for (var i = 0; i < indexes.length; i++) {
|
223 |
var currentItem = jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter + ' .wdi_feed_wrapper [' + indexType + '=' + indexes[i] + ']');
|
224 |
currentItem.addClass('wdi_row_affected');
|
3 |
{
|
4 |
|
5 |
});
|
6 |
+
|
7 |
function wdi_responsive()
|
8 |
{
|
9 |
};
|
114 |
for (var i = 0; i < colNum; i++) {
|
115 |
newCols += '<div class="wdi_masonry_column" wdi_mas_col="' + i + '"></div>';
|
116 |
}
|
117 |
+
newCols += '<div class="wdi_clear">';
|
118 |
wrapper.html(newCols);
|
119 |
|
120 |
//resetting index variables
|
220 |
|
221 |
//find maximum height in row
|
222 |
var maxHeight = 0;
|
223 |
+
|
224 |
+
|
225 |
for (var i = 0; i < indexes.length; i++) {
|
226 |
var currentItem = jQuery('#wdi_feed_' + currentFeed.feed_row.wdi_feed_counter + ' .wdi_feed_wrapper [' + indexType + '=' + indexes[i] + ']');
|
227 |
currentItem.addClass('wdi_row_affected');
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://web-dorado.com/products/wordpress-instagram-feed-wd.html
|
|
4 |
Tags: : custom instagram feed, feed, instagram, hashtag, Instagram feed, instagram gallery, instagram posts, Instagram images, Instagram photos, Instagram wall, lightbox, photos
|
5 |
Requires at least: 3.9
|
6 |
Tested up to: 4.7
|
7 |
-
Stable tag: 1.1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -107,6 +107,13 @@ After downloading the ZIP file of the Instagram Feed WD plugin,
|
|
107 |
|
108 |
== Changelog ==
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
= 1.1.21 =
|
111 |
New: Three new plugins added to featured plugins list: Ad Manager WD, Youtube WD and Staff Team WD
|
112 |
Fixed: Colors and opacities of share buttons in lightbox (PRO)
|
4 |
Tags: : custom instagram feed, feed, instagram, hashtag, Instagram feed, instagram gallery, instagram posts, Instagram images, Instagram photos, Instagram wall, lightbox, photos
|
5 |
Requires at least: 3.9
|
6 |
Tested up to: 4.7
|
7 |
+
Stable tag: 1.1.22
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
107 |
|
108 |
== Changelog ==
|
109 |
|
110 |
+
= 1.1.22 =
|
111 |
+
New: message displayed on frontend if feed has no media
|
112 |
+
Fixed: JS errors for media with Instagram's new "Slideshow" feature. This feature is not supported by Instagram's API yet.
|
113 |
+
Changed: Errors by plugin and Instagram API are alerted in frontend only for admins, otherwise output the message to the Web Console
|
114 |
+
Changed: Custom attribute "wdi_media_user" added to media containers in frontend. Useful for adding different event listeners, e.g. custom redirects for every user's media.
|
115 |
+
Changed: Minor style conflicts fixed
|
116 |
+
|
117 |
= 1.1.21 =
|
118 |
New: Three new plugins added to featured plugins list: Ad Manager WD, Youtube WD and Staff Team WD
|
119 |
Fixed: Colors and opacities of share buttons in lightbox (PRO)
|
wd-instagram-feed.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Instagram Feed WD
|
4 |
Plugin URI: https://web-dorado.com/products/wordpress-instagram-feed-wd.html
|
5 |
Description: WD Instagram 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.1.
|
7 |
Author: WebDorado
|
8 |
Author URI: https://web-dorado.com
|
9 |
License: GPLv2 or later
|
@@ -20,7 +20,7 @@ define("WDI_META", "_".WDI_VAR."_meta");
|
|
20 |
//define("wdi",'wdi');
|
21 |
define('WDI_FEED_TABLE','wdi_feeds');
|
22 |
define('WDI_THEME_TABLE','wdi_themes');
|
23 |
-
define('WDI_VERSION','1.1.
|
24 |
define('WDI_IS_PRO','false');
|
25 |
|
26 |
|
3 |
Plugin Name: Instagram Feed WD
|
4 |
Plugin URI: https://web-dorado.com/products/wordpress-instagram-feed-wd.html
|
5 |
Description: WD Instagram 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.1.22
|
7 |
Author: WebDorado
|
8 |
Author URI: https://web-dorado.com
|
9 |
License: GPLv2 or later
|
20 |
//define("wdi",'wdi');
|
21 |
define('WDI_FEED_TABLE','wdi_feeds');
|
22 |
define('WDI_THEME_TABLE','wdi_themes');
|
23 |
+
define('WDI_VERSION','1.1.22');
|
24 |
define('WDI_IS_PRO','false');
|
25 |
|
26 |
|