Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Paste Description for Aakash

opensocial get friends, ping server

Aakash
Saturday, June 21st, 2008 at 3:54:02pm MDT 

  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <Module>
  3.  <ModulePrefs title="List Friends Example">
  4.    <Require feature="opensocial-0.7"/>
  5.  </ModulePrefs>
  6.  <Content type="html">
  7.  
  8.  <![CDATA[
  9.  
  10. <script type="text/javascript">
  11.  
  12. /**
  13.   * Request for friend information.
  14.   */
  15.   function getData() {   
  16.     var req = opensocial.newDataRequest();
  17.     req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.VIEWER), 'viewer');
  18.     req.add(req.newFetchPeopleRequest(opensocial.DataRequest.Group.VIEWER_FRIENDS), 'viewerFriends');
  19.     req.send(onLoadFriends);
  20.   };
  21.  
  22. /**
  23.   * Parses the response to the friend information request and generates
  24.   * html to list the friends along with their display name.
  25.   *
  26.   * @param {Object} dataResponse Friend information that was requested.
  27.   */
  28.   function onLoadFriends(dataResponse) {
  29.     var viewer = dataResponse.get('viewer').getData();
  30.     var html = 'Friends of ' + viewer.getDisplayName();
  31.     html += ':<br><ul>';
  32.     var viewerFriends = dataResponse.get('viewerFriends').getData();
  33.     viewerFriends.each(function(person) {
  34.       html += '<li>' + person.getDisplayName() + '</li>';
  35.     });
  36.     html += '</ul>';
  37.     document.getElementById('message').innerHTML = html;
  38.   };
  39. function makeServerRequest() {    var params = {};
  40. params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.TEXT; 
  41. var url = "http://dbe44284.joyent.us/test.php";
  42. gadgets.io.makeRequest(url, response, params);};
  43. function response(obj) {document.getElementById('server').innerHTML=obj.text;}
  44.  
  45.   </script>
  46.   <button onClick="getData()">Fetch Friends from orkut.com</button>
  47.   <div id="message"> </div>
  48.   <button onClick="makeServerRequest()">Make request to remote server</button>
  49.   <div id="server"></div>
  50.   ]]>
  51.   </Content>
  52. </Module>

Paste Details

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

worth-right worth-right fantasy-obligation