跳转到主要内容

JQuery oembed被包含在Plone资源注册表中

项目描述

简介

此插件将JQuery插件 oembed 注册到Plone资源注册表中。

版本:1.1.0 RC

如何使用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提供者

  • 5min

  • 亚马逊产品图片

  • Flickr

  • 谷歌视频

  • Hulu

  • IMDb

  • Metacafe

  • Myspace视频

  • Qik

  • Revision3

  • Screenr

  • Slideshare

  • Twitpic

  • Viddler

  • vVimeo

  • 维基百科

  • WordPress

  • YouTube

此javascript插件依赖于‘jsonp’,因此仅直接实现了支持回调方法的oEmbed提供者。

任何其他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和/或maxHeight设置

$(".oembed").oembed(null, {
        maxWidth: 400,
        maxHeight: 300 });
});

致谢

公司

makinacom

作者

变更日志

1.0a (2012-01-02)

  • 初始版本

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源分发

collective.js.oembed-1.0a.tar.gz (12.2 kB 查看哈希值)

上传时间

由以下支持