Jabran Rafique edited this page May 29, 2015 · 10 revisions

Socialmedia.js

socialmedia is a small library that makes is easy to use the JavaScript based Software Development Kits (SDKs) for various social media platforms. It provides easy to use setup and additional helper methods built around SDKs' native methods. At the moment, socialmedia supports following social media platforms:

  • Facebook
  • Twitter
  • Google Plus
  • Pinterest

Here is a quick example to setup Twitter SDK:

Default setup:

...
<script>
!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');
</script>
...

Socialmedia setup:

...
<script>
new Socialmedia.Twitter();
</script>
...

Both setup will expose the default objects and methods to the environment as well as some addition helper methods by socialmedia. See further sections in documentation for complete details on these helper methods.

Next: Installation

Analytics

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.