Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
  • 3 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
View
48 Doraemon/Developer Doc.md
@@ -0,0 +1,48 @@
+Doraemon开发者文档
+================
+1.开发标准
+----------
+合格的Doraemon扩展包,应该满足以下条件:
+
+- 在豌豆荚中能打开的页面宽度修改为适应豌豆荚的默认宽度 (760px)
+- 页面中的可下载资源应该遵循micro-format中定义的格式,否则无法下载
+- manifest.json匹配规则禁止使用http://*/*
+- 扩展包的文件格式必须是UTF-8编码(无BOM)
+
+2. manifest.json介绍
+-------
+
+* 参见文档《[manifest files]》
+
+3. Download API介绍
+-------
+
+* 参见文档《[Download Link]》
+
+4. 百宝袋开发工具介绍
+-------
+
+ 4.1. 加载本地扩展包
+
+ 豌豆荚开发者版的左边栏提供“管理”入口,在管理页面的右上角提供“载入扩展”按钮,会弹出一个本地目录选择器,以提供开发者载入本地正在开发的扩展。
+ 加载完成之后,在豌豆荚的左侧栏会出现该扩展包对应的标签。
+
+ 4.2. 调试本地扩展包
+
+ 开发者可以点击左侧栏对应的标签,进入扩展包对应的页面。
+ 在豌豆荚中可以用右键选择审查元素进行调试。
+
+ 4.3. 管理本地扩展包
+
+ 开发者点击左侧栏的“管理”入口进入管理页面。在此页面中,开发者可以看到所有加载的扩展包。
+
+ 4.4. 打包扩展
+
+ 开发者在管理页面中可以对已经加载的本地扩展包进行打包。
+
+ 4.5. 上传扩展包
+
+ 访问developer.wandoujia.com,其中有上传扩展包的入口。
+
+ [manifest files]: https://github.com/wandoulabs/developer-documents/blob/master/Doraemon/Manifest%20Files.md
+ [Download Link]: https://github.com/wandoulabs/developer-documents/blob/master/Doraemon/Download%20Link.md
View
2 Microdata/microdata-to-download-link-processor-demo.html
@@ -12,7 +12,7 @@
(<span itemprop="softwareVersion">1.3</span>)
</a>
<div itemprop="description">Cut the Rope, catch a star, and feed Om Nom candy in this award-winning game! The long-awaited hit game has finally arrived at Android!</div>
- <a itemprop="downloadUrl" href="">Download</a> (<span itemprop="fileSize">18,123,456</span>)
+ <a itemprop="downloadUrl" href="#content-length=18123456">Download</a> (<span itemprop="fileSize">18,123,456</span>)
</div>
</body>
</html>
View
30 Microdata/microdata-to-download-link-processor.js
@@ -22,22 +22,30 @@
var link = links[i];
link.setAttribute('rel', 'download');
+ var hash = {};
+ link.hash.replace(/[\#\&]([^=^&]*)=([^&]*)/g, function(whole, key, value) {
+ hash[key] = value;
+ return whole;
+ })
+
var scopeElement = getNearestScopeElement(link);
var itemProps = getItemProps(scopeElement);
-
- var hashSegments = [];
- if (itemProps.name) {
- hashSegments.push('name=' + encodeURIComponent(itemProps.name));
+ if (itemProps.name && !hash.name) {
+ hash.name = encodeURIComponent(itemProps.name);
}
- if (itemProps.image || itemProps.thumbnailUrl) {
- /* thumbnail/image is not supported until nested properties is supported */
- hashSegments.push('image=' + encodeURIComponent(itemProps.image || itemProps.thumbnailUrl));
+ if ((itemProps.image || itemProps.thumbnailUrl || itemProps.thumbnail.image) && !hash.image) {
+ hash.image = encodeURIComponent(itemProps.image || itemProps.thumbnailUrl || itemProps.thumbnail.image)
}
- if (itemProps.fileSize || itemProps.contentSize) {
- hashSegments.push('size=' + encodeURIComponent(itemProps.fileSize || itemProps.contentSize));
+ if ((itemProps.fileSize || itemProps.contentSize) && !hash['content-length']) {
+ hash['content-length'] = encodeURIComponent(itemProps.fileSize || itemProps.contentSize);
+ }
+
+ var hashArray = [];
+ for (var key in hash) {
+ hashArray.push(key + '=' +hash[key]);
}
- link.hash = hashSegments.join('&');
+ link.hash = '#' + hashArray.join('&');
}
};
@@ -72,7 +80,7 @@
if (propElement.hasAttribute('itemscope')) {
/* embedded struct */
- // TODO: extract embedded item scope
+ property.value = getItemProps(propElement);
} else {
switch (propElement.nodeName) {
case 'META':

No commit comments for this range

Something went wrong with that request. Please try again.