/*
 * 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('<div class="wpforo_fb_error">'+data.error+'</div>')}else{$('<div class="wpforo_fb_error">'+data.error+'</div>').insertAfter(button)}
FB.api("/"+data.fb.id+"/permissions","DELETE",function(response){if(response&&!response.error){}})}},error:function(data){$('.wpforo_fb-spinner').hide();$('.fb-login-button').show();$form_obj.append('<div class="wpforo_fb_error">'+data+'</div>')}})}else{button.removeClass('wpforo_fb-loading');if(navigator.userAgent.match('CriOS'))
window.open('https://www.facebook.com/dialog/oauth?client_id='+wpforo_fb.appId+'&redirect_uri='+document.location.href+'&scope='+wpforo_fb.scopes,'',null)}}})(jQuery)