tz-facebook.js
710 Bytes
window.fbAsyncInit = function() {
FB.init({appId: TzFBData.AppID, status: true, cookie: true, xfbml: true});
FB.Event.subscribe('auth.login', function(response) { console.log('login called'); window.location.href = TzFBData.loginPage; });
var oBtn = document.getElementById('TzFB');
if (oBtn) {
addEvent(oBtn, 'click', FB.login);
}
if (Cookie.read('wpfb_logout')) {
Cookie.erase('wpfb_logout');
FB.getLoginStatus(function(response) {
if (response.session) {
FB.logout(function() {
Cookie.erase('wpfb_logout');
window.location.reload();
});
}
});
}
};