Ignore:
Timestamp:
Sep 16, 2008, 1:56:21 PM (11 years ago)
Author:
Nick Burch
Message:

Nearly there

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gpx.npemap.org.uk/favourite_postcode.xml

    r658 r659  
    1414
    1515  function startApp() {
    16 //      startShowMap("OX2 6DR");
    1716        findPC();
     17        findFriends();
     18  }
     19
     20  function findFriends() {
     21        var req = opensocial.newDataRequest();
     22        req.add(req.newFetchPeopleRequest(opensocial.DataRequest.Group.VIEWER_FRIENDS), 'viewerFriends');
     23        req.add(req.newFetchPersonAppDataRequest("VIEWER_FRIENDS", [persistentTag]), "pc");
     24        req.send(loadedFriends);
     25  }
     26  function loadedFriends(data) {
     27        var html = "<ul>";
     28
     29        var fd = data.get("pc").getData();
     30
     31        var friends = data.get("viewerFriends").getData();
     32        friends.each(function(person) {
     33                var postcode = "(not set)";
     34                var theirData = fd[person.getId()]
     35                if(theirData && theirData[persistentTag]) {
     36                        postcode = theirData[persistentTag];
     37                }
     38                html += "<li>" + person.getDisplayName() + " " + postcode + "</li>";
     39        });
     40        html += "</ul>";
     41
     42        document.getElementById("friends").innerHTML = html;
    1843  }
    1944
     
    95120   <input type="text" id="pc" style="width: 10em" onblur="pickPC()" />
    96121 </div>
    97  <br />
    98  <h3>Your friends:</h3>
     122 <div>Your friends:</div>
    99123 <div id="friends"></div>
    100124</div>
Note: See TracChangeset for help on using the changeset viewer.