plone资源注册表中的jquery oembed plisted
collective.js.oembed的Python项目详细描述
如何使用jquery.oembed
明确示例:
<script type="text/javascript"> $(document).ready(function() { $("#container").oembed("http://www.flickr.com/photos/14516334@N00/345009210/"); }); </script> <div id="container"></div>
隐含示例:
<script type="text/javascript"> $(document).ready(function() { $("a.oembed").oembed(); }); </script> <div><a href="http://www.flickr.com/photos/14516334@N00/345009210/" class="oembed">Flickr Image</a></div> <div><a href="http://vimeo.com/3108686" class="oembed">Vimeo Video</a></div>
配置多个提供程序示例
<script type="text/javascript"> $(document).ready(function() { $(".oembed").oembed(null, { embedMethod: "append", maxWidth: 1024, maxHeight: 768, vimeo: { autoplay: true, maxWidth: 200, maxHeight: 200} }); }); </script> <div><a href="http://vimeo.com/3108686" class="oembed">Vimeo Video</a></div> <div><a href="http://www.flickr.com/photos/14516334@N00/345009210/" class="oembed">Flickr Image</a></div>
支持的oEmbed提供程序
- 5分钟
- 亚马逊产品图片
- flickr
- 谷歌视频
- Hulu
- IMDB
- 元安全
- MySpace视频
- qik
- 修订3
- 屏幕
- 幻灯片
- Twitpic
- 维德勒
- 时间
- 维基百科
- wordpress
- YouTube
这个javascript插件在“jsonp”中转发,因此只有支持 直接实现回调方法。
任何其他oembed提供程序都使用embedly服务。
如何管理供应商
“greedy”选项允许您激活不受本机支持的回退服务 服务,默认情况下使用的服务是oohembed。
允许的提供程序:
$(".oembed").oembed(null, { allowedProviders: ["flickr", "youtube"] });
自定义提供程序:
$(".oembed").oembed(null, { greedy: false, customProviders: [{ "name": "streetfire.net", "urlschemes": ["streetfire\\.net\/video\/.*"], "apiendpoint": "http://api.embed.ly/v1/api/oembed?" }] });
不允许的提供程序:
$(".oembed").oembed(null, { disallowedProviders: ["flickr", "youtube"] });
默认oEmbed提供程序:
$(".oembed").oembed(null, {defaultOEmbedProvider: "embed.ly"});
嵌入法
附加:
$(".oembed").oembed(null, {embedMethod: "append"});
它将结果附加到.oEmbed容器,并将容器分类:
<a href="..." class="oembed">...</a> <div class="oembed-container oembed-container-Vimeo">...</div>
填充:
$(".oembed").oembed(null, {embedMethod: "fill"});
结果将填充链接:
<a href="..." class="oembed"> <div>...</div> </a>
替换:
$(".oembed").oembed(null, {embedMethod: "replace"});
它用html片段替换链接
管理大小
可以向HTML代码段添加大小约束。您可以设置MaxWidth和/或 最大高度:
$(".oembed").oembed(null, { maxWidth: 400, maxHeight: 300 }); });
变更日志
1.0a(2012-01-02)
- 初始版本