1/*============================================================================ 2 Social Icon Buttons v1.0 3 Author: 4 Carson Shold | @cshold 5 http://www.carsonshold.com 6 MIT License 7==============================================================================*/ 8window.CSbuttons = window.CSbuttons || {}; 9if ( document.referrer ) { 10 if ( document.referrer.indexOf( "facebook.com" ) > 0 && window.location.search.indexOf( 'post_id' ) == 1 ) { 11 window.close(); 12 } 13} 14 15jQuery(function() { 16 CSbuttons.cache = { 17 $shareButtons: jQuery('.social-sharing') 18 } 19}); 20 21CSbuttons.init = function () { 22 CSbuttons.socialSharing(); 23} 24 25CSbuttons.socialSharing = function () { 26 var $buttons = CSbuttons.cache.$shareButtons, 27 $shareLinks = $buttons.find('a'), 28 permalink = $buttons.attr('data-permalink'); 29 30 // Get share stats from respective APIs 31 var $fbLink = jQuery('.share-facebook'), 32 $twitLink = jQuery('.share-twitter'), 33 $pinLink = jQuery('.share-pinterest'), 34 $googleLink = jQuery('.share-google'); 35 $linkedinLink = jQuery('.share-linkedin'); 36 37 if ( $fbLink.length && $fbLink.find('.share-count').length ) { 38 jQuery.getJSON('https://graph.facebook.com/?id=' + permalink + '&callback=?') 39 .done(function(data) { 40 if (data.shares) { 41 $fbLink.find('.share-count').text(data.shares).addClass('is-loaded'); 42 } else { 43 $fbLink.find('.share-count').remove(); 44 } 45 }) 46 .fail(function(data) { 47 $fbLink.find('.share-count').remove(); 48 }); 49 }; 50 51 if ( $twitLink.length && $twitLink.find('.share-count').length ) { 52 jQuery.getJSON('https://cdn.api.twitter.com/1/urls/count.json?url=' + permalink + '&callback=?') 53 .done(function(data) { 54 if (data.count > 0) { 55 $twitLink.find('.share-count').text(data.count).addClass('is-loaded'); 56 } else { 57 $twitLink.find('.share-count').remove(); 58 } 59 }) 60 .fail(function(data) { 61 $twitLink.find('.share-count').remove(); 62 }); 63 }; 64 65 if ( $pinLink.length && $pinLink.find('.share-count').length ) { 66 jQuery.getJSON('https://api.pinterest.com/v1/urls/count.json?url=' + permalink + '&callback=?') 67 .done(function(data) { 68 if (data.count > 0) { 69 $pinLink.find('.share-count').text(data.count).addClass('is-loaded'); 70 } else { 71 $pinLink.find('.share-count').remove(); 72 } 73 }) 74 .fail(function(data) { 75 $pinLink.find('.share-count').remove(); 76 }); 77 }; 78 79 if ( $linkedinLink.length && $linkedinLink.find('.share-count').length ) { 80 jQuery.getJSON('http://www.linkedin.com/countserv/count/share?url=' + permalink + '&format=json') 81 .done(function(data) { 82 if (data.count) { 83 $linkedinLink.find('.share-count').text(data.count).addClass('is-loaded'); 84 } else { 85 $linkedinLink.find('.share-count').remove(); 86 } 87 }) 88 .fail(function(data) { 89 $linkedinLink.find('.share-count').remove(); 90 }); 91 }; 92 93 if ( $googleLink.length && $googleLink.find('.share-count').length ) { 94 // Can't currently get Google+ count with JS, so just pretend it loaded 95 $googleLink.find('.share-count').addClass('is-loaded'); 96 } 97 98 // Share popups 99 jQuery( document ).on( 'click', '.ms-social-share', function( e ) { 100 e.preventDefault(); 101 var el = jQuery( this ); 102 var popup = el.attr( 'class' ).replace( 'ms-social-share', '' ).replace( '-','_' ); 103 var link = el.attr( 'href' ); 104 var w = 700, h = 400; 105 106 // Set popup sizes 107 switch ( popup.trim() ) { 108 case 'share_twitter': 109 h = 300; 110 break; 111 case 'share_google': 112 w = 500; 113 break; 114 } 115 116 window.open(link, popup, 'width=' + w + ', height=' + h); 117 }); 118} 119jQuery(function() { 120 window.CSbuttons.init(); 121});
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.