Skip to content

Instantly share code, notes, and snippets.

@renancouto
Created November 4, 2013 19:44
Show Gist options
  • Save renancouto/7308128 to your computer and use it in GitHub Desktop.
Save renancouto/7308128 to your computer and use it in GitHub Desktop.
Loading social scripts (Facebook, Twitter and Google Plus) AMD style.
/*jslint browser:true, nomen:true*/
/*global define*/
define(function () {
'use strict';
var script = document.getElementsByTagName('script')[0];
function socialTag(src, id) {
var created = document.createElement('script');
if (id && document.getElementById(id)) {
return;
}
created.type = 'text/javascript';
created.async = true;
created.id = id;
created.src = src;
script.parentNode.insertBefore(created, script);
}
socialTag('//connect.facebook.net/pt_BR/all.js#xfbml=1&appId=378405708894505', 'facebook-jssdk');
socialTag('//platform.twitter.com/widgets.js', 'twitter-wjs');
socialTag('//apis.google.com/js/plusone.js');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment