Advertisement
Guest User

Untitled

a guest
Mar 19th, 2013
1,287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.20 KB | None | 0 0
  1. Site URL: http://localhost:8080/
  2.  
  3. Mobile Site URL: http://localhost:8080/
  4.  
  5. <html>
  6. <header>
  7. <title>Kissa Android App</title>
  8. <script type="text/javascript" charset="utf-8" src="cordova-2.5.0.js"></script>
  9. <script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
  10. </header>
  11. <body>
  12. <div id="fb-root"></div>
  13. <div id="user-info"></div>
  14. <script type="text/javascript">
  15. var isLoaded = false;
  16. // Additional JS functions here
  17. window.fbAsyncInit = function() {
  18. FB.init({
  19. appId : 'The App ID', // App ID
  20. channelUrl : 'http://localhost:8080/res/channel.html', // Channel File
  21. //channelUrl : 'http://10.0.2.2:8080/assets/www/channel.html',
  22. status : true, // check login status
  23. cookie : true, // enable cookies to allow the server to access the session
  24. xfbml : true, // parse XFBML
  25. oauth : true
  26. });
  27.  
  28. isLoaded = true;
  29.  
  30. FB.getLoginStatus(function(response) {
  31. if (response.status === 'connected') {
  32. //window.location = "http://www.google.com";
  33. } else if (response.status === 'not_authorized') {
  34. // not_authorized
  35. //alert("You are unauthorized to access this page.");
  36. } else {
  37. //document.getElementById('name').innerHTML = '';
  38. }
  39. });
  40.  
  41.  
  42.  
  43. FB.login(function(response) {
  44. if (response.authResponse) {
  45. FB.api('/me', function(response) {
  46. document.getElementById('name').innerHTML = 'Name : ' + response.first_name;
  47. var fbLoginBtn = document.getElementById('fbLoginBtn');
  48. fbLoginBtn.innerHTML = '<fb:login-button autologoutlink="true" perms="email">&nbsp;</fb:login-button>';
  49. FB.XFBML.parse(fbLoginBtn);
  50. });
  51. } else {
  52. // cancelled
  53. }
  54. });
  55.  
  56. FB.Event.subscribe("auth.logout", function() {window.location = 'index.html'});
  57. };
  58.  
  59. // Load the SDK Asynchronously
  60. (function(d){
  61. var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
  62. if (d.getElementById(id)) {return;}
  63. js = d.createElement('script'); js.id = id; js.async = true;
  64. js.src = "//connect.facebook.net/en_US/all.js";
  65. ref.parentNode.insertBefore(js, ref);
  66. }(document));
  67. </script>
  68.  
  69. <script type="text/javascript">
  70. function isLoaded(){
  71. alert("heuy!");
  72. if(isLoaded)
  73. alert(isLoaded);
  74. else
  75. alert(isLoaded);
  76. }
  77. </script>
  78.  
  79. <fb:login-button autologoutlink="true" perms="email">&nbsp;</fb:login-button>
  80. <div id="fbLoginBtn">
  81. <fb:login-button autologoutlink="true" perms="email">&nbsp;</fb:login-button>
  82. </div>
  83. <div id="name" style="font-family : arial"></div>
  84. <div id="email"></div>
  85.  
  86. <input type="button" onclick="isLoaded()" value="hey"/>
  87.  
  88. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement