Clive Portman: code

Code for adding social media buttons

This includes a fix for Apple products making the Facebook Like button bigger.

<ul class="sharelist clearfix">
<li class="shareontwitter"><a href="https://twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a></li>                        
<li class="shareongoogleplus"><p class="g-plusone" data-size="medium" data-annotation="none"></p></li>                        
<li class="shareonfacebook"><p class="fb-like" data-href="{{ url() }}opinion/{{ entry.slug }}" data-width="44" data-layout="button_count" data-show-faces="false" data-send="false"></p></li>                    
</ul>

and:

/*
#####################################
SHARE LIST
#####################################
*/
ul.sharelist {
  margin: 0; padding: 15px 0 0;
  list-style-type: none;
}
  ul.sharelist li {
    float: left;
    height: 21px; overflow: hidden;
    margin: 0 10px 0 0;
  }
  ul.sharelist li:last-of-type {
    margin: 0;
  }
    .sharelist li.shareontwitter {
      width: 58px;
    }
    .sharelist li.shareonpinterest {
      width: 40px;
    }
    .sharelist li.shareongoogleplus {
      width: 32px;
    }
    .sharelist li.shareonfacebook {
      width: 45px;
    }
    .sharelist li.shareonfacebook.MacOS {
      width: 48px;
    }

and:

/*
#######################################
GOOGLE+ CODE
#######################################
*/
window.___gcfg = {lang: 'en-GB'};
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
/*
#######################################
TWITTER CODE
#######################################
*/
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');
/*
#######################################
FACEBOOK CODE
#######################################
*/
(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId=145933968795229";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

and:

if (navigator.appVersion.indexOf("Mac")!=-1) ('li.shareonfacebook').addClass('MacOS');