Posted to tcl by peterc at Fri Jan 16 14:20:17 GMT 2015view raw

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Blah</title>
  6. </head>
  7. <body>
  8. <script>
  9. window.fbAsyncInit = function() {
  10. FB.init({
  11. appId : 'XXXXXXXXXXXXXXXXX',
  12. xfbml : true,
  13. version : 'v2.2'
  14. });
  15.  
  16. // ADD ADDITIONAL FACEBOOK CODE HERE
  17. };
  18.  
  19. (function(d, s, id){
  20. var js, fjs = d.getElementsByTagName(s)[0];
  21. if (d.getElementById(id)) {return;}
  22. js = d.createElement(s); js.id = id;
  23. js.src = "//connect.facebook.net/en_US/sdk.js";
  24. fjs.parentNode.insertBefore(js, fjs);
  25. }(document, 'script', 'facebook-jssdk'));
  26.  
  27. // Place following code after FB.init call.
  28.  
  29. function onLogin(response) {
  30. if (response.status == 'connected') {
  31. FB.api('/me?fields=first_name', function(data) {
  32. var welcomeBlock = document.getElementById('fb-welcome');
  33. welcomeBlock.innerHTML = 'Hello, ' + data.first_name + '!';
  34. });
  35. }
  36. }
  37.  
  38. FB.getLoginStatus(function(response) {
  39. // Check login status on load, and if the user is
  40. // already logged in, go directly to the welcome message.
  41. if (response.status == 'connected') {
  42. onLogin(response);
  43. } else {
  44. // Otherwise, show Login dialog first.
  45. FB.login(function(response) {
  46. onLogin(response);
  47. }, {scope: 'user_friends, email'});
  48. }
  49. });
  50.  
  51. </script>
  52.  
  53. <div id="playground"
  54. style="width: 100%;
  55. height: 100%;
  56. min-height: 100%;
  57. position: absolute;
  58. left: 0px;
  59. top: 0px;
  60. background-color: #dfdfdf;">
  61.  
  62. <img src="GreySpinner.gif"
  63. style="width: 32px;
  64. height: 32px;
  65. top: 50%;
  66. left: 50%;
  67. position: absolute;
  68. margin-left: -16px;
  69. margin-top: -16px;"/>
  70. </div>
  71.  
  72. <script type="text/javascript" src="script/au_js.js"></script>
  73. </body>
  74. </html>