Advertisement
VidyaPriyadarshini

WithoutsetApi

Aug 22nd, 2014
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.25 KB | None | 0 0
  1.  
  2. <?xml version="1.0" encoding="UTF-8"?>
  3. <Module>
  4. <ModulePrefs title="Hello World"
  5. description="Matches and echoes 'Hello World' string in emails"
  6. height="20"
  7. author="Sarah M and Walter Q"
  8. author_email="..."
  9. author_location="Mountain View, CA">
  10.  
  11. <!-- Declare feature dependencies. -->
  12.  
  13. <!-- This one is not specific to Gmail contextual gadgets. -->
  14. <Require feature="dynamic-height"/>
  15.  
  16. <!-- The next feature, Caja, is optional, and is supported for
  17. use only within test domains. Uncomment the tag only for
  18. non-production gadgets. -->
  19. <!-- <Require feature="caja"/> -->
  20.  
  21. <!-- The next feature, google.contentmatch, is required for all
  22. Gmail contextual gadgets.
  23. <Param> - specify one or more comma-separated extractor IDs in
  24. a param named "extractors". This line is overridden by the extractor ID
  25. in the manifest, but is still expected to be present. -->
  26. <Require feature="google.contentmatch">
  27. <Param name="extractors">
  28. google.com:MessageIDExtractor
  29. </Param>
  30. </Require>
  31.  
  32. </ModulePrefs>
  33.  
  34. <!-- Define the content type and display location. The settings
  35. "html" and "card" are required for all Gmail contextual gadgets. -->
  36. <Content type="html" view="card">
  37. <![CDATA[
  38. <!-- Start with Single Sign-On -->
  39. <!--script type="text/javascript" src="https://example.com/gadgets/sso.js"></script-->
  40. <script type="text/javascript">
  41.  
  42. <!-- Fetch the array of content matches. -->
  43. matches = google.contentmatch.getContentMatches();
  44. var matchList = document.createElement('UL');
  45. var listItem;
  46. var extractedText;
  47. var apiKey = 'AIzaSyBDDcH3TEmfyitCTYzk5VZx7YwiZyNtXlQ';
  48.  
  49. var scopes = ["https://www.googleapis.com/auth/gmail.modify","https://www.googleapis.com/auth/gmail.readonly","https://mail.google.com/","https://www.googleapis.com/auth/userinfo.email"];
  50.  
  51. var clientId = '1095931665697-ipmo6t5o9ul8kj5ofa0pjvg0h33iut1q.apps.googleusercontent.com';
  52.  
  53.  
  54. <!-- Iterate through the array and display output for each match. -->
  55. for (var match in matches) {
  56. for (var key in matches[match]) {
  57. listItem = document.createElement('LI');
  58. extractedText = document.createTextNode(key + ": " + matches[match][key]);
  59. listItem.appendChild(extractedText);
  60. matchList.appendChild(listItem);
  61. }
  62. }
  63. document.body.appendChild(matchList);
  64. gapi.client.load('gmail', 'v1', function() {
  65. var request = gapi.client.gmail.users.messages.get({'id': matchList}).payload.parts[0].body.data;
  66. request.execute(function(resp) {
  67. document.body.appendChild(resp);
  68. });
  69. });
  70. gadgets.window.adjustHeight(100);
  71. </script>
  72. <script src="https://apis.google.com/js/client.js?onload=handleClientLoad"></script>
  73. ]]>
  74. </Content>
  75. </Module>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement