WD Facebook Feed – Custom Facebook Feed Plugin - Version 1.1.25

Version Description

  • Fixed: Include plugin css/js if feed exists.
  • Fixed: implode function arguments for php 7.4.
Download this release

Release Info

Developer 10web
Plugin Icon 128x128 WD Facebook Feed – Custom Facebook Feed Plugin
Version 1.1.25
Comparing to
See all releases

Code changes from version 1.1.24 to 1.1.25

css/ffwd_frontend.css CHANGED
@@ -248,3 +248,21 @@ div[class^="ffwd_title_spun"] a {
248
  word-wrap: break-word;
249
  z-index: 11;
250
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
  word-wrap: break-word;
249
  z-index: 11;
250
  }
251
+ .ffwd_load_more{
252
+ display: block;
253
+ width: 100%;
254
+ text-align: center;
255
+ cursor: pointer;
256
+ }
257
+ .ffwd_load_more.loading:after{
258
+ content: "";
259
+ display: inline-block;
260
+ width: 50px;
261
+ height: 50px;
262
+ background-image: url("../images/loader.svg");
263
+ background-position: center;
264
+ background-size: contain;
265
+ background-repeat: no-repeat;
266
+ position: relative;
267
+ top: 18px;
268
+ }
facebook-feed-wd.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: 10Web Social Feed
5
  * Plugin URI: https://10web.io/plugins/wordpress-facebook-feed/?utm_source=facebook_feed&utm_medium=free_plugin
6
  * Description: 10Web Social Feed is a completely customizable, responsive solution to help you display your Facebook feed on your WordPress website.
7
- * Version: 1.1.24
8
  * Author: 10Web
9
  * Author URI: https://10web.io/plugins/?utm_source=facebook_feed&utm_medium=free_plugin
10
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
@@ -15,7 +15,7 @@ define( 'WD_FFWD_URL', plugins_url( plugin_basename( dirname( __FILE__ ) ) ) );
15
  define( 'WD_FB_PREFIX', 'ffwd' );
16
  define( 'WD_FB_IS_FREE', TRUE );
17
  if (! defined( 'FFWD_VERSION' ) ){
18
- define ('FFWD_VERSION',"1.1.24");
19
  }
20
  add_action( 'admin_init', 'ffwd_init' );
21
 
@@ -441,6 +441,8 @@ add_shortcode( 'WD_FB', 'ffwd_shortcode' );
441
 
442
  $ffwd = 0;
443
  function ffwd_front_end( $params ) {
 
 
444
  global $ffwd;
445
  global $wpdb;
446
  require_once( WD_FFWD_DIR . '/frontend/controllers/FFWDControllerMain.php' );
@@ -1031,7 +1033,7 @@ function ffwd_front_end_scripts() {
1031
 
1032
  }
1033
 
1034
- add_action( 'wp_enqueue_scripts', 'ffwd_front_end_scripts' );
1035
  add_action( 'admin_enqueue_scripts', 'ffwd_enqueue__admin_scripts' );
1036
 
1037
  add_action( 'wp_ajax_ffwd_autoupdate', 'wd_fb_update' );
4
  * Plugin Name: 10Web Social Feed
5
  * Plugin URI: https://10web.io/plugins/wordpress-facebook-feed/?utm_source=facebook_feed&utm_medium=free_plugin
6
  * Description: 10Web Social Feed is a completely customizable, responsive solution to help you display your Facebook feed on your WordPress website.
7
+ * Version: 1.1.25
8
  * Author: 10Web
9
  * Author URI: https://10web.io/plugins/?utm_source=facebook_feed&utm_medium=free_plugin
10
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
15
  define( 'WD_FB_PREFIX', 'ffwd' );
16
  define( 'WD_FB_IS_FREE', TRUE );
17
  if (! defined( 'FFWD_VERSION' ) ){
18
+ define ('FFWD_VERSION',"1.1.25");
19
  }
20
  add_action( 'admin_init', 'ffwd_init' );
21
 
441
 
442
  $ffwd = 0;
443
  function ffwd_front_end( $params ) {
444
+ /* Enqueue css/js in frontend */
445
+ do_action("wp_enqueue_ffwd_front_end_scripts");
446
  global $ffwd;
447
  global $wpdb;
448
  require_once( WD_FFWD_DIR . '/frontend/controllers/FFWDControllerMain.php' );
1033
 
1034
  }
1035
 
1036
+ add_action('wp_enqueue_ffwd_front_end_scripts', 'ffwd_front_end_scripts');
1037
  add_action( 'admin_enqueue_scripts', 'ffwd_enqueue__admin_scripts' );
1038
 
1039
  add_action( 'wp_ajax_ffwd_autoupdate', 'wd_fb_update' );
framework/WDFacebookFeed.php CHANGED
@@ -755,7 +755,8 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? sanitiz
755
  }
756
  $fb_graph_url_update = str_replace(
757
  array('{FB_ID}', '{EDGE}', '{ACCESS_TOKEN}', '{FIELDS}', '{LIMIT}', '{OTHER}'),
758
- array('', '', 'ids=' . implode(array_keys($update_ids), ',') . '&access_token=' . self::$access_token . '&', $fields, 'locale=' . get_locale() . '&', ''),
 
759
  self::$graph_url
760
  );
761
 
@@ -1026,7 +1027,7 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? sanitiz
1026
  }
1027
  $fb_graph_url_update = str_replace(
1028
  array('{FB_ID}', '{EDGE}', '{ACCESS_TOKEN}', '{FIELDS}', '{LIMIT}', '{OTHER}'),
1029
- array('', '', 'ids=' . implode(array_keys($update_ids), ',') . '&access_token=' . self::$access_token . '&', $fields, 'locale=' . get_locale() . '&', ''),
1030
  self::$graph_url
1031
  );
1032
 
755
  }
756
  $fb_graph_url_update = str_replace(
757
  array('{FB_ID}', '{EDGE}', '{ACCESS_TOKEN}', '{FIELDS}', '{LIMIT}', '{OTHER}'),
758
+
759
+ array('', '', 'ids=' . implode(',', array_keys($update_ids)) . '&access_token=' . self::$access_token . '&', $fields, 'locale=' . get_locale() . '&', ''),
760
  self::$graph_url
761
  );
762
 
1027
  }
1028
  $fb_graph_url_update = str_replace(
1029
  array('{FB_ID}', '{EDGE}', '{ACCESS_TOKEN}', '{FIELDS}', '{LIMIT}', '{OTHER}'),
1030
+ array('', '', 'ids=' . implode(',', array_keys($update_ids)) . '&access_token=' . self::$access_token . '&', $fields, 'locale=' . get_locale() . '&', ''),
1031
  self::$graph_url
1032
  );
1033
 
images/loader.svg ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="margin: auto; background: none; display: block; shape-rendering: auto;" width="200px" height="200px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
3
+ <g transform="rotate(0 50 50)">
4
+ <rect x="47" y="24" rx="0" ry="0" width="6" height="12" fill="#908487">
5
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.9166666666666666s" repeatCount="indefinite"></animate>
6
+ </rect>
7
+ </g><g transform="rotate(30 50 50)">
8
+ <rect x="47" y="24" rx="0" ry="0" width="6" height="12" fill="#908487">
9
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.8333333333333334s" repeatCount="indefinite"></animate>
10
+ </rect>
11
+ </g><g transform="rotate(60 50 50)">
12
+ <rect x="47" y="24" rx="0" ry="0" width="6" height="12" fill="#908487">
13
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.75s" repeatCount="indefinite"></animate>
14
+ </rect>
15
+ </g><g transform="rotate(90 50 50)">
16
+ <rect x="47" y="24" rx="0" ry="0" width="6" height="12" fill="#908487">
17
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.6666666666666666s" repeatCount="indefinite"></animate>
18
+ </rect>
19
+ </g><g transform="rotate(120 50 50)">
20
+ <rect x="47" y="24" rx="0" ry="0" width="6" height="12" fill="#908487">
21
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.5833333333333334s" repeatCount="indefinite"></animate>
22
+ </rect>
23
+ </g><g transform="rotate(150 50 50)">
24
+ <rect x="47" y="24" rx="0" ry="0" width="6" height="12" fill="#908487">
25
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.5s" repeatCount="indefinite"></animate>
26
+ </rect>
27
+ </g><g transform="rotate(180 50 50)">
28
+ <rect x="47" y="24" rx="0" ry="0" width="6" height="12" fill="#908487">
29
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.4166666666666667s" repeatCount="indefinite"></animate>
30
+ </rect>
31
+ </g><g transform="rotate(210 50 50)">
32
+ <rect x="47" y="24" rx="0" ry="0" width="6" height="12" fill="#908487">
33
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.3333333333333333s" repeatCount="indefinite"></animate>
34
+ </rect>
35
+ </g><g transform="rotate(240 50 50)">
36
+ <rect x="47" y="24" rx="0" ry="0" width="6" height="12" fill="#908487">
37
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.25s" repeatCount="indefinite"></animate>
38
+ </rect>
39
+ </g><g transform="rotate(270 50 50)">
40
+ <rect x="47" y="24" rx="0" ry="0" width="6" height="12" fill="#908487">
41
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.16666666666666666s" repeatCount="indefinite"></animate>
42
+ </rect>
43
+ </g><g transform="rotate(300 50 50)">
44
+ <rect x="47" y="24" rx="0" ry="0" width="6" height="12" fill="#908487">
45
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.08333333333333333s" repeatCount="indefinite"></animate>
46
+ </rect>
47
+ </g><g transform="rotate(330 50 50)">
48
+ <rect x="47" y="24" rx="0" ry="0" width="6" height="12" fill="#908487">
49
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="0s" repeatCount="indefinite"></animate>
50
+ </rect>
51
+ </g>
52
+ <!-- [ldio] generated by https://loading.io/ --></svg>
js/ffwd_frontend.js CHANGED
@@ -1,1123 +1,1113 @@
1
  function ffwd_frontend_ajax(form_id, current_view, id, album_id, enter_or_back, type, srch_btn, title, sortByParam, load_more, image_onclick_action) {
2
- var page_number = jQuery("#page_number_" + current_view).val();
3
- var ffwd_load_more = jQuery("#ffwd_load_more_" + current_view).val();
4
- var ffwd_previous_album_ids = jQuery('#ffwd_previous_album_id_' + current_view).val();
5
- var ffwd_previous_album_page_numbers = jQuery('#album_page_number_' + current_view).val();
6
- var masonry_already_loaded = jQuery(".ffwd_masonry_thumb_cont_" + current_view + " img").length;
7
- if (typeof load_more == "undefined") {
8
- var load_more = false;
9
- }
10
- var post_data = {};
11
- if (album_id == 'back') { // Back from album.
12
- var album_page_number = ffwd_previous_album_page_numbers.split(",");
13
- page_number = album_page_number[0];
14
- jQuery('#album_page_number_' + current_view).val(ffwd_previous_album_page_numbers.replace(album_page_number[0] + ',', ''));
15
- }
16
- else if (enter_or_back != '') { // Enter album (not change the page).
17
- jQuery('#ffwd_previous_album_id_' + current_view).val(enter_or_back + ',' + ffwd_previous_album_ids);
18
- if (page_number) {
19
- jQuery('#album_page_number_' + current_view).val(page_number + ',' + ffwd_previous_album_page_numbers);
20
- }
21
- page_number = 1;
22
- }
23
- if (typeof title == "undefined") {
24
- var title = "";
25
- }
26
- if (typeof sortByParam == "undefined") {
27
- var sortByParam = jQuery(".bwg_order_" + current_view).val();
28
- }
29
- post_data["page_number_" + current_view] = page_number;
30
- post_data["ffwd_load_more_" + current_view] = ffwd_load_more;
31
- post_data["album_id_" + current_view] = album_id;
32
- post_data["ffwd_previous_album_id_" + current_view] = jQuery('#ffwd_previous_album_id_' + current_view).val();
33
- post_data["album_page_number_" + current_view] = jQuery('#album_page_number_' + current_view).val();
34
- post_data["type_" + current_view] = type;
35
- post_data["title_" + current_view] = title;
36
- post_data["sortImagesByValue_" + current_view] = sortByParam;
37
- // Loading.
38
- jQuery("#ffwd_ajax_loading_" + current_view).css('display', '');
39
- jQuery.post(
40
- window.location,
41
- post_data,
42
- function (data) {
43
- if (load_more) {
44
- var strr = jQuery(data).find('#' + id).html();
45
- jQuery('#' + id).append(strr);
46
- var str = jQuery(data).find('.ffwd_nav_cont_' + current_view).html();
47
- jQuery('.ffwd_nav_cont_' + current_view).html(str);
48
- }
49
- else {
50
- var str = jQuery(data).find('#' + form_id).html();
51
- jQuery('#' + form_id).html(str);
52
- }
53
- }
54
- ).success(function (jqXHR, textStatus, errorThrown) {
55
- jQuery("#ffwd_ajax_loading_" + current_view).css('display', 'none');
56
- if (jQuery(".pagination-links_" + current_view).length) {
57
- jQuery("html, body").animate({scrollTop: jQuery('#' + form_id).offset().top - 150}, 500);
58
- }
59
- /* For all*/
60
- window["ffwd_document_ready_" + current_view]();
61
- /* For masonry view.*/
62
- if (id == "ffwd_masonry_thumbnails_" + current_view || id == "ffwd_album_masonry_" + current_view) {
63
- window["ffwd_masonry_ajax_" + current_view](masonry_already_loaded);
64
- }
65
- });
66
- return false;
67
  }
68
  /* For thumnail amd masonry view */
69
  function ffwd_fill_likes_thumnail(id_object_id, ffwd, graph_url) {
70
- var ids_array_count=Math.ceil(id_object_id.length/50);
71
- var ids_array=[];
72
- var img_ids=[];
73
- for(var i = 0; i < ids_array_count; i++)
74
- {
75
- ids_array[i]=[];
76
- k=0;
77
- for(var j = i*50; j < (i+1)*50; j++ )
78
- {
79
- if(!id_object_id[j])
80
- break;
81
 
82
- ids_array[i][k]=[];
83
- var object_id = id_object_id[i]['from']+'_'+id_object_id[j]['object_id']
84
 
85
 
86
- ids_array[i][k]=object_id;
87
- img_ids[object_id]=id_object_id[j]['id'];
88
- k++;
89
- }
90
 
91
- }
92
 
93
- for(var i = 0; i < ids_array.length; i++)
94
- {
95
 
96
- ids=ids_array[i].join(',');
97
 
98
- url_for_cur_id_likes_thumb = graph_url.replace('{FB_ID}',''),
99
 
100
- graph_url_for_likes_thumb = url_for_cur_id_likes_thumb.replace('{EDGE}', '');
101
- graph_url_for_likes_thumb = graph_url_for_likes_thumb.replace('{FIELDS}', 'ids='+ids+'&fields=comments.summary(true).limit(0),likes.summary(true).limit(0)&');
102
- graph_url_for_likes_thumb = graph_url_for_likes_thumb.replace('{OTHER}', '');
103
 
104
- jQuery.getJSON(graph_url_for_likes_thumb,
105
- function(result)
106
- {
107
 
108
- for(var j in result)
109
- {
110
 
111
- ffwd_fill_likes_comments_thumb(result[j],ffwd,img_ids[j]);
112
 
113
 
114
- }
115
 
116
- }
117
- );
118
 
119
 
120
- }
121
 
122
 
123
  }
124
 
125
  function createCallback_thumbnail(id, ffwd, type) {
126
- return function (result) {
127
- do_something_with_data_thumbnail(result, id, ffwd, type);
128
- };
129
  }
130
 
131
  function ffwd_fill_likes_comments_thumb(result, ffwd,id) {
132
 
133
- var likes_count = (typeof result['likes']['summary'] != 'undefined') ? parseInt(result['likes']['summary']['total_count']) : '0';
134
- jQuery('#ffwd_likes_' + ffwd + '_' + id + ' span').html(likes_count);
135
-
136
- var comments_count = (typeof result['comments']['summary'] != 'undefined') ? parseInt(result['comments']['summary']['total_count']) : '0';
137
- jQuery('#ffwd_comments_' + ffwd + '_' + id + ' span').html(comments_count);
138
 
 
 
139
  }
140
 
141
  function do_something_with_data_thumbnail(result, id, ffwd, type) {
142
- switch (type) {
143
- case 'likes' :
144
- var likes_count = (typeof result['summary'] != 'undefined') ? parseInt(result['summary']['total_count']) : '0';
145
- jQuery('#ffwd_likes_' + ffwd + '_' + id + ' span').html(likes_count);
146
- break;
147
- case 'comments' :
148
- var comments_count = (typeof result['summary'] != 'undefined') ? parseInt(result['summary']['total_count']) : '0';
149
- jQuery('#ffwd_comments_' + ffwd + '_' + id + ' span').html(comments_count);
150
- break;
151
- default :
152
- console.log('error');
153
- break;
154
- }
155
  }
156
 
157
  /* For album view */
