1 2function crpOpenTwitterDialog(datasource){ 3 var url = "https://twitter.com/intent/tweet?url=" + encodeURI(datasource.url) + "&text=" + encodeURI(datasource.caption); 4 var w = window.open(url, "ftgw", "location=1,status=1,scrollbars=1,width=600,height=400"); 5 w.moveTo((screen.width / 2) - (300), (screen.height / 2) - (200)); 6} 7 8function crpOpenFBDialog(datasource){ 9 var url = "https://www.facebook.com/dialog/feed?app_id=369216384960559"; 10 if (datasource.image != '') { 11 url += "&link=" + encodeURI(datasource.url); 12 url += "&picture=" + encodeURI(datasource.image); 13 } else { 14 url += "&link=" + datasource.url; 15 } 16 17 url += "&caption=" + encodeURI(datasource.caption) + "&description=" + encodeURI(datasource.message); 18 19 //Outdated version 20 /* 21 var url = "http://www.facebook.com/sharer.php?u=" + encodeURI(datasource.url) + "&t=" + encodeURI(datasource.caption); 22 if (datasource.image) { 23 url += ("&p[images][0]=" + crpQualifiedURL(datasource.image)); 24 }; 25 */ 26 27 var w = window.open(url, "ftgw", "location=1,status=1,scrollbars=1,width=600,height=400"); 28 w.moveTo((screen.width / 2) - (300), (screen.height / 2) - (200)); 29} 30 31 32function crpOpenPinterestDialog(datasource){ 33 var url = "http://pinterest.com/pin/create/button/?url=" + encodeURI(datasource.url) + "&description=" + encodeURI(datasource.caption)+ "&media=" + encodeURI(datasource.image); 34 if (datasource.image) { 35 url += ("&picture=" + crpQualifiedURL(datasource.image)); 36 } 37 38 var w = window.open(url, "ftgw", "location=1,status=1,scrollbars=1,width=600,height=400"); 39 w.moveTo((screen.width / 2) - (300), (screen.height / 2) - (200)); 40} 41 42function crpQualifiedURL(url) { 43 var img = document.createElement('img'); 44 img.src = url; // set string url 45 url = img.src; // get qualified url 46 img.src = null; // no server request 47 return url; 48} 49 50function crpConfigureSocialButtons() 51{ 52 jQuery( '.ic-share i' ).off().on( 'click', function( evt ) { 53 evt.preventDefault(); 54 55 var target = jQuery(this).parent(); 56 var datasource = jQuery(target.attr("data-datasource")); 57 58 var caption = jQuery.trim(datasource.attr("data-caption") || document.title); 59 var message = jQuery.trim(datasource.attr("data-message")); 60 var url = jQuery.trim( datasource.attr("data-url") || location.href.split('#')[0]); 61 var image = jQuery.trim( datasource.attr("data-image")); 62 63 var datasource = { 64 caption: caption, 65 message: message, 66 url: url, 67 image: image, 68 };console.log(datasource); 69 70 if(target.hasClass("ic-twitter")){ 71 crpOpenTwitterDialog(datasource); 72 }else if(target.hasClass("ic-facebook")){ 73 crpOpenFBDialog(datasource); 74 }else if(target.hasClass("ic-pinterest")){ 75 crpOpenPinterestDialog(datasource); 76 } 77 }); 78} 79 80//Perform some actions when window is ready 81gkitWinReady(function () { 82 crpConfigureSocialButtons(); 83});
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.