Created
March 26, 2013 12:07
-
-
Save kangax/5244909 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(d, s) { | |
var deps = { | |
twitter: [ | |
"//platform.twitter.com/widgets.js", | |
"twitter-wjs" | |
], | |
facebook: [ | |
"//connect.facebook.net/en_US/all.js#xfbml=1", | |
"facebook-jssdk" | |
], | |
vkontakte: [ "//userapi.com/js/api/openapi.js?49" ], | |
pintereset: [ "//assets.pinterest.com/js/pinit.js" ] | |
}; | |
var firstEl = d.getElementsByTagName(s)[0], el, id, url; | |
for (var key in deps) { | |
id = deps[key][1]; | |
url = deps[key][0]; | |
if (id && d.getElementById(id)) continue; | |
el = d.createElement(s); | |
id && (el.id = id); | |
el.src = url; | |
firstEl.parentNode.insertBefore(el, firstEl); | |
} | |
})(document, 'script'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment