Load facebook async

This commit is contained in:
Fergal Moran
2014-06-01 12:35:15 +01:00
parent 3469aed4db
commit 4d3c470c40
2 changed files with 4 additions and 6 deletions

View File

@@ -22,7 +22,10 @@
window.open "http://twitter.com/share?url=" + "http://" + window.location.host + "/" + model.get("item_url") + "&text=" + model.get("title"), "twitterwindow", "height=450, width=550, top=" + ($(window).height() / 2 - 225) + ", left=" + $(window).width() / 2 + ", toolbar=0, location=0, menubar=0, directories=0, scrollbars=0"
sharePageToFacebook: (model) ->
FB.fbAsyncInit('154504534677009');
FB.init({
appId : '154504534677009',
xfbml : true
});
FB.getLoginStatus (oResponse) ->
if oResponse.status is "connected"
FB.ui

View File

@@ -56,17 +56,12 @@
</script>
<script>
jQuery(window).load(function (appId) {
window.fbAsyncInit = function () {
FB.init({appId: appId, status: true, cookie: true, xfbml: true});
};
(function () {
var e = document.createElement('script');
e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
//Write Facebook FBML code to fb-root div
document.getElementById("fb-root").innerHTML = '<fb:like-box href="http://www.facebook.com/platform" width="300" stream="false"></fb:like-box>';
});
</script>
{% block footerscripts %}