1window.FBL = {}; 2function fbl_loginCheck() { 3 window.FB.getLoginStatus( function(response) { 4 FBL.handleResponse(response); 5 } ); 6} 7(function( $ ) { 8 'use strict'; 9 FBL.renderFinish = function () { 10 $('.fbl-spinner').hide(); 11 } 12 13 FBL.handleResponse = function( response ) { 14 var button = $('.fbl-button'), 15 $form_obj = button.parents('form') || false, 16 $redirect_to = $form_obj.find('input[name="redirect_to"]').val() || button.data('redirect'), 17 running = false; 18 /** 19 * If we get a successful authorization response we handle it 20 */ 21 if (response.status == 'connected' && ! running) { 22 running = true; 23 var fb_response = response; 24 $('.fbl-spinner').fadeIn(); 25 $('.fb-login-button').hide(); 26 27 /** 28 * Send the obtained token to server side for extra checks and user data retrieval 29 */ 30 $.ajax({ 31 data: { 32 action: "fbl_facebook_login", 33 fb_response: fb_response, 34 security: button.data('fb_nonce') 35 }, 36 global: false, 37 type: "POST", 38 url: fbl.ajaxurl, 39 success: function (data) { 40 if (data && data.success) { 41 if( data.redirect && data.redirect.length ) { 42 location.href = data.redirect; 43 } else if ( $redirect_to.length ) { 44 location.href = $redirect_to; 45 } else { 46 location.href = fbl.site_url; 47 } 48 } else if (data && data.error) { 49 $('.fbl-spinner').hide(); 50 $('.fb-login-button').show(); 51 52 if ($form_obj.length) { 53 $form_obj.append('<p class="fbl_error">' + data.error + '</p>'); 54 } else { 55 // we just have a button 56 $('<p class="fbl_error">' + data.error + '</p>').insertAfter(button); 57 } 58 // if we had any error remove user from app so we request again permissions 59 FB.api( 60 "/"+data.fb.id+"/permissions", 61 "DELETE", 62 function (response) { 63 if (response && !response.error) { 64 } 65 } 66 ); 67 } 68 }, 69 error: function (data) { 70 $('.fbl-spinner').hide(); 71 $('.fb-login-button').show(); 72 $form_obj.append('<p class="fbl_error">' + data + '</p>'); 73 } 74 }); 75 76 } else { 77 button.removeClass('fbl-loading'); 78 if( navigator.userAgent.match('CriOS') ) 79 window.open('https://www.facebook.com/dialog/oauth?client_id=' + fbl.appId + '&redirect_uri=' + document.location.href + '&scope='+fbl.scopes, '', null); 80 81 if( "standalone" in navigator && navigator.standalone ) 82 window.location.assign('https://www.facebook.com/dialog/oauth?client_id=' + fbl.appId + '&redirect_uri=' + document.location.href + '&scope='+fbl.scopes); 83 } 84 }; 85})( jQuery );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.