158
  function ffwd_fill_thum_srs_likes_compact_album(id_object_id, ffwd, graph_url, ffwd_album_info, image_onclick_action) {
159
- if (typeof id_object_id == 'object') {
160
- /*Album*/
161
 
162
 
163
- var ids_array_count=Math.ceil(id_object_id.length/50);
164
- var ids_array=[];
165
- var img_ids=[];
166
- for(var i = 0; i < ids_array_count; i++)
167
- {
168
- ids_array[i]=[];
169
- k=0;
170
- for(var j = i*50; j < (i+1)*50; j++ )
171
- {
172
- if(!id_object_id[j])
173
- break;
174
-
175
- ids_array[i][k]=[];
176
- var object_id = id_object_id[j]['object_id']
177
 
 
 
178
 
179
- ids_array[i][k]=object_id;
180
- img_ids[object_id]=id_object_id[j]['id'];
181
- k++;
182
- }
183
 
184
- }
 
 
 
185
 
186
- for(var i = 0; i < ids_array.length; i++)
187
- {
 
188
 
189
- ids=ids_array[i].join(',');
190
 
191
- url_for_cur_id_likes_thumb = graph_url.replace('{FB_ID}',''),
192
 
193
- graph_url_for_likes_thumb = url_for_cur_id_likes_thumb.replace('{EDGE}', 'photos');
194
- graph_url_for_likes_thumb = graph_url_for_likes_thumb.replace('{FIELDS}', 'ids='+ids+'&fields=source,width,height,count,link&');
195
- graph_url_for_likes_thumb = graph_url_for_likes_thumb.replace('{OTHER}', '');
196
- jQuery.getJSON(graph_url_for_likes_thumb,
197
- function(result)
198
- {
199
 
200
- for(var j in result)
201
- {
202
 
203
- ffwd_fill_likes_comments_c_album(result[j],ffwd,img_ids[j],ffwd_album_info, image_onclick_action);
204
 
205
 
206
- }
207
 
208
- }
209
- );
210
 
211
 
212
- }
213
 
214
 
215
 
216
 
217
- }
218
- else {
219
- /*Gallery*/
220
- var album_id = id_object_id,
221
- graph_url_for_album_photos = graph_url.replace('{EDGE}', 'photos'),
222
- url_for_album_photos = graph_url_for_album_photos.replace('{FB_ID}', album_id),
223
- url_for_album_photos = url_for_album_photos.replace('{FIELDS}', 'fields=images,link,from{picture,name,link}&');
224
 
225
 
226
- jQuery.getJSON(url_for_album_photos, createCallback_album('', ffwd, 'photos', graph_url, ffwd_album_info, image_onclick_action));
227
 
228
- }
229
  }
230
 
231
 
232
 
233
  function ffwd_fill_likes_comments_c_album(result,ffwd,id,ffwd_album_info, image_onclick_action)
234
  {
235
- var height = (typeof result['data'][0] != 'undefined') ? result['data'][0]['height'] : 0,
236
- width = (typeof result['data'][0] != 'undefined') ? result['data'][0]['width'] : 0,
237
- image_thumb_width,
238
- image_thumb_height,
239
- resolution_w,
240
- resolution_h,
241
- count = (typeof result['data'] != 'undefined') ? result['data'].length : 0,
242
- scale;
243
- if (count) {
244
- if (width && height) {
245
- resolution_w = width;
246
- resolution_h = height;
247
- if (resolution_w != 0 && resolution_h != 0) {
248
- scale = Math.max(ffwd_album_info["album_thumb_width"] / resolution_w, ffwd_album_info["album_thumb_height"] / resolution_h);
249
- image_thumb_width = resolution_w * scale;
250
- image_thumb_height = resolution_h * scale;
251
- }
252
- else {
253
- image_thumb_width = ffwd_album_info["album_thumb_width"];
254
- image_thumb_height = ffwd_album_info["album_thumb_height"];
255
- }
256
- }
257
- else {
258
- image_thumb_width = ffwd_album_info["album_thumb_width"];
259
- image_thumb_height = ffwd_album_info["album_thumb_height"];
260
- }
261
- scale = Math.max(ffwd_album_info["album_thumb_width"] / image_thumb_width, image_thumb_height / image_thumb_height);
262
- image_thumb_width *= scale;
263
- image_thumb_height *= scale;
264
- thumb_left = (ffwd_album_info["album_thumb_width"] - image_thumb_width) / 2;
265
- thumb_top = (ffwd_album_info["album_thumb_height"] - image_thumb_height) / 2;
266
-
267
- jQuery('#ffwd_album_cover_' + id + '_' + ffwd).attr('src', result['data'][0]['source']).css({
268
- 'width': image_thumb_width + 'px',
269
- 'height': image_thumb_height + 'px',
270
- 'margin-left': thumb_left + 'px',
271
- 'margin-top': thumb_top + 'px',
272
- });
273
- }
274
- else {
275
- /*jQuery( "[ffwd_object_id='"+object_id+"']" ).remove();*/
276
- }
277
  }
278
 
279
 
280
  function createCallback_album(id, ffwd, type, graph_url, ffwd_album_info, image_onclick_action) {
281
- return function (result) {
282
- do_something_with_data_album(result, id, ffwd, type, graph_url, ffwd_album_info, image_onclick_action);
283
- };
284
  }
285
 
286
  function ffwd_fill_likes_comments_c_gallery(result,ffwd,id) {
287
- var likes_count = (typeof result['likes']['summary'] != 'undefined') ? parseInt(result['likes']['summary']['total_count']) : '0';
288
- jQuery('#ffwd_likes_' + id + '_' + ffwd + ' span').html(likes_count);
289
 
290
 
291
- var comments_count = (typeof result['comments']['summary'] != 'undefined') ? parseInt(result['comments']['summary']['total_count']) : '0';
292
- jQuery('#ffwd_comments_' + id + '_' + ffwd + ' span').html(comments_count);
293
  }
294
 
295
 
296
  function do_something_with_data_album(result, id, ffwd, type, graph_url, ffwd_album_info, image_onclick_action) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
297
 
298
- switch (type) {
299
- case 'likes' :
300
- case 'comments' :
301
- var likes_count = (typeof result['likes']['summary'] != 'undefined') ? parseInt(result['likes']['summary']['total_count']) : '0';
302
- jQuery('#ffwd_likes_' + id + '_' + ffwd + ' span').html(likes_count);
303
-
304
-
305
- var comments_count = (typeof result['comments']['summary'] != 'undefined') ? parseInt(result['comments']['summary']['total_count']) : '0';
306
- jQuery('#ffwd_comments_' + id + '_' + ffwd + ' span').html(comments_count);
307
- break;
308
- case 'covers' :
309
- var height = (typeof result['data'][0] != 'undefined') ? result['data'][0]['height'] : 0,
310
- width = (typeof result['data'][0] != 'undefined') ? result['data'][0]['width'] : 0,
311
- image_thumb_width,
312
- image_thumb_height,
313
- resolution_w,
314
- resolution_h,
315
- count = (typeof result['data'] != 'undefined') ? result['data'].length : 0,
316
- scale;
317
- if (count) {
318
- if (width && height) {
319
- resolution_w = width;
320
- resolution_h = height;
321
- if (resolution_w != 0 && resolution_h != 0) {
322
- scale = Math.max(ffwd_album_info["album_thumb_width"] / resolution_w, ffwd_album_info["album_thumb_height"] / resolution_h);
323
- image_thumb_width = resolution_w * scale;
324
- image_thumb_height = resolution_h * scale;
325
- }
326
- else {
327
- image_thumb_width = ffwd_album_info["album_thumb_width"];
328
- image_thumb_height = ffwd_album_info["album_thumb_height"];
329
- }
330
- }
331
- else {
332
- image_thumb_width = ffwd_album_info["album_thumb_width"];
333
- image_thumb_height = ffwd_album_info["album_thumb_height"];
334
- }
335
- scale = Math.max(ffwd_album_info["album_thumb_width"] / image_thumb_width, image_thumb_height / image_thumb_height);
336
- image_thumb_width *= scale;
337
- image_thumb_height *= scale;
338
- thumb_left = (ffwd_album_info["album_thumb_width"] - image_thumb_width) / 2;
339
- thumb_top = (ffwd_album_info["album_thumb_height"] - image_thumb_height) / 2;
340
-
341
- jQuery('#ffwd_album_cover_' + id + '_' + ffwd).attr('src', result['data'][0]['source']).css({
342
- 'width': image_thumb_width + 'px',
343
- 'height': image_thumb_height + 'px',
344
- 'margin-left': thumb_left + 'px',
345
- 'margin-top': thumb_top + 'px',
346
- });
347
- }
348
- else {
349
- /*jQuery( "[ffwd_object_id='"+object_id+"']" ).remove();*/
350
- }
351
- break;
352
- case 'photos':
353
- var graph_url_for_likes = graph_url.replace('{EDGE}', ''),
354
- graph_url_for_likes = graph_url_for_likes.replace('{FIELDS}', ''),
355
- graph_url_for_comments = graph_url.replace('{EDGE}', ''),
356
- graph_url_for_comments = graph_url_for_comments.replace('{FIELDS}', '&fields=likes.summary(true).limit(0),comments.summary(true).limit(0)&');
357
-
358
- var data = result['data'];
359
-
360
- if(graph_url.indexOf("&after=")) {
361
- graph_url = graph_url.split("&after")[0];
362
- }
363
- if (graph_url.indexOf("&before=")) {
364
- graph_url = graph_url.split("&before")[0];
365
- }
366
- let prev_url = graph_url + '&before=' + result['paging']['cursors']['before'];
367
- let next_url = graph_url + '&after=' + result['paging']['cursors']['after'];
368
- let prev_url_graph = result['paging']['previous'];
369
- let next_url_graph = result['paging']['next'];
370
-
371
- content = '';
372
- ffwd_album_info["data"] = [];
373
- curent_view = ffwd;
374
-
375
-
376
- var ids_array_count=Math.ceil(data.length/50);
377
- var ids_array=[];
378
- var img_ids=[];
379
- for(var j = 0; j < ids_array_count; j++)
380
- {
381
- ids_array[j]=[];
382
- k=0;
383
- for(var i = j*50; i < (j+1)*50; i++ )
384
- {
385
- if(!data[i])
386
- break;
387
-
388
- ids_array[j][k]=[];
389
- var object_id = data[i]['from']['id']+'_'+data[i]['id']
390
-
391
-
392
- ids_array[j][k]=object_id;
393
- img_ids[object_id]=i;
394
- k++;
395
- //////////////////////////////////////////////////////
396
- var row = {},
397
- images = data[i]['images'],
398
- image_obj_id = data[i]['id'];
399
- index_in_images = (images.length > 3) ? 2 : 0,
400
- image = data[i]['images'][index_in_images];
401
- row['id'] = i;
402
- row['object_id'] = image_obj_id;
403
- row['from'] = data[i]['from']['id'];
404
- ffwd_album_info["data"].push(row);
405
-
406
- var height = image['height'],
407
- width = image['width'],
408
- image_thumb_width,
409
- image_thumb_height,
410
- resolution_w,
411
- resolution_h,
412
- scale;
413
-
414
- if (typeof width != 'undefined' && typeof height != 'undefined') {
415
- resolution_w = width;
416
- resolution_h = height;
417
- if (resolution_w != 0 && resolution_h != 0) {
418
- scale = Math.max(ffwd_album_info["thumb_width"] / resolution_w, ffwd_album_info["thumb_height"] / resolution_h);
419
- image_thumb_width = resolution_w * scale;
420
- image_thumb_height = resolution_h * scale;
421
- }
422
- else {
423
- image_thumb_width = ffwd_album_info["thumb_width"];
424
- image_thumb_height = ffwd_album_info["thumb_height"];
425
- }
426
- }
427
- else {
428
- image_thumb_width = ffwd_album_info["thumb_width"];
429
- image_thumb_height = ffwd_album_info["thumb_height"];
430
- }
431
-
432
- scale = Math.max(ffwd_album_info["thumb_width"] / image_thumb_width, image_thumb_height / image_thumb_height);
433
- image_thumb_width *= scale;
434
- image_thumb_height *= scale;
435
- thumb_left = (ffwd_album_info["thumb_width"] - image_thumb_width) / 2;
436
- thumb_top = (ffwd_album_info["thumb_height"] - image_thumb_height) / 2;
437
-
438
- main_url = image.source;
439
-
440
- if (image_onclick_action == 'facebook') {
441
- main_url = data[i]['link'];
442
- }
443
-
444
- if (image_onclick_action == 'none') {
445
- main_url = '#';
446
- }
447
-
448
-
449
- content += '<a class="ffwd_lightbox_' + curent_view + '" href="' + main_url + '" data-image-id="' + i + '" data-image-obj-id="' + image_obj_id + '" >' +
450
- '<div class="ffwd_standart_thumb_' + curent_view + '">' +
451
- '<div class="ffwd_standart_thumb_spun1_' + curent_view + '">' +
452
- '<div class="ffwd_standart_thumb_spun2_' + curent_view + '">' +
453
- '<img class="ffwd_standart_thumb_img_' + curent_view + '" style="width:' + image_thumb_width + 'px; height:' + image_thumb_height + 'px; margin-left: ' + thumb_left + 'px; margin-top: ' + thumb_top + 'px;" id="" src="' + image.source + '" alt="" />' +
454
- '<div class="ffwd_likes_comments_container_' + curent_view + '" >' +
455
- '<div class="ffwd_likes_comments_container_tab_' + curent_view + '" >' +
456
- '<div class="ffwd_likes_comments_' + curent_view + '" >' +
457
- '<div id="ffwd_likes_' + i + '_' + curent_view + '" class="ffwd_likes_' + curent_view + '">' +
458
- '<i class="ffwd ffwd-like"></i><span></span>' +
459
- '</div>' +
460
- '<div id="ffwd_comments_' + i + '_' + curent_view + '" class="ffwd_comments_' + curent_view + '">' +
461
- '<i class="ffwd ffwd-comment"></i><span></span>' +
462
- '</div>' +
463
- '<div style="clear:both"></div>' +
464
- '</div>' +
465
- '</div>' +
466
- '</div>' +
467
- '</div>' +
468
- '</div>' +
469
- '</div>' +
470
- '</a>';
471
-
472
- var url_for_likes = graph_url_for_likes.replace('{FB_ID}', data[i]['from']['id']+'_'+data[i]['id']),
473
- url_for_comments = graph_url_for_comments.replace('{FB_ID}', data[i]['from']['id']+'_'+data[i]['id']);
474
-
475
- //jQuery.getJSON(url_for_likes, createCallback_album(i, ffwd, 'likes'));
476
-
477
-
478
- // jQuery.getJSON(url_for_comments, createCallback_album(i, ffwd, 'comments'));
479
-
480
- }
481
-
482
- }
483
-
484
- //console.log(img_ids);
485
-
486
- for(var i = 0; i < ids_array.length; i++)
487
- {
488
-
489
- ids=ids_array[i].join(',');
490
-
491
-
492
-
493
- var graph_url_for_comments = graph_url.replace('{EDGE}', '');
494
- graph_url_for_comments=graph_url_for_comments.replace('{FB_ID}','')
495
- graph_url_for_comments = graph_url_for_comments.replace('{FIELDS}', '&ids='+ids+'&fields=likes.summary(true).limit(0),comments.summary(true).limit(0)&');
496
-
497
-
498
-
499
- jQuery.getJSON(graph_url_for_comments,
500
- function(result)
501
- {
502
-
503
- for(var j in result)
504
- {
505
-
506
- ffwd_fill_likes_comments_c_gallery(result[j],ffwd,img_ids[j]);
507
- // console.log(result[j]);
508
-
509
- }
510
-
511
- }
512
- ).success(simulateAjaxEnd());
513
-
514
-
515
- }
516
- content += '<br>';
517
- content += '<div class="tablenav-pages_'+ffwd+'" >';
518
- if (prev_url_graph) {
519
- content += '<a id="go_to_the_previous_page" title="Go to the previous page">Previous</a>'; /*enable prev button if graph has next cursor*/
520
- }
521
- if (next_url_graph) { // enable next button if graph has next cursor
522
- content +=' <a id="go_to_the_next_page" title="Go to the next page">Next</a> ';
523
- }
524
- content += '<div>';
525
 
526
- jQuery('#ffwd_gallery_' + curent_view).html(content);
527
- jQuery( "#go_to_the_next_page" ).on('click', function() { /* go to next page */
528
- ffwd_fill_thum_srs_likes_compact_album(album_id, '0',next_url,ffwd_album_info,"lightbox");
529
- });
530
- jQuery( "#go_to_the_previous_page" ).on('click', function() { /*go to prev page*/
531
- ffwd_fill_thum_srs_likes_compact_album(album_id, '0',prev_url,ffwd_album_info,"lightbox");
532
- });
533
- break;
534
- default :
535
- console.log('error');
536
- break;
537
- }
538
- ffwd_album_info_0["data"] = ffwd_album_info["data"];
539
- }
540
- /* For Blog-style view */
541
- function ffwd_get_passed_time(time) {
542
- var today = new Date(),
543
- arr = time.split(/[^0-9]/);
544
- today = Date.parse(today) / 1000 - client_server_date_difference;
545
- time = Date.UTC(arr[0], arr[1] - 1, arr[2], arr[3], arr[4], arr[5]);
546
- time /= 1000;
547
- time = today - time;
548
-
549
- var tokens = {
550
- 'year' : '31536000',
551
- 'month': '2592000',
552
- 'week': '604800',
553
- 'day': '86400',
554
- 'hour': '3600',
555
- 'minute': '60',
556
- 'second': '1'
557
- };
558
- var tokens_s = {
559
- 'year' : 'years',
560
- 'month': 'months',
561
- 'week': 'weeks',
562
- 'day': 'days',
563
- 'hour': 'hours',
564
- 'minute': 'minutes',
565
- 'second': 'seconds'
566
- };
567
- for (unit in tokens) {
568
- if (time < parseInt(tokens[unit])) continue;
569
- var numberOfUnits = Math.floor(time / parseInt(tokens[unit]));
570
-
571
- if(numberOfUnits > 1)
572
- return numberOfUnits + ' ' + ffwd_frontend_text[tokens_s[unit]] + ' ago';
573
-
574
- return numberOfUnits + ' ' + ffwd_frontend_text[unit] + ' ago' ;
575
- }
576
- }
577
 
