Skip to content

Instantly share code, notes, and snippets.

@vincentchu
Created April 14, 2010 18:12
Show Gist options
  • Save vincentchu/366132 to your computer and use it in GitHub Desktop.
Save vincentchu/366132 to your computer and use it in GitHub Desktop.
<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
Element.observe(window,'load', function() {
FB_RequireFeatures(["XFBML"], function() {
FB.Facebook.init('XXXXXXXX','/xd_receiver.html');
var all_spans = document.getElementsByTagName("span");
var i = 0;
for (i=0; i<all_spans.length; i++) {
if ( /xfbml_name_.*/.test(all_spans[i].id) ) {
FB.ensureInit( function() {
FB.XFBML.Host.addElement(new FB.XFBML.Name($(all_spans[i].id)));
} );
} else if ( /xfbml_pic_.*/.test(all_spans[i].id) ) {
FB.ensureInit( function() {
FB.XFBML.Host.addElement(new FB.XFBML.ProfilePic($(all_spans[i].id)));
} );
} else if ( /xfbml_like_.*/.test(all_spans[i].id) ) {
FB.ensureInit( function() {
FB.XFBML.Host.addElement(new FB.XFBML.Like($(all_spans[i].id)));
} );
}
}
});
});
//]]>
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment