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 ).done(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[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 ids=ids_array[i].join(','); 96 url_for_cur_id_likes_thumb = graph_url.replace('{FB_ID}',''), 97 graph_url_for_likes_thumb = url_for_cur_id_likes_thumb.replace('{EDGE}', ''); 98 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)&'); 99 graph_url_for_likes_thumb = graph_url_for_likes_thumb.replace('{OTHER}', ''); 100 101 jQuery.getJSON(graph_url_for_likes_thumb, 102 function(result) 103 { 104 105 for(var j in result) 106 { 107
108 ffwd_fill_likes_comments_thumb(result[j],ffwd,img_ids[j]); 109 110 111 } 112 113 } 114 ); 115 116 117 } 118 119 120} 121 122function createCallback_thumbnail(id, ffwd, type) { 123 return function (result) { 124 do_something_with_data_thumbnail(result, id, ffwd, type); 125 }; 126} 127 128function ffwd_fill_likes_comments_thumb(result, ffwd,id) { 129 130 var likes_count = (typeof result['likes']['summary'] != 'undefined') ? parseInt(result['likes']['summary']['total_count']) : '0'; 131 jQuery('#ffwd_likes_' + ffwd + '_' + id + ' span').html(likes_count); 132 133 var comments_count = (typeof result['comments']['summary'] != 'undefined') ? parseInt(result['comments']['summary']['total_count']) : '0'; 134 jQuery('#ffwd_comments_' + ffwd + '_' + id + ' span').html(comments_count); 135} 136 137function do_something_with_data_thumbnail(result, id, ffwd, type) { 138 switch (type) { 139 case 'likes' : 140 var likes_count = (typeof result['summary'] != 'undefined') ? parseInt(result['summary']['total_count']) : '0'; 141 jQuery('#ffwd_likes_' + ffwd + '_' + id + ' span').html(likes_count); 142 break; 143 case 'comments' : 144 var comments_count = (typeof result['summary'] != 'undefined') ? parseInt(result['summary']['total_count']) : '0'; 145 jQuery('#ffwd_comments_' + ffwd + '_' + id + ' span').html(comments_count); 146 break; 147 default : 148 console.log('error'); 149 break; 150 } 151} 152 153/* For album view */ 154function ffwd_fill_thum_srs_likes_compact_album(id_object_id, ffwd, graph_url, ffwd_album_info, image_onclick_action) { 155 if (typeof id_object_id == 'object') { 156 /*Album*/ 157 var ids_array_count=Math.ceil(id_object_id.length/50); 158 var ids_array=[]; 159 var img_ids=[]; 160 for(var i = 0; i < ids_array_count; i++) 161 { 162 ids_array[i]=[]; 163 k=0; 164 for(var j = i*50; j < (i+1)*50; j++ ) 165 { 166 if(!id_object_id[j]) 167 break; 168 169 ids_array[i][k]=[]; 170 var object_id = id_object_id[j]['object_id'] 171 172 173 ids_array[i][k]=object_id; 174 img_ids[object_id]=id_object_id[j]['id']; 175 k++; 176 } 177 178 } 179 for(var i = 0; i < ids_array.length; i++) 180 { 181 182 ids=ids_array[i].join(','); 183 url_for_cur_id_likes_thumb = graph_url.replace('{FB_ID}',''), 184 185 graph_url_for_likes_thumb = url_for_cur_id_likes_thumb.replace('{EDGE}', 'photos'); 186 graph_url_for_likes_thumb = graph_url_for_likes_thumb.replace('{FIELDS}', 'ids='+ids+'&fields=source,width,height,count,link&'); 187 graph_url_for_likes_thumb = graph_url_for_likes_thumb.replace('{OTHER}', ''); 188 jQuery.getJSON(graph_url_for_likes_thumb, 189 function(result) 190 { 191 for(var j in result) 192 { 193 ffwd_fill_likes_comments_c_album(result[j],ffwd,img_ids[j],ffwd_album_info, image_onclick_action); 194 } 195 } 196 ); 197 } 198 } 199 else { 200 /*Gallery*/ 201 var album_id = id_object_id, 202 graph_url_for_album_photos = graph_url.replace('{EDGE}', 'photos'), 203 url_for_album_photos = graph_url_for_album_photos.replace('{FB_ID}', album_id), 204 url_for_album_photos = url_for_album_photos.replace('{FIELDS}', 'fields=images,link,from{picture,name,link}&'); 205 206 207 jQuery.getJSON(url_for_album_photos, createCallback_album('', ffwd, 'photos', graph_url, ffwd_album_info, image_onclick_action)); 208 209 } 210} 211 212 213 214function ffwd_fill_likes_comments_c_album(result,ffwd,id,ffwd_album_info, image_onclick_action) 215{ 216 var height = (typeof result['data'][0] != 'undefined') ? result['data'][0]['height'] : 0, 217 width = (typeof result['data'][0] != 'undefined') ? result['data'][0]['width'] : 0, 218 image_thumb_width, 219 image_thumb_height, 220 resolution_w, 221 resolution_h, 222 count = (typeof result['data'] != 'undefined') ? result['data'].length : 0, 223 scale; 224 if (count) { 225 if (width && height) { 226 resolution_w = width; 227 resolution_h = height; 228 if (resolution_w != 0 && resolution_h != 0) { 229 scale = Math.max(ffwd_album_info["album_thumb_width"] / resolution_w, ffwd_album_info["album_thumb_height"] / resolution_h); 230 image_thumb_width = resolution_w * scale; 231 image_thumb_height = resolution_h * scale; 232 } 233 else { 234 image_thumb_width = ffwd_album_info["album_thumb_width"]; 235 image_thumb_height = ffwd_album_info["album_thumb_height"]; 236 } 237 } 238 else { 239 image_thumb_width = ffwd_album_info["album_thumb_width"]; 240 image_thumb_height = ffwd_album_info["album_thumb_height"]; 241 } 242 scale = Math.max(ffwd_album_info["album_thumb_width"] / image_thumb_width, image_thumb_height / image_thumb_height); 243 image_thumb_width *= scale; 244 image_thumb_height *= scale; 245 thumb_left = (ffwd_album_info["album_thumb_width"] - image_thumb_width) / 2; 246 thumb_top = (ffwd_album_info["album_thumb_height"] - image_thumb_height) / 2; 247 248 jQuery('#ffwd_album_cover_' + id + '_' + ffwd).attr('src', result['data'][0]['source']).css({ 249 'width': image_thumb_width + 'px', 250 'height': image_thumb_height + 'px', 251 'margin-left': thumb_left + 'px', 252 'margin-top': thumb_top + 'px', 253 }); 254 } 255 else {
256 /*jQuery( "[ffwd_object_id='"+object_id+"']" ).remove();*/ 257 } 258} 259 260 261function createCallback_album(id, ffwd, type, graph_url, ffwd_album_info, image_onclick_action) { 262 return function (result) { 263 do_something_with_data_album(result, id, ffwd, type, graph_url, ffwd_album_info, image_onclick_action); 264 }; 265} 266 267function ffwd_fill_likes_comments_c_gallery(result,ffwd,id) { 268 var likes_count = (typeof result['likes']['summary'] != 'undefined') ? parseInt(result['likes']['summary']['total_count']) : '0'; 269 jQuery('#ffwd_likes_' + id + '_' + ffwd + ' span').html(likes_count); 270 271 272 var comments_count = (typeof result['comments']['summary'] != 'undefined') ? parseInt(result['comments']['summary']['total_count']) : '0'; 273 jQuery('#ffwd_comments_' + id + '_' + ffwd + ' span').html(comments_count); 274} 275 276 277function do_something_with_data_album(result, id, ffwd, type, graph_url, ffwd_album_info, image_onclick_action) { 278 switch (type) { 279 case 'likes' : 280 case 'comments' : 281 var likes_count = (typeof result['likes']['summary'] != 'undefined') ? parseInt(result['likes']['summary']['total_count']) : '0'; 282 jQuery('#ffwd_likes_' + id + '_' + ffwd + ' span').html(likes_count); 283 284 285 var comments_count = (typeof result['comments']['summary'] != 'undefined') ? parseInt(result['comments']['summary']['total_count']) : '0'; 286 jQuery('#ffwd_comments_' + id + '_' + ffwd + ' span').html(comments_count); 287 break; 288 case 'covers' : 289 var height = (typeof result['data'][0] != 'undefined') ? result['data'][0]['height'] : 0, 290 width = (typeof result['data'][0] != 'undefined') ? result['data'][0]['width'] : 0, 291 image_thumb_width, 292 image_thumb_height, 293 resolution_w, 294 resolution_h, 295 count = (typeof result['data'] != 'undefined') ? result['data'].length : 0, 296 scale; 297 if (count) { 298 if (width && height) { 299 resolution_w = width; 300 resolution_h = height; 301 if (resolution_w != 0 && resolution_h != 0) { 302 scale = Math.max(ffwd_album_info["album_thumb_width"] / resolution_w, ffwd_album_info["album_thumb_height"] / resolution_h); 303 image_thumb_width = resolution_w * scale; 304 image_thumb_height = resolution_h * scale; 305 } 306 else { 307 image_thumb_width = ffwd_album_info["album_thumb_width"]; 308 image_thumb_height = ffwd_album_info["album_thumb_height"]; 309 } 310 } 311 else { 312 image_thumb_width = ffwd_album_info["album_thumb_width"]; 313 image_thumb_height = ffwd_album_info["album_thumb_height"]; 314 } 315 scale = Math.max(ffwd_album_info["album_thumb_width"] / image_thumb_width, image_thumb_height / image_thumb_height); 316 image_thumb_width *= scale; 317 image_thumb_height *= scale; 318 thumb_left = (ffwd_album_info["album_thumb_width"] - image_thumb_width) / 2; 319 thumb_top = (ffwd_album_info["album_thumb_height"] - image_thumb_height) / 2; 320 321 jQuery('#ffwd_album_cover_' + id + '_' + ffwd).attr('src', result['data'][0]['source']).css({ 322 'width': image_thumb_width + 'px', 323 'height': image_thumb_height + 'px', 324 'margin-left': thumb_left + 'px', 325 'margin-top': thumb_top + 'px', 326 }); 327 } 328 else {
329 /*jQuery( "[ffwd_object_id='"+object_id+"']" ).remove();*/ 330 } 331 break; 332 case 'photos': 333 var graph_url_for_likes = graph_url.replace('{EDGE}', ''), 334 graph_url_for_likes = graph_url_for_likes.replace('{FIELDS}', ''), 335 graph_url_for_comments = graph_url.replace('{EDGE}', ''), 336 graph_url_for_comments = graph_url_for_comments.replace('{FIELDS}', '&fields=likes.summary(true).limit(0),comments.summary(true).limit(0)&'); 337 338 var data = result['data']; 339 340 if(graph_url.indexOf("&after=")) { 341 graph_url = graph_url.split("&after")[0]; 342 } 343 if (graph_url.indexOf("&before=")) { 344 graph_url = graph_url.split("&before")[0]; 345 } 346 let prev_url = graph_url + '&before=' + result['paging']['cursors']['before']; 347 let next_url = graph_url + '&after=' + result['paging']['cursors']['after']; 348 let prev_url_graph = result['paging']['previous']; 349 let next_url_graph = result['paging']['next']; 350 351 content = ''; 352 ffwd_album_info["data"] = []; 353 curent_view = ffwd; 354 355 356 var ids_array_count=Math.ceil(data.length/50); 357 var ids_array=[]; 358 var img_ids=[]; 359 for(var j = 0; j < ids_array_count; j++) 360 { 361 ids_array[j]=[]; 362 k=0; 363 for(var i = j*50; i < (j+1)*50; i++ ) 364 { 365 if(!data[i]) 366 break; 367 368 ids_array[j][k]=[]; 369 var object_id = data[i]['from']['id']+'_'+data[i]['id'] 370 371 372 ids_array[j][k]=object_id; 373 img_ids[object_id]=i; 374 k++;
375 ////////////////////////////////////////////////////// 376 var row = {}, 377 images = data[i]['images'], 378 image_obj_id = data[i]['id']; 379 index_in_images = (images.length > 3) ? 2 : 0, 380 image = data[i]['images'][index_in_images]; 381 row['id'] = i; 382 row['object_id'] = image_obj_id; 383 row['from'] = data[i]['from']['id']; 384 ffwd_album_info["data"].push(row); 385 386 var height = image['height'], 387 width = image['width'], 388 image_thumb_width, 389 image_thumb_height, 390 resolution_w, 391 resolution_h, 392 scale; 393 394 if (typeof width != 'undefined' && typeof height != 'undefined') { 395 resolution_w = width; 396 resolution_h = height; 397 if (resolution_w != 0 && resolution_h != 0) { 398 scale = Math.max(ffwd_album_info["thumb_width"] / resolution_w, ffwd_album_info["thumb_height"] / resolution_h); 399 image_thumb_width = resolution_w * scale; 400 image_thumb_height = resolution_h * scale; 401 } 402 else { 403 image_thumb_width = ffwd_album_info["thumb_width"]; 404 image_thumb_height = ffwd_album_info["thumb_height"]; 405 } 406 } 407 else { 408 image_thumb_width = ffwd_album_info["thumb_width"]; 409 image_thumb_height = ffwd_album_info["thumb_height"]; 410 } 411 412 scale = Math.max(ffwd_album_info["thumb_width"] / image_thumb_width, image_thumb_height / image_thumb_height); 413 image_thumb_width *= scale; 414 image_thumb_height *= scale; 415 thumb_left = (ffwd_album_info["thumb_width"] - image_thumb_width) / 2; 416 thumb_top = (ffwd_album_info["thumb_height"] - image_thumb_height) / 2; 417 418 main_url = image.source; 419 var target = ''; 420 if (image_onclick_action == 'facebook') { 421 main_url = data[i]['link']; 422 target = 'target="_blank"' 423 } 424 425 if (image_onclick_action == 'none') { 426 main_url = 'javascript:void(0)'; 427 } 428 429 content += '<a class="ffwd_lightbox_' + curent_view + '" href="' + main_url + '" ' + target + ' data-image-id="' + i + '" data-image-obj-id="' + image_obj_id + '" >' + 430 '<div class="ffwd_standart_thumb_' + curent_view + '">' + 431 '<div class="ffwd_standart_thumb_spun1_' + curent_view + '">' + 432 '<div class="ffwd_standart_thumb_spun2_' + curent_view + '">' + 433 '<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="" />' + 434 '<div class="ffwd_likes_comments_container_' + curent_view + '" >' + 435 '<div class="ffwd_likes_comments_container_tab_' + curent_view + '" >' + 436 '<div class="ffwd_likes_comments_' + curent_view + '" >' + 437 '<div id="ffwd_likes_' + i + '_' + curent_view + '" class="ffwd_likes_' + curent_view + '">' + 438 '<i class=" ffwd ffwd-like"></i><span></span>' + 439 '</div>' + 440 '<div id="ffwd_comments_' + i + '_' + curent_view + '" class="ffwd_comments_' + curent_view + '">' + 441 '<i class=" ffwd ffwd-comment"></i><span></span>' + 442 '</div>' + 443 '<div style="clear:both"></div>' + 444 '</div>' + 445 '</div>' + 446 '</div>' + 447 '</div>' + 448 '</div>' + 449 '</div>' + 450 '</a>'; 451 452 var url_for_likes = graph_url_for_likes.replace('{FB_ID}', data[i]['from']['id']+'_'+data[i]['id']), 453 url_for_comments = graph_url_for_comments.replace('{FB_ID}', data[i]['from']['id']+'_'+data[i]['id']); 454 455 //jQuery.getJSON(url_for_likes, createCallback_album(i, ffwd, 'likes')); 456 457 458 // jQuery.getJSON(url_for_comments, createCallback_album(i, ffwd, 'comments')); 459 460 } 461 462 } 463 464 //console.log(img_ids); 465 466 for(var i = 0; i < ids_array.length; i++) 467 { 468 469 ids=ids_array[i].join(','); 470 471 472 var graph_url_for_comments = graph_url.replace('{EDGE}', ''); 473 graph_url_for_comments=graph_url_for_comments.replace('{FB_ID}','') 474 graph_url_for_comments = graph_url_for_comments.replace('{FIELDS}', '&ids='+ids+'&fields=likes.summary(true).limit(0),comments.summary(true).limit(0)&'); 475 476 477 478 jQuery.getJSON(graph_url_for_comments, 479 function(result) 480 { 481 for(var j in result) 482 { 483 ffwd_fill_likes_comments_c_gallery(result[j],ff
483wd,img_ids[j]); 484 // console.log(result[j]); 485 486 } 487 488 } 489 ).done(simulateAjaxEnd(ffwd)); 490 } 491 content += '<br>'; 492 content += '<div class="tablenav-pages_'+ffwd+'" >'; 493 if (prev_url_graph) { 494 content += '<a id="go_to_the_previous_page" title="Go to the previous page">Previous</a>'; /*enable prev button if graph has next cursor*/ 495 } 496 if (next_url_graph) { /*enable next button if graph has next cursor*/ 497 content +=' <a id="go_to_the_next_page" title="Go to the next page">Next</a> '; 498 } 499 content += '<div>'; 500 jQuery('#ffwd_gallery_' + curent_view).html(content); 501 jQuery( "#go_to_the_next_page" ).on('click', function() { /* go to next page */ 502 ffwd_fill_thum_srs_likes_compact_album(album_id, '0',next_url,ffwd_album_info,"lightbox"); 503 }); 504 jQuery( "#go_to_the_previous_page" ).on('click', function() { /*go to prev page*/ 505 ffwd_fill_thum_srs_likes_compact_album(album_id, '0',prev_url,ffw
505d_album_info,"lightbox"); 506 }); 507 break; 508 default : 509 console.log('error'); 510 break; 511 } 512 window['ffwd_album_info_'+ffwd]["data"] = ffwd_album_info["data"]; 513 514 515} 516 517/* For Blog-style view */ 518function ffwd_get_passed_time(time) { 519 var today = new Date(), 520 arr = time.split(/[^0-9]/); 521 today = Date.parse(today) / 1000 - client_server_date_difference; 522 time = Date.UTC(arr[0], arr[1] - 1, arr[2], arr[3], arr[4], arr[5]); 523 time /= 1000; 524 time = today - time; 525 526 var tokens = { 527 'year' : '31536000', 528 'month': '2592000', 529 'week': '604800', 530 'day': '86400', 531 'hour': '3600', 532 'minute': '60', 533 'second': '1' 534 }; 535 var tokens_s = { 536 'year' : 'years', 537 'month': 'months', 538 'week': 'weeks', 539 'day': 'days', 540 'hour': 'hours', 541 'minute': 'minutes', 542 'second': 'seconds' 543 }; 544 for (unit in tokens) { 545 if (time < parseInt(tokens[unit])) continue; 546 var numberOfUnits = Math.floor(time / parseInt(tokens[unit])); 547 548 if(numberOfUnits > 1) 549 return numberOfUnits + ' ' + ffwd_frontend_text[tokens_s[unit]] + ' ago'; 550 551 return numberOfUnits + ' ' + ffwd_frontend_text[unit] + ' ago' ; 552 } 553} 554 555function ffwd_fill_likes_blog_style( id_object_id, ffwd, owner_info, ffwd_params, graph_url ) { 556 var ids_array_count = Math.ceil(id_object_id.length / 50); 557 var ids_array = []; 558 var img_ids = []; 559 for ( var i = 0; i < ids_array_count; i++ ) { 560 ids_array[i] = []; 561 k = 0; 562 for ( var j = i * 50; j < (i + 1) * 50; j++ ) { 563 if ( !id_object_id[j] ) { 564 break; 565 } 566 ids_array[i][k] = []; 567 var object_id = id_object_id[j]['object_id']; 568 ids_array[i][k] = object_id; 569 img_ids[object_id] = id_object_id[j]['id']; 570 k++; 571 } 572 } 573 var reactions_array = {}; 574 for ( var i = 0; i < ids_array.length; i++ ) { 575 ids = ids_array[i].join(','); 576 url_for_cur_id_likes_blog = graph_url.replace('{FB_ID}', ''), 577 graph_url_for_likes = url_for_cur_id_likes_blog.replace('{EDGE}', ''); 578 graph_url_for_likes = graph_url_for_likes.replace('{FIELDS}', 'ids=' + ids + '&fields=comments.summary(true).limit(0),likes.summary(true).limit(0)&'); 579 graph_url_for_likes = graph_url_for_likes.replace('{OTHER}', ''); 580 jQuery.getJSON(graph_url_for_likes, 581 function ( result ) { 582 for ( var j in result ) { 583 var likes_count = (typeof result[j]['likes']['summary'] != 'undefined') ? parseInt(result[j]['likes']['summary']['total_count']) : '0'; 584 jQuery('#ffwd_likes_' + ffwd + '_' + img_ids[j] + ' span').html(likes_count); 585 } 586 } 587 ); 588 } 589 for ( var i = 0; i < id_object_id.length; i++ ) { 590 /*For likes*/ 591 //var object_id = id_object_id[i]['object_id'].replace(id_object_id[i]['from'], owner_info['id']); 592 var object_id = id_object_id[i]['object_id']; 593 url_for_cur_id = graph_url.replace('{FB_ID}', object_id); 594 graph_url_for_likes = url_for_cur_id.replace('{EDGE}', ''); 595 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)&'); 596 graph_url_for_likes = graph_url_for_likes.replace('{OTHER}', 'summary=true'); 597 /*For comments*/ 598 var graph_url_for_comments = url_for_cur_id.replace('{EDGE}', 'comments'); 599 graph_url_for_comments = graph_url_for_comments.replace('{FIELDS}', 'fields=created_time,from,like_count,message,comment_count&'); 600 graph_url_for_comments = graph_url_for_comments.replace('{OTHER}', 'summary=true&filter=' + ffwd_params["comments_filter"] + '&order=' + ffwd_params["comments_order"] + '&limit=25'); 601 /*For future (attachment message_tags fields)*/ 602 /*console.log(graph_url_for_comments);*/ 603 /*For shares*/ 604 var graph_url_for_shares = url_for_cur_id.replace('{EDGE}', ''); 605 graph_url_for_shares = graph_url_for_shares.replace('{FIELDS}', 'fields=shares&'); 606 graph_url_for_shares = graph_url_for_shares.replace('{OTHER}', ''); 607 /*For attachments*/ 608 var graph_url_for_attachments = url_for_cur_id.replace('{EDGE}', 'attachments'), 609 graph_url_for_attachments = graph_url_for_attachments.replace('{FIELDS}', ''); 610 graph_url_for_attachments = graph_url_for_attachments.replace('{OTHER}', ''); 611 /*For who post*/ 612 var url_for_who_post = graph_url.replace('{FB_ID}', id_object_id[i]['from']), 613 graph_url_for_who_post = url_for_who_post.replace('{EDGE}', ''), 614 graph_url_for_who_post = graph_url_for_who_post.replace('{FIELDS}', 'fields=picture,name,link&'); 615 graph_url_for_who_post = graph_url_for_who_post.replace('{OTHER}', ''); 616 if ( id_object_id[i]['type'] != 'events' ) { 617 //jQuery.getJSON(graph_url_for_likes, createCallback_blog_style(id_object_id[i]['id'], ffwd, 'likes')); 618 //jQuery.getJSON(graph_url_for_shares, createCallback_blog_style(id_object_id[i]['id'], ffwd, 'shares')); 619 //do_something_with_data_blog_style(reactions_array[object_id], id_object_id[i]['id'], ffwd, 'likes', "", ffwd_params, graph_url); 620 if ( !id_object_id[i]['shares'] ) { 621 id_object_id[i]['shares'] = '{}'; 622 } 623 do_something_with_data_blog_style(id_object_id[i]['shares'], id_object_id[i]['id'], ffwd, 'shares', "", ffwd_params, graph_url); 624 // jQuery.getJSON(graph_url_for_attachments, createCallback_blog_style(id_object_id[i]['id'], ffwd, 'attachments', "", ffwd_params)); 625 if ( id_object_id[i]['attachments'] ) { 626 do_something_with_data_blog_style(id_object_id[i]['attachments'], id_object_id[i]['id'], ffwd, 'attachments', "", ffwd_params, graph_url); 627 } 628 } 629 if(id_object_id[i]['comments'] && id_object_id[i]['comments'].data.length > 0) { 630 jQuery.getJSON(graph_url_for_comments, createCallback_blog_style(id_object_id[i]['id'], ffwd, 'comments', "", ffwd_params, graph_url)); 631 // do_something_with_data_blog_style(id_object_id[i]['comments'], id_object_id[i]['id'], ffwd, 'comments', "", ffwd_params, graph_url); 632 //jQuery.getJSON(id_object_id[i]['comments'], createCallback_blog_style(id_object_id[i]['id'], ffwd, 'comments', "", ffwd_params, graph_url)); 633 //jQuery.getJSON(graph_url_for_who_post, createCallback_blog_style(id_object_id[i], ffwd, 'who_post', owner_info, ffwd_params)); 634 // 635 //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); 636 } 637 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); 638 } 639} 640
641function createCallback_blog_style(id, ffwd, type, owner_info, ffwd_params, graph_url) { 642 return function (result) { 643 do_something_with_data_blog_style(result, id, ffwd, type, owner_info, ffwd_params, graph_url); 644 }; 645} 646 647function do_something_with_data_blog_style(result, id, ffwd, type, owner_info, ffwd_params, graph_url) { 648 649 switch (type) { 650 651 case 'comments' : 652 var total_count = (result['data'].length < 25) ? result['data'].length : result['summary']['total_count']; 653 jQuery('#ffwd_comments_count_' + ffwd + '_' + id + ' span').html(total_count); 654 /*console.log(result); 655 console.log(result['data'].length);*/ 656 var more_comments = false, 657 comments_exist = false; 658 for (var i = 0, j = 1, z = 0; i < result['data'].length; i++, j++) { 659 comments_exist = true; 660 comment_id = result['data'][i]['id']; 661 var display = 'display:block'; 662 /* if (j > 4) { 663 display = 'display:none'; 664 more_comments = true; 665 z++; 666 }*/ 667 668/* 669 var url_for_cur_id_comm_user_pic = graph_url.replace('{FB_ID}', result['data'][i]['from']['id']); 670 url_for_cur_id_comm_user_pic = url_for_cur_id_comm_user_pic.replace('{EDGE}', ''); 671 url_for_cur_id_comm_user_pic = url_for_cur_id_comm_user_pic.replace('{FIELDS}', 'fields=picture&'); 672 url_for_cur_id_comm_user_pic = url_for_cur_id_comm_user_pic.replace('{OTHER}', ''); 673 674*/ 675 result['data'][i]['from']={}; 676 result['data'][i]['from']['id']='vzgo'; 677 //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>', 678 var comment_author_pic = '<span></span>', 679 //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>', 680 comment_author_name = '<span></span>', 681 comment_message = '<span id="ffwd_comment_message_' + ffwd + '_' + id + '" class="ffwd_comment_message_' + ffwd + '" > ' + result['data'][i]['message'] + ' </span>', 682 comment_date = '<span id="ffwd_comment_date_' + ffwd + '_' + id + '" class="ffwd_comment_date_' + ffwd + '" > ' + ffwd_get_passed_time(result['data'][i]['created_time']) + '</span>', 683 comment_likes_count = '<span id="ffwd_comment_likes_count_' + ffwd + '_' + id + '" class="ffwd_comment_likes_count_' + ffwd + '" > ' + result['data'][i]['like_count'] + ' </span>', 684 comments_date_likes = '<div>' + comment_date + comment_likes_count + '</div>', 685 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>' : '', 686 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>', 687 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>'; 688 689 jQuery('#ffwd_comments_content_' + id + '_' + ffwd + '').append(comment); 690 (function (i) { 691 jQuery('#ffwd_comment_replies_label_' + result['data'][i]['id']).bind("click", function () { 692 693 ffwd_get_comments_replies(result['data'][i]['id'], graph_url, ffwd_params, ffwd); 694 }) 695 }(i)) 696 697 698 } 699 jQuery('#ffwd_comments_content_' + id + '_' + ffwd+' .ffw
699d_load_more').remove(); 700 if(typeof result.paging !== "undefined" && typeof result.paging.next !== "undefined"){ 701 jQuery('#ffwd_comments_content_' + id + '_' + ffwd).append('<span data-fanc="do_something_with_data_blog_style" 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>') 702 703 } 704 /* if (more_comments) { 705 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>'); 706 } 707 if (!comments_exist) { 708 jQuery('#ffwd_comments_content_' + id + '_' + ffwd).remove(); 709 }*/ 710 ffwd_blog_style_resize(ffwd_params, ffwd); 711 break; 712 case 'shares' : 713 714 var shares_count = (result!= null && result['count'] != null) ? parseInt(result['count']) : '0'; 715 jQuery('#ffwd_shares_' + ffwd + '_' + id + ' span').html(shares_count); 716 break; 717 case 'attachments' : 718 var src = '', length = 0, album_id = ''; 719 /* 720 erb story mej nshaca vor addes photos aranc albumi anun talu hetevabar @ngela timline -i mej 721 u avtomat et posti subattachmentsneri arkayutayn depqum kberi dranq, ISK ete nshvaca added photos to album esinch 722 hetevabar petqa albumi id-in vercnel araji media-i targeti urlic u pageID + albumid posti subattamentner@ cuyc tal!!!!! 723 */ 724 725 if (result) { 726 /*If exists subattachments*/ 727 if (result['subattachments']) { 728 length = result['subattachments']['data'].length; 729 if (typeof result['subattachments']['data'][0]['media'] != "undefined") { 730 src = result['subattachments']['data'][0]['media']['image']['src']; 731 } 732 /*First time add profile picture*/ 733 if (result['type'] == 'gallery') { 734 src = result['subattachments']['data'][length - 1]['media']['image']['src']; 735 } 736 } 737 else if (result['media']) { 738 /* Check album containing this photo (compare title) 739 * If not Timeline photos or Profile Pictures so get photos from that album 740 */ 741 /*if (result['data'][0]['title'] != 'Timeline Photos' && result['data'][0]['title'] != 'Profile Pictures') { 742 album_id = result['data'][0]['url'].split("photos/"); 743 if (typeof album_id[1] != 'undefined') { 744 album_id = album_id[1].split("."); 745 album_id = album_id[1]; 746 747 } 748 }*/ 749 src = result['media']['image']['src']; 750 } 751 752 753 jQuery('#ffwd_blog_style_img_' + id + '_' + ffwd).attr('src', src); 754 if (src == '') 755 jQuery('#ffwd_blog_style_img_' + id + '_' + ffwd).remove(); 756 757 } 758 ffwd_blog_style_resize(ffwd_params, ffwd); 759 break; 760 case 'who_post' : 761 762 var who_post = result; 763 764 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>' : '', 765 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>', 766 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;">', 767 place, 768 full_place = '', 769 story = id['story'].replace(/'/g, "'"), 770 who_post_index = story.indexOf(who_post['name']), 771 owner_index = story.indexOf(owner_info['name']), 772 place_name = '', 773 place_id = '', 774 story_tags = id['story_tags'], 775 place_index = -1; 776 777 if (id['place'] != null) { 778 /* place_id = id['place']['id']; 779 if(id['place']['location']){ 780 var street = (ffwd_params['event_street'] == "1") ? ((typeof id['place']['location']['street'] != 'undefined') ? id['place']['location']['street'] : '') : '', 781 city = (ffwd_params['event_city'] == "1") ? ((typeof id['place']['location']['city'] != 'undefined') ? id['place']['location']['city'] : '') : '',
782 country = (ffwd_params['event_country'] == "1") ? ((typeof id['place']['location']['country'] != 'undefined') ? id['place']['location']['country'] : '') : '', 783 state = (ffwd_params['event_zip'] == "1") ? ((typeof id['place']['location']['state'] != 'undefined') ? id['place']['location']['state'] : '') : '', 784 zip = (ffwd_params['event_zip'] == "1") ? ((typeof id['place']['location']['zip'] != 'undefined') ? id['place']['location']['zip'] : '') : '', 785 latitude = (ffwd_params['event_map'] == "1") ? ((typeof id['place']['location']['latitude'] != 'undefined') ? id['place']['location']['latitude'] : '') : '', 786 longitude = (ffwd_params['event_map'] == "1") ? ((typeof id['place']['location']['longitude'] != 'undefined') ? id['place']['location']['longitude'] : '') : ''; 787 788 full_place = ((ffwd_params['event_street'] == "1") ? '<div class="ffwd_place_street_' + ffwd + '" >' + street + '</div> ' : '') + 789 ((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>' : '') + 790 ((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>' : ''); 791 }*/ 792 if(id['place']['name'] && ffwd_params['event_street'] == "1"){ 793 full_place = '<div class="ffwd_place_city_state_country_' + ffwd + '" >' + id['place']['name'] + '</div>'; 794 } 795 } 796 // Who post 797 if (who_post_index != -1) { 798 story = story.replace(who_post['name'], who_post_name_link); 799 } 800 if (owner_index != -1) { 801 story = story.replace(owner_info['name'], owner_name_link); 802 } 803 if (who_post_index == -1 && owner_index == -1) { 804 story = who_post_name_link; 805 } 806
807 // With whom after was 808 if (story_tags != null) { 809 var type = story_tags.constructor.name; 810 if (type == "Object") { 811 for (var x in story_tags) { 812 var story_tag_name = story_tags[x]["0"]["name"], 813 story_tag_id = story_tags[x]["0"]["id"]; 814 with_name_index = story.indexOf(story_tag_name); 815 if ((with_name_index != -1) && (story_tag_name != who_post['name']) && (story_tag_name != owner_info['name']) && (story_tag_id != place_id)) { 816 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>' : '', 817 story = story.replace(story_tag_name, story_tag_link); 818 } 819 else if (story_tag_id == place_id) { 820 // Where after was 821 place_index = 1; 822 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>' : ''; 823 story = story.replace("\u2014", ""); 824 story = story.replace(story_tag_name, place); 825 } 826 } 827 } 828 else if (type == "Array") { 829 for (var j = 0; j < story_tags.length; j++) { 830 if (typeof story_tags[j]["0"] != "undefined") { 831 var story_tag_name = story_tags[j]["0"]["name"], 832 story_tag_id = story_tags[j]["0"]["id"]; 833 } else { 834 var story_tag_name = story_tags[j].name, 835 story_tag_id = story_tags[j].id; 836 } 837 with_name_index = story.indexOf(story_tag_name); 838 if ((with_name_index != -1) && (story_tag_name != who_post['name']) && (story_tag_name != owner_info['name']) && (story_tag_id != place_id)) { 839 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>' : '', 840 story = story.replace(story_tag_name, story_tag_link); 841 } 842 843 else if (story_tag_id == place_id) { 844 // Where after was 845 place_index = 1; 846 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>' : ''; 847 story = story.replace("\u2014", ""); 848 story = story.replace(story_tag_name, place); 849 } 850 } 851 } 852 } 853 // Where after was 854 if (ffwd_params['blog_style_place_name'] == "1"/* && typeof place != 'undefined' && place != ''*/) { 855 if (id['type'] == 'events') { 856 story += full_place; 857 } 858 } 859 else { 860 story = story.replace(/ at| in|/gi, ""); 861 } 862 jQuery('#ffwd_blog_style_object_from_pic_' + ffwd + '_' + id['id']).html(who_post_pic).attr("href", who_post['link']); 863 jQuery('#ffwd_blog_style_object_story_' + ffwd + '_' + id['id']).html(story); 864 break; 865 default : 866 break; 867 } 868} 869 870jQuery( document ).ready(function() { 871 jQuery('body').on('click', '.ffwd_load_more', function (){ 872 jQuery(this).addClass("loading"); 873 var ffwd_fanc = jQuery(this).data("fanc"); 874 var ffwd_id = jQuery(this).data("id"); 875 var ffwd_ffwd = jQuery(this).data("ffwd"); 876 var ffwd_type = jQuery(this).data("type"); 877 var ffwd_owner_info = jQuery(this).data("owner_info"); 878 var ffwd_ffwd_params = jQuery(this).data("ffwd_params"); 879 var ffwd_graph_url = jQuery(this).data("next_url"); 880 881 var ffwd_links = jQuery(this).data("links"); 882 var ffwd_id = jQuery(this).data("id"); 883 //} 884 885 886 //var ffwd_result = jQuery(this).data("next_url"); 887 jQuery.getJSON(ffwd_graph_url, function (result) { 888 889 jQuery(this).removeClass("loading"); 890 891 892 893 do_something_with_data_blog_style(result, ffwd_id, ffwd_ffwd, ffwd_type, ffwd_owner_info, ffwd_ffwd_params, ffwd_graph_url) 894 895 896 result["comments"] = result; 897 result.likes = ffwd_links; 898 result.id = ffwd_id; 899 gallery_box_comments(result, ffwd_id); 900 901 902 }); 903 }); 904}); 905function ffwd_get_comments_replies(comment_id,graph_url,ffwd_params,ffwd) { 906 var url_for_cur_id_comm_replies = graph_url.replace('{FB_ID}', comment_id); 907 url_for_cur_id_comm_replies = url_for_cur_id_comm_replies.replace('{EDGE}', 'comments'); 908 url_for_cur_id_comm_replies = url_for_cur_id_comm_replies.replace('{FIELDS}', 'fields=parent,created_time,from,like_count,message&'); 909 url_for_cur_id_comm_replies = url_for_cur_id_comm_replies.replace('{OTHER}', ''); 910 jQuery.getJSON(url_for_cur_id_comm_replies, function (result) { 911 for (var k = 0; k < result['data'].length; k++) { 912 var parent_comm_id = result['data'][k]["parent"]["id"], 913 comment_reply_id = result['data'][k]["id"]; 914 915 var url_for_cur_id_comm_rep_user_pic = graph_url.replace('{FB_ID}', result['data'][k]['from']['id']); 916 url_for_cur_id_comm_rep_user_pic = url_for_cur_id_comm_rep_user_pic.replace('{EDGE}', ''); 917 url_for_cur_id_comm_rep_user_pic = url_for_cur_id_comm_rep_user_pic.replace('{FIELDS}', 'fields=picture&'); 918 url_for_cur_id_comm_rep_user_pic = url_for_cur_id_comm_rep_user_pic.replace('{OTHER}', ''); 919 920 var 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>', 921 comment_reply_message = '<span class="ffwd_comment_reply_message_' + ffwd + '" > ' + result['data'][k]['message'] + ' </span>', 922 comment_reply_date = '<span class="ffwd_comment_reply_date_' + ffwd + '" > ' + ffwd_get_passed_time(result['data'][k]['created_time']) + '</span>', 923 comment_reply_likes_count = '<span class="ffwd_comment_reply_likes_count_' + ffwd + '" > ' + result['data'][k]['like_count'] + ' </span>', 924 comments_reply_date_likes = '<div>' + comment_reply_date + comment_reply_likes_count + '</div>', 925 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>', 926 comment_reply = '<div id="ffwd_comment_reply_' + ffwd + '_' + comment_reply_id + '" class="ffwd_comment_reply_' + ffwd + '">' + comment_reply_div_cont + '<div style="clear:both" > </div></div>'; 927 jQuery('#ffwd_comment_' + ffwd + '_' + parent_comm_id + ' .ffwd_comment_replies_content_' + ffwd).append(comment_reply
927); 928 929 } 930 ffwd_blog_style_resize(ffwd_params, ffwd); 931 }); 932 933 934} 935function ffwd_fill_likes(result, ffwd, id) { 936 937 938 939 var total_reactions_count = {} 940 total_reactions_count[ffwd] = parseInt(result['total_reactions']['summary']['total_count']); 941 var likes_count = {}; 942 likes_count[ffwd] = parseInt(result['like']['summary']['total_count']); 943 var love_count = {}; 944 love_count[ffwd] = parseInt(result['love']['summary']['total_count']); 945 var wow_count = {}; 946 wow_count[ffwd] = parseInt(result['wow']['summary']['total_count']); 947 var haha_count = {}; 948 haha_count[ffwd] = parseInt(result['haha']['summary']['total_count']); 949 var sad_count = {}; 950 sad_count[ffwd] = parseInt(result['sad']['summary']['total_count']); 951 var angry_count = {}; 952 angry_count[ffwd] = parseInt(result['angry']['summary']['total_count']); 953 jQuery('#ffwd_likes_' + ffwd + '_' + id + ' span').html(total_reactions_count[ffwd]); 954 if (total_reactions_count[ffwd] >= 3 && result['total_reactions']['data'][0]) { 955 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>'; 956 var likes_count_last_part = '<div class="ffwd_almost_' + ffwd + '"> ' + ffwd_frontend_text.and + ' ' + (total_reactions_count[ffwd] - 2) + ' ' + ffwd_frontend_text.others + ' </div>'; 957 } 958 else if (total_reactions_count[ffwd] == 2 && result['total_reactions']['data'][0]) { 959 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>'; 960 var likes_count_last_part = ''; 961 } 962 else if (total_reactions_count[ffwd] == 1 && result['total_reactions']['data'][0]) { 963 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>'; 964 var likes_count_last_part = ''; 965 } 966 else { 967 var likes_some_names = ''; 968 var likes_count_last_part = ''; 969 } 970 971 972 var reactions_icons = '' 973 reactions_width = 0; 974 if (likes_count[ffwd] != 0) { 975 reactions_icons += '<span class="ffwd_react_icons_like_' + ffwd + '" title="Like"></span>'; 976 reactions_width += 40; 977 jQuery('#ffwd_reactions_like_' + id + '_' + ffwd).show(); 978 jQuery('#ffwd_tootlip_text_like_' + id + '_' + ffwd).html('Like: ' + likes_count[ffwd]); 979 } 980 if (love_count[ffwd] != 0) { 981 reactions_icons += '<span class="ffwd_react_icons_love_' + ffwd + '" title="Love"></span>'; 982 reactions_width += 40; 983 jQuery('#ffwd_reactions_love_' + id + '_' + ffwd).show(); 984 jQuery('#ffwd_tootlip_text_love_' + id + '_' + ffwd).html('Love: ' + love_count[ffwd]); 985 986 987 } 988 if (haha_count[ffwd] != 0) { 989 reactions_icons += '<span class="ffwd_react_icons_haha_' + ffwd + '" title="Haha"></span>'; 990 reactions_width += 40; 991 jQuery('#ffwd_reactions_haha_' + id + '_' + ffwd).show(); 992 jQuery('#ffwd_tootlip_text_haha_' + id + '_' + ffwd).html('Haha: ' + haha_count[ffwd]); 993 994 995 } 996 if (wow_count[ffwd] != 0) { 997 reactions_icons += '<span class="ffwd_react_icons_wow_' + ffwd + '" title="WOW"></span>'; 998 reactions_width += 40; 999 jQuery('#ffwd_reactions_wow_' + id + '_' + ffwd).show(); 1000 jQuery('#ffwd_tootlip_text_wow_' + id + '_' + ffwd).html('Wow: ' + wow_count[ffwd]); 1001 1002 1003 } 1004 if (sad_count[ffwd] != 0) { 1005 reactions_icons += '<span class="ffwd_react_icons_sad_' + ffwd + '" title="Sad"></span>'; 1006 reactions_width += 40; 1007 jQuery('#ffwd_reactions_sad_' + id + '_' + ffwd).show(); 1008 jQuery('#ffwd_tootlip_text_sad_' + id + '_' + ffwd).html('Sad: ' + sad_count[ffwd]); 1009 1010 1011 } 1012 if (angry_count[ffwd] != 0) { 1013 reactions_icons += '<span class="ffwd_react_icons_angry_' + ffwd + '" title="Angry"></span>'; 1014 reactions_width += 40; 1015 jQuery('#ffwd_reactions_angry_' + id + '_' + ffwd).show(); 1016 jQuery('#ffwd_tootlip_text_angry_' + id + '_' + ffwd).html('Angry: ' + angry_count[ffwd]); 1017 1018 1019 } 1020 1021 jQuery('#ffwd_reacts_' + id + '_' + ffwd).css('width', reactions_width + 52
1021+ 'px'); 1022 1023 if (total_reactions_count[ffwd] == 0) 1024 jQuery('#ffwd_reacts_' + id + '_' + ffwd).css('display', 'none'); 1025 1026 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>'; 1027 1028 1029 if (total_reactions_count[ffwd]) 1030 jQuery('#ffwd_likes_names_count_' + id + '_' + ffwd).html(likes_names_count); 1031 else 1032 jQuery('#ffwd_likes_names_count_' + id + '_' + ffwd).remove(); 1033 1034} 1035 1036function ffwd_blog_style_resize(ffwd_params, ffwd) { 1037 var window_width = window.innerWidth, 1038 blogstyle_object = jQuery(".blog_style_object_container_" + ffwd), 1039 blogstyle_object_width = blogstyle_object.width(), 1040 blogstyle_comment_content = jQuery(".ffwd_comment_content_" + ffwd), 1041 blogstyle_comment_reply_content = jQuery(".ffwd_comment_reply_content_" + ffwd), 1042 blogstyle_comment_content_left_margin = (parseInt(blogstyle_comment_content.css("margin-left"))) ? 1043 parseInt(blogstyle_comment_content.css("margin-left")) : 0, 1044 comment_author_pic_width = (parseInt(jQuery(".ffwd_comment_author_pic_" + ffwd + " img").css("width"))) ?
1045 parseInt(jQuery(".ffwd_comment_author_pic_" + ffwd + " img").css("width")) : 0, 1046 comment_reply_author_pic_width = (parseInt(jQuery(".ffwd_comment_reply_author_pic_" + ffwd + " img").css("width"))) ? 1047 parseInt(jQuery(".ffwd_comment_reply_author_pic_" + ffwd + " img").css("width")) : 0, 1048 comment_content_padding = (parseInt(jQuery(".ffwd_comment_" + ffwd).css("padding-left"))) ? 1049 parseInt(jQuery(".ffwd_comment_" + ffwd).css("padding-left")) : 0, 1050 ffwd_blog_style_img = jQuery(".ffwd_blog_style_img_" + ffwd); 1051 /* Minus one for twenty fifteen theme :))*/ 1052 max_width_for_comment_content = blogstyle_object_width - 1053 comment_author_pic_width - 1054 blogstyle_comment_content_left_margin - 1055 (2 * comment_content_padding) - 1, 1056 max_width_for_comment_reply_content = max_width_for_comment_content - 1057 comment_reply_author_pic_width - 1058 blogstyle_comment_content_left_margin - 1059 (2 * comment_content_padding) - 1; 1060 1061 1062 max_width_for_attachment = (ffwd_params["blog_style_view_type"] != "1" && window_width > 520) ? 1063 blogstyle_object_width * 0.55 : blogstyle_object_width; 1064 1065 blogstyle_comment_content.css("max-width", max_width_for_comment_content); 1066 blogstyle_comment_reply_content.css("max-width", max_width_for_comment_reply_content); 1067 ffwd_blog_style_img.css("max-width", max_width_for_attachment); 1068} 1069 1070 1071function simulateAjaxStart(ffwd) { 1072 let ajaxLoadingWrapperId = "ffwd_ajax_loading_"+ffwd; 1073 let ajaxLoadingWrapper = jQuery("#"+ajaxLoadingWrapperId)[0]; 1074 ajaxLoadingWrapper.setAttribute("style", "display:block;"); 1075} 1076 1077function simulateAjaxEnd(ffwd) { 1078 let ajaxLoadingWrapperId = "ffwd_ajax_loading_"+ffwd; 1079 let ajaxLoadingWrapper = jQuery("#"+ajaxLoadingWrapperId)[0]; 1080 let ff_form_id = "ffwd_front_form_"+ffwd; 1081 jQuery("html, body").animate({scrollTop: jQuery('#' + ff_form_id).offset().top - 150}, 500); 1082 setTimeout(function () { 1083 ajaxLoadingWrapper.setAttribute("style", "display:none;"); 1084 }, 2000) 1085} 1086 1087/* 1088jQuery(window).ready(function () { 1089 jQuery.ajax({ 1090 url: ffwd_frontend_text.ajax_url, 1091 data: { 1092 'action': 'ffwd_autoupdate', 1093 }, 1094 type: 'get', 1095 success: function (response) { 1096 console.log(response); 1097 } 1098 1099 }) 1100 1101})*/
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.