/* * Facebook Login with the Facebook SDK for JavaScript enables people to sign into forum and ebsite with their Facebook credentials. * https://developers.facebook.com/docs/facebook-login/web */ window.WPFFB={};function wpforo_fb_check_auth(){window.FB.getLoginStatus(function(response){WPFFB.handleResponse(response)})}(function($){'use strict';WPFFB.renderFinish=function(){$('.wpforo_fb-spinner').hide()} WPFFB.handleResponse=function(response){var button=$('.wpforo_fb-button'),$form_obj=button.parents('form')||!1,$redirect_to=$form_obj.find('input[name="redirect_to"]').val()||button.data('redirect'),running=!1;if(response.status=='connected'&&!running){running=!0;var fb_response=response;$('.wpforo_fb-spinner').fadeIn();$('.fb-login-button').hide();$.ajax({data:{action:"wpforo_facebook_auth",fb_response:fb_response,security:button.data('fb_nonce')},global:!1,type:"POST",url:wpforo_fb.ajaxurl,success:function(data){if(data&&data.success){if(data.redirect&&data.redirect.length){location.href=data.redirect}else if($redirect_to.length){location.href=$redirect_to}else{location.href=wpforo_fb.site_url}}else if(data&&data.error){$('.wpforo_fb-spinner').hide();$('.fb-login-button').show();if($form_obj.length){$form_obj.append('