Subversion Repositories SmartDukaan

Rev

Rev 7016 | Rev 7024 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7016 Rev 7020
Line 9... Line 9...
9
      cookie     : true, // enable cookies to allow the server to access the session
9
      cookie     : true, // enable cookies to allow the server to access the session
10
      xfbml      : true,  // parse XFBML
10
      xfbml      : true,  // parse XFBML
11
      oauth  	 : true
11
      oauth  	 : true
12
    });
12
    });
13
  	};
13
  	};
-
 
14
  	
-
 
15
  	window.fbAsyncInit();
14
 
16
  	
15
  // Load the SDK Asynchronously
17
  // Load the SDK Asynchronously
16
  (function(d){
18
  (function(d){
17
     var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
19
     var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
18
     if (d.getElementById(id)) {return;}
20
     if (d.getElementById(id)) {return;}
19
     js = d.createElement('script'); js.id = id; js.async = true;
21
     js = d.createElement('script'); js.id = id; js.async = true;
Line 36... Line 38...
36
	        }
38
	        }
37
	    },{scope: 'email,publish_stream'});
39
	    },{scope: 'email,publish_stream'});
38
  }
40
  }
39
 
41
 
40
  function checkAndCallFacebookLogin() {
42
  function checkAndCallFacebookLogin() {
41
	  	window.fbAsyncInit();
43
	  	//window.fbAsyncInit();
42
	    FB.getLoginStatus(function(response) {
44
	    FB.getLoginStatus(function(response) {
43
	    	  if (response.status === 'connected') {
45
	    	  if (response.status === 'connected') {
44
	    		  FB.api('/me', function(response){
46
	    		  FB.api('/me', function(response){
45
	    			  userDetails = response;
47
	    			  userDetails = response;
46
	    			  if(userDetails!==null) {
48
	    			  if(userDetails!==null) {
47
	  	    			loginToSaholicByFacebook(userDetails, authDetails);
49
	  	    			loginToSaholicByFacebook(userDetails, authDetails);
48
	  	    		  }
50
	  	    		  }
49
	    		  });
51
	    		  });
50
	    	  } else if (response.status === 'not_authorized') {
52
	    	  } else if (response.status === 'not_authorized') {
51
	    		  FB.login(function(response) {
-
 
52
	    		    	if (response.authResponse) {
-
 
53
	    		    		authDetails = response.authResponse;
-
 
54
	    		    		FB.api('/me', function(response){
-
 
55
	    		    			  userDetails = response;
-
 
56
	    		    			  if(userDetails!==null) {
-
 
57
	    		    				  loginToSaholicByFacebook(userDetails, authDetails);
-
 
58
	    		  	    		  }
-
 
59
	    		    		});
-
 
60
	    		        } else {
-
 
61
	    		            // cancelled
-
 
62
	    		        }
-
 
63
	    		    },{scope: 'email,publish_stream'});
-
 
64
	    		  //login();
53
	    		  login();
65
	    	  } else {
54
	    	  } else {
66
	    		  FB.login(function(response) {
-
 
67
	    		    	if (response.authResponse) {
-
 
68
	    		    		authDetails = response.authResponse;
-
 
69
	    		    		FB.api('/me', function(response){
-
 
70
	    		    			  userDetails = response;
-
 
71
	    		    			  if(userDetails!==null) {
-
 
72
	    		    				  loginToSaholicByFacebook(userDetails, authDetails);
-
 
73
	    		  	    		  }
-
 
74
	    		    		});
-
 
75
	    		        } else {
-
 
76
	    		            // cancelled
-
 
77
	    		        }
-
 
78
	    		    },{scope: 'email,publish_stream'});
-
 
79
	    		  //login();
55
	    		  login();
80
	    	  }
56
	    	  }
81
	    });
57
	    });
82
  }
58
  }
83
59