Advertisement
Guest User

Untitled

a guest
Dec 16th, 2012
675
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.35 KB | None | 0 0
  1. <html xmlns:fb="http://www.facebook.com/2008/fbml" xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xml:lang="en-gb" lang="en-gb" slick-uniqueid="3">
  2. <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# video: http://ogp.me/ns/video#"><meta property="fb:app_id" content="my_app_id">
  3. <meta property="og:type" content="video.other" >
  4. <meta property="og:url" content="path_to_swf" >
  5. <meta property="og:image" content="path_to_image" >
  6.  
  7. <div id='fb-root'></div>
  8. <script>
  9. var APP_ID='137867843030139';
  10.  
  11. window.fbAsyncInit = initFacebook;
  12.  
  13. function initFacebook()
  14. {
  15. FB.init({
  16. appId : APP_ID,
  17. status : true, // check login status
  18. cookie : false, // enable cookies to allow the server to access the session
  19. xfbml : true // parse XFBML
  20. });
  21.  
  22. FB.getLoginStatus(onFacebookLoginStatus);
  23. };
  24.  
  25. (function() {
  26. var e = document.createElement('script');
  27. e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
  28. e.async = true;
  29. document.getElementById('fb-root').appendChild(e);
  30.  
  31. }());
  32.  
  33.  
  34.  
  35. function facebookLogout()
  36. {
  37. FB.logout();
  38. var loginButtonDiv=document.getElementById("fb-login-button-div");
  39. loginButtonDiv.style.display="block";
  40. var logoutButtonDiv=document.getElementById("fb-logout-button-div");
  41. logoutButtonDiv.style.display="none";
  42. var contentDiv=document.getElementById("user-is-authenticated-div");
  43. contentDiv.style.display="none";
  44. }
  45.  
  46. function facebookLogin()
  47. {
  48. var loginUrl='http://www.facebook.com/dialog/oauth/?'+
  49. 'scope=publish_stream,manage_pages&'+
  50. 'client_id='+APP_ID+'&'+
  51. 'redirect_uri='+document.location.href+'&'+
  52. 'response_type=token';
  53. window.location=loginUrl;
  54. }
  55.  
  56. /*
  57. * Callback function for FB.login
  58. */
  59.  
  60. function onFacebookLoginStatus(response)
  61. {
  62. if (response.status=='connected' && response.authResponse)
  63. {
  64. var loginButtonDiv=document.getElementById("fb-login-button-div");
  65. loginButtonDiv.style.display="none";
  66. var logoutButtonDiv=document.getElementById("fb-logout-button-div");
  67. logoutButtonDiv.style.display="none";
  68. var contentDiv=document.getElementById("user-is-authenticated-div");
  69. contentDiv.style.display="block";
  70.  
  71. }
  72. else
  73. {
  74. var loginButtonDiv=document.getElementById("fb-login-button-div");
  75. loginButtonDiv.style.display="block";
  76. var contentDiv=document.getElementById("user-is-authenticated-div");
  77. contentDiv.style.display="none";
  78. }
  79.  
  80. }
  81.  
  82.  
  83.  
  84.  
  85.  
  86. function postToWallUsingFBUi()
  87. {
  88. var data=
  89. {
  90. method: 'feed',
  91. message: '',
  92. display: 'iframe',
  93. caption: '<? echo $this->album->artist_name; ?> Click to Listen',
  94. name: '<? echo $this->album->name; ?>',
  95. picture: 'http://fnoob.com/images/albums/<? echo $this->album->image; ?>',
  96. source: link_to_file',
  97. link: '<? echo $album_link ?>', // Go here if user click the picture
  98. description: 'By artist <? echo $this->album->artist_name; ?> on <? echo $this->album->format_name; ?> and powered by FNOOB.com ',
  99. actions: [{ name: 'fnoob.com', link: '<? echo $album_link ?>' }],
  100. }
  101. FB.ui(data, onPostToWallCompleted);
  102. }
  103.  
  104. function onPostToWallCompleted(response)
  105. {
  106. if (response)
  107. {
  108. //console.log(response);
  109. if (response.error)
  110. {
  111. alert(response.error.message);
  112. }
  113. else
  114. {
  115. if (response.id)
  116. alert('Posted.... carry on!');
  117. else if (response.post_id)
  118. alert('Posted.... carry on!');
  119. else
  120. alert('Crap... something went wrong');
  121. }
  122. }
  123. // user cancelled
  124. }
  125.  
  126. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement