PageSourceSearch

https://www.placidway.com/frontend/custom-assets/facebook_login.js

js placidway.com collected 2026-10-02 04:15:16 UTC 9,904 bytes, 245 lines download raw bytes

1
2
3window.fbAsyncInit = function() {
4  FB.init({
5    appId      : '707279341371262',
6    cookie     : true,
7    xfbml      : true,
8    version    : 'v18.0'
9  });
10  FB.AppEvents.logPageView();   
11  };
12
13/*   (function(d, s, id){
14   var js, fjs = d.getElementsByTagName(s)[0];
15   if (d.getElementById(id)) {return;}
16   js = d.createElement(s); js.id = id;
17   js.src = "https://connect.facebook.net/en_US/sdk.js";
18   fjs.parentNode.insertBefore(js, fjs);
19   }(document, 'script', 'facebook-jssdk')); */
20
21   window.initFB_SDK = function(){
22    (function(d, s, id){
23      var js, fjs = d.getElementsByTagName(s)[0];
24      if (d.getElementById(id)) {return;}
25      js = d.createElement(s); js.id = id;
26      js.src = "https://connect.facebook.net/en_US/sdk.js";
27      fjs.parentNode.insertBefore(js, fjs);
28      }(document, 'script', 'facebook-jssdk'));
29   }
30   
31   function fbLogin(url){
32    FB.login(function(response){
33      debugger;
34      if(response.authResponse){
35        fbAfterLogin(url);
36      }
37    }, {scope: 'public_profile,email'});
38   }
39   
40   function fbAfterLogin(url){
41      FB.getLoginStatus(function(response) {
42        if (response.status === 'connected') {   // Lo
43          FB.api('/me',{ locale: 'en_US', fields: 'name, email, picture.width(350).height(350)' }, function(response) {
44            console.log(response);
45            if(typeof  response.email != 'undefined' && typeof  response.name != 'undefined'){
46                var profilePictureURL = typeof response.picture != 'undefined' && typeof response.picture.data != 'undefined' && typeof response.picture.data.url != 'undefined'? response.picture.data.url : '';
47                checkPatientExist(response.email,response.name,url,'facebook',profilePictureURL);
48            }
49          });
50        }
51      });
52   }
53
54
55
56   function checkLoginState() {
57    FB.getLoginStatus(function(response) {
58      if (response.status === 'connected') {   // Lo
59        FB.api('/me',{ locale: 'en_US', fields: 'name, email, picture.width(350).height(350)' }, function(response) {
60          console.log(response);
61          if(typeof  response.email != 'undefined' && typeof  response.name != 'undefined'){
62              var profilePictureURL = typeof response.picture != 'undefined' && typeof response.picture.data != 'undefined' && typeof response.picture.data.url != 'undefined'? response.picture.data.url : '';
63              checkPatientExist(response.email,response.name,url,'facebook',profilePictureURL)
64          }
65        });
66      }
67    });
68  }
69
70   function checkPatientExist(email,name,redirect_url='',signup_type,profile_pic)
71   {
72    if(typeof profile_pic == "undefined"){
73      profile_pic = '';
74    }
75      if(window.location.href.includes('referral')){
76        name = name.replace(" ","_");
77        $.ajax({
78          url: '/patients/ajax/affiliate_login.php',
79          type: 'POST',
80          data: {email: email, name:name,signup_type,profile_pic:profile_pic},
81        })
82        .done(function(response) {
83            if(parseInt(response) > 0){
84              window.location.href = '/referral/'+name+'/'+btoa(response);
85            }
86        });
87      } else {
88        var currentURL = window.location.href;
89
90        $.ajax({
91          url: (window.location.hostname == 'test1.placidway.com' ? 'https://test1.placidway.com/patients/ajax/patient_login.php' : 'https://www.placidway.com/patients/ajax/patient_login.php'),
92          type: 'POST',
93          data: {email: email, name:name,signup_type,page_url:currentURL,profile_pic:profile_pic},
94        })
95        .done(function(response) {
96          if(typeof ga != "undefined"){
97            // gtag('event', 'social_media_rfi', {
98            //   'page_path': 'https://www.placidway.com/socialmedia_login'
99            // });
100            gtag('event', 'placidway_chatbot', {
101              'page_path': '/fromchatbot'
102            });
103          }
104          if(response.startsWith('https://')){
105            window.location.href = response;
106          }else{
107            if(response == 0){
108              window.location.href = "https://"+window.location.hostname+"/patients/profile";
109            } else {
110              if (currentURL.indexOf("contact") !== -1) {
111                window.location.href = "https://"+window.location.hostname+"/patients/profile";
112              } else {
113                window.location.href = 'https://'+window.location.host+'/c/patient/'+btoa(response);
114                // window.location.href = "https://"+window.location.hostname+"/patients/get-price-quotation-v2";
115              }  
116            }
117            
118          }
119
120            /*if(parseInt(response) > 0){
121              if(redirect_url){
122                location.href = redirect_url;
123              } else if($("#source_url").val() != '') {
124                var obj = new Object();
125                obj.name = name;
126                obj.email  = email;
127                obj.center_id  = $("#cta_centerid").val();
128                obj.source_url  = $("#source_url").val();
129                obj.source_name  = $("#source_name").val();
130                var jsonString= btoa(JSON.stringify(obj));
131                window.location.href = "/patients/profile";
132                // window.location.href = '/complete-request?q='+encodeURIComponent(jsonString);
133            } else {
134                location.reload();
135              }
136            } else {
137              if(window.location.href.includes('Register') || window.location.href.includes('register')){
138                $("#email").val(email);
139                $("#name").val(name);
140              } else if(window.location.href.includes('Login') || window.location.href.includes('login')){
141                  var obj = new Object();
142                  obj.name = name;
143                  obj.email  = email;
144                  var jsonString= btoa(JSON.stringify(obj));
145                  window.location.href = '/Medical-Tourism-Patients/Register?q='+encodeURIComponent(jsonString);
146              } else if($("#source_url").val() != '') {
147                  var obj = new Object();
148                  obj.name = name;
149                  obj.email  = email;
150                  obj.center_id  = $("#cta_centerid").val();
151                  obj.source_url  = $("#source_url").val();
152                  obj.source_name  = $("#source_name").val();
153                  var jsonString= btoa(JSON.stringify(obj));
154                  window.location.href = '/complete-request?q='+encodeURIComponent(jsonString);
155              } else {
156                $("#email").val(email);
157                $("#name").val(name);
158                
159                $("#q1").val(name);
160                $(".answer1").val(name);
161  
162                $("#q2").val(email);
163                $(".answer2").val(email);
164              }
165            }*/
166        })
167        .fail(function() {
168            console.log("error");
169        });
170      }
171      
172   }
173
174  
175
176  var googleUser = {};
177  window.startApp = function() {
178    if(document.getElementById('google') != null || document.getElementById('chatbot_google') != null){
179      gapi.load('auth2', function(){
180        // Retrieve the singleton for the GoogleAuth library and set up the client.
181        auth2 = gapi.auth2.init({
182            client_id: '428221764481-bo1fse9ovmlsb2nt70cque18ophi2hl4.apps.googleusercontent.com',
183            cookiepolicy: 'single_host_origin',
184            scope: 'profile email'
185            // scope: 'profile email https://www.googleapis.com/auth/user.phonenumbers.read'
186            // Request scopes in addition to 'profile' and 'email'
187            //scope: 'additional_scope'
188        });
189        if(document.getElementById('google') != null){
190          attachSignin(document.getElementById('google'));
191        }
192        if(document.getElementById('chatbot_google') != null){
193          attachSignin(document.getElementById('chatbot_google'));
194        }
195      });
196    }
197  };
198
199  function attachSignin(element) {
200      var url = element.ref_url;
201      auth2.attachClickHandler(element, {},
202        async  function(googleUser) {
203            var name = googleUser.getBasicProfile().getName();
204            var email = googleUser.getBasicProfile().getEmail();
205            debugger;
206            var profileImageUrl = googleUser.getBasicProfile().getImageUrl();
207            console.log(profileImageUrl);
208
209            googleUser.getAuthResponse().access_token;
210            var id_token = googleUser.getAuthResponse().id_token;
211            var access_token = googleUser.getAuthResponse().access_token;
212
213            // Get phone number using People API
214            var access_token = googleUser.getAuthResponse().access_token;
215
216            /* console.log("Profile Image:", profileImageUrl);
217            console.log("Access Token:", access_token);
218
219            // Fetch user's phone number from Google's People API
220            // Fetch user's phone number from Google's People API
221            let response = await fetch('https://people.googleapis.com/v1/people/me?personFields=phoneNumbers&key=AIzaSyAx2aCq721enWy9lYJC9-lyBl9JLr1UvEk', {
222                method: 'GET',
223                headers: {
224                    'Authorization': 'Bearer ' + access_token,
225                    'Content-Type': 'application/json'
226                }
227            });
228
229            let data = await response.json(); // Wait for the JSON response
230
231            console.log("Google People API Response:", data);
232            var phoneNumber = data.phoneNumbers ? data.phoneNumbers[
2320].value : "No phone number available";
233            console.log("Phone Number:", phoneNumber);
234            debugger; */
235
236            /* if(email == '[email protected]'){
237              alert('This is a test account. Please use another account');
238            }else{
239            } */
240            checkPatientExist(email,name,url,'google',profileImageUrl)
241            
242          }, function(error) {
243            console.info(JSON.stringify(error, undefined, 2));
244          });
245  }

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.