slowjet

is a part of a carburetor

FacebookのJS SDKをinitするようなやつ

これやっとけばOK。

function fb_init(app_id, abs_path, callback) {
  var body = document.body,
    fb_root = document.createElement('div');

  fb_root.setAttribute('id', 'fb-root');
  body.appendChild(fb_root);

  window.fbAsyncInit = function() {
    FB.init({
      appId      : app_id,
      channelUrl : abs_path.replace('http:', '') + 'channel.html',
      status     : true,
      cookie     : true,
      xfbml      : true
    });
    if ( typeof callback !== 'function' ) return;
    callback();
  };

  (function() {
    var js = undefined,
      id = 'facebook-jssdk';

    if ( document.getElementById(id) ) {
      return;
    }
    js = document.createElement('script');
    js.id = id;
    js.async = true;
    js.src = "//connect.facebook.net/ja_JP/all.js";
    document.getElementsByTagName('head')[0].appendChild(js);
  }());
}

使い方は普通に

fb_init(
  YOUR_APP_ID,
  SITE_ABS_PATH,
  function() {
    // callback
  }
);

だけ。HTMLにdiv#fb-footも入れなくていいし楽々