私は Gmail コンテキスト ガジェットに取り組んでいます。最初の「Hello World」ガジェットを作成するために、 https: //developers.google.com/google-apps/gmail/contextual_gadgets からコードをコピー し、まったく同じことを行いました。manifest.xml と gadget.xml は次のとおりです。
1.manifest
<?xml version="1.0" encoding="UTF-8" ?>
<ApplicationManifest xmlns="http://schemas.google.com/ApplicationManifest/2009">
<!-- Support info to show in the marketplace & control panel -->
<Support>
</Support> <!-- Name and description pulled from message bundles -->
<Name>HelloWorld</Name>
<Description>A simple Hello World application for testing Gmail contextual gadgets</Description>
<!-- Show this link in Google's universal navigation for all users -->
<!-- EXTRACTOR -->
<Extension id="HelloWorldExtractor" type="contextExtractor">
<Name>Hello World</Name>
<Url>google.com:HelloWorld</Url>
<!-- Uncomment this Param to apply a filter to the extractor's default output. The example regexp below makes the match case sensitive. <Param name="hello" value="H[a-z]* W[a-z]*"/> -->
<Triggers ref="HelloWorldGadget"/>
<Scope ref="emailSubject"/>
<Scope ref="emailBody"/>
<Container name="mail"/></Extension>
<!-- GADGET -->
<Extension id="HelloWorldGadget" type="gadget">
<Name>Hello World Gmail contextual gadget</Name>
<Url>http://xxxx.com/gadget.xml</Url>
<Container name="mail"/>
<!-- Uncomment this to enable Caja. -->
<!-- <Param name="caja" value="enabled"/> -->
</Extension>
<!-- SCOPE -->
<Scope id="emailSubject">
<Url>tag:google.com,2010:auth/contextual/extractor/SUBJECT</Url>
<Reason>This application searches the Subject: line of each email for the text "Hello World."</Reason>
</Scope><Scope id="emailBody">
<Url>tag:google.com,2010:auth/contextual/extractor/BODY</Url>
<Reason>This application searches the message body of each email for the text "Hello World."</Reason>
</Scope></ApplicationManifest>
2. gadget.xml:
<?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:HelloWorld </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"></script>
<script type="text/javascript">
<!-- Fetch the array of content matches. -->
matches = google.contentmatch.getContentMatches();
var matchList = document.createElement('UL');
var listItem;
var extractedText;
<!-- 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);
gadgets.window.adjustHeight(100);
</script>
]]> </Content></Module>
しかし、JavaScriptエラーが発生しました:
- 'Date' は未定義です 2.'unescape' は未定義です
- プロパティ 'setMessages_' の値を取得できません: オブジェクトが null または未定義です
- プロパティ 'getContentMatches' の値を取得できません: オブジェクトが null または未定義です