578
- function ffwd_fill_likes_blog_style(id_object_id, ffwd, owner_info, ffwd_params, graph_url) {
 
 
579
 
 
 
 
580
 
581
 
582
- var ids_array_count=Math.ceil(id_object_id.length/50);
583
- var ids_array=[];
584
- var img_ids=[];
585
- for(var i = 0; i < ids_array_count; i++)
586
- {
587
- ids_array[i]=[];
588
- k=0;
589
- for(var j = i*50; j < (i+1)*50; j++ )
590
- {
591
- if(!id_object_id[j])
592
- break;
 
 
 
 
 
 
 
 
 
 
 
593
 
594
- ids_array[i][k]=[];
595
- var object_id = id_object_id[j]['object_id'];
596
 
 
597
 
598
- ids_array[i][k]=object_id;
599
- img_ids[object_id]=id_object_id[j]['id'];
600
- k++;
601
- }
602
 
603
- }
604
 
605
- var reactions_array={};
606
 
607
- /* for(var i = 0; i < ids_array.length; i++)
608
- {
609
 
610
- ids=ids_array[i].join(',');
611
 
612
- url_for_cur_id_likes = graph_url.replace('{FB_ID}',''),
613
- graph_url_for_likes = url_for_cur_id_likes.replace('{EDGE}', '');
614
- graph_url_for_likes = graph_url_for_likes.replace('{FIELDS}', 'ids='+ids+'&fields=reactions.type(LIKE).limit(0).summary(true).as(like),reactions.type(LOVE).limit(0).summary(true).as(love),reactions.type(WOW).limit(0).summary(true).as(wow),reactions.type(HAHA).limit(0).summary(true).as(haha),reactions.type(SAD).limit(0).summary(true).as(sad),reactions.type(ANGRY).limit(0).summary(true).as(angry),reactions.limit(5).summary(true).as(total_reactions)&');
615
- graph_url_for_likes = graph_url_for_likes.replace('{OTHER}', 'summary=true');
616
- jQuery.getJSON(graph_url_for_likes,
617
- function(result)
618
- {
619
 
620
- for(var j in result)
621
- {
622
 
623
- ffwd_fill_likes(result[j],ffwd,img_ids[j]);
624
 
625
- }
626
 
627
- }
628
- );
629
- }*/
630
 
631
- for(var i = 0; i < ids_array.length; i++)
632
- {
633
- ids=ids_array[i].join(',');
634
- url_for_cur_id_likes_blog = graph_url.replace('{FB_ID}',''),
635
- graph_url_for_likes = url_for_cur_id_likes_blog.replace('{EDGE}', '');
636
- graph_url_for_likes = graph_url_for_likes.replace('{FIELDS}', 'ids='+ids+'&fields=comments.summary(true).limit(0),likes.summary(true).limit(0)&');
637
- graph_url_for_likes = graph_url_for_likes.replace('{OTHER}', '');
638
 
639
- jQuery.getJSON(graph_url_for_likes,
640
- function(result)
641
- {
642
 
643
- for(var j in result)
644
- {
645
- var likes_count = (typeof result[j]['likes']['summary'] != 'undefined') ? parseInt(result[j]['likes']['summary']['total_count']) : '0';
646
- jQuery('#ffwd_likes_' + ffwd + '_' + img_ids[j] + ' span').html(likes_count);
 
 
647
 
648
- }
 
649
 
650
  }
651
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
652
  }
653
 
 
654
 
 
655
 
656
- for (var i = 0; i < id_object_id.length; i++) {
657
 
 
 
 
 
 
 
 
658
 
659
- /*For likes*/
 
 
660
 
661
- var object_id = id_object_id[i]['object_id'].replace(id_object_id[i]['from'], owner_info['id']);
 
 
 
662
 
663
- url_for_cur_id = graph_url.replace('{FB_ID}', object_id);
664
- graph_url_for_likes = url_for_cur_id.replace('{EDGE}', '');
665
- graph_url_for_likes = graph_url_for_likes.replace('{FIELDS}', 'fields=reactions.type(LIKE).limit(0).summary(true).as(like),reactions.type(LOVE).limit(0).summary(true).as(love),reactions.type(WOW).limit(0).summary(true).as(wow),reactions.type(HAHA).limit(0).summary(true).as(haha),reactions.type(SAD).limit(0).summary(true).as(sad),reactions.type(ANGRY).limit(0).summary(true).as(angry),reactions.limit(5).summary(true).as(total_reactions)&');
666
- graph_url_for_likes = graph_url_for_likes.replace('{OTHER}', 'summary=true');
667
 
668
- /*For comments*/
 
 
669
 
 
670
 
671
 
 
672
 
673
- var graph_url_for_comments = url_for_cur_id.replace('{EDGE}', 'comments');
674
- graph_url_for_comments = graph_url_for_comments.replace('{FIELDS}', 'fields=created_time,from,like_count,message,comment_count&');
675
- graph_url_for_comments = graph_url_for_comments.replace('{OTHER}', 'summary=true&filter=' + ffwd_params["comments_filter"] + '&order=' + ffwd_params["comments_order"] + '&limit=25');
676
 
677
- /*For future (attachment message_tags fields)*/
678
- /*console.log(graph_url_for_comments);*/
679
- /*For shares*/
680
- var graph_url_for_shares = url_for_cur_id.replace('{EDGE}', '');
681
- graph_url_for_shares = graph_url_for_shares.replace('{FIELDS}', 'fields=shares&');
682
- graph_url_for_shares = graph_url_for_shares.replace('{OTHER}', '');
683
 
684
- /*For attachments*/
685
- var graph_url_for_attachments = url_for_cur_id.replace('{EDGE}', 'attachments'),
686
- graph_url_for_attachments = graph_url_for_attachments.replace('{FIELDS}', '');
687
- graph_url_for_attachments = graph_url_for_attachments.replace('{OTHER}', '');
688
 
689
- /*For who post*/
690
 
691
- var url_for_who_post = graph_url.replace('{FB_ID}', id_object_id[i]['from']),
692
 
693
- graph_url_for_who_post = url_for_who_post.replace('{EDGE}', ''),
694
- graph_url_for_who_post = graph_url_for_who_post.replace('{FIELDS}', 'fields=picture,name,link&');
695
- graph_url_for_who_post = graph_url_for_who_post.replace('{OTHER}', '');
696
 
697
- if (id_object_id[i]['type'] != 'events') {
698
- //jQuery.getJSON(graph_url_for_likes, createCallback_blog_style(id_object_id[i]['id'], ffwd, 'likes'));
699
- //jQuery.getJSON(graph_url_for_shares, createCallback_blog_style(id_object_id[i]['id'], ffwd, 'shares'));
700
 
 
 
 
 
 
 
701
 
702
- //do_something_with_data_blog_style(reactions_array[object_id], id_object_id[i]['id'], ffwd, 'likes', "", ffwd_params, graph_url);
 
 
 
703
 
704
- if(!id_object_id[i]['shares'])
705
- {
706
- id_object_id[i]['shares']='{}';
707
- }
708
 
709
- do_something_with_data_blog_style(id_object_id[i]['shares'], id_object_id[i]['id'], ffwd, 'shares', "", ffwd_params, graph_url);
710
 
711
- // jQuery.getJSON(graph_url_for_attachments, createCallback_blog_style(id_object_id[i]['id'], ffwd, 'attachments', "", ffwd_params));
 
 
712
 
 
 
 
713
 
714
- if(id_object_id[i]['attachments'])
715
- do_something_with_data_blog_style(id_object_id[i]['attachments'], id_object_id[i]['id'], ffwd, 'attachments', "", ffwd_params, graph_url);
716
 
717
- }
 
 
 
 
 
 
 
718
 
719
- if(id_object_id[i]['comments']);
720
- do_something_with_data_blog_style(id_object_id[i]['comments'], id_object_id[i]['id'], ffwd, 'comments', "", ffwd_params, graph_url);
 
 
 
721
 
 
 
722
 
723
  // jQuery.getJSON(id_object_id[i]['comments'], createCallback_blog_style(id_object_id[i]['id'], ffwd, 'comments', "", ffwd_params, graph_url));
724
- //jQuery.getJSON(graph_url_for_who_post, createCallback_blog_style(id_object_id[i], ffwd, 'who_post', owner_info, ffwd_params));
725
- do_something_with_data_blog_style(id_object_id[i]['who_post'], id_object_id[i], ffwd, 'who_post', owner_info, ffwd_params, graph_url);
726
 
727
 
728
 
729
- }
730
  }
731
 
732
  function createCallback_blog_style(id, ffwd, type, owner_info, ffwd_params, graph_url) {
733
- return function (result) {
734
- do_something_with_data_blog_style(result, id, ffwd, type, owner_info, ffwd_params, graph_url);
735
- };
736
  }
737
 
738
  function do_something_with_data_blog_style(result, id, ffwd, type, owner_info, ffwd_params, graph_url) {
739
 
740
- switch (type) {
741
-
742
- case 'comments' :
743
-
744
- var total_count = (result['data'].length < 25) ? result['data'].length : result['summary']['total_count'];
745
- jQuery('#ffwd_comments_count_' + ffwd + '_' + id + ' span').html(total_count);
746
- /*console.log(result);
747
- console.log(result['data'].length);*/
748
- var more_comments = false,
749
- comments_exist = false;
750
- for (var i = 0, j = 1, z = 0; i < result['data'].length; i++, j++) {
751
- comments_exist = true;
752
- comment_id = result['data'][i]['id'];
753
- var display = 'display:block';
754
- if (j > 4) {
755
- display = 'display:none';
756
- more_comments = true;
757
- z++;
758
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
759
 
760
- /*
761
- var url_for_cur_id_comm_user_pic = graph_url.replace('{FB_ID}', result['data'][i]['from']['id']);
762
- url_for_cur_id_comm_user_pic = url_for_cur_id_comm_user_pic.replace('{EDGE}', '');
763
- url_for_cur_id_comm_user_pic = url_for_cur_id_comm_user_pic.replace('{FIELDS}', 'fields=picture&');
764
- url_for_cur_id_comm_user_pic = url_for_cur_id_comm_user_pic.replace('{OTHER}', '');
765
- */
766
-
767
-
768
-
769
- //var comment_author_pic = '<div style="float:left" id="ffwd_comment_author_pic_' + ffwd + '_' + id + '" class="ffwd_comment_author_pic_' + ffwd + '" > <img class="user_' + result['data'][i]['from']['id'] + '" src="https://graph.facebook.com/'+result['data'][i]['from']['id']+'/picture" > </div>',
770
- var comment_author_pic = '<span></span>',
771
- comment_author_name = '<span></span>',
772
- //comment_author_name = '<a id="ffwd_comment_author_name_' + ffwd + '_' + id + '" href="https://www.facebook.com/' + result['data'][i]['from']['id'] + '" class="ffwd_comment_author_name_' + ffwd + '" > ' + result['data'][i]['from']['name'] + ' </a>',
773
- comment_message = '<span id="ffwd_comment_message_' + ffwd + '_' + id + '" class="ffwd_comment_message_' + ffwd + '" > ' + result['data'][i]['message'] + ' </span>',
774
- comment_date = '<span id="ffwd_comment_date_' + ffwd + '_' + id + '" class="ffwd_comment_date_' + ffwd + '" > ' + ffwd_get_passed_time(result['data'][i]['created_time']) + '</span>',
775
- comment_likes_count = '<span id="ffwd_comment_likes_count_' + ffwd + '_' + id + '" class="ffwd_comment_likes_count_' + ffwd + '" > ' + result['data'][i]['like_count'] + ' </span>',
776
- comments_date_likes = '<div>' + comment_date + comment_likes_count + '</div>',
777
- comment_replies_cont = (ffwd_params["comments_filter"] == "toplevel" && ffwd_params["comments_replies"] == "1" && result['data'][i]['comment_count'] > 0) ? '<div class="ffwd_comment_replies_' + ffwd + '"><div id="ffwd_comment_replies_label_'+comment_id+'" class="ffwd_comment_replies_label_' + ffwd + '">' + result['data'][i]['comment_count'] +' '+ffwd_frontend_text.comment_reply+' </div><div class="ffwd_comment_replies_content_' + ffwd + '"></div></div>' : '',
778
- comment_div_cont = '<div class="ffwd_comment_content_' + ffwd + '" id="ffwd_comment_content_' + ffwd + '_' + id + '" >' + comment_author_name + comment_message + comments_date_likes + comment_replies_cont + '<div style="clear:both"></div></div>',
779
- comment = '<div id="ffwd_comment_' + ffwd + '_' + comment_id + '" class="ffwd_comment_' + ffwd + '" style="' + display + '">' + comment_author_pic + comment_div_cont + '<div style="clear:both" > </div></div>';
780
-
781
- jQuery('#ffwd_comments_content_' + id + '_' + ffwd + '').append(comment);
782
- (function (i) {
783
- jQuery('#ffwd_comment_replies_label_' + result['data'][i]['id']).bind("click", function () {
784
-
785
- ffwd_get_comments_replies(result['data'][i]['id'], graph_url, ffwd_params, ffwd);
786
- })
787
- }(i))
788
-
789
-
790
- }
791
- if (more_comments) {
792
- jQuery('#ffwd_comments_content_' + id + '_' + ffwd).append('<div class="ffwd_view_more_comments_cont_' + ffwd + '"> <a href="#" class="ffwd_view_more_comments" more_count="' + z + '"> <span>'+ffwd_frontend_text.view+' '+ z + ' '+ffwd_frontend_text.more_comments+'</span> <a> </div>');
793
- }
794
- if (!comments_exist) {
795
- jQuery('#ffwd_comments_content_' + id + '_' + ffwd).remove();
796
- }
797
- ffwd_blog_style_resize(ffwd_params, ffwd);
798
- break;
799
- case 'shares' :
800
-
801
- var shares_count = (result!= null && result['count'] != null) ? parseInt(result['count']) : '0';
802
- jQuery('#ffwd_shares_' + ffwd + '_' + id + ' span').html(shares_count);
803
- break;
804
- case 'attachments' :
805
- var src = '', length = 0, album_id = '';
806
- /*
807
- erb story mej nshaca vor addes photos aranc albumi anun talu hetevabar @ngela timline -i mej
808
- u avtomat et posti subattachmentsneri arkayutayn depqum kberi dranq, ISK ete nshvaca added photos to album esinch
809
- hetevabar petqa albumi id-in vercnel araji media-i targeti urlic u pageID + albumid posti subattamentner@ cuyc tal!!!!!
810
- */
811
-
812
- if (result) {
813
- /*If exists subattachments*/
814
- if (result['subattachments']) {
815
- length = result['subattachments']['data'].length;
816
- if (typeof result['subattachments']['data'][0]['media'] != "undefined") {
817
- src = result['subattachments']['data'][0]['media']['image']['src'];
818
- }
819
- /*First time add profile picture*/
820
- if (result['type'] == 'gallery') {
821
- src = result['subattachments']['data'][length - 1]['media']['image']['src'];
822
- }
823
- }
824
- else if (result['media']) {
825
- /* Check album containing this photo (compare title)
826
- * If not Timeline photos or Profile Pictures so get photos from that album
827
- */
828
- /*if (result['data'][0]['title'] != 'Timeline Photos' && result['data'][0]['title'] != 'Profile Pictures') {
829
- album_id = result['data'][0]['url'].split("photos/");
830
- if (typeof album_id[1] != 'undefined') {
831
- album_id = album_id[1].split(".");
832
- album_id = album_id[1];
833
-
834
- }
835
- }*/
836
- src = result['media']['image']['src'];
837
- }
838
-
839
-
840
- jQuery('#ffwd_blog_style_img_' + id + '_' + ffwd).attr('src', src);
841
- if (src == '')
842
- jQuery('#ffwd_blog_style_img_' + id + '_' + ffwd).remove();
843
-
844
- }
845
- ffwd_blog_style_resize(ffwd_params, ffwd);
846
- break;
847
- case 'who_post' :
848
-
849
- var who_post = result;
850
-
851
- var who_post_name_link = (ffwd_params['blog_style_author'] == "1") ? '<a class="ffwd_blog_style_object_from_name_' + ffwd + '" href="https://www.facebook.com/' + who_post['id'] + '" target="_blank">' + who_post['name'] + '</a>' : '',
852
- owner_name_link = '<a class="ffwd_blog_style_object_from_name_' + ffwd + '" href="https://www.facebook.com/' + owner_info['id'] + '" target="_blank">' + owner_info['name'] + '</a>',
853
- who_post_pic = '<img id="ffwd_user_pic_' + ffwd + '_' + id['id'] + '" class="ffwd_user_pic" src="' + who_post['picture']['data']['url'] + '" style="width:50px;height:50px;box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);margin-top: 9px;">',
854
- place,
855
- full_place = '',
856
- story = id['story'].replace(/'/g, "&#039;"),
857
- who_post_index = story.indexOf(who_post['name']),
858
- owner_index = story.indexOf(owner_info['name']),
859
- place_name = '',
860
- place_id = '',
861
- story_tags = id['story_tags'],
862
- place_index = -1;
863
-
864
- if (id['place'] != null) {
865
- /* place_id = id['place']['id'];
866
- if(id['place']['location']){
867
- var street = (ffwd_params['event_street'] == "1") ? ((typeof id['place']['location']['street'] != 'undefined') ? id['place']['location']['street'] : '') : '',
868
- city = (ffwd_params['event_city'] == "1") ? ((typeof id['place']['location']['city'] != 'undefined') ? id['place']['location']['city'] : '') : '',
869
- country = (ffwd_params['event_country'] == "1") ? ((typeof id['place']['location']['country'] != 'undefined') ? id['place']['location']['country'] : '') : '',
870
- state = (ffwd_params['event_zip'] == "1") ? ((typeof id['place']['location']['state'] != 'undefined') ? id['place']['location']['state'] : '') : '',
871
- zip = (ffwd_params['event_zip'] == "1") ? ((typeof id['place']['location']['zip'] != 'undefined') ? id['place']['location']['zip'] : '') : '',
872
- latitude = (ffwd_params['event_map'] == "1") ? ((typeof id['place']['location']['latitude'] != 'undefined') ? id['place']['location']['latitude'] : '') : '',
873
- longitude = (ffwd_params['event_map'] == "1") ? ((typeof id['place']['location']['longitude'] != 'undefined') ? id['place']['location']['longitude'] : '') : '';
874
-
875
- full_place = ((ffwd_params['event_street'] == "1") ? '<div class="ffwd_place_street_' + ffwd + '" >' + street + '</div> ' : '') +
876
- ((ffwd_params['event_city'] == "1" || ffwd_params['event_zip'] == "1" || ffwd_params['event_country'] == "1" ) ? '<div class="ffwd_place_city_state_country_' + ffwd + '" >' + city + ' ' + state + ' ' + zip + ' ' + country + '</div>' : '') +
877
- ((ffwd_params['event_map'] == "1") ? '<a class="ffwd_place_map_' + ffwd + '" style="text-decoration:underline" href="https://maps.google.com/maps?q=' + latitude + ',' + longitude + '" target="_blank">Map</a>' : '');
878
- }*/
879
- if(id['place']['name'] && ffwd_params['event_street'] == "1"){
880
- full_place = '<div class="ffwd_place_city_state_country_' + ffwd + '" >' + id['place']['name'] + '</div>';
881
- }
882
- }
883
- // Who post
884
- if (who_post_index != -1) {
885
- story = story.replace(who_post['name'], who_post_name_link);
886
- }
887
- if (owner_index != -1) {
888
- story = story.replace(owner_info['name'], owner_name_link);
889
- }
890
- if (who_post_index == -1 && owner_index == -1) {
891
- story = who_post_name_link;
892
- }
893
-
894
- // With whom after was
895
- if (story_tags != null) {
896
- var type = story_tags.constructor.name;
897
- if (type == "Object") {
898
- for (var x in story_tags) {
899
- var story_tag_name = story_tags[x]["0"]["name"],
900
- story_tag_id = story_tags[x]["0"]["id"];
901
- with_name_index = story.indexOf(story_tag_name);
902
- if ((with_name_index != -1) && (story_tag_name != who_post['name']) && (story_tag_name != owner_info['name']) && (story_tag_id != place_id)) {
903
- story_tag_link = (/*ffwd_params['blog_style_with_whom'] == "1"*/true) ? '<a class="ffwd_blog_style_object_from_name_' + ffwd + '" href="https://www.facebook.com/' + story_tag_id + '" target="_blank">' + story_tag_name + '</a>' : '',
904
- story = story.replace(story_tag_name, story_tag_link);
905
- }
906
- else if (story_tag_id == place_id) {
907
- // Where after was
908
- place_index = 1;
909
- place = (ffwd_params['blog_style_place_name'] == "1") ? '<a class="ffwd_place_name_' + ffwd + '" href="https://www.facebook.com/' + story_tag_id + '" target="_blank">' + story_tag_name + '</a>' : '';
910
- story = story.replace("\u2014", "");
911
- story = story.replace(story_tag_name, place);
912
- }
913
- }
914
- }
915
- else if (type == "Array") {
916
- for (var j = 0; j < story_tags.length; j++) {
917
- if (typeof story_tags[j]["0"] != "undefined") {
918
- var story_tag_name = story_tags[j]["0"]["name"],
919
- story_tag_id = story_tags[j]["0"]["id"];
920
- } else {
921
- var story_tag_name = story_tags[j].name,
922
- story_tag_id = story_tags[j].id;
923
- }
924
- with_name_index = story.indexOf(story_tag_name);
925
- if ((with_name_index != -1) && (story_tag_name != who_post['name']) && (story_tag_name != owner_info['name']) && (story_tag_id != place_id)) {
926
- story_tag_link = (/*ffwd_params['blog_style_with_whom'] == "1"*/true) ? '<a class="ffwd_blog_style_object_from_name_' + ffwd + '" href="https://www.facebook.com/' + story_tag_id + '" target="_blank">' + story_tag_name + '</a>' : '',
927
- story = story.replace(story_tag_name, story_tag_link);
928
- }
929
-
930
- else if (story_tag_id == place_id) {
931
- // Where after was
932
- place_index = 1;
933
- place = (ffwd_params['blog_style_place_name'] == "1") ? '<a class="ffwd_place_name_' + ffwd + '" href="https://www.facebook.com/' + story_tag_id + '" target="_blank">' + story_tag_name + '</a>' : '';
934
- story = story.replace("\u2014", "");
935
- story = story.replace(story_tag_name, place);
936
- }
937
- }
938
- }
939
- }
940
- // Where after was
941
- if (ffwd_params['blog_style_place_name'] == "1"/* && typeof place != 'undefined' && place != ''*/) {
942
- if (id['type'] == 'events') {
943
- story += full_place;
944
- }
945
- }
946
- else {
947
- story = story.replace(/ at| in|/gi, "");
948
- }
949
- jQuery('#ffwd_blog_style_object_from_pic_' + ffwd + '_' + id['id']).html(who_post_pic).attr("href", who_post['link']);
950
- jQuery('#ffwd_blog_style_object_story_' + ffwd + '_' + id['id']).html(story);
951
- break;
952
- default :
953
- break;
954
- }
955
  }
956
 
957
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
958
  function ffwd_get_comments_replies(comment_id,graph_url,ffwd_params,ffwd) {
959
 
960
- var url_for_cur_id_comm_replies = graph_url.replace('{FB_ID}', comment_id);
961
- url_for_cur_id_comm_replies = url_for_cur_id_comm_replies.replace('{EDGE}', 'comments');
962
- url_for_cur_id_comm_replies = url_for_cur_id_comm_replies.replace('{FIELDS}', 'fields=parent,created_time,from,like_count,message&');
963
- url_for_cur_id_comm_replies = url_for_cur_id_comm_replies.replace('{OTHER}', '');
964
- jQuery.getJSON(url_for_cur_id_comm_replies, function (result) {
965
- for (var k = 0; k < result['data'].length; k++) {
966
- var parent_comm_id = result['data'][k]["parent"]["id"],
967
- comment_reply_id = result['data'][k]["id"];
968
-
969
- var url_for_cur_id_comm_rep_user_pic = graph_url.replace('{FB_ID}', result['data'][k]['from']['id']);
970
- url_for_cur_id_comm_rep_user_pic = url_for_cur_id_comm_rep_user_pic.replace('{EDGE}', '');
971
- url_for_cur_id_comm_rep_user_pic = url_for_cur_id_comm_rep_user_pic.replace('{FIELDS}', 'fields=picture&');
972
- url_for_cur_id_comm_rep_user_pic = url_for_cur_id_comm_rep_user_pic.replace('{OTHER}', '');
973
-
974
- var comment_reply_author_pic = '<div style="float:left" class="ffwd_comment_reply_author_pic_' + ffwd + '" > <img class="reply_user_' + result['data'][k]['from']['id'] + '" src="https://graph.facebook.com/'+result['data'][k]['from']['id']+'/picture" > </div>',
975
- comment_reply_author_name = '<a href="https://www.facebook.com/' + result['data'][k]['from']['id'] + '" class="ffwd_comment_reply_author_name_' + ffwd + '" > ' + result['data'][k]['from']['name'] + ' </a>',
976
- comment_reply_message = '<span class="ffwd_comment_reply_message_' + ffwd + '" > ' + result['data'][k]['message'] + ' </span>',
977
- comment_reply_date = '<span class="ffwd_comment_reply_date_' + ffwd + '" > ' + ffwd_get_passed_time(result['data'][k]['created_time']) + '</span>',
978
- comment_reply_likes_count = '<span class="ffwd_comment_reply_likes_count_' + ffwd + '" > ' + result['data'][k]['like_count'] + ' </span>',
979
- comments_reply_date_likes = '<div>' + comment_reply_date + comment_reply_likes_count + '</div>',
980
- comment_reply_div_cont = '<div class="ffwd_comment_reply_content_' + ffwd + '" >' + comment_reply_author_name + comment_reply_message + comments_reply_date_likes + '<div style="clear:both"></div></div>',
981
- comment_reply = '<div id="ffwd_comment_reply_' + ffwd + '_' + comment_reply_id + '" class="ffwd_comment_reply_' + ffwd + '">' + comment_reply_author_pic + comment_reply_div_cont + '<div style="clear:both" > </div></div>';
982
- jQuery('#ffwd_comment_' + ffwd + '_' + parent_comm_id + ' .ffwd_comment_replies_content_' + ffwd).append(comment_reply);
983
-
984
- }
985
- ffwd_blog_style_resize(ffwd_params, ffwd);
986
- });
987
 
988
 
989
  }
990
  function ffwd_fill_likes(result, ffwd, id) {
991
- var total_reactions_count = {}
992
- total_reactions_count[ffwd] = parseInt(result['total_reactions']['summary']['total_count']);
993
- var likes_count = {};
994
- likes_count[ffwd] = parseInt(result['like']['summary']['total_count']);
995
- var love_count = {};
996
- love_count[ffwd] = parseInt(result['love']['summary']['total_count']);
997
- var wow_count = {};
998
- wow_count[ffwd] = parseInt(result['wow']['summary']['total_count']);
999
- var haha_count = {};
1000
- haha_count[ffwd] = parseInt(result['haha']['summary']['total_count']);
1001
- var sad_count = {};
1002
- sad_count[ffwd] = parseInt(result['sad']['summary']['total_count']);
1003
- var angry_count = {};
1004
- angry_count[ffwd] = parseInt(result['angry']['summary']['total_count']);
1005
-
1006
- jQuery('#ffwd_likes_' + ffwd + '_' + id + ' span').html(total_reactions_count[ffwd]);
1007
- if (total_reactions_count[ffwd] >= 3 && result['total_reactions']['data'][0]) {
1008
- var likes_some_names = '<div class="ffwd_like_name_cont_' + ffwd + '"> <a class="ffwd_like_name_' + ffwd + '" href="https://www.facebook.com/' + result['total_reactions']['data'][0]['id'] + '" target="_blank">' + result['total_reactions']['data'][0]['name'] + ' , </a><a class="ffwd_like_name_' + ffwd + '" href="https://www.facebook.com/' + result['total_reactions']['data'][1]['id'] + '" target="_blank">' + result['total_reactions']['data'][1]['name'] + ' </a></div>';
1009
- var likes_count_last_part = '<div class="ffwd_almost_' + ffwd + '"> ' + ffwd_frontend_text.and + ' ' + (total_reactions_count[ffwd] - 2) + ' ' + ffwd_frontend_text.others + ' </div>';
1010
- }
1011
- else if (total_reactions_count[ffwd] == 2 && result['total_reactions']['data'][0]) {
1012
- var likes_some_names = '<div class="ffwd_like_name_cont_' + ffwd + '"> <a class="ffwd_like_name_' + ffwd + '" href="https://www.facebook.com/' + result['total_reactions']['data'][0]['id'] + '" target="_blank">' + result['total_reactions']['data'][0]['name'] + ' , </a><a class="ffwd_like_name_' + ffwd + '" href="https://www.facebook.com/' + result['total_reactions']['data'][1]['id'] + '" target="_blank">' + result['total_reactions']['data'][1]['name'] + ' </a></div>';
1013
- var likes_count_last_part = '';
1014
- }
1015
- else if (total_reactions_count[ffwd] == 1 && result['total_reactions']['data'][0]) {
1016
- var likes_some_names = '<div class="ffwd_like_name_cont_' + ffwd + '"> <a class="ffwd_like_name_' + ffwd + '" href="https://www.facebook.com/' + result['total_reactions']['data'][0]['id'] + '" target="_blank">' + result['total_reactions']['data'][0]['name'] + '</a></div>';
1017
- var likes_count_last_part = '';
1018
- }
1019
- else {
1020
- var likes_some_names = '';
1021
- var likes_count_last_part = '';
1022
- }
1023
-
1024
- var reactions_icons = ''
1025
- reactions_width = 0;
1026
- if (likes_count[ffwd] != 0) {
1027
- reactions_icons += '<span class="ffwd_react_icons_like_' + ffwd + '" title="Like"></span>';
1028
- reactions_width += 40;
1029
- jQuery('#ffwd_reactions_like_' + id + '_' + ffwd).show();
1030
- jQuery('#ffwd_tootlip_text_like_' + id + '_' + ffwd).html('Like: ' + likes_count[ffwd]);
1031
- }
1032
- if (love_count[ffwd] != 0) {
1033
- reactions_icons += '<span class="ffwd_react_icons_love_' + ffwd + '" title="Love"></span>';
1034
- reactions_width += 40;
1035
- jQuery('#ffwd_reactions_love_' + id + '_' + ffwd).show();
1036
- jQuery('#ffwd_tootlip_text_love_' + id + '_' + ffwd).html('Love: ' + love_count[ffwd]);
1037
-
1038
-
1039
- }
1040
- if (haha_count[ffwd] != 0) {
1041
- reactions_icons += '<span class="ffwd_react_icons_haha_' + ffwd + '" title="Haha"></span>';
1042
- reactions_width += 40;
1043
- jQuery('#ffwd_reactions_haha_' + id + '_' + ffwd).show();
1044
- jQuery('#ffwd_tootlip_text_haha_' + id + '_' + ffwd).html('Haha: ' + haha_count[ffwd]);
1045
-
1046
-
1047
- }
1048
- if (wow_count[ffwd] != 0) {
1049
- reactions_icons += '<span class="ffwd_react_icons_wow_' + ffwd + '" title="WOW"></span>';
1050
- reactions_width += 40;
1051
- jQuery('#ffwd_reactions_wow_' + id + '_' + ffwd).show();
1052
- jQuery('#ffwd_tootlip_text_wow_' + id + '_' + ffwd).html('Wow: ' + wow_count[ffwd]);
1053
-
1054
-
1055
- }
1056
- if (sad_count[ffwd] != 0) {
1057
- reactions_icons += '<span class="ffwd_react_icons_sad_' + ffwd + '" title="Sad"></span>';
1058
- reactions_width += 40;
1059
- jQuery('#ffwd_reactions_sad_' + id + '_' + ffwd).show();
1060
- jQuery('#ffwd_tootlip_text_sad_' + id + '_' + ffwd).html('Sad: ' + sad_count[ffwd]);
1061
-
1062
-
1063
- }
1064
- if (angry_count[ffwd] != 0) {
1065
- reactions_icons += '<span class="ffwd_react_icons_angry_' + ffwd + '" title="Angry"></span>';
1066
- reactions_width += 40;
1067
- jQuery('#ffwd_reactions_angry_' + id + '_' + ffwd).show();
1068
- jQuery('#ffwd_tootlip_text_angry_' + id + '_' + ffwd).html('Angry: ' + angry_count[ffwd]);
1069
-
1070
-
1071
- }
1072
-
1073
- jQuery('#ffwd_reacts_' + id + '_' + ffwd).css('width', reactions_width + 52 + 'px');
1074
-
1075
- if (total_reactions_count[ffwd] == 0)
1076
- jQuery('#ffwd_reacts_' + id + '_' + ffwd).css('display', 'none');
1077
-
1078
- var likes_names_count = '<div class="ffwd_likes_names_' + ffwd + '">' + reactions_icons + likes_some_names + likes_count_last_part + ' </div><div style="clear:both" ></div>';
1079
-
1080
-
1081
- if (total_reactions_count[ffwd])
1082
- jQuery('#ffwd_likes_names_count_' + id + '_' + ffwd).html(likes_names_count);
1083
- else
1084
- jQuery('#ffwd_likes_names_count_' + id + '_' + ffwd).remove();
1085
 
1086
- }
1087
 
1088
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1089
  function ffwd_blog_style_resize(ffwd_params, ffwd) {
1090
- var window_width = window.innerWidth,
1091
- blogstyle_object = jQuery(".blog_style_object_container_" + ffwd),
1092
- blogstyle_object_width = blogstyle_object.width(),
1093
- blogstyle_comment_content = jQuery(".ffwd_comment_content_" + ffwd),
1094
- blogstyle_comment_reply_content = jQuery(".ffwd_comment_reply_content_" + ffwd),
1095
- blogstyle_comment_content_left_margin = (parseInt(blogstyle_comment_content.css("margin-left"))) ?
1096
- parseInt(blogstyle_comment_content.css("margin-left")) : 0,
1097
- comment_author_pic_width = (parseInt(jQuery(".ffwd_comment_author_pic_" + ffwd + " img").css("width"))) ?
1098
- parseInt(jQuery(".ffwd_comment_author_pic_" + ffwd + " img").css("width")) : 0,
1099
- comment_reply_author_pic_width = (parseInt(jQuery(".ffwd_comment_reply_author_pic_" + ffwd + " img").css("width"))) ?
1100
- parseInt(jQuery(".ffwd_comment_reply_author_pic_" + ffwd + " img").css("width")) : 0,
1101
- comment_content_padding = (parseInt(jQuery(".ffwd_comment_" + ffwd).css("padding-left"))) ?
1102
- parseInt(jQuery(".ffwd_comment_" + ffwd).css("padding-left")) : 0,
1103
- ffwd_blog_style_img = jQuery(".ffwd_blog_style_img_" + ffwd);
1104
- /* Minus one for twenty fifteen theme :))*/
1105
- max_width_for_comment_content = blogstyle_object_width -
1106
- comment_author_pic_width -
1107
- blogstyle_comment_content_left_margin -
1108
- (2 * comment_content_padding) - 1,
1109
- max_width_for_comment_reply_content = max_width_for_comment_content -
1110
- comment_reply_author_pic_width -
1111
- blogstyle_comment_content_left_margin -
1112
- (2 * comment_content_padding) - 1;
1113
-
1114
-
1115
- max_width_for_attachment = (ffwd_params["blog_style_view_type"] != "1" && window_width > 520) ?
1116
- blogstyle_object_width * 0.55 : blogstyle_object_width;
1117
-
1118
- blogstyle_comment_content.css("max-width", max_width_for_comment_content);
1119
- blogstyle_comment_reply_content.css("max-width", max_width_for_comment_reply_content);
1120
- ffwd_blog_style_img.css("max-width", max_width_for_attachment);
1121
  }
1122
 
1123
 
@@ -1127,7 +1117,7 @@ jQuery(window).ready(function () {
1127
  url: ffwd_frontend_text.ajax_url,
1128
  data: {
1129
  'action': 'ffwd_autoupdate',
1130
- },
1131
  type: 'get',
1132
  success: function (response) {
1133
  console.log(response);
1
  function ffwd_frontend_ajax(form_id, current_view, id, album_id, enter_or_back, type, srch_btn, title, sortByParam, load_more, image_onclick_action) {
2
+ var page_number = jQuery("#page_number_" + current_view).val();
3
+ var ffwd_load_more = jQuery("#ffwd_load_more_" + current_view).val();
4
+ var ffwd_previous_album_ids = jQuery('#ffwd_previous_album_id_' + current_view).val();
5
+ var ffwd_previous_album_page_numbers = jQuery('#album_page_number_' + current_view).val();
6
+ var masonry_already_loaded = jQuery(".ffwd_masonry_thumb_cont_" + current_view + " img").length;
7
+ if (typeof load_more == "undefined") {
8
+ var load_more = false;
9
+ }
10
+ var post_data = {};
11
+ if (album_id == 'back') { // Back from album.
12
+ var album_page_number = ffwd_previous_album_page_numbers.split(",");
13
+ page_number = album_page_number[0];
14
+ jQuery('#album_page_number_' + current_view).val(ffwd_previous_album_page_numbers.replace(album_page_number[0] + ',', ''));
15
+ }
16
+ else if (enter_or_back != '') { // Enter album (not change the page).
17
+ jQuery('#ffwd_previous_album_id_' + current_view).val(enter_or_back + ',' + ffwd_previous_album_ids);
18
+ if (page_number) {
19
+ jQuery('#album_page_number_' + current_view).val(page_number + ',' + ffwd_previous_album_page_numbers);
20
+ }
21
+ page_number = 1;
22
+ }
23
+ if (typeof title == "undefined") {
24
+ var title = "";
25
+ }
26
+ if (typeof sortByParam == "undefined") {
27
+ var sortByParam = jQuery(".bwg_order_" + current_view).val();
28
+ }
29
+ post_data["page_number_" + current_view] = page_number;
30
+ post_data["ffwd_load_more_" + current_view] = ffwd_load_more;
31
+ post_data["album_id_" + current_view] = album_id;
32
+ post_data["ffwd_previous_album_id_" + current_view] = jQuery('#ffwd_previous_album_id_' + current_view).val();
33
+ post_data["album_page_number_" + current_view] = jQuery('#album_page_number_' + current_view).val();
34
+ post_data["type_" + current_view] = type;
35
+ post_data["title_" + current_view] = title;
36
+ post_data["sortImagesByValue_" + current_view] = sortByParam;
37
+ // Loading.
38
+ jQuery("#ffwd_ajax_loading_" + current_view).css('display', '');
39
+ jQuery.post(
40
+ window.location,
41
+ post_data,
42
+ function (data) {
43
+ if (load_more) {
44
+ var strr = jQuery(data).find('#' + id).html();
45
+ jQuery('#' + id).append(strr);
46
+ var str = jQuery(data).find('.ffwd_nav_cont_' + current_view).html();
47
+ jQuery('.ffwd_nav_cont_' + current_view).html(str);
48
+ }
49
+ else {
50
+ var str = jQuery(data).find('#' + form_id).html();
51
+ jQuery('#' + form_id).html(str);
52
+ }
53
+ }
54
+ ).success(function (jqXHR, textStatus, errorThrown) {
55
+ jQuery("#ffwd_ajax_loading_" + current_view).css('display', 'none');
56
+ if (jQuery(".pagination-links_" + current_view).length) {
57
+ jQuery("html, body").animate({scrollTop: jQuery('#' + form_id).offset().top - 150}, 500);
58
+ }
59
+ /* For all*/
60
+ window["ffwd_document_ready_" + current_view]();
61
+ /* For masonry view.*/
62
+ if (id == "ffwd_masonry_thumbnails_" + current_view || id == "ffwd_album_masonry_" + current_view) {
63
+ window["ffwd_masonry_ajax_" + current_view](masonry_already_loaded);
64
+ }
65
+ });
66
+ return false;
67
  }
68
  /* For thumnail amd masonry view */
69
  function ffwd_fill_likes_thumnail(id_object_id, ffwd, graph_url) {
70
+ var ids_array_count=Math.ceil(id_object_id.length/50);
71
+ var ids_array=[];
72
+ var img_ids=[];
73
+ for(var i = 0; i < ids_array_count; i++)
74
+ {
75
+ ids_array[i]=[];
76
+ k=0;
77
+ for(var j = i*50; j < (i+1)*50; j++ )
78
+ {
79
+ if(!id_object_id[j])
80
+ break;
81
 
82
+ ids_array[i][k]=[];
83
+ var object_id = id_object_id[i]['from']+'_'+id_object_id[j]['object_id']
84
 
85
 
86
+ ids_array[i][k]=object_id;
87
+ img_ids[object_id]=id_object_id[j]['id'];
88
+ k++;
89
+ }
90
 
91
+ }
92
 
93
+ for(var i = 0; i < ids_array.length; i++)
94
+ {
95
 
96
+ ids=ids_array[i].join(',');
97
 
98
+ url_for_cur_id_likes_thumb = graph_url.replace('{FB_ID}',''),
99
 
100
+ graph_url_for_likes_thumb = url_for_cur_id_likes_thumb.replace('{EDGE}', '');
101
+ graph_url_for_likes_thumb = graph_url_for_likes_thumb.replace('{FIELDS}', 'ids='+ids+'&fields=comments.summary(true).limit(0),likes.summary(true).limit(0)&');
102
+ graph_url_for_likes_thumb = graph_url_for_likes_thumb.replace('{OTHER}', '');
103
 
104
+ jQuery.getJSON(graph_url_for_likes_thumb,
105
+ function(result)
106
+ {
107
 
108
+ for(var j in result)
109
+ {
110
 
111
+ ffwd_fill_likes_comments_thumb(result[j],ffwd,img_ids[j]);
112
 
113
 
114
+ }
115
 
116
+ }
117
+ );
118
 
119
 
120
+ }
121
 
122
 
123
  }
124
 
125
  function createCallback_thumbnail(id, ffwd, type) {
126
+ return function (result) {
127
+ do_something_with_data_thumbnail(result, id, ffwd, type);
128
+ };
129
  }
130
 
131
  function ffwd_fill_likes_comments_thumb(result, ffwd,id) {
132
 
133
+ var likes_count = (typeof result['likes']['summary'] != 'undefined') ? parseInt(result['likes']['summary']['total_count']) : '0';
134
+ jQuery('#ffwd_likes_' + ffwd + '_' + id + ' span').html(likes_count);
 
 
 
135
 
136
+ var comments_count = (typeof result['comments']['summary'] != 'undefined') ? parseInt(result['comments']['summary']['total_count']) : '0';
137
+ jQuery('#ffwd_comments_' + ffwd + '_' + id + ' span').html(comments_count);
138
  }
139
 
140
  function do_something_with_data_thumbnail(result, id, ffwd, type) {
141
+ switch (type) {
142
+ case 'likes' :
143
+ var likes_count = (typeof result['summary'] != 'undefined') ? parseInt(result['summary']['total_count']) : '0';
144
+ jQuery('#ffwd_likes_' + ffwd + '_' + id + ' span').html(likes_count);
145
+ break;
146
+ case 'comments' :
147
+ var comments_count = (typeof result['summary'] != 'undefined') ? parseInt(result['summary']['total_count']) : '0';
148
+ jQuery('#ffwd_comments_' + ffwd + '_' + id + ' span').html(comments_count);
149
+ break;
150
+ default :
151
+ console.log('error');
152
+ break;
153
+ }
154
  }
155
 
156
  /* For album view */
157
  function ffwd_fill_thum_srs_likes_compact_album(id_object_id, ffwd, graph_url, ffwd_album_info, image_onclick_action) {
158
+ if (typeof id_object_id == 'object') {
159
+ /*Album*/
160
 
161
 
162
+ var ids_array_count=Math.ceil(id_object_id.length/50);
163
+ var ids_array=[];
164
+ var img_ids=[];
165
+ for(var i = 0; i < ids_array_count; i++)
166
+ {
167
+ ids_array[i]=[];
168
+ k=0;
169
+ for(var j = i*50; j < (i+1)*50; j++ )
170
+ {
171
+ if(!id_object_id[j])
172
+ break;
 
 
 
173
 
174
+ ids_array[i][k]=[];
175
+ var object_id = id_object_id[j]['object_id']
176
 
 
 
 
 
177
 
178
+ ids_array[i][k]=object_id;
179
+ img_ids[object_id]=id_object_id[j]['id'];
180
+ k++;
181
+ }
182
 
183
+ }
184
+ for(var i = 0; i < ids_array.length; i++)
185
+ {
186
 
187
+ ids=ids_array[i].join(',');
188
 
189
+ url_for_cur_id_likes_thumb = graph_url.replace('{FB_ID}',''),
190
 
191
+ graph_url_for_likes_thumb = url_for_cur_id_likes_thumb.replace('{EDGE}', 'photos');
192
+ graph_url_for_likes_thumb = graph_url_for_likes_thumb.replace('{FIELDS}', 'ids='+ids+'&fields=source,width,height,count,link&');
193
+ graph_url_for_likes_thumb = graph_url_for_likes_thumb.replace('{OTHER}', '');
194
+ jQuery.getJSON(graph_url_for_likes_thumb,
195
+ function(result)
196
+ {
197
 
198
+ for(var j in result)
199
+ {
200
 
201
+ ffwd_fill_likes_comments_c_album(result[j],ffwd,img_ids[j],ffwd_album_info, image_onclick_action);
202
 
203
 
204
+ }
205
 
206
+ }
207
+ );
208
 
209
 
210
+ }
211
 
212
 
213
 
214
 
215
+ }
216
+ else {
217
+ /*Gallery*/
218
+ var album_id = id_object_id,
219
+ graph_url_for_album_photos = graph_url.replace('{EDGE}', 'photos'),
220
+ url_for_album_photos = graph_url_for_album_photos.replace('{FB_ID}', album_id),
221
+ url_for_album_photos = url_for_album_photos.replace('{FIELDS}', 'fields=images,link,from{picture,name,link}&');
222
 
223
 
224
+ jQuery.getJSON(url_for_album_photos, createCallback_album('', ffwd, 'photos', graph_url, ffwd_album_info, image_onclick_action));
225
 
226
+ }
227
  }
228
 
229
 
230
 
231
  function ffwd_fill_likes_comments_c_album(result,ffwd,id,ffwd_album_info, image_onclick_action)
232
  {
233
+ var height = (typeof result['data'][0] != 'undefined') ? result['data'][0]['height'] : 0,
234
+ width = (typeof result['data'][0] != 'undefined') ? result['data'][0]['width'] : 0,
235
+ image_thumb_width,
236
+ image_thumb_height,
237
+ resolution_w,
238
+ resolution_h,
239
+ count = (typeof result['data'] != 'undefined') ? result['data'].length : 0,
240
+ scale;
241
+ if (count) {
242
+ if (width && height) {
243
+ resolution_w = width;
244
+ resolution_h = height;
245
+ if (resolution_w != 0 && resolution_h != 0) {
246
+ scale = Math.max(ffwd_album_info["album_thumb_width"] / resolution_w, ffwd_album_info["album_thumb_height"] / resolution_h);
247
+ image_thumb_width = resolution_w * scale;
248
+ image_thumb_height = resolution_h * scale;
249
+ }
250
+ else {
251
+ image_thumb_width = ffwd_album_info["album_thumb_width"];
252
+ image_thumb_height = ffwd_album_info["album_thumb_height"];
253
+ }
254
+ }
255
+ else {
256
+ image_thumb_width = ffwd_album_info["album_thumb_width"];
257
+ image_thumb_height = ffwd_album_info["album_thumb_height"];
258
+ }
259
+ scale = Math.max(ffwd_album_info["album_thumb_width"] / image_thumb_width, image_thumb_height / image_thumb_height);
260
+ image_thumb_width *= scale;
261
+ image_thumb_height *= scale;
262
+ thumb_left = (ffwd_album_info["album_thumb_width"] - image_thumb_width) / 2;
263
+ thumb_top = (ffwd_album_info["album_thumb_height"] - image_thumb_height) / 2;
264
+
265
+ jQuery('#ffwd_album_cover_' + id + '_' + ffwd).attr('src', result['data'][0]['source']).css({
266
+ 'width': image_thumb_width + 'px',
267
+ 'height': image_thumb_height + 'px',
268
+ 'margin-left': thumb_left + 'px',
269
+ 'margin-top': thumb_top + 'px',
270
+ });
271
+ }
272
+ else {
273
+ /*jQuery( "[ffwd_object_id='"+object_id+"']" ).remove();*/
274
+ }
275
  }
276
 
277
 
278
  function createCallback_album(id, ffwd, type, graph_url, ffwd_album_info, image_onclick_action) {
279
+ return function (result) {
280
+ do_something_with_data_album(result, id, ffwd, type, graph_url, ffwd_album_info, image_onclick_action);
281
+ };
282
  }
283
 
284
  function ffwd_fill_likes_comments_c_gallery(result,ffwd,id) {
285
+ var likes_count = (typeof result['likes']['summary'] != 'undefined') ? parseInt(result['likes']['summary']['total_count']) : '0';
286
+ jQuery('#ffwd_likes_' + id + '_' + ffwd + ' span').html(likes_count);
287
 
288
 
289
+ var comments_count = (typeof result['comments']['summary'] != 'undefined') ? parseInt(result['comments']['summary']['total_count']) : '0';
290
+ jQuery('#ffwd_comments_' + id + '_' + ffwd + ' span').html(comments_count);
291
  }
292
 
293
 
294
  function do_something_with_data_album(result, id, ffwd, type, graph_url, ffwd_album_info, image_onclick_action) {
295
+ switch (type) {
296
+ case 'likes' :
297
+ case 'comments' :
298
+ var likes_count = (typeof result['likes']['summary'] != 'undefined') ? parseInt(result['likes']['summary']['total_count']) : '0';
299
+ jQuery('#ffwd_likes_' + id + '_' + ffwd + ' span').html(likes_count);
300
+
301
+
302
+ var comments_count = (typeof result['comments']['summary'] != 'undefined') ? parseInt(result['comments']['summary']['total_count']) : '0';
303
+ jQuery('#ffwd_comments_' + id + '_' + ffwd + ' span').html(comments_count);
304
+ break;
305
+ case 'covers' :
306
+ var height = (typeof result['data'][0] != 'undefined') ? result['data'][0]['height'] : 0,
307
+ width = (typeof result['data'][0] != 'undefined') ? result['data'][0]['width'] : 0,
308
+ image_thumb_width,
309
+ image_thumb_height,
310
+ resolution_w,
311
+ resolution_h,
312
+ count = (typeof result['data'] != 'undefined') ? result['data'].length : 0,
313
+ scale;
314
+ if (count) {
315
+ if (width && height) {
316
+ resolution_w = width;
317
+ resolution_h = height;
318
+ if (resolution_w != 0 && resolution_h != 0) {
319
+ scale = Math.max(ffwd_album_info["album_thumb_width"] / resolution_w, ffwd_album_info["album_thumb_height"] / resolution_h);
320
+ image_thumb_width = resolution_w * scale;
321
+ image_thumb_height = resolution_h * scale;
322
+ }
323
+ else {
324
+ image_thumb_width = ffwd_album_info["album_thumb_width"];
325
+ image_thumb_height = ffwd_album_info["album_thumb_height"];
326
+ }
327
+ }
328
+ else {
329
+ image_thumb_width = ffwd_album_info["album_thumb_width"];
330
+ image_thumb_height = ffwd_album_info["album_thumb_height"];
331
+ }
332
+ scale = Math.max(ffwd_album_info["album_thumb_width"] / image_thumb_width, image_thumb_height / image_thumb_height);
333
+ image_thumb_width *= scale;
334
+ image_thumb_height *= scale;
335
+ thumb_left = (ffwd_album_info["album_thumb_width"] - image_thumb_width) / 2;
336
+ thumb_top = (ffwd_album_info["album_thumb_height"] - image_thumb_height) / 2;
337
+
338
+ jQuery('#ffwd_album_cover_' + id + '_' + ffwd).attr('src', result['data'][0]['source']).css({
339
+ 'width': image_thumb_width + 'px',
340
+ 'height': image_thumb_height + 'px',
341
+ 'margin-left': thumb_left + 'px',
342
+ 'margin-top': thumb_top + 'px',
343
+ });
344
+ }
345
+ else {
346
+ /*jQuery( "[ffwd_object_id='"+object_id+"']" ).remove();*/
347
+ }
348
+ break;
349
+ case 'photos':
350
+ var graph_url_for_likes = graph_url.replace('{EDGE}', ''),
351
+ graph_url_for_likes = graph_url_for_likes.replace('{FIELDS}', ''),
352
+ graph_url_for_comments = graph_url.replace('{EDGE}', ''),
353
+ graph_url_for_comments = graph_url_for_comments.replace('{FIELDS}', '&fields=likes.summary(true).limit(0),comments.summary(true).limit(0)&');
354
+
355
+ var data = result['data'];
356
+
357
+ if(graph_url.indexOf("&after=")) {
358
+ graph_url = graph_url.split("&after")[0];
359
+ }
360
+ if (graph_url.indexOf("&before=")) {
361
+ graph_url = graph_url.split("&before")[0];
362
+ }
363
+ let prev_url = graph_url + '&before=' + result['paging']['cursors']['before'];
364
+ let next_url = graph_url + '&after=' + result['paging']['cursors']['after'];
365
+ let prev_url_graph = result['paging']['previous'];
366
+ let next_url_graph = result['paging']['next'];
367
+
368
+ content = '';
369
+ ffwd_album_info["data"] = [];
370
+ curent_view = ffwd;
371
+
372
+
373
+ var ids_array_count=Math.ceil(data.length/50);
374
+ var ids_array=[];
375
+ var img_ids=[];
376
+ for(var j = 0; j < ids_array_count; j++)
377
+ {
378
+ ids_array[j]=[];
379
+ k=0;
380
+ for(var i = j*50; i < (j+1)*50; i++ )
381
+ {
382
+ if(!data[i])
383
+ break;
384
+
385
+ ids_array[j][k]=[];
386
+ var object_id = data[i]['from']['id']+'_'+data[i]['id']
387
+
388
+
389
+ ids_array[j][k]=object_id;
390
+ img_ids[object_id]=i;
391
+ k++;
392
+ //////////////////////////////////////////////////////
393
+ var row = {},
394
+ images = data[i]['images'],
395
+ image_obj_id = data[i]['id'];
396
+ index_in_images = (images.length > 3) ? 2 : 0,
397
+ image = data[i]['images'][index_in_images];
398
+ row['id'] = i;
399
+ row['object_id'] = image_obj_id;
400
+ row['from'] = data[i]['from']['id'];
401
+ ffwd_album_info["data"].push(row);
402
+
403
+ var height = image['height'],
404
+ width = image['width'],
405
+ image_thumb_width,
406
+ image_thumb_height,
407
+ resolution_w,
408
+ resolution_h,
409
+ scale;
410
+
411
+ if (typeof width != 'undefined' && typeof height != 'undefined') {
412
+ resolution_w = width;
413
+ resolution_h = height;
414
+ if (resolution_w != 0 && resolution_h != 0) {
415
+ scale = Math.max(ffwd_album_info["thumb_width"] / resolution_w, ffwd_album_info["thumb_height"] / resolution_h);
416
+ image_thumb_width = resolution_w * scale;
417
+ image_thumb_height = resolution_h * scale;
418
+ }
419
+ else {
420
+ image_thumb_width = ffwd_album_info["thumb_width"];
421
+ image_thumb_height = ffwd_album_info["thumb_height"];
422
+ }
423
+ }
424
+ else {
425
+ image_thumb_width = ffwd_album_info["thumb_width"];
426
+ image_thumb_height = ffwd_album_info["thumb_height"];
427
+ }
428
 
429
+ scale = Math.max(ffwd_album_info["thumb_width"] / image_thumb_width, image_thumb_height / image_thumb_height);
430
+ image_thumb_width *= scale;
431
+ image_thumb_height *= scale;
432
+ thumb_left = (ffwd_album_info["thumb_width"] - image_thumb_width) / 2;
433
+ thumb_top = (ffwd_album_info["thumb_height"] - image_thumb_height) / 2;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
434
 
435
+ main_url = image.source;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
436
 
437
+ if (image_onclick_action == 'facebook') {
438
+ main_url = data[i]['link'];
439
+ }
440
 
441
+ if (image_onclick_action == 'none') {
442
+ main_url = '#';
443
+ }
444
 
445
 
446
+ content += '<a class="ffwd_lightbox_' + curent_view + '" href="' + main_url + '" data-image-id="' + i + '" data-image-obj-id="' + image_obj_id + '" >' +
447
+ '<div class="ffwd_standart_thumb_' + curent_view + '">' +
448
+ '<div class="ffwd_standart_thumb_spun1_' + curent_view + '">' +
449
+ '<div class="ffwd_standart_thumb_spun2_' + curent_view + '">' +
450
+ '<img class="ffwd_standart_thumb_img_' + curent_view + '" style="width:' + image_thumb_width + 'px; height:' + image_thumb_height + 'px; margin-left: ' + thumb_left + 'px; margin-top: ' + thumb_top + 'px;" id="" src="' + image.source + '" alt="" />' +
451
+ '<div class="ffwd_likes_comments_container_' + curent_view + '" >' +
452
+ '<div class="ffwd_likes_comments_container_tab_' + curent_view + '" >' +
453
+ '<div class="ffwd_likes_comments_' + curent_view + '" >' +
454
+ '<div id="ffwd_likes_' + i + '_' + curent_view + '" class="ffwd_likes_' + curent_view + '">' +
455
+ '<i class=" ffwd ffwd-like"></i><span></span>' +
456
+ '</div>' +
457
+ '<div id="ffwd_comments_' + i + '_' + curent_view + '" class="ffwd_comments_' + curent_view + '">' +
458
+ '<i class=" ffwd ffwd-comment"></i><span></span>' +
459
+ '</div>' +
460
+ '<div style="clear:both"></div>' +
461
+ '</div>' +
462
+ '</div>' +
463
+ '</div>' +
464
+ '</div>' +
465
+ '</div>' +
466
+ '</div>' +
467
+ '</a>';
468
 
469
+ var url_for_likes = graph_url_for_likes.replace('{FB_ID}', data[i]['from']['id']+'_'+data[i]['id']),
470
+ url_for_comments = graph_url_for_comments.replace('{FB_ID}', data[i]['from']['id']+'_'+data[i]['id']);
471
 
472
+ //jQuery.getJSON(url_for_likes, createCallback_album(i, ffwd, 'likes'));
473
 
 
 
 
 
474
 
475
+ // jQuery.getJSON(url_for_comments, createCallback_album(i, ffwd, 'comments'));
476
 
477
+ }
478
 
479
+ }
 
480
 
481
+ //console.log(img_ids);
482
 
483
+ for(var i = 0; i < ids_array.length; i++)
484
+ {
 
 
 
 
 
485
 
486
+ ids=ids_array[i].join(',');
 
487
 
 
488
 
 
489
 
490
+ var graph_url_for_comments = graph_url.replace('{EDGE}', '');
491
+ graph_url_for_comments=graph_url_for_comments.replace('{FB_ID}','')
492
+ graph_url_for_comments = graph_url_for_comments.replace('{FIELDS}', '&ids='+ids+'&fields=likes.summary(true).limit(0),comments.summary(true).limit(0)&');
493
 
 
 
 
 
 
 
 
494
 
 
 
 
495
 
496
+ jQuery.getJSON(graph_url_for_comments,
497
+ function(result)
498
+ {
499
+
500
+ for(var j in result)
501
+ {
502
 
503
+ ffwd_fill_likes_comments_c_gallery(result[j],ffwd,img_ids[j]);
504
+ // console.log(result[j]);
505
 
506
  }
507
+
508
+ }
509
+ ).success(simulateAjaxEnd());
510
+
511
+
512
+ }
513
+ content += '<br>';
514
+ content += '<div class="tablenav-pages_'+ffwd+'" >';
515
+ if (prev_url_graph) {
516
+ content += '<a id="go_to_the_previous_page" title="Go to the previous page">Previous</a>'; /*enable prev button if graph has next cursor*/
517
+ }
518
+ if (next_url_graph) { /*enable next button if graph has next cursor*/
519
+ content +=' <a id="go_to_the_next_page" title="Go to the next page">Next</a> ';
520
+ }
521
+ content += '<div>';
522
+ jQuery('#ffwd_gallery_' + curent_view).html(content);
523
+ jQuery( "#go_to_the_next_page" ).on('click', function() { /* go to next page */
524
+ ffwd_fill_thum_srs_likes_compact_album(album_id, '0',next_url,ffwd_album_info,"lightbox");
525
+ });
526
+ jQuery( "#go_to_the_previous_page" ).on('click', function() { /*go to prev page*/
527
+ ffwd_fill_thum_srs_likes_compact_album(album_id, '0',prev_url,ffwd_album_info,"lightbox");
528
+ });
529
+ break;
530
+ default :
531
+ console.log('error');
532
+ break;
533
+ }
534
+ ffwd_album_info_0["data"] = ffwd_album_info["data"];
535
+
536
+
537
+ }
538
+
539
+ /* For Blog-style view */
540
+ function ffwd_get_passed_time(time) {
541
+ var today = new Date(),
542
+ arr = time.split(/[^0-9]/);
543
+ today = Date.parse(today) / 1000 - client_server_date_difference;
544
+ time = Date.UTC(arr[0], arr[1] - 1, arr[2], arr[3], arr[4], arr[5]);
545
+ time /= 1000;
546
+ time = today - time;
547
+
548
+ var tokens = {
549
+ 'year' : '31536000',
550
+ 'month': '2592000',
551
+ 'week': '604800',
552
+ 'day': '86400',
553
+ 'hour': '3600',
554
+ 'minute': '60',
555
+ 'second': '1'
556
+ };
557
+ var tokens_s = {
558
+ 'year' : 'years',
559
+ 'month': 'months',
560
+ 'week': 'weeks',
561
+ 'day': 'days',
562
+ 'hour': 'hours',
563
+ 'minute': 'minutes',
564
+ 'second': 'seconds'
565
+ };
566
+ for (unit in tokens) {
567
+ if (time < parseInt(tokens[unit])) continue;
568
+ var numberOfUnits = Math.floor(time / parseInt(tokens[unit]));
569
+
570
+ if(numberOfUnits > 1)
571
+ return numberOfUnits + ' ' + ffwd_frontend_text[tokens_s[unit]] + ' ago';
572
+
573
+ return numberOfUnits + ' ' + ffwd_frontend_text[unit] + ' ago' ;
574
+ }
575
+ }
576
+
577
+ function ffwd_fill_likes_blog_style(id_object_id, ffwd, owner_info, ffwd_params, graph_url) {
578
+
579
+
580
+
581
+ var ids_array_count=Math.ceil(id_object_id.length/50);
582
+ var ids_array=[];
583
+ var img_ids=[];
584
+ for(var i = 0; i < ids_array_count; i++)
585
+ {
586
+ ids_array[i]=[];
587
+ k=0;
588
+ for(var j = i*50; j < (i+1)*50; j++ )
589
+ {
590
+ if(!id_object_id[j])
591
+ break;
592
+
593
+ ids_array[i][k]=[];
594
+ var object_id = id_object_id[j]['object_id'];
595
+
596
+
597
+ ids_array[i][k]=object_id;
598
+ img_ids[object_id]=id_object_id[j]['id'];
599
+ k++;
600
  }
601
 
602
+ }
603
 
604
+ var reactions_array={};
605
 
 
606
 
607
+ for(var i = 0; i < ids_array.length; i++)
608
+ {
609
+ ids=ids_array[i].join(',');
610
+ url_for_cur_id_likes_blog = graph_url.replace('{FB_ID}',''),
611
+ graph_url_for_likes = url_for_cur_id_likes_blog.replace('{EDGE}', '');
612
+ graph_url_for_likes = graph_url_for_likes.replace('{FIELDS}', 'ids='+ids+'&fields=comments.summary(true).limit(0),likes.summary(true).limit(0)&');
613
+ graph_url_for_likes = graph_url_for_likes.replace('{OTHER}', '');
614
 
615
+ jQuery.getJSON(graph_url_for_likes,
616
+ function(result)
617
+ {
618
 
619
+ for(var j in result)
620
+ {
621
+ var likes_count = (typeof result[j]['likes']['summary'] != 'undefined') ? parseInt(result[j]['likes']['summary']['total_count']) : '0';
622
+ jQuery('#ffwd_likes_' + ffwd + '_' + img_ids[j] + ' span').html(likes_count);
623
 
624
+ }
 
 
 
625
 
626
+ }
627
+ );
628
+ }
629
 
630
+ for (var i = 0; i < id_object_id.length; i++) {
631
 
632
 
633
+ /*For likes*/
634
 
635
+ var object_id = id_object_id[i]['object_id'].replace(id_object_id[i]['from'], owner_info['id']);
 
 
636
 
637
+ url_for_cur_id = graph_url.replace('{FB_ID}', object_id);
638
+ graph_url_for_likes = url_for_cur_id.replace('{EDGE}', '');
639
+ graph_url_for_likes = graph_url_for_likes.replace('{FIELDS}', 'fields=reactions.type(LIKE).limit(0).summary(true).as(like),reactions.type(LOVE).limit(0).summary(true).as(love),reactions.type(WOW).limit(0).summary(true).as(wow),reactions.type(HAHA).limit(0).summary(true).as(haha),reactions.type(SAD).limit(0).summary(true).as(sad),reactions.type(ANGRY).limit(0).summary(true).as(angry),reactions.limit(5).summary(true).as(total_reactions)&');
640
+ graph_url_for_likes = graph_url_for_likes.replace('{OTHER}', 'summary=true');
 
 
641
 
642
+ /*For comments*/
 
 
 
643
 
 
644
 
 
645
 
 
 
 
646
 
647
+ var graph_url_for_comments = url_for_cur_id.replace('{EDGE}', 'comments');
648
+ graph_url_for_comments = graph_url_for_comments.replace('{FIELDS}', 'fields=created_time,from,like_count,message,comment_count&');
649
+ graph_url_for_comments = graph_url_for_comments.replace('{OTHER}', 'summary=true&filter=' + ffwd_params["comments_filter"] + '&order=' + ffwd_params["comments_order"] + '&limit=25');
650
 
651
+ /*For future (attachment message_tags fields)*/
652
+ /*console.log(graph_url_for_comments);*/
653
+ /*For shares*/
654
+ var graph_url_for_shares = url_for_cur_id.replace('{EDGE}', '');
655
+ graph_url_for_shares = graph_url_for_shares.replace('{FIELDS}', 'fields=shares&');
656
+ graph_url_for_shares = graph_url_for_shares.replace('{OTHER}', '');
657
 
658
+ /*For attachments*/
659
+ var graph_url_for_attachments = url_for_cur_id.replace('{EDGE}', 'attachments'),
660
+ graph_url_for_attachments = graph_url_for_attachments.replace('{FIELDS}', '');
661
+ graph_url_for_attachments = graph_url_for_attachments.replace('{OTHER}', '');
662
 
663
+ /*For who post*/
 
 
 
664
 
665
+ var url_for_who_post = graph_url.replace('{FB_ID}', id_object_id[i]['from']),
666
 
667
+ graph_url_for_who_post = url_for_who_post.replace('{EDGE}', ''),
668
+ graph_url_for_who_post = graph_url_for_who_post.replace('{FIELDS}', 'fields=picture,name,link&');
669
+ graph_url_for_who_post = graph_url_for_who_post.replace('{OTHER}', '');
670
 
671
+ if (id_object_id[i]['type'] != 'events') {
672
+ //jQuery.getJSON(graph_url_for_likes, createCallback_blog_style(id_object_id[i]['id'], ffwd, 'likes'));
673
+ //jQuery.getJSON(graph_url_for_shares, createCallback_blog_style(id_object_id[i]['id'], ffwd, 'shares'));
674
 
 
 
675
 
676
+ //do_something_with_data_blog_style(reactions_array[object_id], id_object_id[i]['id'], ffwd, 'likes', "", ffwd_params, graph_url);
677
+
678
+ if(!id_object_id[i]['shares'])
679
+ {
680
+ id_object_id[i]['shares']='{}';
681
+ }
682
+
683
+ do_something_with_data_blog_style(id_object_id[i]['shares'], id_object_id[i]['id'], ffwd, 'shares', "", ffwd_params, graph_url);
684
 
685
+ // jQuery.getJSON(graph_url_for_attachments, createCallback_blog_style(id_object_id[i]['id'], ffwd, 'attachments', "", ffwd_params));
686
+ if(id_object_id[i]['attachments'])
687
+ do_something_with_data_blog_style(id_object_id[i]['attachments'], id_object_id[i]['id'], ffwd, 'attachments', "", ffwd_params, graph_url);
688
+
689
+ }
690
 
691
+ if(id_object_id[i]['comments']);
692
+ do_something_with_data_blog_style(id_object_id[i]['comments'], id_object_id[i]['id'], ffwd, 'comments', "", ffwd_params, graph_url);
693
 
694
  // jQuery.getJSON(id_object_id[i]['comments'], createCallback_blog_style(id_object_id[i]['id'], ffwd, 'comments', "", ffwd_params, graph_url));
695
+ //jQuery.getJSON(graph_url_for_who_post, createCallback_blog_style(id_object_id[i], ffwd, 'who_post', owner_info, ffwd_params));
696
+ do_something_with_data_blog_style(id_object_id[i]['who_post'], id_object_id[i], ffwd, 'who_post', owner_info, ffwd_params, graph_url);
697
 
698
 
699
 
700
+ }
701
  }
702
 
703
  function createCallback_blog_style(id, ffwd, type, owner_info, ffwd_params, graph_url) {
704
+ return function (result) {
705
+ do_something_with_data_blog_style(result, id, ffwd, type, owner_info, ffwd_params, graph_url);
706
+ };
707
  }
708
 
709
  function do_something_with_data_blog_style(result, id, ffwd, type, owner_info, ffwd_params, graph_url) {
710
 
711
+ switch (type) {
712
+
713
+ case 'comments' :
714
+ var total_count = (result['data'].length < 25) ? result['data'].length : result['summary']['total_count'];
715
+ jQuery('#ffwd_comments_count_' + ffwd + '_' + id + ' span').html(total_count);
716
+ /*console.log(result);
717
+ console.log(result['data'].length);*/
718
+ var more_comments = false,
719
+ comments_exist = false;
720
+ for (var i = 0, j = 1, z = 0; i < result['data'].length; i++, j++) {
721
+ comments_exist = true;
722
+ comment_id = result['data'][i]['id'];
723
+ var display = 'display:block';
724
+ /* if (j > 4) {
725
+ display = 'display:none';
726
+ more_comments = true;
727
+ z++;
728
+ }*/
729
+
730
+ /*
731
+ var url_for_cur_id_comm_user_pic = graph_url.replace('{FB_ID}', result['data'][i]['from']['id']);
732
+ url_for_cur_id_comm_user_pic = url_for_cur_id_comm_user_pic.replace('{EDGE}', '');
733
+ url_for_cur_id_comm_user_pic = url_for_cur_id_comm_user_pic.replace('{FIELDS}', 'fields=picture&');
734
+ url_for_cur_id_comm_user_pic = url_for_cur_id_comm_user_pic.replace('{OTHER}', '');
735
+
736
+ */
737
+ //var comment_author_pic = '<div style="float:left" id="ffwd_comment_author_pic_' + ffwd + '_' + id + '" class="ffwd_comment_author_pic_' + ffwd + '" > <img class="user_' + result['data'][i]['from']['id'] + '" src="https://graph.facebook.com/'+result['data'][i]['from']['id']+'/picture" > </div>',
738
+ var comment_author_pic = '<span></span>',
739
+ //comment_author_name = '<a id="ffwd_comment_author_name_' + ffwd + '_' + id + '" href="https://www.facebook.com/' + result['data'][i]['from']['id'] + '" class="ffwd_comment_author_name_' + ffwd + '" > ' + result['data'][i]['from']['name'] + ' </a>',
740
+ comment_author_name = '<span></span>',
741
+ comment_message = '<span id="ffwd_comment_message_' + ffwd + '_' + id + '" class="ffwd_comment_message_' + ffwd + '" > ' + result['data'][i]['message'] + ' </span>',
742
+ comment_date = '<span id="ffwd_comment_date_' + ffwd + '_' + id + '" class="ffwd_comment_date_' + ffwd + '" > ' + ffwd_get_passed_time(result['data'][i]['created_time']) + '</span>',
743
+ comment_likes_count = '<span id="ffwd_comment_likes_count_' + ffwd + '_' + id + '" class="ffwd_comment_likes_count_' + ffwd + '" > ' + result['data'][i]['like_count'] + ' </span>',
744
+ comments_date_likes = '<div>' + comment_date + comment_likes_count + '</div>',
745
+ comment_replies_cont = (ffwd_params["comments_filter"] == "toplevel" && ffwd_params["comments_replies"] == "1" && result['data'][i]['comment_count'] > 0) ? '<div class="ffwd_comment_replies_' + ffwd + '"><div id="ffwd_comment_replies_label_'+comment_id+'" class="ffwd_comment_replies_label_' + ffwd + '">' + result['data'][i]['comment_count'] +' '+ffwd_frontend_text.comment_reply+' </div><div class="ffwd_comment_replies_content_' + ffwd + '"></div></div>' : '',
746
+ comment_div_cont = '<div class="ffwd_comment_content_' + ffwd + '" id="ffwd_comment_content_' + ffwd + '_' + id + '" >' + comment_author_name + comment_message + comments_date_likes + comment_replies_cont + '<div style="clear:both"></div></div>',
747
+ comment = '<div id="ffwd_comment_' + ffwd + '_' + comment_id + '" class="ffwd_comment_' + ffwd + '" style="' + display + '">' + comment_author_pic + comment_div_cont + '<div style="clear:both" > </div></div>';
748
+
749
+ jQuery('#ffwd_comments_content_' + id + '_' + ffwd + '').append(comment);
750
+ (function (i) {
751
+ jQuery('#ffwd_comment_replies_label_' + result['data'][i]['id']).bind("click", function () {
752
+
753
+ ffwd_get_comments_replies(result['data'][i]['id'], graph_url, ffwd_params, ffwd);
754
+ })
755
+ }(i))
756
+
757
+
758
+ }
759
+ jQuery('#ffwd_comments_content_' + id + '_' + ffwd+' .ffwd_load_more').remove();
760
+ if(typeof result.paging !== "undefined" && typeof result.paging.next !== "undefined"){
761
+ jQuery('#ffwd_comments_content_' + id + '_' + ffwd).append('<span data-ffwd_params="'+ffwd_params+'" data-owner_info="'+owner_info+'" data-type="'+type+'" data-ffwd="'+ffwd+'" data-id="'+id+'" data-next_url = "'+result.paging.next+'" class="ffwd_load_more">Load more</span>')
762
+
763
+ }
764
+ /* if (more_comments) {
765
+ jQuery('#ffwd_comments_content_' + id + '_' + ffwd).append('<div class="ffwd_view_more_comments_cont_' + ffwd + '"> <a href="#" class="ffwd_view_more_comments" more_count="' + z + '"> <span>'+ffwd_frontend_text.view+' '+ z + ' '+ffwd_frontend_text.more_comments+'</span> <a> </div>');
766
+ }
767
+ if (!comments_exist) {
768
+ jQuery('#ffwd_comments_content_' + id + '_' + ffwd).remove();
769
+ }*/
770
+ ffwd_blog_style_resize(ffwd_params, ffwd);
771
+ break;
772
+ case 'shares' :
773
+
774
+ var shares_count = (result!= null && result['count'] != null) ? parseInt(result['count']) : '0';
775
+ jQuery('#ffwd_shares_' + ffwd + '_' + id + ' span').html(shares_count);
776
+ break;
777
+ case 'attachments' :
778
+ var src = '', length = 0, album_id = '';
779
+ /*
780
+ erb story mej nshaca vor addes photos aranc albumi anun talu hetevabar @ngela timline -i mej
781
+ u avtomat et posti subattachmentsneri arkayutayn depqum kberi dranq, ISK ete nshvaca added photos to album esinch
782
+ hetevabar petqa albumi id-in vercnel araji media-i targeti urlic u pageID + albumid posti subattamentner@ cuyc tal!!!!!
783
+ */
784
+
785
+ if (result) {
786
+ /*If exists subattachments*/
787
+ if (result['subattachments']) {
788
+ length = result['subattachments']['data'].length;
789
+ if (typeof result['subattachments']['data'][0]['media'] != "undefined") {
790
+ src = result['subattachments']['data'][0]['media']['image']['src'];
791
+ }
792
+ /*First time add profile picture*/
793
+ if (result['type'] == 'gallery') {
794
+ src = result['subattachments']['data'][length - 1]['media']['image']['src'];
795
+ }
796
+ }
797
+ else if (result['media']) {
798
+ /* Check album containing this photo (compare title)
799
+ * If not Timeline photos or Profile Pictures so get photos from that album
800
+ */
801
+ /*if (result['data'][0]['title'] != 'Timeline Photos' && result['data'][0]['title'] != 'Profile Pictures') {
802
+ album_id = result['data'][0]['url'].split("photos/");
803
+ if (typeof album_id[1] != 'undefined') {
804
+ album_id = album_id[1].split(".");
805
+ album_id = album_id[1];
806
+
807
+ }
808
+ }*/
809
+ src = result['media']['image']['src'];
810
+ }
811
+
812
+
813
+ jQuery('#ffwd_blog_style_img_' + id + '_' + ffwd).attr('src', src);
814
+ if (src == '')
815
+ jQuery('#ffwd_blog_style_img_' + id + '_' + ffwd).remove();
816
+
817
+ }
818
+ ffwd_blog_style_resize(ffwd_params, ffwd);
819
+ break;
820
+ case 'who_post' :
821
+
822
+ var who_post = result;
823
+
824
+ var who_post_name_link = (ffwd_params['blog_style_author'] == "1") ? '<a class="ffwd_blog_style_object_from_name_' + ffwd + '" href="https://www.facebook.com/' + who_post['id'] + '" target="_blank">' + who_post['name'] + '</a>' : '',
825
+ owner_name_link = '<a class="ffwd_blog_style_object_from_name_' + ffwd + '" href="https://www.facebook.com/' + owner_info['id'] + '" target="_blank">' + owner_info['name'] + '</a>',
826
+ who_post_pic = '<img id="ffwd_user_pic_' + ffwd + '_' + id['id'] + '" class="ffwd_user_pic" src="' + who_post['picture']['data']['url'] + '" style="width:50px;height:50px;box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);margin-top: 9px;">',
827
+ place,
828
+ full_place = '',
829
+ story = id['story'].replace(/'/g, "&#039;"),
830
+ who_post_index = story.indexOf(who_post['name']),
831
+ owner_index = story.indexOf(owner_info['name']),
832
+ place_name = '',
833
+ place_id = '',
834
+ story_tags = id['story_tags'],
835
+ place_index = -1;
836
+
837
+ if (id['place'] != null) {
838
+ /* place_id = id['place']['id'];
839
+ if(id['place']['location']){
840
+ var street = (ffwd_params['event_street'] == "1") ? ((typeof id['place']['location']['street'] != 'undefined') ? id['place']['location']['street'] : '') : '',
841
+ city = (ffwd_params['event_city'] == "1") ? ((typeof id['place']['location']['city'] != 'undefined') ? id['place']['location']['city'] : '') : '',
842
+ country = (ffwd_params['event_country'] == "1") ? ((typeof id['place']['location']['country'] != 'undefined') ? id['place']['location']['country'] : '') : '',
843
+ state = (ffwd_params['event_zip'] == "1") ? ((typeof id['place']['location']['state'] != 'undefined') ? id['place']['location']['state'] : '') : '',
844
+ zip = (ffwd_params['event_zip'] == "1") ? ((typeof id['place']['location']['zip'] != 'undefined') ? id['place']['location']['zip'] : '') : '',
845
+ latitude = (ffwd_params['event_map'] == "1") ? ((typeof id['place']['location']['latitude'] != 'undefined') ? id['place']['location']['latitude'] : '') : '',
846
+ longitude = (ffwd_params['event_map'] == "1") ? ((typeof id['place']['location']['longitude'] != 'undefined') ? id['place']['location']['longitude'] : '') : '';
847
+
848
+ full_place = ((ffwd_params['event_street'] == "1") ? '<div class="ffwd_place_street_' + ffwd + '" >' + street + '</div> ' : '') +
849
+ ((ffwd_params['event_city'] == "1" || ffwd_params['event_zip'] == "1" || ffwd_params['event_country'] == "1" ) ? '<div class="ffwd_place_city_state_country_' + ffwd + '" >' + city + ' ' + state + ' ' + zip + ' ' + country + '</div>' : '') +
850
+ ((ffwd_params['event_map'] == "1") ? '<a class="ffwd_place_map_' + ffwd + '" style="text-decoration:underline" href="https://maps.google.com/maps?q=' + latitude + ',' + longitude + '" target="_blank">Map</a>' : '');
851
+ }*/
852
+ if(id['place']['name'] && ffwd_params['event_street'] == "1"){
853
+ full_place = '<div class="ffwd_place_city_state_country_' + ffwd + '" >' + id['place']['name'] + '</div>';
854
+ }
855
+ }
856
+ // Who post
857
+ if (who_post_index != -1) {
858
+ story = story.replace(who_post['name'], who_post_name_link);
859
+ }
860
+ if (owner_index != -1) {
861
+ story = story.replace(owner_info['name'], owner_name_link);
862
+ }
863
+ if (who_post_index == -1 && owner_index == -1) {
864
+ story = who_post_name_link;
865
+ }
866
+
867
+ // With whom after was
868
+ if (story_tags != null) {
869
+ var type = story_tags.constructor.name;
870
+ if (type == "Object") {
871
+ for (var x in story_tags) {
872
+ var story_tag_name = story_tags[x]["0"]["name"],
873
+ story_tag_id = story_tags[x]["0"]["id"];
874
+ with_name_index = story.indexOf(story_tag_name);
875
+ if ((with_name_index != -1) && (story_tag_name != who_post['name']) && (story_tag_name != owner_info['name']) && (story_tag_id != place_id)) {
876
+ story_tag_link = (/*ffwd_params['blog_style_with_whom'] == "1"*/true) ? '<a class="ffwd_blog_style_object_from_name_' + ffwd + '" href="https://www.facebook.com/' + story_tag_id + '" target="_blank">' + story_tag_name + '</a>' : '',
877
+ story = story.replace(story_tag_name, story_tag_link);
878
+ }
879
+ else if (story_tag_id == place_id) {
880
+ // Where after was
881
+ place_index = 1;
882
+ place = (ffwd_params['blog_style_place_name'] == "1") ? '<a class="ffwd_place_name_' + ffwd + '" href="https://www.facebook.com/' + story_tag_id + '" target="_blank">' + story_tag_name + '</a>' : '';
883
+ story = story.replace("\u2014", "");
884
+ story = story.replace(story_tag_name, place);
885
+ }
886
+ }
887
+ }
888
+ else if (type == "Array") {
889
+ for (var j = 0; j < story_tags.length; j++) {
890
+ if (typeof story_tags[j]["0"] != "undefined") {
891
+ var story_tag_name = story_tags[j]["0"]["name"],
892
+ story_tag_id = story_tags[j]["0"]["id"];
893
+ } else {
894
+ var story_tag_name = story_tags[j].name,
895
+ story_tag_id = story_tags[j].id;
896
+ }
897
+ with_name_index = story.indexOf(story_tag_name);
898
+ if ((with_name_index != -1) && (story_tag_name != who_post['name']) && (story_tag_name != owner_info['name']) && (story_tag_id != place_id)) {
899
+ story_tag_link = (/*ffwd_params['blog_style_with_whom'] == "1"*/true) ? '<a class="ffwd_blog_style_object_from_name_' + ffwd + '" href="https://www.facebook.com/' + story_tag_id + '" target="_blank">' + story_tag_name + '</a>' : '',
900
+ story = story.replace(story_tag_name, story_tag_link);
901
+ }
902
 
903
+ else if (story_tag_id == place_id) {
904
+ // Where after was
905
+ place_index = 1;
906
+ place = (ffwd_params['blog_style_place_name'] == "1") ? '<a class="ffwd_place_name_' + ffwd + '" href="https://www.facebook.com/' + story_tag_id + '" target="_blank">' + story_tag_name + '</a>' : '';
907
+ story = story.replace("\u2014", "");
908
+ story = story.replace(story_tag_name, place);
909
+ }
910
+ }
911
+ }
912
+ }
913
+ // Where after was
914
+ if (ffwd_params['blog_style_place_name'] == "1"/* && typeof place != 'undefined' && place != ''*/) {
915
+ if (id['type'] == 'events') {
916
+ story += full_place;
917
+ }
918
+ }
919
+ else {
920
+ story = story.replace(/ at| in|/gi, "");
921
+ }
922
+ jQuery('#ffwd_blog_style_object_from_pic_' + ffwd + '_' + id['id']).html(who_post_pic).attr("href", who_post['link']);
923
+ jQuery('#ffwd_blog_style_object_story_' + ffwd + '_' + id['id']).html(story);
924
+ break;
925
+ default :
926
+ break;
927
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
928
  }
929
 
930
+ jQuery( document ).ready(function() {
931
+ jQuery('body').on('click', '.ffwd_load_more', function (){
932
+ jQuery(this).addClass("loading");
933
+ var ffwd_id = jQuery(this).data("id");
934
+ var ffwd_ffwd = jQuery(this).data("ffwd");
935
+ var ffwd_type = jQuery(this).data("type");
936
+ var ffwd_owner_info = jQuery(this).data("owner_info");
937
+ var ffwd_ffwd_params = jQuery(this).data("ffwd_params");
938
+ var ffwd_graph_url = jQuery(this).data("next_url");
939
+ //var ffwd_result = jQuery(this).data("next_url");
940
+ jQuery.getJSON(ffwd_graph_url, function (result) {
941
+ jQuery(this).removeClass("loading");
942
+ do_something_with_data_blog_style(result, ffwd_id, ffwd_ffwd, ffwd_type, ffwd_owner_info, ffwd_ffwd_params, ffwd_graph_url)
943
+ });
944
+ });
945
+ });
946
  function ffwd_get_comments_replies(comment_id,graph_url,ffwd_params,ffwd) {
947
 
948
+ var url_for_cur_id_comm_replies = graph_url.replace('{FB_ID}', comment_id);
949
+ url_for_cur_id_comm_replies = url_for_cur_id_comm_replies.replace('{EDGE}', 'comments');
950
+ url_for_cur_id_comm_replies = url_for_cur_id_comm_replies.replace('{FIELDS}', 'fields=parent,created_time,from,like_count,message&');
951
+ url_for_cur_id_comm_replies = url_for_cur_id_comm_replies.replace('{OTHER}', '');
952
+ jQuery.getJSON(url_for_cur_id_comm_replies, function (result) {
953
+ for (var k = 0; k < result['data'].length; k++) {
954
+ var parent_comm_id = result['data'][k]["parent"]["id"],
955
+ comment_reply_id = result['data'][k]["id"];
956
+
957
+ var url_for_cur_id_comm_rep_user_pic = graph_url.replace('{FB_ID}', result['data'][k]['from']['id']);
958
+ url_for_cur_id_comm_rep_user_pic = url_for_cur_id_comm_rep_user_pic.replace('{EDGE}', '');
959
+ url_for_cur_id_comm_rep_user_pic = url_for_cur_id_comm_rep_user_pic.replace('{FIELDS}', 'fields=picture&');
960
+ url_for_cur_id_comm_rep_user_pic = url_for_cur_id_comm_rep_user_pic.replace('{OTHER}', '');
961
+
962
+ var comment_reply_author_pic = '<div style="float:left" class="ffwd_comment_reply_author_pic_' + ffwd + '" > <img class="reply_user_' + result['data'][k]['from']['id'] + '" src="https://graph.facebook.com/'+result['data'][k]['from']['id']+'/picture" > </div>',
963
+ comment_reply_author_name = '<a href="https://www.facebook.com/' + result['data'][k]['from']['id'] + '" class="ffwd_comment_reply_author_name_' + ffwd + '" > ' + result['data'][k]['from']['name'] + ' </a>',
964
+ comment_reply_message = '<span class="ffwd_comment_reply_message_' + ffwd + '" > ' + result['data'][k]['message'] + ' </span>',
965
+ comment_reply_date = '<span class="ffwd_comment_reply_date_' + ffwd + '" > ' + ffwd_get_passed_time(result['data'][k]['created_time']) + '</span>',
966
+ comment_reply_likes_count = '<span class="ffwd_comment_reply_likes_count_' + ffwd + '" > ' + result['data'][k]['like_count'] + ' </span>',
967
+ comments_reply_date_likes = '<div>' + comment_reply_date + comment_reply_likes_count + '</div>',
968
+ comment_reply_div_cont = '<div class="ffwd_comment_reply_content_' + ffwd + '" >' + comment_reply_author_name + comment_reply_message + comments_reply_date_likes + '<div style="clear:both"></div></div>',
969
+ comment_reply = '<div id="ffwd_comment_reply_' + ffwd + '_' + comment_reply_id + '" class="ffwd_comment_reply_' + ffwd + '">' + comment_reply_author_pic + comment_reply_div_cont + '<div style="clear:both" > </div></div>';
970
+ jQuery('#ffwd_comment_' + ffwd + '_' + parent_comm_id + ' .ffwd_comment_replies_content_' + ffwd).append(comment_reply);
971
+
972
+ }
973
+ ffwd_blog_style_resize(ffwd_params, ffwd);
974
+ });
975
 
976
 
977
  }
978
  function ffwd_fill_likes(result, ffwd, id) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
979
 
 
980
 
981
 
982
+ var total_reactions_count = {}
983
+ total_reactions_count[ffwd] = parseInt(result['total_reactions']['summary']['total_count']);
984
+ var likes_count = {};
985
+ likes_count[ffwd] = parseInt(result['like']['summary']['total_count']);
986
+ var love_count = {};
987
+ love_count[ffwd] = parseInt(result['love']['summary']['total_count']);
988
+ var wow_count = {};
989
+ wow_count[ffwd] = parseInt(result['wow']['summary']['total_count']);
990
+ var haha_count = {};
991
+ haha_count[ffwd] = parseInt(result['haha']['summary']['total_count']);
992
+ var sad_count = {};
993
+ sad_count[ffwd] = parseInt(result['sad']['summary']['total_count']);
994
+ var angry_count = {};
995
+ angry_count[ffwd] = parseInt(result['angry']['summary']['total_count']);
996
+ jQuery('#ffwd_likes_' + ffwd + '_' + id + ' span').html(total_reactions_count[ffwd]);
997
+ if (total_reactions_count[ffwd] >= 3 && result['total_reactions']['data'][0]) {
998
+ var likes_some_names = '<div class="ffwd_like_name_cont_' + ffwd + '"> <a class="ffwd_like_name_' + ffwd + '" href="https://www.facebook.com/' + result['total_reactions']['data'][0]['id'] + '" target="_blank">' + result['total_reactions']['data'][0]['name'] + ' , </a><a class="ffwd_like_name_' + ffwd + '" href="https://www.facebook.com/' + result['total_reactions']['data'][1]['id'] + '" target="_blank">' + result['total_reactions']['data'][1]['name'] + ' </a></div>';
999
+ var likes_count_last_part = '<div class="ffwd_almost_' + ffwd + '"> ' + ffwd_frontend_text.and + ' ' + (total_reactions_count[ffwd] - 2) + ' ' + ffwd_frontend_text.others + ' </div>';
1000
+ }
1001
+ else if (total_reactions_count[ffwd] == 2 && result['total_reactions']['data'][0]) {
1002
+ var likes_some_names = '<div class="ffwd_like_name_cont_' + ffwd + '"> <a class="ffwd_like_name_' + ffwd + '" href="https://www.facebook.com/' + result['total_reactions']['data'][0]['id'] + '" target="_blank">' + result['total_reactions']['data'][0]['name'] + ' , </a><a class="ffwd_like_name_' + ffwd + '" href="https://www.facebook.com/' + result['total_reactions']['data'][1]['id'] + '" target="_blank">' + result['total_reactions']['data'][1]['name'] + ' </a></div>';
1003
+ var likes_count_last_part = '';
1004
+ }
1005
+ else if (total_reactions_count[ffwd] == 1 && result['total_reactions']['data'][0]) {
1006
+ var likes_some_names = '<div class="ffwd_like_name_cont_' + ffwd + '"> <a class="ffwd_like_name_' + ffwd + '" href="https://www.facebook.com/' + result['total_reactions']['data'][0]['id'] + '" target="_blank">' + result['total_reactions']['data'][0]['name'] + '</a></div>';
1007
+ var likes_count_last_part = '';
1008
+ }
1009
+ else {
1010
+ var likes_some_names = '';
1011
+ var likes_count_last_part = '';
1012
+ }
1013
+
1014
+
1015
+ var reactions_icons = ''
1016
+ reactions_width = 0;
1017
+ if (likes_count[ffwd] != 0) {
1018
+ reactions_icons += '<span class="ffwd_react_icons_like_' + ffwd + '" title="Like"></span>';
1019
+ reactions_width += 40;
1020
+ jQuery('#ffwd_reactions_like_' + id + '_' + ffwd).show();
1021
+ jQuery('#ffwd_tootlip_text_like_' + id + '_' + ffwd).html('Like: ' + likes_count[ffwd]);
1022
+ }
1023
+ if (love_count[ffwd] != 0) {
1024
+ reactions_icons += '<span class="ffwd_react_icons_love_' + ffwd + '" title="Love"></span>';
1025
+ reactions_width += 40;
1026
+ jQuery('#ffwd_reactions_love_' + id + '_' + ffwd).show();
1027
+ jQuery('#ffwd_tootlip_text_love_' + id + '_' + ffwd).html('Love: ' + love_count[ffwd]);
1028
+
1029
+
1030
+ }
1031
+ if (haha_count[ffwd] != 0) {
1032
+ reactions_icons += '<span class="ffwd_react_icons_haha_' + ffwd + '" title="Haha"></span>';
1033
+ reactions_width += 40;
1034
+ jQuery('#ffwd_reactions_haha_' + id + '_' + ffwd).show();
1035
+ jQuery('#ffwd_tootlip_text_haha_' + id + '_' + ffwd).html('Haha: ' + haha_count[ffwd]);
1036
+
1037
+
1038
+ }
1039
+ if (wow_count[ffwd] != 0) {
1040
+ reactions_icons += '<span class="ffwd_react_icons_wow_' + ffwd + '" title="WOW"></span>';
1041
+ reactions_width += 40;
1042
+ jQuery('#ffwd_reactions_wow_' + id + '_' + ffwd).show();
1043
+ jQuery('#ffwd_tootlip_text_wow_' + id + '_' + ffwd).html('Wow: ' + wow_count[ffwd]);
1044
+
1045
+
1046
+ }
1047
+ if (sad_count[ffwd] != 0) {
1048
+ reactions_icons += '<span class="ffwd_react_icons_sad_' + ffwd + '" title="Sad"></span>';
1049
+ reactions_width += 40;
1050
+ jQuery('#ffwd_reactions_sad_' + id + '_' + ffwd).show();
1051
+ jQuery('#ffwd_tootlip_text_sad_' + id + '_' + ffwd).html('Sad: ' + sad_count[ffwd]);
1052
+
1053
+
1054
+ }
1055
+ if (angry_count[ffwd] != 0) {
1056
+ reactions_icons += '<span class="ffwd_react_icons_angry_' + ffwd + '" title="Angry"></span>';
1057
+ reactions_width += 40;
1058
+ jQuery('#ffwd_reactions_angry_' + id + '_' + ffwd).show();
1059
+ jQuery('#ffwd_tootlip_text_angry_' + id + '_' + ffwd).html('Angry: ' + angry_count[ffwd]);
1060
+
1061
+
1062
+ }
1063
+
1064
+ jQuery('#ffwd_reacts_' + id + '_' + ffwd).css('width', reactions_width + 52 + 'px');
1065
+
1066
+ if (total_reactions_count[ffwd] == 0)
1067
+ jQuery('#ffwd_reacts_' + id + '_' + ffwd).css('display', 'none');
1068
+
1069
+ var likes_names_count = '<div class="ffwd_likes_names_' + ffwd + '">' + reactions_icons + likes_some_names + likes_count_last_part + ' </div><div style="clear:both" ></div>';
1070
+
1071
+
1072
+ if (total_reactions_count[ffwd])
1073
+ jQuery('#ffwd_likes_names_count_' + id + '_' + ffwd).html(likes_names_count);
1074
+ else
1075
+ jQuery('#ffwd_likes_names_count_' + id + '_' + ffwd).remove();
1076
+
1077
+ }
1078
+
1079
  function ffwd_blog_style_resize(ffwd_params, ffwd) {
1080
+ var window_width = window.innerWidth,
1081
+ blogstyle_object = jQuery(".blog_style_object_container_" + ffwd),
1082
+ blogstyle_object_width = blogstyle_object.width(),
1083
+ blogstyle_comment_content = jQuery(".ffwd_comment_content_" + ffwd),
1084
+ blogstyle_comment_reply_content = jQuery(".ffwd_comment_reply_content_" + ffwd),
1085
+ blogstyle_comment_content_left_margin = (parseInt(blogstyle_comment_content.css("margin-left"))) ?
1086
+ parseInt(blogstyle_comment_content.css("margin-left")) : 0,
1087
+ comment_author_pic_width = (parseInt(jQuery(".ffwd_comment_author_pic_" + ffwd + " img").css("width"))) ?
1088
+ parseInt(jQuery(".ffwd_comment_author_pic_" + ffwd + " img").css("width")) : 0,
1089
+ comment_reply_author_pic_width = (parseInt(jQuery(".ffwd_comment_reply_author_pic_" + ffwd + " img").css("width"))) ?
1090
+ parseInt(jQuery(".ffwd_comment_reply_author_pic_" + ffwd + " img").css("width")) : 0,
1091
+ comment_content_padding = (parseInt(jQuery(".ffwd_comment_" + ffwd).css("padding-left"))) ?
1092
+ parseInt(jQuery(".ffwd_comment_" + ffwd).css("padding-left")) : 0,
1093
+ ffwd_blog_style_img = jQuery(".ffwd_blog_style_img_" + ffwd);
1094
+ /* Minus one for twenty fifteen theme :))*/
1095
+ max_width_for_comment_content = blogstyle_object_width -
1096
+ comment_author_pic_width -
1097
+ blogstyle_comment_content_left_margin -
1098
+ (2 * comment_content_padding) - 1,
1099
+ max_width_for_comment_reply_content = max_width_for_comment_content -
1100
+ comment_reply_author_pic_width -
1101
+ blogstyle_comment_content_left_margin -
1102
+ (2 * comment_content_padding) - 1;
1103
+
1104
+
1105
+ max_width_for_attachment = (ffwd_params["blog_style_view_type"] != "1" && window_width > 520) ?
1106
+ blogstyle_object_width * 0.55 : blogstyle_object_width;
1107
+
1108
+ blogstyle_comment_content.css("max-width", max_width_for_comment_content);
1109
+ blogstyle_comment_reply_content.css("max-width", max_width_for_comment_reply_content);
1110
+ ffwd_blog_style_img.css("max-width", max_width_for_attachment);
1111
  }
1112
 
1113
 
1117
  url: ffwd_frontend_text.ajax_url,
1118
  data: {
1119
  'action': 'ffwd_autoupdate',
1120
+ },
1121
  type: 'get',
1122
  success: function (response) {
1123
  console.log(response);
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: webdorado,10web,wdsupport
3
  Tags: customizable facebook feed, facebook, facebook feed, facebook group, facebook like box, facebook likes, facebook page, facebook photos, facebook plugin, facebook posts, facebook likebox
4
  Requires at least: 3.4
5
  Requires PHP: 5.2
6
- Tested up to: 5.3
7
- Stable tag: 1.1.24
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -104,6 +104,10 @@ If you think you found a bug in 10Web Facebook Feed or have any problem/question
104
  The plugin uses Facebook API to get public data from Facebook. All the received data is cached in WordPress database for some short customizable period to provide optimization. You can delete or update cached data. You can optionally enable like button for Facebook page. If you do so, Facebook will load some JS and embedded content which may track visitors. Facebook embeds are regulated under terms of Facebook privacy policy https://www.facebook.com/policy.php.
105
 
106
  == Changelog ==
 
 
 
 
107
  = 1.1.24 =
108
  * Fixed: Compatibility with IE.
109
 
3
  Tags: customizable facebook feed, facebook, facebook feed, facebook group, facebook like box, facebook likes, facebook page, facebook photos, facebook plugin, facebook posts, facebook likebox
4
  Requires at least: 3.4
5
  Requires PHP: 5.2
6
+ Tested up to: 5.5
7
+ Stable tag: 1.1.25
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
104
  The plugin uses Facebook API to get public data from Facebook. All the received data is cached in WordPress database for some short customizable period to provide optimization. You can delete or update cached data. You can optionally enable like button for Facebook page. If you do so, Facebook will load some JS and embedded content which may track visitors. Facebook embeds are regulated under terms of Facebook privacy policy https://www.facebook.com/policy.php.
105
 
106
  == Changelog ==
107
+ = 1.1.25 =
108
+ * Fixed: Include plugin css/js if feed exists.
109
+ * Fixed: implode function arguments for php 7.4.
110
+
111
  = 1.1.24 =
112
  * Fixed: Compatibility with IE.
113