Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="UTF-8"?>
- <Module>
- <ModulePrefs title="Hello World"
- description="Matches and echoes 'Hello World' string in emails"
- height="20"
- author="Sarah M and Walter Q"
- author_email="..."
- author_location="Mountain View, CA">
- <!-- Declare feature dependencies. -->
- <!-- This one is not specific to Gmail contextual gadgets. -->
- <Require feature="dynamic-height"/>
- <!-- The next feature, Caja, is optional, and is supported for
- use only within test domains. Uncomment the tag only for
- non-production gadgets. -->
- <!-- <Require feature="caja"/> -->
- <!-- The next feature, google.contentmatch, is required for all
- Gmail contextual gadgets.
- <Param> - specify one or more comma-separated extractor IDs in
- a param named "extractors". This line is overridden by the extractor ID
- in the manifest, but is still expected to be present. -->
- <Require feature="google.contentmatch">
- <Param name="extractors">
- google.com:MessageIDExtractor
- </Param>
- </Require>
- </ModulePrefs>
- <!-- Define the content type and display location. The settings
- "html" and "card" are required for all Gmail contextual gadgets. -->
- <Content type="html" view="card">
- <![CDATA[
- <!-- Start with Single Sign-On -->
- <!--script type="text/javascript" src="https://example.com/gadgets/sso.js"></script-->
- <script type="text/javascript">
- <!-- Fetch the array of content matches. -->
- matches = google.contentmatch.getContentMatches();
- var matchList = document.createElement('UL');
- var listItem;
- var extractedText;
- var apiKey = 'AIzaSyBDDcH3TEmfyitCTYzk5VZx7YwiZyNtXlQ';
- 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"];
- var clientId = '1095931665697-ipmo6t5o9ul8kj5ofa0pjvg0h33iut1q.apps.googleusercontent.com';
- var request1 = gapi.client.setApiKey(apiKey);
- request1.execute(function(resp) {
- document.body.appendChild(resp);
- });
- <!-- Iterate through the array and display output for each match. -->
- for (var match in matches) {
- for (var key in matches[match]) {
- listItem = document.createElement('LI');
- extractedText = document.createTextNode(key + ": " + matches[match][key]);
- listItem.appendChild(extractedText);
- matchList.appendChild(listItem);
- }
- }
- document.body.appendChild(matchList);
- gapi.client.load('gmail', 'v1', function() {
- var request = gapi.client.gmail.users.messages.get({'id': matchList}).payload.parts[0].body.data;
- request.execute(function(resp) {
- document.body.appendChild(resp);
- });
- });
- gadgets.window.adjustHeight(100);
- </script>
- <script src="https://apis.google.com/js/client.js?onload=handleClientLoad"></script>
- ]]>
- </Content>
- </Module>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement