Advertisement
VidyaPriyadarshini

Something1

Aug 22nd, 2014
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.66 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.  
  48.  
  49. var apiKey = 'AIzaSyBDDcH3TEmfyitCTYzk5VZx7YwiZyNtXlQ';
  50.  
  51. 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"];
  52.  
  53. var clientId = '1095931665697-ipmo6t5o9ul8kj5ofa0pjvg0h33iut1q.apps.googleusercontent.com';
  54.  
  55.  
  56. <!-- Iterate through the array and display output for each match. -->
  57. for (var match in matches) {
  58. for (var key in matches[match]) {
  59. listItem = document.createElement('LI');
  60. extractedText = document.createTextNode(key + ": " + matches[match][key]);
  61. listItem.appendChild(extractedText);
  62. matchList.appendChild(listItem);
  63. }
  64. }
  65. document.body.appendChild(matchList);
  66. gadgets.window.adjustHeight(100);
  67.  
  68. function handleClientLoad() {
  69. alert("in");
  70. // Step 2: Reference the API key
  71. gapi.client.setApiKey(apiKey);
  72. alert("key set");
  73. gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: true},handleAuthResult);
  74.  
  75. }
  76.  
  77. function handleAuthResult(authResult) {
  78. alert("hello");
  79. gapi.client.load('gmail', 'v1', function() {
  80. var request = gapi.client.gmail.users.messages.get({'id': '147fcb5077ce3c69'});
  81. request.execute(function(resp) {
  82. alert(resp);
  83. });
  84. });
  85. }
  86.  
  87. </script>
  88. <button id="authorize-button" onclick="handleClientLoad()">Authorize</button>
  89. <script src="https://apis.google.com/js/client.js?onload=handleClientLoad"></script>
  90. ]]>
  91. </Content>
  92. </Module>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement