Posted By

serialk89 on 06/14/11


Tagged

api facebook


Versions (?)

FUNCIONES FACEBOOK, PUBLICAR EN EL MURO, ACTUALIZAR STATUS, AUTO PUBLISH


 / Published in: JavaScript
 

  1. // DE La MANO CON LA D ABAJO
  2. function streamPublish(name, description, hrefTitle, hrefLink, userPrompt){
  3. FB.ui(
  4. {
  5. method: 'stream.publish',
  6. message: '',
  7. attachment: {
  8. name: name,
  9. caption: '',
  10. description: (description),
  11. href: hrefLink
  12. },
  13. action_links: [
  14. { text: hrefTitle, href: hrefLink }
  15. ],
  16. user_prompt_message: userPrompt
  17. },
  18. function(response) {
  19.  
  20. });
  21. }
  22.  
  23. //PUBLICAR CON MENSAJE
  24.  
  25. function publishStream(){
  26. streamPublish("Stream Publish", 'Thinkdiff.net is AWESOME. I just learned how to develop Iframe+Jquery+Ajax base facebook application development. ', 'Checkout the Tutorial', 'http://wp.me/pr3EW-sv', "Demo Facebook Application Tutorial");
  27. }
  28.  
  29. //PUBLICAR AUTOMATICAMENTE
  30. function auto_publishPost() {
  31. var publish = {
  32. method: 'stream.publish',
  33. message: 'is learning how to develop Facebook apps.',
  34. picture : 'http://www.takwing.idv.hk/facebook/demoapp_jssdk/img/logo.gif',
  35. link : 'http://www.takwing.idv.hk/facebook/demoapp_jssdk/',
  36. name: 'This is my demo Facebook application (JS SDK)!',
  37. caption: 'Caption of the Post',
  38. description: 'It is fun to write Facebook App!',
  39. actions : { name : 'Start Learning', link : 'http://www.takwing.idv.hk/tech/fb_dev/index.php'}
  40. };
  41.  
  42. FB.api('/me/feed', 'POST', publish, function(response) {
  43. document.getElementById('confirmMsg').innerHTML =
  44. 'A post had just been published into the stream on your wall.';
  45. });
  46. };
  47.  
  48.  
  49. // UPDATE ESTATUS 1
  50. function updateStatus(){
  51. var status = document.getElementById('status').value;
  52.  
  53. $.ajax({
  54. type: "POST",
  55. url: "<?php echo $fbconfig['baseUrl'];?>pb_ajax.php",
  56. data: "status=" + status,
  57. success: function(msg){
  58. alert(msg);
  59. },
  60. error: function(msg){
  61. alert(msg);
  62. }
  63. });
  64. }
  65.  
  66. //UPDATE ESTATUS 2
  67. function updateStatusViaJavascriptAPICalling(){
  68. var status = document.getElementById('status').value;
  69. FB.api('/me/feed', 'post', { message: status }, function(response) {
  70. if (!response || response.error) {
  71. alert('Ha ocurrido un error');
  72. } else {
  73. alert('El estado se actualizo correctamente.');
  74. }
  75. });
  76. }

Report this snippet  

You need to login to post a comment.