Home | History | Annotate | Download | only in oauth_contacts
      1 <!DOCTYPE html>
      2 <!--
      3  * Copyright (c) 2009 The Chromium Authors. All rights reserved.  Use of this
      4  * source code is governed by a BSD-style license that can be found in the
      5  * LICENSE file.
      6 -->
      7 <html>
      8   <head>
      9     <title>Your Google Contacts List</title>
     10     <style type="text/css">
     11       body {
     12         font: 14px Arial;
     13       }
     14       p {
     15         font-weight: bold;
     16       }
     17     </style>
     18   </head>
     19   <body>
     20     <h1>Your Google Contacts List</h1>
     21     <h2>Listing the first 100 results of a standard query to
     22       <a href="http://code.google.com/apis/contacts/">Google's
     23       Contacts API</a></h2>
     24     <button onclick="logout();">Click here to clear your OAuth token</button>
     25     <div id="output">
     26     </div>
     27     <script type="text/javascript">
     28       var contacts = chrome.extension.getBackgroundPage().contacts;
     29       var output = document.getElementById('output');
     30       for (var i = 0, contact; contact = contacts[i]; i++) {
     31         var div = document.createElement('div');
     32         var pName = document.createElement('p');
     33         var ulEmails = document.createElement('ul');
     34 
     35         pName.innerText = contact['name'];
     36         div.appendChild(pName);
     37 
     38         for (var j = 0, email; email = contact['emails'][j]; j++) {
     39           var liEmail = document.createElement('li');
     40           liEmail.innerText = email;
     41           ulEmails.appendChild(liEmail);
     42         }
     43 
     44         div.appendChild(ulEmails);
     45         output.appendChild(div);
     46       }
     47 
     48       function logout() {
     49         chrome.extension.getBackgroundPage().logout();
     50         window.close();
     51       };
     52     </script>
     53   </body>
     54 </html>
     55