1if (typeof Object.create !== 'function') { 2 Object.create = function(obj) { 3 function F() {} 4 F.prototype = obj; 5 return new F(); 6 }; 7} 8function fb_twit_insta_megnific_content_image_height_manage(){ 9 var window_width = jQuery(window).width(); 10 if(window_width > 768){ 11 var fb_image_height = jQuery('.svc_facebok_popup .vcfti-col-md-8').height(); 12 jQuery('.svc_facebok_popup .vcfti-col-md-8 .fb_popup_img').css('max-height',fb_image_height+'px'); 13 jQuery(window).resize(function(){ 14 var window_width = jQuery(window).width(); 15 if(window_width > 768){ 16 var fb_image_height = jQuery('.svc_facebok_popup .vcfti-col-md-8').height(); 17 jQuery('.svc_facebok_popup .vcfti-col-md-8 .fb_popup_img').css('max-height',fb_image_height+'px'); 18 }else{ 19 jQuery('.svc_facebok_popup .vcfti-col-md-8 .fb_popup_img').removeAttr('style'); 20 } 21 }); 22 }else{ 23 jQuery(window).resize(function(){ 24 var window_width = jQuery(window).width(); 25 if(window_width > 768){ 26 var fb_image_height = jQuery('.svc_facebok_popup .vcfti-col-md-8').height(); 27 jQuery('.svc_facebok_popup .vcfti-col-md-8 .fb_popup_img').css('max-height',fb_image_height+'px'); 28 }else{ 29 jQuery('.svc_facebok_popup .vcfti-col-md-8 .fb_popup_img').removeAttr('style'); 30 } 31 }); 32 } 33} 34function fb_twit_insta_megnific_script_with_content(){ 35 jQuery('a.svc_big_img,.popup-youtube,.popup-vimeo').magnificPopup({ 36 type: 'ajax', 37 mainClass: 'ssocial-popup-close', 38 closeBtnInside:false, 39 closeOnBgClick: false, 40 callbacks: { 41 ajaxContentAdded: function(){ 42 fb_twit_insta_megnific_content_image_height_manage(); 43 } 44 } 45 }); 46 jQuery('a.svc_gplus_img').magnificPopup({ 47 type: 'image', 48 mainClass: 'ssocial-popup-close', 49 closeBtnInside:false 50 }); 51} 52function fb_twit_insta_megnific_script(){ 53 jQuery('a.svc_big_img').magnificPopup({ 54 type: 'image', 55 mainClass: 'ssocial-popup-close', 56 closeBtnInside:false 57 }); 58 jQuery('.popup-youtube').magnificPopup({ 59 type: 'iframe', 60 mainClass: 'mfp-fade', 61 preloader: false, 62 closeBtnInside:false, 63 mainClass: 'ssocial-popup-close', 64 iframe: { 65 patterns: { 66 youtube: { 67 index: 'youtube.com', 68 id: 'v=', 69 src: '//www.youtube.com/embed/%id%?rel=0&autoplay=0' 70 } 71 } 72 } 73 }); 74 jQuery('a.svc_twit_video').magnificPopup({ 75 type: 'ajax', 76 mainClass: 'ssocial-popup-close', 77 closeBtnInside:false, 78 closeOnBgClick: false 79 }); 80 jQuery('.popup-vimeo').magnificPopup({ 81 type: 'iframe', 82 mainClass: 'mfp-fade', 83 preloader: false, 84 closeBtnInside:false, 85 mainClass: 'ssocial-popup-close', 86 iframe: { 87 patterns: { 88 vimeo: { 89 index: 'vimeo.com', 90 id: '/', 91 src: '//player.vimeo.com/video/%id%?autoplay=0' 92 } 93 } 94 } 95 }); 96} 97function fb_twit_insta_getSorted(selector, attrName) { 98 return jQuery(jQuery(selector).toArray().sort(function(a, b){ 99 var aVal = parseInt(a.getAttribute(attrName)), 100 bVal = parseInt(b.getAttribute(attrName)); 101 return bVal - aVal; 102 })); 103} 104var sv = 0; 105var si = 0; 106var social_dataa = ''; 107(function($, window, document, undefined) { 108 $.fn.svc_fb_insta_twitt_social_stream = function(_options) { 109 110 111 var defaults = { 112 plugin_folder: '', // a folder in which the plugin is located (with a slash in the end) 113 template: 'template.html', // a path to the template file 114 show_media: false, // show images of attachments if available 115 media_min_width: 300, 116 length: 150, // maximum length of post message shown 117 effect:'', 118 insta_access_token:'', 119 grid_columns_count_for_desktop:'', 120 grid_columns_count_for_tablet:'', 121 grid_columns_count_for_mobile:'', 122 popup:'', 123 stream_id:'' 124 }; 125 moment.locale('en'); 126 console.log(svc_ajax_url.laungage); 127 moment.locale(svc_ajax_url.laungage); 128 //--------------------------------------------------------------------------------- 129 var options = $.extend(defaults, _options), 130 container = $(this), 131 template, 132 social_networks = ['facebook', 'instagram', 'twitter']; 133 //--------------------------------------------------------------------------------- 134 135 //--------------------------------------------------------------------------------- 136 // This function performs consequent data loading from all of the sources by calling corresponding functions 137 138 function fireCallback(dataa_social) { 139 var fire = true; 140 if (fire && options.callback) { 141 options.callback(dataa_social); 142 social_dataa = ''; 143 if(options.popup == 'p1'){ 144 fb_twit_insta_megnific_script(); 145 }else{ 146 fb_twit_insta_megnific_script_with_content(); 147 } 148 } 149 } 150 151 var Utility = { 152 request: function(url, callback) { 153 $.ajax({
154 url: url, 155 dataType: 'jsonp', 156 success: callback 157 }); 158 }, 159 request_json: function(url, callback) { 160 $.ajax({ 161 url: url, 162 dataType: 'json', 163 success: callback 164 }); 165 }, 166 get_request: function(url, callback) { 167 $.get(url, callback, 'json'); 168 }, 169 wrapLinks: function(string, social_network) { 170 var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; 171 if (social_network === 'google-plus' || social_network === 'tumblr') { 172 string = string.replace(/(@|#)([a-z0-9_]+['])/ig, Utility.wrapGoogleplusTagTemplate); 173 } else { 174 string = string.replace(exp, Utility.wrapLinkTemplate); 175 } 176 return string; 177 }, 178 wrapLinkTemplate: function(string) { 179 return '<a target="_blank" href="' + string + '">' + string + '<\/a>'; 180 }, 181 wrapGoogleplusTagTemplate: function(string) { 182 return '<a target="_blank" href="https://plus.google.com/s/' + string + '" >' + string + '<\/a>'; 183 }, 184 shorten: function(string) { 185 string = $.trim(string); 186 if (string.length > options.length) { 187 return jQuery.trim(string).substring(0, options.length).split(" ").slice(0, -1).join(" ") + "..."; 188 } else { 189 return string; 190 } 191 }, 192 stripHTML: function(string) { 193 if (typeof string === "undefined" || string === null) { 194 return ''; 195 } 196 return string.replace(/(<([^>]+)>)|nbsp;|\s{2,}|/ig, ""); 197 }, 198 isotop_loop: function(){ 199 sv++; 200 console.log(si+' = '+sv); 201 if(si === sv){ 202 fireCallback(social_dataa); 203 } 204 }, 205 isotop_insert: function(rendered_html){ 206 jQuery('.social-feed-container_'+options.stream_id).isotope({transformsEnabled: false,isResizeBound: false,transitionDuration: 0}).isotope( 'insert',jQuery( rendered_html ) ); 207 } 208 }; 209 210 function SocialFeedPost(social_network, data) { 211 this.content = data; 212 this.content.social_network = (social_network == 'vimeo') ? 'vimeo-square' : social_network; 213 this.content.attachment = (this.content.attachment === undefined) ? '' : this.content.attachment; 214 this.content.time_ago = data.dt_create.fromNow(); 215 var dp = this.content.dt_create.locale('en').format("YYYY-MM-DD, hh:mm:ss"); 216 var d = new Date(dp); 217 this.content.dt_create = d.getTime(); 218 //this.content.dt_create = this.content.dt_create.locale('en').format("MMMM DD, YYYY"); 219 //this.content.dt_create = this.content.dt_create.valueOf(); 220 this.content.text = Utility.wrapLinks(Utility.shorten(data.message + ' ' + data.description), data.social_network); 221 this.content.moderation_passed = (options.moderation) ? options.moderation(this.content) : true; 222 this.content.effect = options.effect; 223 this.content.grid_columns_count_for_desktop = options.grid_columns_count_for_desktop; 224 this.content.grid_columns_count_for_tablet = options.grid_columns_count_for_tablet; 225 this.content.grid_columns_count_for_mobile = options.grid_columns_count_for_mobile; 226 this.content.popup = options.popup; 227 228 Feed[social_network].posts.push(this); 229 } 230 SocialFeedPost.prototype = { 231 render: function() { 232 var rendered_html = Feed.template(this.content); 233 var data = this.content; 234 if ($(container).children('[social-feed-id=' + data.id + ']').length !== 0) { 235 return false; 236 } 237 238 if ($(container).children().length === 0) { 239 if($('.social-feed-container_'+options.stream_id).html() === ''){
240 social_dataa += rendered_html; 241 //Utility.isotop_insert(rendered_html); 242 }else{ 243 social_dataa += rendered_html; 244 //$(container).append(rendered_html); 245 /*jQuery('.social-feed-container_'+options.stream_id).isotope({ 246 itemSelector: '.svc-social-item', 247 transformsEnabled: false, 248 isResizeBound: true, 249 transitionDuration: '0.8s', 250 filter: '*', 251 layoutMode: 'masonry', 252 masonry: { 253 columnWidth: 1 254 } 255 }); */ 256 } 257 } else { 258 var i = 0, 259 insert_index = -1; 260 $.each($(container).children(), function() { 261 if ($(this).attr('dt-create') < data.dt_create) { 262 insert_index = i; 263 return false; 264 } 265 i++; 266 }); 267 268 social_dataa += rendered_html; 269 //Utility.isotop_insert(rendered_html); 270 271 /*if (insert_index >= 0) { 272 insert_index++; 273 var before = $(container).children('div:nth-child(' + insert_index + ')'), 274 current = $(container).children('div:last-child'); 275 $(current).insertBefore(before); 276 }*/ 277 278 } 279 280 if (options.media_min_width) { 281 282 var query = '[social-feed-id=' + data.id + '] img.attachment'; 283 var image = $(query); 284 285 // preload the image 286 var height, width = ''; 287 var img = new Image(); 288 var imgSrc = image.attr("src"); 289 290 $(img).load(function () { 291 292 if (img.width < options.media_min_width) { 293 //image.hide(); 294 } 295 // garbage collect img 296 delete img; 297 298 }).error(function () { 299 // image couldnt be loaded 300 image.hide(); 301 302 }).attr({ src: imgSrc }); 303 304 } 305 306 } 307 308 }; 309 310 var Feed = { 311 template: false, 312 init: function() { 313 Feed.getTemplate(function() { 314 social_networks.forEach(function(network) { 315 if (options[network]) { 316 options[network].accounts.forEach(function(account) { 317 si++; 318 Feed[network].getData(account); 319 }); 320 } 321 }); 322 console.log(si); 323 }); 324 }, 325 getTemplate: function(callback) { 326 if (Feed.template){ 327 return callback(); 328 }else { 329 if (options.template_html) { 330 Feed.template = doT.template(options.template_html); 331 return callback(); 332 } else { 333 $.get(options.template, function(template_html) { 334 Feed.template = doT.template(template_html); 335 return callback(); 336 }); 337 } 338 } 339 }, 340 twitter: { 341 posts: [], 342 loaded: false, 343 api: 'http://api.tweecool.com/', 344 345 getData: function(account) { 346 347 if($('#social_load_more_btn_'+options.stream_id).attr('data-twitter') == 'finish'){ 348 sv++; 349 var twitter_data = $('#social_load_more_btn_'+options.stream_id).attr('data-twitter'); 350 var instagram_data = $('#social_load_more_btn_'+options.stream_id).attr('data-instagram'); 351 var facebook_data = $('#social_load_more_btn_'+options.stream_id).attr('data-facebook'); 352 if(twitter_data == '' && instagram_data == '' && facebook_data == ''){ 353 $('#svc_infinite').hide(); 354 } 355 } 356 switch (account[0]) { 357 case '@': 358 var userid = account.substr(1); 359 var max_id = ''; 360 var twit_max_id = $('#social_load_more_btn_'+options.stream_id).attr('data-twitter'); 361 if(twit_max_id != '' && typeof twit_max_id != 'undefined'){ 362 max_id = '&max_id='+twit_max_id; 363 options.twitter.limit = parseInt(options.twitter.limit) + 1; 364 } 365 if(twit_max_id != 'finish'){ 366 $.ajax({
367 url: svc_ajax_url.url, 368 data : 'action=svc_fb_twit_insta_get_tweet&user_name='+userid+'&limit='+options.twitter.limit+max_id, 369 dataType:"json", 370 type: 'POST', 371 success: function(response) { 372 Feed.twitter.utility.getPosts(response,''); 373 } 374 }); 375 } 376 break; 377 case '#': 378 var hashtag = account.substr(1); 379 if(typeof options.twitter.loadmore === 'undefined'){ 380 var main_lm = 'action=svc_fb_twit_insta_get_search_tweet&q='+hashtag+'&limit='+options.twitter.limit; 381 }else{ 382 var lm = options.twitter.loadmore; 383 var main_lm = 'action=svc_fb_twit_insta_get_search_tweet&other=yes&limit='+options.twitter.limit+'&que='+lm.replace('?',''); 384 } 385 $.ajax({ 386 url: svc_ajax_url.url, 387 data : main_lm, 388 dataType:"json", 389 type: 'POST', 390 success: function(reply) { 391 if (typeof reply['search_metadata'] === "undefined") { 392 reply['search_metadata'] = "undefined"; 393 reply['search_metadata']['next_results'] = "undefined"; 394 } 395 if (typeof reply['search_metadata']['next_results'] !== "undefined" && reply['search_metadata']['next_results'] !== "undefined") { 396 $('#social_load_more_btn_'+options.stream_id).attr('data-twitter',reply['search_metadata']['next_results']); 397 }else{ 398 $('#social_load_more_btn_'+options.stream_id).attr('data-twitter',''); 399 } 400 Feed.twitter.utility.getPosts(reply.statuses,'search'); 401 } 402 });
403 break; 404 default: 405 } 406 }, 407 utility: { 408 getPosts: function(json,searchh) { 409 if(json.length == 0){ 410 $('#social_load_more_btn_'+options.stream_id).attr('data-twitter','finish'); 411 } 412 if (json) { 413 var tc = 0; 414 $.each(json, function() { 415 tc++; 416 var element = this; 417 if(searchh != 'search'){ 418 $('#social_load_more_btn_'+options.stream_id).attr('data-twitter',element['id']); 419 } 420 var post = new SocialFeedPost('twitter', Feed.twitter.utility.unifyPostData(element)); 421 post.render(); 422 }); 423 424 if(json.length == tc){ 425 Utility.isotop_loop(); 426 } 427 428 } 429 }, 430 unifyPostData: function(element) { 431 //console.log(element); 432 var post = {}; 433 if (element.id) { 434 post.id = element.id; 435 post.dt_create = moment(element.created_at, 'dd MMM DD HH:mm:ss ZZ YYYY', 'en'); 436 post.author_link = 'http://twitter.com/' + element.user.screen_name; 437 if (location.protocol == 'https:'){ 438 post.author_picture = element.user.profile_image_url_https; 439 }else{ 440 post.author_picture = element.user.profile_image_url; 441 } 442 post.post_url = post.author_link + '/status/' + element.id_str; 443 post.author_name = element.user.name; 444 post.message = (element.full_text) ? element.full_text : element.text; 445 post.description = ''; 446 post.link = 'http://twitter.com/' + element.user.screen_name + '/status/' + element.id_str; 447 448 var video_url = ''; 449 //console.log(element); 450 if (typeof element.retweeted_status !== "undefined" && typeof element.retweeted_status.extended_entities !== "undefined" && typeof element.retweeted_status.extended_entities.media !== "undefined") { 451 var media_type = element.retweeted_status.extended_entities.media[0].type; 452 if (typeof element.retweeted_status.extended_entities.media[0].video_info !== "undefined"){ 453 var each_video = element.retweeted_status.extended_entities.media[0].video_info.variants; 454 //console.log(each_video); 455 var bit_video = 0; 456 $.each(each_video, function() { 457 var vi = this; 458 if (vi.content_type == "video/mp4" && bit_video < vi.bitrate){ 459 bit_video = vi.bitrate; 460 video_url = vi.url; 461 //video_url = element.retweeted_status.extended_entities.media[0].video_info.variants[3].url; 462 } 463 }); 464 } 465 }else if(typeof element.extended_entities !== "undefined" && typeof element.extended_entities.media !== "undefined"){ 466 var media_type = element.extended_entities.media[0].type; 467 if (typeof element.extended_entities.media[0].video_info !== "undefined"){ 468 var each_video = element.extended_entities.media[0].video_info.variants; 469 var bit_video = 0; 470 $.each(each_video, function() { 471 var vi = this; 472 if (vi.content_type == "video/mp4" && bit_video < vi.bitrate){ 473 bit_video = vi.bitrate; 474 video_url = vi.url; 475 //video_url = element.retweeted_status.extended_entities.media[0].video_info.variants[3].url; 476 } 477 }); 478 } 479 }else{ 480 var media_type = 'photo'; 481 } 482 483 if (options.show_media === true) { 484 if (typeof element.retweeted_status !== "undefined" && typeof element.retweeted_status.entities.media !== "undefined") { 485 //if (element.retweeted_status.entities.media.length > 0) { 486 if (location.protocol == 'https:'){ 487 var image_url = element.retweeted_status.entities.media[0].media_url_https; 488 }else{ 489 var image_url = element.retweeted_status.entities.media[0].media_url; 490 } 491 if (image_url) { 492 if(options.popup == 'p1'){ 493 if(media_type == 'video'){ 494 post.attachment = '<a href="'+image_url+'" class="svc_big_img svc_twit_video" data-mfp-src="'+svc_ajax_url.url+'?action=svc_fb_twit_insta_inline_twit_video_popup&video_url='+video_url+'"><img class="svc_attachment" src="' + image_url + '" /></a>'; 495 }else{ 496 post.attachment = '<a href="'+image_url+'" class="svc_big_img"><img class="svc_attachment" src="' + image_url + '" /></a>'; 497 } 498 } 499 if(options.popup == 'p2'){ 500 if(media_type == 'video'){ 501 post.attachment = '<a href="'+image_url+'" data-mfp-src="'+svc_ajax_url.url+'?action=svc_fb_twit_insta_inline_social_popup&network=twitter&twiit_id='+element.i
501d_str+'&image_url='+video_url+'&type=video&authore_name='+element.user.name+'&authore_img='+element.user.profile_image_url+'&retweet='+element.retweet_count+'&like='+element.favorite_count+'&username='+element.user.screen_name+'&msg='+post.message+'" class="svc_big_img svc_twit_video"><img class="svc_attachment" src="' + image_url + '" /></a>'; 502 }else{ 503 post.attachment = '<a href="'+image_url+'" data-mfp-src="'+svc_ajax_url.url+'?action=svc_fb_twit_insta_inline_social_popup&network=twitter&twiit_id='+element.id_str+'&image_url='+image_url+'&authore_name='+element.user.name+'&authore_img='+element.user.profile_image_url+'&retweet='+element.retweet_count+'&like='+element.favorite_count+'&username='+element.user.screen_name+'&msg='+post.message+'" class="svc_big_img"><img class="svc_attachment" src="' + image_url + '" /></a>'; 504 } 505 } 506 } 507 //} 508 } 509 510 if (typeof element.entities.media !== "undefined" && element.entities.media.length > 0) { 511 if (location.protocol == 'https:'){ 512 var image_url = element.entities.media[0].media_url_https; 513 }else{ 514 var image_url = element.entities.media[0].media_url; 515 } 516 if (image_url) { 517 if(options.popup == 'p1'){ 518 if(media_type == 'video'){ 519 post.attachment = '<a href="'+image_url+'" class="svc_big_img svc_twit_video" data-mfp-src="'+svc_ajax_url.url+'?action=svc_fb_twit_insta_inline_twit_video_popup&video_url='+video_url+'"><img class="svc_attachment" src="' + image_url + '" /></a>'; 520 }else{ 521 post.attachment = '<a href="'+image_url+'" class="svc_big_img"><img class="svc_attachment" src="' + image_url + '" /></a>'; 522 } 523 } 524 if(options.popup == 'p2'){ 525 if(media_type == 'video'){ 526 post.attachment = '<a href="'+image_url+'" data-mfp-src="'+svc_ajax_url.url+'?action=svc_fb_twit_insta_inline_social_popup&network=twitter&twiit_id='+element.id_str+'&image_url='+video_url+'&type=video&authore_name='+element.user.name+'&authore_img='+element.user.profile_image_url+'&retweet='+element.retweet_count+'&like='+element.favorite_count+'&username='+element.user.screen_name+'&msg='+post.message+'" class="svc_big_img svc_twit_video"><img class="svc_attachment" src="' + image_url + '" /></a>'; 527 }else{ 528 post.attachment = '<a href="'+image_url+'" data-mfp-src="'+svc_ajax_url.url+'?action=svc_fb_twit_insta_inline_social_popup&network=twitter&twiit_id='+element.id_str+'&image_url='+image_url+'&authore_name='+element.user.name+'&authore_img='+element.user.profile_image_url+'&retweet='+element.retweet_count+'&like='+element.favorite_count+'&username='+element.user.screen_name+'&msg='+post.message+'" class="svc_big_img"><img class="svc_attachment" src="' + image_url + '" /></a>'; 529 } 530 } 531 } 532 } 533 } 534 } 535 post.feed = "svc_twitter"; 536 return post; 537 }, 538 } 539 540 }, 541 facebook: { 542 posts: [], 543 graph: 'https://graph.facebook.com/', 544 loaded: false, 545 getData: function(account) { 546 var request_url, limit = 'limit=' + options.facebook.limit+'&fields=id,full_picture,created_time,from{id,name,picture},message,link,type,shares,object_id,attachments',
547 query_extention = '&access_token=' + options.facebook.access_token + '&callback=?'; 548 if(typeof options.facebook.loadmore === 'undefined'){ 549 switch (account[0]) { 550 case '@': 551 var username = account.substr(1); 552 $.ajax({ 553 url: svc_ajax_url.url, 554 data : 'action=svc_fbs_insta_twit_get_fb_post&username='+username+'&count='+options.facebook.limit+'&cache_time='+options.cache_time+'&cache_id='+options.cache_id, 555 dataType:"json", 556 type: 'POST', 557 success: function(response) { 558 Feed.facebook.utility.getPosts(response); 559 //console.log(response); 560 } 561 }); 562 request_url = Feed.facebook.graph + 'v3.1/' + username + '/posts?' + limit + query_extention; 563 console.log(request_url); 564 break; 565 case '#': 566 var username = account.substr(1); 567 request_url = Feed.facebook.graph + 'v3.1/' + username + '/feed?' + limit + query_extention; 568 break; 569 default: 570 var username = account.substr(1); 571 request_url = Feed.facebook.graph + 'v3.1/' + username + '/posts?' + limit + query_extention; 572 } 573 //Utility.request(request_url, Feed.facebook.utility.getPosts); 574 }else{ 575 if(options.facebook.loadmore != ''){ 576 request_url = options.facebook.loadmore; 577 Utility.request(request_url, Feed.facebook.utility.getPosts); 578 } 579 if(options.facebook.loadmore == ''){ 580 sv++; 581 var twitter_data = $('#social_load_more_btn_'+options.stream_id).attr('data-twitter'); 582 var instagram_data = $('#social_load_more_btn_'+options.stream_id).attr('data-instagram'); 583 var facebook_data = $('#social_load_more_btn_'+options.stream_id).attr('data-facebook'); 584 if(twitter_data == '' && instagram_data == '' && facebook_data == ''){ 585 $('#svc_infinite').hide(); 586 } 587 } 588 } 589 }, 590 utility: { 591 prepareAttachment: function(element) { 592 //console.log(element); 593 var fb_type = element.type; 594 var image_url = element.full_picture; 595 if (element.full_picture) { 596 image_url = element.full_picture;//Feed.facebook.graph + element.object_id + '/picture/?type=normal'; 597 }/*else if (image_url.indexOf('_b.') !== -1) { 598 //do nothing it is already big 599 } else if (image_url.indexOf('safe_image.php') !== -1) { 600 image_url = Feed.facebook.utility.getExternalImageURL(image_url, 'url'); 601 602 } else if (image_url.indexOf('app_full_proxy.php') !== -1) { 603 image_url = Feed.facebook.utility.getExternalImageURL(image_url, 'src'); 604 605 }*/ 606 607 if(options.popup == 'p1'){ 608 return '<a href="'+image_url+'" class="svc_big_img"><img class="svc_attachment" src="' + image_url + '" /></a>'; 609 }else{ 610 if(typeof element.shares == 'undefined'){ 611 var fb_share_count = 0; 612 }else{ 613 var fb_share_count = element.shares.count; 614 } 615 616 var fb_text = (element.message) ? element.message : ''; 617 if(fb_type == 'video'){ 618 return '<a href="'+image_url+'" data-mfp-src="'+svc_ajax_url.url+'?action=svc_fb_twit_insta_inline_social_popup&network=facebook&facebook_id='+element.object_id+'&fb_type='+fb_type+'&story='+fb_text+'&share='+fb_share_count+'" class="svc_big_img"><img class="svc_attachment" src="' + image_url + '' + '" /></a>'; 619 }else if(fb_type == 'link'){ 620 var el_object_id = element.id; 621 var el_object_id_array = el_object_id.split('_'); 622 el_object_id = el_object_id_array[1]; 623 //var image_url_popup = image_url.replace(/&/g,'||'); 624 return '<a href="'+image_url+'" data-mfp-src="'+svc_ajax_url.url+'?action=svc_fb_twit_insta_inline_social_popup&network=facebook&facebook_id='+el_object_id+'&fb_type='+fb_type+'&story='+fb_text+'&share='+fb_share_count+'&img='+image_url+'" class="svc_big_img"><img class="svc_attachment" src="' + image_url + '' + '" /></a>'; 625 }else{ 626 return '<a href="'+image_url+'" data-mfp-src="'+svc_ajax_url.url+'?action=svc_fb_twit_insta_inline_social_popup&network=facebook&facebook_id='+element.object_id+'&fb_type='+fb_type+'&story='+fb_text+'&share='+fb_share_count+'" class="svc_big_img"><img class="svc_attachment" src="' + image_url + '' + '" /></a>'; 627 } 628 } 629 }, 630 getExternalImageURL: function(image_url, parameter) { 631 image_url = decodeURIComponent(image_url).split(parameter + '=')[1]; 632 if (image_url.indexOf('fbcdn-sphotos') === -1) { 633 return image_url.split('&')[0]; 634 } else { 635 return image_url; 636 } 637 638 }, 639 getPosts: function(json) { 640 if (typeof json['paging'] === "undefined") { 641 json['paging'] = "undefined"; 642 json['paging']['next'] = "undefined"; 643 } 644 if (typeof json['paging']['next'] !== "undefined" && json['paging']['next'] !== "undefined") { 645 $('#social_load_more_btn_'+options.stream_id).attr('data-facebook',json['paging']['next']); 646 }else{ 647 $('#social_load_more_btn_'+options.stream_id).attr('data-facebook',''); 648 } 649 if (json['data']){ 650 var c = 0; 651 json['data'].forEach(function(element) { 652 c++; 653 var post = new SocialFeedPost('facebook', Feed.facebook.utility.unifyPostData(element)); 654 post.render(); 655 }); 656 if(json['data'].length == c){ 657 Utility.isotop_loop(); 658 } 659 } 660 }, 661 unifyPostData: function(element) { 662 //console.log(element); 663 var post = {}, 664 text = (element.message) ? element.message : ''; 665 666 if(text == '' || text == 'undefined' || typeof text == "undefined"){ 667 if(element.attachments.data[0].type == 'cover_photo'){ 668 text = 'cover photo'; 669 } 670 }
671 post.id = element.id; 672 post.dt_create = moment(element.created_time); 673 post.author_link = 'http://facebook.com/' + element.from.id; 674 //post.author_picture = Feed.facebook.graph + element.from.id + '/picture'; 675 post.author_picture = element.from.picture.data.url; 676 post.author_name = element.from.name; 677 post.name = element.name || ""; 678 post.message = (text) ? text : ''; 679 post.description = (element.description) ? element.description : ''; 680 post.link = (element.link) ? element.link : 'http://facebook.com/' + element.from.id; 681 682 if (options.show_media === true) { 683 if (element.full_picture) { 684 var attachment = Feed.facebook.utility.prepareAttachment(element); 685 if (attachment) { 686 post.attachment = attachment; 687 } 688 } 689 } 690 post.feed = "svc_facebook"; 691 return post; 692 } 693 } 694 }, 695 instagram: { 696 posts: [], 697 api: 'https://api.instagram.com/v1/', 698 loaded: true, 699 getData: function(account) { 700 var url; 701 if(typeof options.instagram.loadmore === 'undefined'){ 702 if(options.instagram.instagram_access_token){ 703 switch (account[0]) { 704 case '@@': 705 var username = account.substr(1); 706 //url = Feed.instagram.api + 'users/search/?q=' + username + '&access_token='+options.instagram.instagram_access_token+'&' + 'client_id=' + options.instagram.client_id + '&count=1' + '&callback=?'; 707 url = Feed.instagram.api + 'users/self/?access_token='+options.instagram.instagram_access_token; 708 Utility.request(url, Feed.instagram.utility.getUsers); 709 break; 710 case '#': 711 var hashtag = account.substr(1); 712 url = Feed.instagram.api + 'tags/' + hashtag + '/media/recent/?' + 'client_id=' + options.instagram.client_id + '&access_token='+options.instagram.instagram_access_token+'&' + 'count=' + options.instagram.limit + '&callback=?'; 713 Utility.request(url, Feed.instagram.utility.getImages); 714 break; 715 //case '&': 716 case '@': 717 var id = account.substr(1); 718 url = Feed.instagram.api + 'users/' + id + '/?client_id=' + options.instagram.client_id + '&access_token='+options.instagram.instagram_access_token+'&' + 'count=' + options.instagram.limit + '&callback=?'; 719 Utility.request(url, Feed.instagram.utility.getUsers); 720 default: 721 } 722 } 723 }else{ 724 if(options.instagram.loadmore != ''){ 725 url = options.instagram.loadmore; 726 Utility.request(url, Feed.instagram.utility.getImages); 727 } 728 if(options.instagram.loadmore == ''){ 729 sv++; 730 var twitter_data = $('#social_load_more_btn_'+options.stream_id).attr('data-twitter'); 731 var instagram_data = $('#social_load_more_btn_'+options.stream_id).attr('data-instagram'); 732 var facebook_data = $('#social_load_more_btn_'+options.stream_id).attr('data-facebook'); 733 if(twitter_data == '' && instagram_data == '' && facebook_data == ''){ 734 $('#svc_infinite').hide(); 735 } 736 } 737 } 738 }, 739 utility: { 740 741 getImages: function(json) { 742 //console.log(json['pagination']); 743 if (typeof json['pagination'] == "undefined") { 744 json['pagination'] = 'undefined'; 745 json['pagination']['next_url'] = "undefined"; 746 } 747 if (typeof json['pagination']['next_url'] !== "undefined" && json['pagination']['next_url'] !== "undefined") { 748 $('#social_load_more_btn_'+options.stream_id).attr('data-instagram',json['pagination']['next_url']); 749 }else{ 750 $('#social_load_more_btn_'+options.stream_id).attr('data-instagram',''); 751 } 752 if (json.data) { 753 var ic = 0; 754 json.data.forEach(function(element) { 755 ic++; 756 var post = new SocialFeedPost('instagram', Feed.instagram.utility.unifyPostData(element)); 757 post.render(); 758 }); 759 760 if(json.data.length == ic){ 761 Utility.isotop_loop(); 762 } 763 } 764 }, 765 getUsers: function(json) { 766 if (typeof json['pagination'] === "undefined") { 767 json['pagination'] = "undefined"; 768 json['pagination']['next_url'] = "undefined"; 769 } 770 if (typeof json['pagination']['next_url'] !== "undefined" && json['pagination']['next_url'] !== "undefined") { 771 $('#social_load_more_btn_'+options.stream_id).attr('data-instagram',json['pagination']['next_url']); 772 }else{ 773 $('#social_load_more_btn_'+options.stream_id).attr('data-instagram',''); 774 } 775 776 if( ! jQuery.isArray(json.data)) json.data = [json.data] 777 json.data.forEach(function(user) { 778 var url = Feed.instagram.api + 'users/' + user.id + '/media/recent/?' + 'access_token='+options.instagram.instagram_access_token+'&' + 'count=' + options.instagram.limit + '&callback=?'; 779 Utility.request(url, Feed.instagram.utility.getImages); 780 }); 781 }, 782 unifyPostData: function(element) { 783 var post = {}; 784
785 post.id = element.id; 786 post.dt_create = moment(element.created_time * 1000); 787 post.author_link = 'http://instagram.com/' + element.user.username; 788 post.author_picture = element.user.profile_picture; 789 post.author_name = element.user.full_name; 790 post.message = (element.caption && element.caption) ? element.caption.text : ''; 791 post.description = ''; 792 post.link = element.link; 793 //console.log(element.images); 794 if (options.show_media) { 795 if(options.popup == 'p1'){ 796 post.attachment = '<a href="'+element.images.standard_resolution.url+'" class="svc_big_img"><img class="svc_attachment" src="' + element.images.standard_resolution.url + '' + '" /></a>'; 797 }else{ 798 post.attachment = '<a href="'+element.images.standard_resolution.url+'" data-mfp-src="'+svc_ajax_url.url+'?action=svc_fb_twit_insta_inline_social_popup&network=instagram&url='+element.link+'" class="svc_big_img"><img class="svc_attachment" src="' + element.images.standard_resolution.url + '' + '" /></a>'; 799 } 800 } 801 post.feed = "svc_instagram"; 802 return post; 803 } 804 } 805 }, 806 blogspot: { 807 loaded: true, 808 getData: function(account) { 809 var url; 810 811 switch (account[0]) { 812 case '@': 813 var username = account.substr(1); 814 url = 'http://' + username + '.blogspot.com/feeds/posts/default?alt=json-in-script&callback=?'; 815 request(url, getPosts); 816 break; 817 default: 818 } 819 }, 820 utility: { 821 getPosts: function(json) { 822 $.each(json.feed.entry, function() { 823 var post = {}, 824 element = this; 825 post.id = element.id['$t'].replace(/[^a-z0-9]/gi, ''); 826 post.dt_create = moment((element.published['$t'])); 827 post.author_link = element.author[0]['uri']['$t']; 828 post.author_picture = 'http:' + element.author[0]['gd$image']['src']; 829 post.author_name = element.author[0]['name']['$t']; 830 post.message = element.title['$t'] + '</br></br>' + stripHTML(element.content['$t']); 831 post.description = ''; 832 post.link = element.link.pop().href; 833 834 if (options.show_media) { 835 if (element['media$thumbnail']) { 836 post.attachment = '<img class="svc_attachment" src="' + element['media$thumbnail']['url'] + '" />'; 837 } 838 } 839 840 post.render(); 841 842 }); 843 } 844 } 845 } 846 }; 847 // Initialization 848 Feed.init(); 849 if (options.update_period) { 850 setInterval(function() { 851 return Feed.init(); 852 }, options.update_period); 853 } 854 }; 855 856})(jQuery);
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.