PageSourceSearch

https://familytreemagazine.com/wp-content/plugins/social-login/login.js?ver=1.0.1

js familytreemagazine.com collected 2026-09-24 09:24:59 UTC 6,885 bytes, 157 lines download raw bytes

1jQuery(document).ready(function(){
2
3    HandleGoogleApiLibrary();
4
5    jQuery('#btn-facebook').on('click', function(ev) {
6        ev.preventDefault();
7        
8        // Check if Facebook SDK is initialized
9        if (typeof FB === 'undefined') {
10            console.error('Facebook SDK not initialized');
11            alert('Facebook login is not available. Please refresh the page.');
12            return;
13        }
14
15        FB.login(function (response) {
16            if (response.authResponse) {
17                // Get and display the user profile data
18                FB.api('/me', {
19                    locale: 'en_US', 
20                    fields: 'id,first_name,last_name,email,link,gender,locale,picture'
21                }, function (profileResponse) {
22                    console.log('Facebook login successful:', profileResponse);
23                    
24                    var token = jQuery('#social_nonce').val();
25                    
26                    jQuery.ajax({
27                        url: ajaxurl,
28                        data: {
29                            'action': 'fw_social_ajax_request',
30                            'email': profileResponse.email,
31                            'first_name': profileResponse.first_name,
32                            'last_name': profileResponse.last_name,
33                            'social_type': 'facebook',
34                            'token': token
35                        },
36                        type: 'POST',
37                        success: function(resp){
38                            console.log('Facebook login result:', resp);
39                            try {
40                                var response = JSON.parse(resp);
41                                if(response.success && response.data.type == 'reload'){
42                                    window.location = response.data.url;
43                                } else if(response.success) {
44                                    console.log('Login successful:', response.data.message);
45                                    window.location = response.data.url;
46                                } else {
47                                    console.error('Login failed:', response.data.message);
48                                    alert('Login failed: ' + response.data.message);
49                                }
50                            } catch(e) {
51                                console.error('Invalid response format:', resp);
52                                alert('Login failed: Invalid response from server');
53                            }
54                        },
55                        error: function(xhr, status, error){
56                            console.error('Facebook login AJAX error:', {xhr: xhr, status: status, error: error});
57                            alert('Login failed: Server error. Please try again.');
58                        }
59                    });
60                });
61            } else {
62                console.log('Facebook login cancelled or not authorized');
63                if (response.status === 'not_authorized') {
64                    alert('Facebook login was not authorized. Please try again.');
65                } else if (response.status === 'unknown') {
66                    alert('Facebook login failed. Please try again.');
67                }
68            }
69        }, {
70            scope: 'email,public_profile',
71            return_scopes: true,
72            auth_type: 'rerequest'
73        });
74    });
75
76        //Modern Google Identity Services Login/Register
77    jQuery('#btn-google').on('click', function(ev) {
78        ev.preventDefault();
79        
80        // Check if Google API is initialized
81        if (!gapi.auth2) {
82            console.error('Google API not initialized');
83            alert('Google login is not available. Please refresh the page.');
84            return;
85        }
86
87        gapi.auth2.getAuthInstance().signIn({
88            scope: 'email profile'
89        }).then(
90            // On success
91            function(googleUser) {
92                var profile = googleUser.getBasicProfile();
93                var id_token = googleUser.getAuthResponse().id_token;
94                
95                // Get user info from profile
96                var user_info = {
97                    email: profile.getEmail(),
98                    first_name: profile.getGivenName(),
99                    last_name: profile.getFamilyName(),
100                    id: profile.getId()
101                };
102                
103                console.log('Google login successful:', user_info);
104                
105                var token = jQuery('#social_nonce').val();
106                
107                jQuery.ajax({
108                    url: ajaxurl,
109                    data: {
110                        'action': 'fw_social_ajax_request',
111                        'email': user_info.email,
112                        'first_name': user_info.first_name,
113                        'last_name': user_info.last_name,
114                        'social_type': 'google',
115                        'token': token
116                    },
117                    type: 'POST',
118                    success: function(result){
119                        console.log('Google login result:', result);
120                        try {
121                            var response = JSON.parse(result);
122                            if(response.success && response.data.type == 'reload'){
123                                window.location = response.data.url;
124                            } else if(response.success) {
125                                console.log('Login successful:', response.data.message);
126                                window.location = response.data.url;
127                            } else {
128                                console.error('Login failed:', response.data.message);
129                                alert('Login failed: ' + response.data.message);
130                            }
131                        } catch(e) {
132                            console.error('Invalid response format:', result);
133                            alert('Login failed: Invalid response from server');
134                        }
135                    },
136                    error: function(xhr, status, error){
137                        console.error('Google login AJAX error:', {xhr: xhr, status: status, error: error});
138                        alert('Login failed: Server error. Please try again.');
139                    }
140                });
141            },
142            // On error
143            function(error) {
144                console.error('Google sign-in error:', error);
145                if (error.error === 'popup_closed_by_user') {
146                    console.log('User closed the popup');
147                } else {
148                    alert('Google login failed: ' + (error.error || 'Unknown error'));
149                }
150            }
151        );
152    });
153
154
155
156});    
157

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.