Want more features on Pastebin? Sign Up, it's FREE!
Guest

FB.ui publish feed example

By: a guest on Sep 13th, 2011  |  syntax: JavaScript  |  size: 1.29 KB  |  views: 181  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. var param = {
  2.  
  3.     method: 'feed',
  4.     message: 'blah',
  5.     attachment: {
  6.       name: 'JSSDK',
  7.       caption: 'The Facebook JavaScript SDK',
  8.       description: (
  9.         'A small JavaScript library that allows you to harness ' +
  10.         'the power of Facebook, bringing the user\'s identity, ' +
  11.         'social graph and distribution power to your site.'
  12.       ),
  13.       href: 'http://fbrell.com/'
  14.     },
  15.     action_links: [
  16.       { text: 'fbrell', href: 'http://fbrell.com/' }
  17.     ]
  18.  
  19. }
  20.  
  21.  
  22.  
  23.     // perform action
  24.     FB.ui(param, g.bind(function (res){
  25.  
  26.         // if mode is edit before post then on error
  27.         // res will be null
  28.         if (g.isNull(res) || !g.isDef(res)) {
  29.             log.warning('Error from facebook. res is null');
  30.             listener(false, w.errmsg);
  31.             return;
  32.         }
  33.  
  34.         if (g.isObject(res['error'])) {
  35.             log.warning('Error from facebook:' + res['error']['message']);
  36.             listener(false, res['error']['message']);
  37.         } else {
  38.             if (this.db.editBeforePost)
  39.                 this.savedId = res['post_id'];
  40.             else
  41.                 this.savedId = res;
  42.             log.info('Post ok to facebook. id:' + this.savedId);
  43.  
  44.  
  45.  
  46.             listener(true, this.savedId);
  47.         }
  48.     }, this));
clone this paste RAW Paste Data