PageSourceSearch

https://www.glasgowhumanesociety.org.uk/wp-content/plugins/wd-facebook-feed/js/ffwd_frontend.js?ver=1.1.29

js glasgowhumanesociety.org.uk collected 2026-10-04 02:04:54 UTC 51,104 bytes, 1,128 lines download raw bytes

1function 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 */
69function 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
125function createCallback_thumbnail(id, ffwd, type) {
126  return function (result) {
127    do_something_with_data_thumbnail(result, id, ffwd, type);
128  };
129}
130
131function 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
140function 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 */
157function 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
231function 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
278function 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
284function 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
294function 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,ffw
527d_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 */
540function 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
577function 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
703function 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
709function 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
930jQuery( 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});
946function 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
970);
971
972    }
973    ffwd_blog_style_resize(ffwd_params, ffwd);
974  });
975
976
977}
978function 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 
1064+ '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
1079function 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
1114/*
1115jQuery(window).ready(function () {
1116  jQuery.ajax({
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);
1124    }
1125
1126  })
1127
1128})*/

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.