jquery-oembed-rails 0.1.0 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,92 +5,103 @@
5
5
  * Licensed under the MIT license
6
6
  *
7
7
  * Orignal Author: Richard Chamorro
8
- * Forked by Andrew Mee to Provide a slightly diffent kind of embedding
9
- * experience
8
+ * Forked by Andrew Mee to Provide a slightly diffent kind of embedding experience
10
9
  */
11
- (function($) {
12
- $.fn.oembed = function(url, options, embedAction) {
10
+ (function ($) {
11
+ $.fn.oembed = function (url, options, embedAction) {
13
12
 
14
13
  settings = $.extend(true, $.fn.oembed.defaults, options);
15
- var shortURLList = ["0rz.tw","1link.in","1url.com","2.gp","2big.at","2tu.us","3.ly","307.to","4ms.me","4sq.com","4url.cc","6url.com","7.ly","a.gg","a.nf","aa.cx","abcurl.net",
16
- "ad.vu","adf.ly","adjix.com","afx.cc","all.fuseurl.com","alturl.com","amzn.to","ar.gy","arst.ch","atu.ca","azc.cc","b23.ru","b2l.me","bacn.me","bcool.bz","binged.it",
17
- "bit.ly","bizj.us","bloat.me","bravo.ly","bsa.ly","budurl.com","canurl.com","chilp.it","chzb.gr","cl.lk", "cl.ly", "clck.ru", "cli.gs", "cliccami.info",
18
- "clickthru.ca", "clop.in", "conta.cc", "cort.as", "cot.ag", "crks.me", "ctvr.us", "cutt.us", "dai.ly", "decenturl.com", "dfl8.me", "digbig.com",
19
- "http:\/\/digg\.com\/[^\/]+$", "disq.us", "dld.bz", "dlvr.it", "do.my", "doiop.com", "dopen.us", "easyuri.com", "easyurl.net", "eepurl.com", "eweri.com",
20
- "fa.by", "fav.me", "fb.me", "fbshare.me", "ff.im", "fff.to", "fire.to", "firsturl.de", "firsturl.net", "flic.kr", "flq.us", "fly2.ws", "fon.gs", "freak.to",
21
- "fuseurl.com", "fuzzy.to", "fwd4.me", "fwib.net", "g.ro.lt", "gizmo.do", "gl.am", "go.9nl.com", "go.ign.com", "go.usa.gov", "goo.gl", "goshrink.com", "gurl.es",
22
- "hex.io", "hiderefer.com", "hmm.ph", "href.in", "hsblinks.com", "htxt.it", "huff.to", "hulu.com", "hurl.me", "hurl.ws", "icanhaz.com", "idek.net", "ilix.in", "is.gd",
23
- "its.my", "ix.lt", "j.mp", "jijr.com", "kl.am", "klck.me", "korta.nu", "krunchd.com", "l9k.net", "lat.ms", "liip.to", "liltext.com", "linkbee.com", "linkbun.ch",
24
- "liurl.cn", "ln-s.net", "ln-s.ru", "lnk.gd", "lnk.ms", "lnkd.in", "lnkurl.com", "lru.jp", "lt.tl", "lurl.no", "macte.ch", "mash.to", "merky.de", "migre.me", "miniurl.com",
25
- "minurl.fr", "mke.me", "moby.to", "moourl.com", "mrte.ch", "myloc.me", "myurl.in", "n.pr", "nbc.co", "nblo.gs", "nn.nf", "not.my", "notlong.com", "nsfw.in",
26
- "nutshellurl.com", "nxy.in", "nyti.ms", "o-x.fr", "oc1.us", "om.ly", "omf.gd", "omoikane.net", "on.cnn.com", "on.mktw.net", "onforb.es", "orz.se", "ow.ly", "ping.fm",
27
- "pli.gs", "pnt.me", "politi.co", "post.ly", "pp.gg", "profile.to", "ptiturl.com", "pub.vitrue.com", "qlnk.net", "qte.me", "qu.tc", "qy.fi", "r.ebay.com", "r.im", "rb6.me", "read.bi",
28
- "readthis.ca", "reallytinyurl.com", "redir.ec", "redirects.ca", "redirx.com", "retwt.me", "ri.ms", "rickroll.it", "riz.gd", "rt.nu", "ru.ly", "rubyurl.com", "rurl.org",
29
- "rww.tw", "s4c.in", "s7y.us", "safe.mn", "sameurl.com", "sdut.us", "shar.es", "shink.de", "shorl.com", "short.ie", "short.to", "shortlinks.co.uk", "shorturl.com",
30
- "shout.to", "show.my", "shrinkify.com", "shrinkr.com", "shrt.fr", "shrt.st", "shrten.com", "shrunkin.com", "simurl.com", "slate.me", "smallr.com", "smsh.me", "smurl.name",
31
- "sn.im", "snipr.com", "snipurl.com", "snurl.com", "sp2.ro", "spedr.com", "srnk.net", "srs.li", "starturl.com","stks.co", "su.pr", "surl.co.uk", "surl.hu", "t.cn", "t.co", "t.lh.com",
32
- "ta.gd", "tbd.ly", "tcrn.ch", "tgr.me", "tgr.ph", "tighturl.com", "tiniuri.com", "tiny.cc", "tiny.ly", "tiny.pl", "tinylink.in", "tinyuri.ca", "tinyurl.com", "tk.", "tl.gd",
33
- "tmi.me", "tnij.org", "tnw.to", "tny.com", "to.ly", "togoto.us", "totc.us", "toysr.us", "tpm.ly", "tr.im", "tra.kz", "trunc.it", "twhub.com", "twirl.at",
34
- "twitclicks.com", "twitterurl.net", "twitterurl.org", "twiturl.de", "twurl.cc", "twurl.nl", "u.mavrev.com", "u.nu", "u76.org", "ub0.cc", "ulu.lu", "updating.me", "ur1.ca",
35
- "url.az", "url.co.uk", "url.ie", "url360.me", "url4.eu", "urlborg.com", "urlbrief.com", "urlcover.com", "urlcut.com", "urlenco.de", "urli.nl", "urls.im",
36
- "urlshorteningservicefortwitter.com", "urlx.ie", "urlzen.com", "usat.ly", "use.my", "vb.ly", "vevo.ly", "vgn.am", "vl.am", "vm.lc", "w55.de", "wapo.st", "wapurl.co.uk", "wipi.es",
37
- "wp.me", "x.vu", "xr.com", "xrl.in", "xrl.us", "xurl.es", "xurl.jp", "y.ahoo.it", "yatuc.com", "ye.pe", "yep.it", "yfrog.com", "yhoo.it", "yiyd.com", "youtu.be", "yuarel.com",
38
- "z0p.de", "zi.ma", "zi.mu", "zipmyurl.com", "zud.me", "zurl.ws", "zz.gd", "zzang.kr", "›.ws", "✩.ws", "✿.ws", "❥.ws", "➔.ws", "➞.ws", "➡.ws", "➨.ws", "➯.ws", "➹.ws", "➽.ws"];
14
+ var shortURLList = ["0rz.tw", "1link.in", "1url.com", "2.gp", "2big.at", "2tu.us", "3.ly", "307.to", "4ms.me", "4sq.com", "4url.cc", "6url.com", "7.ly", "a.gg", "a.nf", "aa.cx", "abcurl.net",
15
+ "ad.vu", "adf.ly", "adjix.com", "afx.cc", "all.fuseurl.com", "alturl.com", "amzn.to", "ar.gy", "arst.ch", "atu.ca", "azc.cc", "b23.ru", "b2l.me", "bacn.me", "bcool.bz", "binged.it",
16
+ "bit.ly", "bizj.us", "bloat.me", "bravo.ly", "bsa.ly", "budurl.com", "canurl.com", "chilp.it", "chzb.gr", "cl.lk", "cl.ly", "clck.ru", "cli.gs", "cliccami.info",
17
+ "clickthru.ca", "clop.in", "conta.cc", "cort.as", "cot.ag", "crks.me", "ctvr.us", "cutt.us", "dai.ly", "decenturl.com", "dfl8.me", "digbig.com",
18
+ "http:\/\/digg\.com\/[^\/]+$", "disq.us", "dld.bz", "dlvr.it", "do.my", "doiop.com", "dopen.us", "easyuri.com", "easyurl.net", "eepurl.com", "eweri.com",
19
+ "fa.by", "fav.me", "fb.me", "fbshare.me", "ff.im", "fff.to", "fire.to", "firsturl.de", "firsturl.net", "flic.kr", "flq.us", "fly2.ws", "fon.gs", "freak.to",
20
+ "fuseurl.com", "fuzzy.to", "fwd4.me", "fwib.net", "g.ro.lt", "gizmo.do", "gl.am", "go.9nl.com", "go.ign.com", "go.usa.gov", "goo.gl", "goshrink.com", "gurl.es",
21
+ "hex.io", "hiderefer.com", "hmm.ph", "href.in", "hsblinks.com", "htxt.it", "huff.to", "hulu.com", "hurl.me", "hurl.ws", "icanhaz.com", "idek.net", "ilix.in", "is.gd",
22
+ "its.my", "ix.lt", "j.mp", "jijr.com", "kl.am", "klck.me", "korta.nu", "krunchd.com", "l9k.net", "lat.ms", "liip.to", "liltext.com", "linkbee.com", "linkbun.ch",
23
+ "liurl.cn", "ln-s.net", "ln-s.ru", "lnk.gd", "lnk.ms", "lnkd.in", "lnkurl.com", "lru.jp", "lt.tl", "lurl.no", "macte.ch", "mash.to", "merky.de", "migre.me", "miniurl.com",
24
+ "minurl.fr", "mke.me", "moby.to", "moourl.com", "mrte.ch", "myloc.me", "myurl.in", "n.pr", "nbc.co", "nblo.gs", "nn.nf", "not.my", "notlong.com", "nsfw.in",
25
+ "nutshellurl.com", "nxy.in", "nyti.ms", "o-x.fr", "oc1.us", "om.ly", "omf.gd", "omoikane.net", "on.cnn.com", "on.mktw.net", "onforb.es", "orz.se", "ow.ly", "ping.fm",
26
+ "pli.gs", "pnt.me", "politi.co", "post.ly", "pp.gg", "profile.to", "ptiturl.com", "pub.vitrue.com", "qlnk.net", "qte.me", "qu.tc", "qy.fi", "r.ebay.com", "r.im", "rb6.me", "read.bi",
27
+ "readthis.ca", "reallytinyurl.com", "redir.ec", "redirects.ca", "redirx.com", "retwt.me", "ri.ms", "rickroll.it", "riz.gd", "rt.nu", "ru.ly", "rubyurl.com", "rurl.org",
28
+ "rww.tw", "s4c.in", "s7y.us", "safe.mn", "sameurl.com", "sdut.us", "shar.es", "shink.de", "shorl.com", "short.ie", "short.to", "shortlinks.co.uk", "shorturl.com",
29
+ "shout.to", "show.my", "shrinkify.com", "shrinkr.com", "shrt.fr", "shrt.st", "shrten.com", "shrunkin.com", "simurl.com", "slate.me", "smallr.com", "smsh.me", "smurl.name",
30
+ "sn.im", "snipr.com", "snipurl.com", "snurl.com", "sp2.ro", "spedr.com", "srnk.net", "srs.li", "starturl.com", "stks.co", "su.pr", "surl.co.uk", "surl.hu", "t.cn", "t.co", "t.lh.com",
31
+ "ta.gd", "tbd.ly", "tcrn.ch", "tgr.me", "tgr.ph", "tighturl.com", "tiniuri.com", "tiny.cc", "tiny.ly", "tiny.pl", "tinylink.in", "tinyuri.ca", "tinyurl.com", "tk.", "tl.gd",
32
+ "tmi.me", "tnij.org", "tnw.to", "tny.com", "to.ly", "togoto.us", "totc.us", "toysr.us", "tpm.ly", "tr.im", "tra.kz", "trunc.it", "twhub.com", "twirl.at",
33
+ "twitclicks.com", "twitterurl.net", "twitterurl.org", "twiturl.de", "twurl.cc", "twurl.nl", "u.mavrev.com", "u.nu", "u76.org", "ub0.cc", "ulu.lu", "updating.me", "ur1.ca",
34
+ "url.az", "url.co.uk", "url.ie", "url360.me", "url4.eu", "urlborg.com", "urlbrief.com", "urlcover.com", "urlcut.com", "urlenco.de", "urli.nl", "urls.im",
35
+ "urlshorteningservicefortwitter.com", "urlx.ie", "urlzen.com", "usat.ly", "use.my", "vb.ly", "vevo.ly", "vgn.am", "vl.am", "vm.lc", "w55.de", "wapo.st", "wapurl.co.uk", "wipi.es",
36
+ "wp.me", "x.vu", "xr.com", "xrl.in", "xrl.us", "xurl.es", "xurl.jp", "y.ahoo.it", "yatuc.com", "ye.pe", "yep.it", "yfrog.com", "yhoo.it", "yiyd.com", "youtu.be", "yuarel.com",
37
+ "z0p.de", "zi.ma", "zi.mu", "zipmyurl.com", "zud.me", "zurl.ws", "zz.gd", "zzang.kr", "›.ws", "✩.ws", "✿.ws", "❥.ws", "➔.ws", "➞.ws", "➡.ws", "➨.ws", "➯.ws", "➹.ws", "➽.ws"];
39
38
 
40
39
  if ($('#jqoembeddata').length === 0) $('<span id="jqoembeddata"></span>').appendTo('body');
41
40
 
42
- return this.each(function() {
43
-
41
+ return this.each(function () {
44
42
  var container = $(this),
45
- resourceURL = (url && (!url.indexOf('http://') || !url.indexOf('https://'))) ? url : container.attr("href"),
43
+ resourceURL = (url && (!url.indexOf('http://') || !url.indexOf('https://'))) ? url : container.attr("href"),
46
44
  provider;
47
45
 
48
46
  if (embedAction) {
49
47
  settings.onEmbed = embedAction;
50
48
  }
51
- else if (!settings.onEmbed){
52
- settings.onEmbed = function(oembedData) {
49
+ else if (!settings.onEmbed) {
50
+ settings.onEmbed = function (oembedData) {
53
51
  $.fn.oembed.insertCode(this, settings.embedMethod, oembedData);
54
52
  };
55
53
  }
56
54
 
57
55
  if (resourceURL !== null && resourceURL !== undefined) {
58
- //Check if shorten URL
59
- for (var j = 0, l =shortURLList.length; j < l; j++) {
60
- var regExp = new RegExp('://'+shortURLList[j]+'/', "i");
61
- if (resourceURL.match(regExp) !== null) {
62
- //AJAX to http://api.longurl.org/v2/expand?url=http://bit.ly/JATvIs&format=json&callback=hhh
63
- var ajaxopts = $.extend({
64
- url: "http://api.longurl.org/v2/expand",
65
- dataType: 'jsonp',
66
- data: {
67
- url: resourceURL,
68
- format: "json"
69
- //callback: "?"
70
- },
71
- success: function(data) {
72
- //this = $.fn.oembed;
73
- resourceURL = data['long-url'];
74
- provider = $.fn.oembed.getOEmbedProvider(data['long-url']);
75
-
76
- if (provider !== null) {
77
- provider.params = getNormalizedParams(settings[provider.name]) || {};
78
- provider.maxWidth = settings.maxWidth;
79
- provider.maxHeight = settings.maxHeight;
80
- embedCode(container, resourceURL, provider);
81
- } else {
82
- settings.onProviderNotFound.call(container, resourceURL);
83
- }
84
- }
85
- }, settings.ajaxOptions || {});
86
-
87
- $.ajax(ajaxopts);
88
-
89
- return container;
90
- }
91
- }
56
+ //Check if shorten URL
57
+ for (var j = 0, l = shortURLList.length; j < l; j++) {
58
+ var regExp = new RegExp('://' + shortURLList[j] + '/', "i");
59
+
60
+ if (resourceURL.match(regExp) !== null) {
61
+ //AJAX to http://api.longurl.org/v2/expand?url=http://bit.ly/JATvIs&format=json&callback=hhh
62
+ var ajaxopts = $.extend({
63
+ url: "http://api.longurl.org/v2/expand",
64
+ dataType: 'jsonp',
65
+ data: {
66
+ url: resourceURL,
67
+ format: "json"
68
+ //callback: "?"
69
+ },
70
+ success: function (data) {
71
+ //this = $.fn.oembed;
72
+ resourceURL = data['long-url'];
73
+ provider = $.fn.oembed.getOEmbedProvider(data['long-url']);
74
+
75
+ //remove fallback
76
+ if (!!settings.fallback === false) {
77
+ provider = provider.name.toLowerCase() === 'opengraph' ? null : provider;
78
+ }
79
+
80
+ if (provider !== null) {
81
+ provider.params = getNormalizedParams(settings[provider.name]) || {};
82
+ provider.maxWidth = settings.maxWidth;
83
+ provider.maxHeight = settings.maxHeight;
84
+ embedCode(container, resourceURL, provider);
85
+ } else {
86
+ settings.onProviderNotFound.call(container, resourceURL);
87
+ }
88
+ },
89
+ error: function () {
90
+ settings.onError.call(container, resourceURL)
91
+ }
92
+ }, settings.ajaxOptions || {});
93
+
94
+ $.ajax(ajaxopts);
95
+
96
+ return container;
97
+ }
98
+ }
92
99
  provider = $.fn.oembed.getOEmbedProvider(resourceURL);
93
100
 
101
+ //remove fallback
102
+ if (!!settings.fallback === false) {
103
+ provider = provider.name.toLowerCase() === 'opengraph' ? null : provider;
104
+ }
94
105
  if (provider !== null) {
95
106
  provider.params = getNormalizedParams(settings[provider.name]) || {};
96
107
  provider.maxWidth = settings.maxWidth;
@@ -100,42 +111,45 @@
100
111
  settings.onProviderNotFound.call(container, resourceURL);
101
112
  }
102
113
  }
103
-
104
114
  return container;
105
115
  });
106
-
107
-
108
116
  };
109
117
 
110
118
  var settings;
111
119
 
112
120
  // Plugin defaults
113
121
  $.fn.oembed.defaults = {
122
+ fallback: true,
114
123
  maxWidth: null,
115
124
  maxHeight: null,
116
- includeHandle: true,
125
+ includeHandle: true,
117
126
  embedMethod: 'auto',
118
- // "auto", "append", "fill"
119
- onProviderNotFound: function() {},
120
- beforeEmbed: function() {},
121
- afterEmbed: function() {},
127
+ // "auto", "append", "fill"
128
+ onProviderNotFound: function () {
129
+ },
130
+ beforeEmbed: function () {
131
+ },
132
+ afterEmbed: function () {
133
+ },
122
134
  onEmbed: false,
123
- onError: function() {},
135
+ onError: function (a, b, c, d) {
136
+ console.log('err:', a, b, c, d)
137
+ },
124
138
  ajaxOptions: {}
125
139
  };
126
140
 
127
141
  /* Private functions */
128
- function rand(length,current){ //Found on http://stackoverflow.com/questions/1349404/generate-a-string-of-5-random-characters-in-javascript
129
- current = current ? current : '';
130
- return length ? rand( --length , "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz".charAt( Math.floor( Math.random() * 60 ) ) + current ) : current;
142
+ function rand(length, current) { //Found on http://stackoverflow.com/questions/1349404/generate-a-string-of-5-random-characters-in-javascript
143
+ current = current ? current : '';
144
+ return length ? rand(--length, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz".charAt(Math.floor(Math.random() * 60)) + current) : current;
131
145
  }
132
-
146
+
133
147
  function getRequestUrl(provider, externalUrl) {
134
148
  var url = provider.apiendpoint,
135
149
  qs = "",
136
150
  i;
137
151
  url += (url.indexOf("?") <= 0) ? "?" : "&";
138
- url = url.replace('#','%23');
152
+ url = url.replace('#', '%23');
139
153
 
140
154
  if (provider.maxWidth !== null && (typeof provider.params.maxwidth === 'undefined' || provider.params.maxwidth === null)) {
141
155
  provider.params.maxwidth = provider.maxWidth;
@@ -147,17 +161,21 @@
147
161
 
148
162
  for (i in provider.params) {
149
163
  // We don't want them to jack everything up by changing the callback parameter
150
- if (i == provider.callbackparameter) continue;
164
+ if (i == provider.callbackparameter)
165
+ continue;
151
166
 
152
167
  // allows the options to be set to null, don't send null values to the server as parameters
153
- if (provider.params[i] !== null) qs += "&" + escape(i) + "=" + provider.params[i];
168
+ if (provider.params[i] !== null)
169
+ qs += "&" + escape(i) + "=" + provider.params[i];
154
170
  }
155
171
 
156
172
  url += "format=" + provider.format + "&url=" + escape(externalUrl) + qs;
157
- if(provider.dataType!='json') url += "&" + provider.callbackparameter + "=?";
173
+ if (provider.dataType != 'json')
174
+ url += "&" + provider.callbackparameter + "=?";
158
175
 
159
176
  return url;
160
177
  }
178
+
161
179
  function success(oembedData, externalUrl, container) {
162
180
  $('#jqoembeddata').data(externalUrl, oembedData.code);
163
181
  settings.beforeEmbed.call(container, oembedData);
@@ -166,149 +184,155 @@
166
184
  }
167
185
 
168
186
  function embedCode(container, externalUrl, embedProvider) {
169
- if ($('#jqoembeddata').data(externalUrl)!=undefined && embedProvider.embedtag.tag!='iframe'){
170
- var oembedData = {code: $('#jqoembeddata').data(externalUrl)};
171
- success(oembedData, externalUrl, container);
172
- }else if (embedProvider.yql) {
173
- var from = embedProvider.yql.from || 'htmlstring';
174
- var url = embedProvider.yql.url ? embedProvider.yql.url(externalUrl) : externalUrl;
175
- var query = 'SELECT * FROM '
176
- + from
177
- + ' WHERE url="' + (url) + '"'
178
- + " and " + (/html/.test(from) ? 'xpath' : 'itemPath') + "='" + (embedProvider.yql.xpath || '/')+"'" ;
179
- if(from=='html') query += " and compat='html5'";
180
- var ajaxopts = $.extend({
181
- url: "http://query.yahooapis.com/v1/public/yql",
182
- dataType: 'jsonp',
183
- data: {
184
- q: query,
185
- format: "json",
186
- env: 'store://datatables.org/alltableswithkeys',
187
- callback: "?"
188
- },
189
- success: function(data) {
190
- var result;
191
- if(embedProvider.yql.xpath && embedProvider.yql.xpath=='//meta|//title|//link'){
192
- var meta={};
193
- if (data.query.results == null) {
194
- data.query.results = {"meta": []};
195
- }
196
- for(var i=0, l=data.query.results.meta.length; i<l; i++){
197
- var name = data.query.results.meta[i].name||data.query.results.meta[i].property||null;
198
- if(name==null)continue;
199
- meta[name.toLowerCase()]=data.query.results.meta[i].content;
200
- }
201
- if (!meta.hasOwnProperty("title") || !meta.hasOwnProperty("og:title") ) {
202
- if ( data.query.results.title != null ) {
203
- meta.title = data.query.results.title;
204
- }
205
- }
206
- if (!meta.hasOwnProperty("og:image") && data.query.results.hasOwnProperty("link")) {
207
- for ( var i=0, l=data.query.results.link.length; i<l; i++){
208
- if ( data.query.results.link[i].hasOwnProperty("rel") ) {
209
- if (data.query.results.link[i].rel == "apple-touch-icon") {
210
- if ( data.query.results.link[i].href.charAt(0) == "/" ) {
211
- meta["og:image"] = url.match(/^(([a-z]+:)?(\/\/)?[^\/]+\/).*$/)[1] + data.query.results.link[i].href;
212
- } else {
213
- meta["og:image"] = data.query.results.link[i].href;
214
- }
215
- }
216
- }
217
- }
218
- }
219
- result = embedProvider.yql.datareturn(meta);
220
- }else{
221
- result = embedProvider.yql.datareturn ? embedProvider.yql.datareturn(data.query.results) : data.query.results.result;
222
- }
223
- if(result===false)return;
224
- var oembedData = $.extend({}, result);
225
- oembedData.code = result;
187
+ if ($('#jqoembeddata').data(externalUrl) != undefined && embedProvider.embedtag.tag != 'iframe') {
188
+ var oembedData = {code: $('#jqoembeddata').data(externalUrl)};
226
189
  success(oembedData, externalUrl, container);
227
- },
228
- error: settings.onError.call(container, externalUrl, embedProvider)
229
- }, settings.ajaxOptions || {});
230
-
231
- $.ajax(ajaxopts);
232
- }else if (embedProvider.templateRegex) {
233
- if(embedProvider.embedtag.tag!==''){
234
- var flashvars = embedProvider.embedtag.flashvars || '';
235
- var tag = embedProvider.embedtag.tag || 'embed';
236
- var width = embedProvider.embedtag.width || 'auto';
237
- var nocache = embedProvider.embedtag.nocache || 0;
238
- var height = embedProvider.embedtag.height || 'auto';
239
- var src =externalUrl.replace(embedProvider.templateRegex,embedProvider.apiendpoint);
240
- if(!embedProvider.nocache) src += '&jqoemcache='+rand(5);
241
- if (embedProvider.apikey) src = src.replace('_APIKEY_', settings.apikeys[embedProvider.name]);
242
-
243
-
244
- var code = $('<'+tag+'/>')
245
- .attr('src',src)
246
- .attr('width',width)
247
- .attr('height',height)
248
- .attr('allowfullscreen',embedProvider.embedtag.allowfullscreen || 'true')
249
- .attr('allowscriptaccess',embedProvider.embedtag.allowfullscreen || 'always')
250
- .css('max-height', settings.maxHeight || 'auto' )
251
- .css('max-width', settings.maxWidth || 'auto' );
252
- if(tag=='embed')
253
- code
254
- .attr('type',embedProvider.embedtag.type || "application/x-shockwave-flash")
255
- .attr('flashvars',externalUrl.replace(embedProvider.templateRegex,flashvars));
256
- if(tag=='iframe')
257
- code
258
- .attr('scrolling',embedProvider.embedtag.scrolling || "no")
259
- .attr('frameborder',embedProvider.embedtag.frameborder || "0");
260
-
261
-
262
- var oembedData = {code: code};
263
- success(oembedData, externalUrl,container);
264
- }else if (embedProvider.apiendpoint) {
265
- //Add APIkey if true
266
- if (embedProvider.apikey) embedProvider.apiendpoint = embedProvider.apiendpoint.replace('_APIKEY_', settings.apikeys[embedProvider.name]);
267
- ajaxopts = $.extend({
268
- url: externalUrl.replace(embedProvider.templateRegex, embedProvider.apiendpoint),
269
- dataType: 'jsonp',
270
- success: function(data) {
271
- var oembedData = $.extend({}, data);
272
- oembedData.code = embedProvider.templateData(data);
273
- success(oembedData, externalUrl, container);
274
- },
275
- error: settings.onError.call(container, externalUrl, embedProvider)
190
+ } else if (embedProvider.yql) {
191
+ var from = embedProvider.yql.from || 'htmlstring';
192
+ var url = embedProvider.yql.url ? embedProvider.yql.url(externalUrl) : externalUrl;
193
+ var query = 'SELECT * FROM ' + from
194
+ + ' WHERE url="' + (url) + '"'
195
+ + " and " + (/html/.test(from) ? 'xpath' : 'itemPath') + "='" + (embedProvider.yql.xpath || '/') + "'";
196
+ if (from == 'html')
197
+ query += " and compat='html5'";
198
+ var ajaxopts = $.extend({
199
+ url: "//query.yahooapis.com/v1/public/yql",
200
+ dataType: 'jsonp',
201
+ data: {
202
+ q: query,
203
+ format: "json",
204
+ env: 'store://datatables.org/alltableswithkeys',
205
+ callback: "?"
206
+ },
207
+ success: function (data) {
208
+ var result;
209
+
210
+ if (embedProvider.yql.xpath && embedProvider.yql.xpath == '//meta|//title|//link') {
211
+ var meta = {};
212
+
213
+ if (data.query == null) {
214
+ data.query = {};
215
+ }
216
+ if (data.query.results == null) {
217
+ data.query.results = {"meta": []};
218
+ }
219
+ for (var i = 0, l = data.query.results.meta.length; i < l; i++) {
220
+ var name = data.query.results.meta[i].name || data.query.results.meta[i].property || null;
221
+ if (name == null)continue;
222
+ meta[name.toLowerCase()] = data.query.results.meta[i].content;
223
+ }
224
+ if (!meta.hasOwnProperty("title") || !meta.hasOwnProperty("og:title")) {
225
+ if (data.query.results.title != null) {
226
+ meta.title = data.query.results.title;
227
+ }
228
+ }
229
+ if (!meta.hasOwnProperty("og:image") && data.query.results.hasOwnProperty("link")) {
230
+ for (var i = 0, l = data.query.results.link.length; i < l; i++) {
231
+ if (data.query.results.link[i].hasOwnProperty("rel")) {
232
+ if (data.query.results.link[i].rel == "apple-touch-icon") {
233
+ if (data.query.results.link[i].href.charAt(0) == "/") {
234
+ meta["og:image"] = url.match(/^(([a-z]+:)?(\/\/)?[^\/]+\/).*$/)[1] + data.query.results.link[i].href;
235
+ } else {
236
+ meta["og:image"] = data.query.results.link[i].href;
237
+ }
238
+ }
239
+ }
240
+ }
241
+ }
242
+ result = embedProvider.yql.datareturn(meta);
243
+ } else {
244
+ result = embedProvider.yql.datareturn ? embedProvider.yql.datareturn(data.query.results) : data.query.results.result;
245
+ }
246
+ if (result === false)return;
247
+ var oembedData = $.extend({}, result);
248
+ oembedData.code = result;
249
+ success(oembedData, externalUrl, container);
250
+ },
251
+ error: settings.onError.call(container, externalUrl, embedProvider)
276
252
  }, settings.ajaxOptions || {});
277
-
278
- $.ajax( ajaxopts );
279
- }else {
280
- var oembedData = {code: externalUrl.replace(embedProvider.templateRegex,embedProvider.template)};
281
- success(oembedData, externalUrl,container);
282
- }
283
- } else {
253
+ $.ajax(ajaxopts);
254
+ } else if (embedProvider.templateRegex) {
255
+ if (embedProvider.embedtag.tag !== '') {
256
+ var flashvars = embedProvider.embedtag.flashvars || '';
257
+ var tag = embedProvider.embedtag.tag || 'embed';
258
+ var width = embedProvider.embedtag.width || 'auto';
259
+ var height = embedProvider.embedtag.height || 'auto';
260
+ var src = externalUrl.replace(embedProvider.templateRegex, embedProvider.apiendpoint);
261
+
262
+ if (!embedProvider.nocache) {
263
+ src += '&jqoemcache=' + rand(5);
264
+ }
265
+
266
+ if (embedProvider.apikey) {
267
+ src = src.replace('_APIKEY_', settings.apikeys[embedProvider.name]);
268
+ }
269
+
270
+ var code = $('<' + tag + '/>').attr('src', src).attr('width', width)
271
+ .attr('height', height)
272
+ .attr('allowfullscreen', embedProvider.embedtag.allowfullscreen || 'true')
273
+ .attr('allowscriptaccess', embedProvider.embedtag.allowfullscreen || 'always')
274
+ .css('max-height', settings.maxHeight || 'auto')
275
+ .css('max-width', settings.maxWidth || 'auto');
276
+
277
+ if (tag == 'embed') {
278
+ code.attr('type', embedProvider.embedtag.type || "application/x-shockwave-flash")
279
+ .attr('flashvars', externalUrl.replace(embedProvider.templateRegex, flashvars));
280
+ }
284
281
 
285
- var requestUrl = getRequestUrl(embedProvider, externalUrl),
282
+ if (tag == 'iframe') {
283
+ code.attr('scrolling', embedProvider.embedtag.scrolling || "no")
284
+ .attr('frameborder', embedProvider.embedtag.frameborder || "0");
285
+
286
+ }
287
+
288
+ success({code: code}, externalUrl, container);
289
+ } else if (embedProvider.apiendpoint) {
290
+ //Add APIkey if true
291
+ if (embedProvider.apikey)
292
+ embedProvider.apiendpoint = embedProvider.apiendpoint.replace('_APIKEY_', settings.apikeys[embedProvider.name]);
293
+
294
+ ajaxopts = $.extend({
295
+ url: externalUrl.replace(embedProvider.templateRegex, embedProvider.apiendpoint),
296
+ dataType: 'jsonp',
297
+ success: function (data) {
298
+ var oembedData = $.extend({}, data);
299
+ oembedData.code = embedProvider.templateData(data);
300
+ success(oembedData, externalUrl, container);
301
+ },
302
+ error: settings.onError.call(container, externalUrl, embedProvider)
303
+ }, settings.ajaxOptions || {});
304
+ $.ajax(ajaxopts);
305
+ } else {
306
+ success({code: externalUrl.replace(embedProvider.templateRegex, embedProvider.template)}, externalUrl, container);
307
+ }
308
+ } else {
309
+
310
+ var requestUrl = getRequestUrl(embedProvider, externalUrl);
286
311
  ajaxopts = $.extend({
287
312
  url: requestUrl,
288
313
  dataType: embedProvider.dataType || 'jsonp',
289
- success: function(data) {
314
+ success: function (data) {
290
315
  var oembedData = $.extend({}, data);
291
316
  switch (oembedData.type) {
292
- case "file": //Deviant Art has this
293
- case "photo":
294
- oembedData.code = $.fn.oembed.getPhotoCode(externalUrl, oembedData);
295
- break;
296
- case "video":
297
- case "rich":
298
- oembedData.code = $.fn.oembed.getRichCode(externalUrl, oembedData);
299
- break;
300
- default:
301
- oembedData.code = $.fn.oembed.getGenericCode(externalUrl, oembedData);
302
- break;
317
+ case "file": //Deviant Art has this
318
+ case "photo":
319
+ oembedData.code = $.fn.oembed.getPhotoCode(externalUrl, oembedData);
320
+ break;
321
+ case "video":
322
+ case "rich":
323
+ oembedData.code = $.fn.oembed.getRichCode(externalUrl, oembedData);
324
+ break;
325
+ default:
326
+ oembedData.code = $.fn.oembed.getGenericCode(externalUrl, oembedData);
327
+ break;
303
328
  }
304
329
  success(oembedData, externalUrl, container);
305
330
  },
306
331
  error: settings.onError.call(container, externalUrl, embedProvider)
307
332
  }, settings.ajaxOptions || {});
308
-
309
- $.ajax(ajaxopts);
310
- }
311
- };
333
+ $.ajax(ajaxopts);
334
+ }
335
+ }
312
336
 
313
337
  function getNormalizedParams(params) {
314
338
  if (params === null) return null;
@@ -320,140 +344,166 @@
320
344
  }
321
345
 
322
346
  /* Public functions */
323
- $.fn.oembed.insertCode = function(container, embedMethod, oembedData) {
324
- if (oembedData === null) return;
325
- if(embedMethod=='auto' && container.attr("href") !== null) embedMethod='append';
326
- else if(embedMethod=='auto') embedMethod='replace';
347
+ $.fn.oembed.insertCode = function (container, embedMethod, oembedData) {
348
+ if (oembedData === null)
349
+ return;
350
+
351
+ if (embedMethod === 'auto' && container.attr('href') !== null) {
352
+ embedMethod = 'append';
353
+ } else if (embedMethod == 'auto') {
354
+ embedMethod = 'replace';
355
+ }
356
+
327
357
  switch (embedMethod) {
328
- case "replace":
329
- container.replaceWith(oembedData.code);
330
- break;
331
- case "fill":
332
- container.html(oembedData.code);
333
- break;
334
- case "append":
335
- container.wrap('<div class="oembedall-container"></div>');
336
- var oembedContainer = container.parent();
337
- if (settings.includeHandle) {
338
- $('<span class="oembedall-closehide">&darr;</span>').insertBefore(container).click(function() {
339
- var encodedString = encodeURIComponent($(this).text());
340
- $(this).html((encodedString == '%E2%86%91') ? '&darr;' : '&uarr;');
341
- $(this).parent().children().last().toggle();
342
- });
343
- }
344
- oembedContainer.append('<br/>');
345
- try {
346
- oembedData.code.clone().appendTo(oembedContainer);
347
- } catch(e) {
348
- oembedContainer.append(oembedData.code);
349
- }
350
- /* Make videos semi-responsive
351
- * If parent div width less than embeded iframe video then iframe gets shrunk to fit smaller width
352
- * If parent div width greater thans embed iframe use the max widht
353
- * - works on youtubes and vimeo
354
- */
355
- if(settings.maxWidth){
356
- var post_width = oembedContainer.parent().width();
357
- if(post_width < settings.maxWidth)
358
- {
359
- var iframe_width_orig = $('iframe',oembedContainer).width();
360
- var iframe_height_orig = $('iframe',oembedContainer).height();
361
- var ratio = iframe_width_orig / post_width;
362
- $('iframe',oembedContainer).width(iframe_width_orig / ratio);
363
- $('iframe',oembedContainer).height(iframe_height_orig / ratio);
364
- } else {
365
- if(settings.maxWidth){
366
- $('iframe',oembedContainer).width(settings.maxWidth);
367
- }
368
- if(settings.maxHeight){
369
- $('iframe',oembedContainer).height(settings.maxHeight);
370
- }
371
- }
372
- }
373
- break;
358
+ case "replace":
359
+ container.replaceWith(oembedData.code);
360
+ break;
361
+ case "fill":
362
+ container.html(oembedData.code);
363
+ break;
364
+ case "append":
365
+ container.wrap('<div class="oembedall-container"></div>');
366
+ var oembedContainer = container.parent();
367
+ if (settings.includeHandle) {
368
+ $('<span class="oembedall-closehide">&darr;</span>').insertBefore(container).click(function () {
369
+ var encodedString = encodeURIComponent($(this).text());
370
+ $(this).html((encodedString == '%E2%86%91') ? '&darr;' : '&uarr;');
371
+ $(this).parent().children().last().toggle();
372
+ });
373
+ }
374
+ oembedContainer.append('<br/>');
375
+ try {
376
+ oembedData.code.clone().appendTo(oembedContainer);
377
+ } catch (e) {
378
+ oembedContainer.append(oembedData.code);
379
+ }
380
+ /* Make videos semi-responsive
381
+ * If parent div width less than embeded iframe video then iframe gets shrunk to fit smaller width
382
+ * If parent div width greater thans embed iframe use the max widht
383
+ * - works on youtubes and vimeo
384
+ */
385
+ if (settings.maxWidth) {
386
+ var post_width = oembedContainer.parent().width();
387
+ if (post_width < settings.maxWidth) {
388
+ var iframe_width_orig = $('iframe', oembedContainer).width();
389
+ var iframe_height_orig = $('iframe', oembedContainer).height();
390
+ var ratio = iframe_width_orig / post_width;
391
+ $('iframe', oembedContainer).width(iframe_width_orig / ratio);
392
+ $('iframe', oembedContainer).height(iframe_height_orig / ratio);
393
+ } else {
394
+ if (settings.maxWidth) {
395
+ $('iframe', oembedContainer).width(settings.maxWidth);
396
+ }
397
+ if (settings.maxHeight) {
398
+ $('iframe', oembedContainer).height(settings.maxHeight);
399
+ }
400
+ }
401
+ }
402
+ break;
374
403
  }
375
404
  };
376
405
 
377
- $.fn.oembed.getPhotoCode = function(url, oembedData) {
378
- var code, alt = oembedData.title ? oembedData.title : '';
406
+ $.fn.oembed.getPhotoCode = function (url, oembedData) {
407
+ var code;
408
+ var alt = oembedData.title ? oembedData.title : '';
379
409
  alt += oembedData.author_name ? ' - ' + oembedData.author_name : '';
380
410
  alt += oembedData.provider_name ? ' - ' + oembedData.provider_name : '';
381
- if (oembedData.url){
411
+
412
+ if (oembedData.url) {
382
413
  code = '<div><a href="' + url + '" target=\'_blank\'><img src="' + oembedData.url + '" alt="' + alt + '"/></a></div>';
383
- } else if (oembedData.thumbnail_url){
384
- var newURL = oembedData.thumbnail_url.replace('_s','_b');
414
+ } else if (oembedData.thumbnail_url) {
415
+ var newURL = oembedData.thumbnail_url.replace('_s', '_b');
385
416
  code = '<div><a href="' + url + '" target=\'_blank\'><img src="' + newURL + '" alt="' + alt + '"/></a></div>';
386
417
  } else {
387
418
  code = '<div>Error loading this picture</div>';
388
419
  }
389
- if (oembedData.html) code += "<div>" + oembedData.html + "</div>";
420
+
421
+ if (oembedData.html) {
422
+ code += "<div>" + oembedData.html + "</div>";
423
+ }
424
+
390
425
  return code;
391
426
  };
392
427
 
393
- $.fn.oembed.getRichCode = function(url, oembedData) {
394
- var code = oembedData.html;
395
- return code;
428
+ $.fn.oembed.getRichCode = function (url, oembedData) {
429
+ return oembedData.html;
396
430
  };
397
431
 
398
- $.fn.oembed.getGenericCode = function(url, oembedData) {
399
- var title = (oembedData.title !== null) ? oembedData.title : url,
400
- code = '<a href="' + url + '">' + title + '</a>';
401
- if (oembedData.html) code += "<div>" + oembedData.html + "</div>";
432
+ $.fn.oembed.getGenericCode = function (url, oembedData) {
433
+ var title = ((oembedData.title) && (oembedData.title !== null)) ? oembedData.title : url;
434
+ var code = '<a href="' + url + '">' + title + '</a>';
435
+
436
+ if (oembedData.html) {
437
+ code += "<div>" + oembedData.html + "</div>";
438
+ }
439
+
402
440
  return code;
403
441
  };
404
442
 
405
- $.fn.oembed.getOEmbedProvider = function(url) {
443
+ $.fn.oembed.getOEmbedProvider = function (url) {
406
444
  for (var i = 0; i < $.fn.oembed.providers.length; i++) {
407
- for (var j = 0, l =$.fn.oembed.providers[i].urlschemes.length; j < l; j++) {
445
+ for (var j = 0, l = $.fn.oembed.providers[i].urlschemes.length; j < l; j++) {
408
446
  var regExp = new RegExp($.fn.oembed.providers[i].urlschemes[j], "i");
409
- if (url.match(regExp) !== null) return $.fn.oembed.providers[i];
447
+
448
+ if (url.match(regExp) !== null)
449
+ return $.fn.oembed.providers[i];
410
450
  }
411
451
  }
412
452
  return null;
413
453
  };
414
454
 
415
- $.fn.oembed.OEmbedProvider = function(name, type, urlschemesarray, apiendpoint, extraSettings) {
455
+ // Constructor Function for OEmbedProvider Class.
456
+ $.fn.oembed.OEmbedProvider = function (name, type, urlschemesarray, apiendpoint, extraSettings) {
416
457
  this.name = name;
417
458
  this.type = type; // "photo", "video", "link", "rich", null
418
459
  this.urlschemes = urlschemesarray;
419
460
  this.apiendpoint = apiendpoint;
420
461
  this.maxWidth = 500;
421
462
  this.maxHeight = 400;
422
- extraSettings =extraSettings ||{};
423
-
424
- if(extraSettings.useYQL){
425
-
426
- if(extraSettings.useYQL=='xml'){
427
- extraSettings.yql = {xpath:"//oembed/html", from:'xml'
428
- , apiendpoint: this.apiendpoint
429
- , url: function(externalurl){return this.apiendpoint+'?format=xml&url='+externalurl}
430
- , datareturn:function(results){return results.html.replace(/.*\[CDATA\[(.*)\]\]>$/,'$1') || ''}
431
- };
432
- }else{
433
- extraSettings.yql = {from:'json'
434
- , apiendpoint: this.apiendpoint
435
- , url: function(externalurl){return this.apiendpoint+'?format=json&url='+externalurl}
436
- , datareturn:function(results){
437
- if (results.json.type != 'video' && (results.json.url || results.json.thumbnail_url)) {
438
- return '<img src="' + (results.json.url || results.json.thumbnail_url) + '" />';
439
- }
440
- return results.json.html || ''
441
- }
442
- };
443
- }
444
- this.apiendpoint = null;
463
+ extraSettings = extraSettings || {};
464
+
465
+ if (extraSettings.useYQL) {
466
+
467
+ if (extraSettings.useYQL == 'xml') {
468
+ extraSettings.yql = {
469
+ xpath: "//oembed/html",
470
+ from: 'xml',
471
+ apiendpoint: this.apiendpoint,
472
+ url: function (externalurl) {
473
+ return this.apiendpoint + '?format=xml&url=' + externalurl
474
+ },
475
+ datareturn: function (results) {
476
+ return results.html.replace(/.*\[CDATA\[(.*)\]\]>$/, '$1') || ''
477
+ }
478
+ };
479
+ } else {
480
+ extraSettings.yql = {
481
+ from: 'json',
482
+ apiendpoint: this.apiendpoint,
483
+ url: function (externalurl) {
484
+ return this.apiendpoint + '?format=json&url=' + externalurl
485
+ },
486
+ datareturn: function (results) {
487
+ if (results.json.type != 'video' && (results.json.url || results.json.thumbnail_url)) {
488
+ return '<img src="' + (results.json.url || results.json.thumbnail_url) + '" />';
489
+ }
490
+ return results.json.html || ''
491
+ }
492
+ };
493
+ }
494
+ this.apiendpoint = null;
445
495
  }
446
-
447
-
496
+
497
+
448
498
  for (var property in extraSettings) {
449
- this[property] = extraSettings[property];
499
+ this[property] = extraSettings[property];
450
500
  }
451
-
501
+
452
502
  this.format = this.format || 'json';
453
503
  this.callbackparameter = this.callbackparameter || "callback";
454
- this.embedtag = this.embedtag || {tag:""};
504
+ this.embedtag = this.embedtag || {tag: ""};
505
+
455
506
 
456
-
457
507
  };
458
508
 
459
509
  /*
@@ -465,7 +515,7 @@
465
515
  * @param {String} apiendpoint The endpoint of the provider
466
516
  * @param {String} extraSettings Extra settings of the provider
467
517
  */
468
- $.fn.updateOEmbedProvider = function(name, type, urlschemesarray, apiendpoint, extraSettings) {
518
+ $.fn.updateOEmbedProvider = function (name, type, urlschemesarray, apiendpoint, extraSettings) {
469
519
  for (var i = 0; i < $.fn.oembed.providers.length; i++) {
470
520
  if ($.fn.oembed.providers[i].name === name) {
471
521
  if (type !== null) {
@@ -491,355 +541,468 @@
491
541
 
492
542
  /* Native & common providers */
493
543
  $.fn.oembed.providers = [
494
-
495
- //Video
496
- new $.fn.oembed.OEmbedProvider("youtube", "video", ["youtube\\.com/watch.+v=[\\w-]+&?", "youtu\\.be/[\\w-]+","youtube.com/embed"], 'http://www.youtube.com/embed/$1?wmode=transparent', {
497
- templateRegex: /.*(?:v\=|be\/|embed\/)([\w\-]+)&?.*/,embedtag: {tag: 'iframe',width: '425',height: '349'}
498
- }),
499
-
500
- //new $.fn.oembed.OEmbedProvider("youtube", "video", ["youtube\\.com/watch.+v=[\\w-]+&?", "youtu\\.be/[\\w-]+"], 'http://www.youtube.com/oembed', {useYQL:'json'}),
501
- //new $.fn.oembed.OEmbedProvider("youtubeiframe", "video", ["youtube.com/embed"], "$1?wmode=transparent",
502
- // {templateRegex:/(.*)/,embedtag : {tag: 'iframe', width:'425',height: '349'}}),
503
- new $.fn.oembed.OEmbedProvider("wistia", "video", ["wistia.com/m/.+", "wistia.com/embed/.+","wi.st/m/.+","wi.st/embed/.+"], 'http://fast.wistia.com/oembed', {useYQL:'json'}),
504
- new $.fn.oembed.OEmbedProvider("xtranormal", "video", ["xtranormal\\.com/watch/.+"], "http://www.xtranormal.com/xtraplayr/$1/$2", {
505
- templateRegex: /.*com\/watch\/([\w\-]+)\/([\w\-]+).*/,embedtag: {tag: 'iframe',width: '320',height: '269'}}),
506
- new $.fn.oembed.OEmbedProvider("scivee", "video", ["scivee.tv/node/.+"], "http://www.scivee.tv/flash/embedCast.swf?", {
507
- templateRegex: /.*tv\/node\/(.+)/,embedtag: {width: '480',height: '400',flashvars:"id=$1&type=3"}}),
508
- new $.fn.oembed.OEmbedProvider("veoh", "video", ["veoh.com/watch/.+"], "http://www.veoh.com/swf/webplayer/WebPlayer.swf?version=AFrontend.5.7.0.1337&permalinkId=$1&player=videodetailsembedded&videoAutoPlay=0&id=anonymous", {
509
- templateRegex: /.*watch\/([^\?]+).*/,embedtag: {width: '410',height: '341'}}),
510
- new $.fn.oembed.OEmbedProvider("gametrailers", "video", ["gametrailers\\.com/video/.+"], "http://media.mtvnservices.com/mgid:moses:video:gametrailers.com:$2", {
511
- templateRegex: /.*com\/video\/([\w\-]+)\/([\w\-]+).*/,embedtag: {width: '512',height: '288' }}),
512
- new $.fn.oembed.OEmbedProvider("funnyordie", "video", ["funnyordie\\.com/videos/.+"], "http://player.ordienetworks.com/flash/fodplayer.swf?", {
513
- templateRegex: /.*videos\/([^\/]+)\/([^\/]+)?/,embedtag: {width: 512,height: 328,flashvars: "key=$1"}}),
514
- new $.fn.oembed.OEmbedProvider("colledgehumour", "video", ["collegehumor\\.com/video/.+"],"http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=$1&use_node_id=true&fullscreen=1",
515
- {templateRegex:/.*video\/([^\/]+).*/ , embedtag : {width:600,height: 338}}),
516
- new $.fn.oembed.OEmbedProvider("metacafe", "video", ["metacafe\\.com/watch/.+"],"http://www.metacafe.com/fplayer/$1/$2.swf",
517
- {templateRegex:/.*watch\/(\d+)\/(\w+)\/.*/ , embedtag : {width:400,height: 345}}),
518
- new $.fn.oembed.OEmbedProvider("bambuser", "video", ["bambuser\\.com\/channel\/.*\/broadcast\/.*"],"http://static.bambuser.com/r/player.swf?vid=$1",
519
- {templateRegex:/.*bambuser\.com\/channel\/.*\/broadcast\/(\w+).*/ , embedtag : {width:512,height: 339 }}),
520
- new $.fn.oembed.OEmbedProvider("twitvid", "video", ["twitvid\\.com/.+"],"http://www.twitvid.com/embed.php?guid=$1&autoplay=0",
521
- {templateRegex:/.*twitvid\.com\/(\w+).*/ , embedtag : {tag:'iframe',width:480,height: 360 }}),
522
-
523
- new $.fn.oembed.OEmbedProvider("aniboom", "video", ["aniboom\\.com/animation-video/.+"],"http://api.aniboom.com/e/$1",
524
- {templateRegex:/.*animation-video\/(\d+).*/ , embedtag : {width:594,height: 334}}),
525
-
526
- new $.fn.oembed.OEmbedProvider("vzaar", "video", ["vzaar\\.com/videos/.+","vzaar.tv/.+"],"http://view.vzaar.com/$1/player?",
527
- {templateRegex:/.*\/(\d+).*/, embedtag : {tag:'iframe',width:576,height: 324 }}),
528
- new $.fn.oembed.OEmbedProvider("snotr", "video", ["snotr\\.com/video/.+"],"http://www.snotr.com/embed/$1",
529
- {templateRegex:/.*\/(\d+).*/, embedtag : {tag:'iframe',width:400,height: 330, nocache:1 }}),
530
-
531
- new $.fn.oembed.OEmbedProvider("youku", "video", ["v.youku.com/v_show/id_.+"],"http://player.youku.com/player.php/sid/$1/v.swf",
532
- {templateRegex:/.*id_(.+)\.html.*/, embedtag : {width:480,height:400, nocache:1 }}),
533
- new $.fn.oembed.OEmbedProvider("tudou", "video", ["tudou.com/programs/view/.+\/"],"http://www.tudou.com/v/$1/v.swf",
534
- {templateRegex:/.*view\/(.+)\//, embedtag : {width:480,height:400, nocache:1 }}),
535
-
536
- new $.fn.oembed.OEmbedProvider("embedr", "video", ["embedr\\.com/playlist/.+"],"http://embedr.com/swf/slider/$1/425/520/default/false/std?",
537
- {templateRegex:/.*playlist\/([^\/]+).*/, embedtag : {width:425,height: 520}}),
538
- new $.fn.oembed.OEmbedProvider("blip", "video", ["blip\\.tv/.+"], "http://blip.tv/oembed/"),
539
- new $.fn.oembed.OEmbedProvider("minoto-video", "video", ["http://api.minoto-video.com/publishers/.+/videos/.+","http://dashboard.minoto-video.com/main/video/details/.+","http://embed.minoto-video.com/.+"], "http://api.minoto-video.com/services/oembed.json",{useYQL:'json'}),
540
- new $.fn.oembed.OEmbedProvider("animoto", "video", ["animoto.com/play/.+"], "http://animoto.com/services/oembed"),
541
- new $.fn.oembed.OEmbedProvider("hulu", "video", ["hulu\\.com/watch/.*"], "http://www.hulu.com/api/oembed.json"),
542
- new $.fn.oembed.OEmbedProvider("ustream", "video", ["ustream\\.tv/recorded/.*"], "http://www.ustream.tv/oembed",{useYQL:'json'}),
543
- new $.fn.oembed.OEmbedProvider("videojug", "video", ["videojug\\.com/(film|payer|interview).*"], "http://www.videojug.com/oembed.json",{useYQL:'json'}),
544
- new $.fn.oembed.OEmbedProvider("sapo", "video", ["videos\\.sapo\\.pt/.*"], "http://videos.sapo.pt/oembed",{useYQL:'json'}),
545
- new $.fn.oembed.OEmbedProvider("vodpod", "video", ["vodpod.com/watch/.*"], "http://vodpod.com/oembed.js",{useYQL:'json'}),
546
- new $.fn.oembed.OEmbedProvider("vimeo", "video", ["www\.vimeo\.com\/groups\/.*\/videos\/.*", "www\.vimeo\.com\/.*", "vimeo\.com\/groups\/.*\/videos\/.*", "vimeo\.com\/.*"], "//vimeo.com/api/oembed.json"),
547
- new $.fn.oembed.OEmbedProvider("dailymotion", "video", ["dailymotion\\.com/.+"],'http://www.dailymotion.com/services/oembed'),
548
- new $.fn.oembed.OEmbedProvider("5min", "video", ["www\\.5min\\.com/.+"], 'http://api.5min.com/oembed.xml',{useYQL:'xml'}),
549
- new $.fn.oembed.OEmbedProvider("National Film Board of Canada", "video", ["nfb\\.ca/film/.+"],'http://www.nfb.ca/remote/services/oembed/',{useYQL:'json'}),
550
- new $.fn.oembed.OEmbedProvider("qik", "video", ["qik\\.com/\\w+"], 'http://qik.com/api/oembed.json',{useYQL:'json'}),
551
- new $.fn.oembed.OEmbedProvider("revision3", "video", ["revision3\\.com"], "http://revision3.com/api/oembed/"),
552
- new $.fn.oembed.OEmbedProvider("dotsub", "video", ["dotsub\\.com/view/.+"], "http://dotsub.com/services/oembed",{useYQL:'json'}),
553
- new $.fn.oembed.OEmbedProvider("clikthrough", "video", ["clikthrough\\.com/theater/video/\\d+"], "http://clikthrough.com/services/oembed"),
554
- new $.fn.oembed.OEmbedProvider("Kinomap", "video", ["kinomap\\.com/.+"], "http://www.kinomap.com/oembed"),
555
- new $.fn.oembed.OEmbedProvider("VHX", "video", ["vhx.tv/.+"], "http://vhx.tv/services/oembed.json"),
556
- new $.fn.oembed.OEmbedProvider("bambuser", "video", ["bambuser.com/.+"], "http://api.bambuser.com/oembed/iframe.json"),
557
- new $.fn.oembed.OEmbedProvider("justin.tv", "video", ["justin.tv/.+"], 'http://api.justin.tv/api/embed/from_url.json',{useYQL:'json'}),
558
-
559
-
560
- //Audio
561
- new $.fn.oembed.OEmbedProvider("official.fm", "rich", ["official.fm/.+"], 'http://official.fm/services/oembed',{useYQL:'json'}),
562
- new $.fn.oembed.OEmbedProvider("chirbit", "rich", ["chirb.it/.+"], 'http://chirb.it/oembed.json',{useYQL:'json'}),
563
- new $.fn.oembed.OEmbedProvider("Huffduffer", "rich", ["huffduffer.com/[-.\\w@]+/\\d+"], "http://huffduffer.com/oembed"),
564
- new $.fn.oembed.OEmbedProvider("Spotify", "rich", ["open.spotify.com/(track|album|user)/"], "https://embed.spotify.com/oembed/"),
565
- new $.fn.oembed.OEmbedProvider("shoudio", "rich", ["shoudio.com/.+","shoud.io/.+"], "http://shoudio.com/api/oembed"),
566
- new $.fn.oembed.OEmbedProvider("mixcloud", "rich", ["mixcloud.com/.+"],'http://www.mixcloud.com/oembed/',{useYQL:'json'}),
567
- new $.fn.oembed.OEmbedProvider("rdio.com", "rich", ["rd.io/.+","rdio.com"], "http://www.rdio.com/api/oembed/"),
568
- new $.fn.oembed.OEmbedProvider("Soundcloud", "rich", ["soundcloud.com/.+","snd.sc/.+"], "http://soundcloud.com/oembed",{format:'js'}),
569
- new $.fn.oembed.OEmbedProvider("bandcamp", "rich", ["bandcamp\\.com/album/.+"], null,
570
- {yql:{xpath:"//meta[contains(@content, \\'EmbeddedPlayer\\')]", from:'html'
571
- , datareturn:function(results){
572
- return results.meta ?'<iframe width="400" height="100" src="'+results.meta.content+'" allowtransparency="true" frameborder="0"></iframe>':false;
573
- }
574
- }
575
- }),
576
-
577
- //Photo
578
- new $.fn.oembed.OEmbedProvider("deviantart", "photo", ["deviantart.com/.+","fav.me/.+","deviantart.com/.+"], "http://backend.deviantart.com/oembed",{format:'jsonp'}),
579
- new $.fn.oembed.OEmbedProvider("skitch", "photo", ["skitch.com/.+"], null,
580
- {yql:{xpath:"json", from:'json'
581
- , url: function(externalurl){return 'http://skitch.com/oembed/?format=json&url='+externalurl}
582
- , datareturn:function(data){return $.fn.oembed.getPhotoCode( data.json.url, data.json);}
583
- }
584
- }),
585
- new $.fn.oembed.OEmbedProvider("mobypicture", "photo", ["mobypicture.com/user/.+/view/.+","moby.to/.+"], "http://api.mobypicture.com/oEmbed"),
586
- new $.fn.oembed.OEmbedProvider("flickr", "photo", ["flickr\\.com/photos/.+"], "http://flickr.com/services/oembed",{callbackparameter:'jsoncallback'}),
587
- new $.fn.oembed.OEmbedProvider("photobucket", "photo", ["photobucket\\.com/(albums|groups)/.+"], "http://photobucket.com/oembed/"),
588
- new $.fn.oembed.OEmbedProvider("instagram", "photo", ["instagr\\.?am(\\.com)?/.+"], "http://api.instagram.com/oembed"),
589
- //new $.fn.oembed.OEmbedProvider("yfrog", "photo", ["yfrog\\.(com|ru|com\\.tr|it|fr|co\\.il|co\\.uk|com\\.pl|pl|eu|us)/.+"], "http://www.yfrog.com/api/oembed",{useYQL:"json"}),
590
- new $.fn.oembed.OEmbedProvider("SmugMug", "photo", ["smugmug.com/[-.\\w@]+/.+"], "http://api.smugmug.com/services/oembed/"),
591
-
592
- new $.fn.oembed.OEmbedProvider("dribbble", "photo", ["dribbble.com/shots/.+"], "http://api.dribbble.com/shots/$1?callback=?",
593
- { templateRegex:/.*shots\/([\d]+).*/,
594
- templateData : function(data){if(!data.image_teaser_url)return false;
595
- return '<img src="'+data.image_teaser_url+'"/>';
596
- }
597
- }),
598
- new $.fn.oembed.OEmbedProvider("chart.ly", "photo", ["chart\\.ly/[a-z0-9]{6,8}"],"http://chart.ly/uploads/large_$1.png",
599
- {templateRegex:/.*ly\/([^\/]+).*/ , embedtag : {tag:'img'},nocache:1}),
600
- //new $.fn.oembed.OEmbedProvider("stocktwits.com", "photo", ["stocktwits\\.com/message/.+"], "http://charts.stocktwits.com/production/original_$1.png?",
601
- // { templateRegex: /.*message\/([^\/]+).*/, embedtag: { tag: 'img'},nocache:1 }),
602
- new $.fn.oembed.OEmbedProvider("circuitlab", "photo", ["circuitlab.com/circuit/.+"],"https://www.circuitlab.com/circuit/$1/screenshot/540x405/",
603
- {templateRegex:/.*circuit\/([^\/]+).*/ , embedtag : {tag:'img'},nocache:1}),
604
- new $.fn.oembed.OEmbedProvider("23hq", "photo", ["23hq.com/[-.\\w@]+/photo/.+"],"http://www.23hq.com/23/oembed",{useYQL:"json"}),
605
- new $.fn.oembed.OEmbedProvider("img.ly", "photo", ["img\\.ly/.+"],"http://img.ly/show/thumb/$1",
606
- {templateRegex:/.*ly\/([^\/]+).*/ , embedtag : {tag:'img'},nocache:1
607
- }),
608
- new $.fn.oembed.OEmbedProvider("twitgoo.com", "photo", ["twitgoo\\.com/.+"],"http://twitgoo.com/show/thumb/$1",
609
- {templateRegex:/.*com\/([^\/]+).*/ , embedtag : {tag:'img'},nocache:1}),
610
- new $.fn.oembed.OEmbedProvider("imgur.com", "photo", ["imgur\\.com/gallery/.+"],"http://imgur.com/$1l.jpg",
611
- {templateRegex:/.*gallery\/([^\/]+).*/ , embedtag : {tag:'img'},nocache:1}),
612
- new $.fn.oembed.OEmbedProvider("visual.ly", "rich", ["visual\\.ly/.+"], null,
613
- {yql:{xpath:"//a[@id=\\'gc_article_graphic_image\\']/img", from:'htmlstring'}
614
- }),
615
- new $.fn.oembed.OEmbedProvider("gravtar", "photo", ["mailto:.+"],null,
616
- {templateRegex:/mailto:([^\/]+).*/
617
- , template : function(wm,email){
618
- return '<img src="http://gravatar.com/avatar/'+email.md5()+'.jpg" alt="on Gravtar" class="jqoaImg">';
619
- }
620
- }),
621
-
622
- //Rich
623
- new $.fn.oembed.OEmbedProvider("twitter", "rich", ["twitter.com/.+"], "https://api.twitter.com/1/statuses/oembed.json"),
624
- new $.fn.oembed.OEmbedProvider("gmep", "rich", ["gmep.imeducate.com/.*","gmep.org/.*"], "http://gmep.org/oembed.json"),
625
- new $.fn.oembed.OEmbedProvider("urtak", "rich", ["urtak.com/(u|clr)/.+"], "http://oembed.urtak.com/1/oembed"),
626
- new $.fn.oembed.OEmbedProvider("cacoo", "rich", ["cacoo.com/.+"], "http://cacoo.com/oembed.json"),
627
- new $.fn.oembed.OEmbedProvider("dailymile", "rich", ["dailymile.com/people/.*/entries/.*"], "http://api.dailymile.com/oembed"),
628
- new $.fn.oembed.OEmbedProvider("dipity", "rich", ["dipity.com/timeline/.+"],'http://www.dipity.com/oembed/timeline/',{useYQL:'json'}),
629
- new $.fn.oembed.OEmbedProvider("sketchfab", "rich", ["sketchfab.com/show/.+"],'http://sketchfab.com/oembed',{useYQL:'json'}),
630
- new $.fn.oembed.OEmbedProvider("speakerdeck", "rich", ["speakerdeck.com/.+"],'http://speakerdeck.com/oembed.json',{useYQL:'json'}),
631
- new $.fn.oembed.OEmbedProvider("popplet", "rich", ["popplet.com/app/.*"],"http://popplet.com/app/Popplet_Alpha.swf?page_id=$1&em=1",
632
- {templateRegex:/.*#\/([^\/]+).*/,embedtag : {width:460,height: 460} }),
633
-
634
- new $.fn.oembed.OEmbedProvider("pearltrees", "rich", ["pearltrees.com/.*"],"http://cdn.pearltrees.com/s/embed/getApp?",
635
- {templateRegex:/.*N-f=1_(\d+).*N-p=(\d+).*/, embedtag : {width:460,height: 460,
636
- flashvars : "lang=en_US&amp;embedId=pt-embed-$1-693&amp;treeId=$1&amp;pearlId=$2&amp;treeTitle=Diagrams%2FVisualization&amp;site=www.pearltrees.com%2FF"}
637
- }),
638
-
639
- new $.fn.oembed.OEmbedProvider("prezi", "rich", ["prezi.com/.*"],"http://prezi.com/bin/preziloader.swf?",
640
- {templateRegex:/.*com\/([^\/]+)\/.*/,embedtag : {width:550,height: 400,
641
- flashvars : "prezi_id=$1&amp;lock_to_path=0&amp;color=ffffff&amp;autoplay=no&amp;autohide_ctrls=0"
642
- }
643
- }),
644
-
645
- new $.fn.oembed.OEmbedProvider("tourwrist", "rich", ["tourwrist.com/tours/.+"], null,
646
- { templateRegex:/.*tours.([\d]+).*/,
647
- template : function(wm,tourid){
648
- setTimeout(function(){if(loadEmbeds)loadEmbeds();},2000);
649
- return "<div id='"+tourid+"' class='tourwrist-tour-embed direct'></div> <script type='text/javascript' src='http://tourwrist.com/tour_embed.js'></script>";
650
- }
651
- }),
652
-
653
- new $.fn.oembed.OEmbedProvider("meetup", "rich", ["meetup\\.(com|ps)/.+"], "http://api.meetup.com/oembed"),
654
- new $.fn.oembed.OEmbedProvider("ebay", "rich", ["ebay\\.*"],"http://togo.ebay.com/togo/togo.swf?2008013100",
655
- {templateRegex:/.*\/([^\/]+)\/(\d{10,13}).*/, embedtag : {width:355,height: 300,
656
- flashvars : "base=http://togo.ebay.com/togo/&lang=en-us&mode=normal&itemid=$2&query=$1"
657
- }
658
- }),
659
- new $.fn.oembed.OEmbedProvider("wikipedia", "rich", ["wikipedia.org/wiki/.+"], "http://$1.wikipedia.org/w/api.php?action=parse&page=$2&format=json&section=0&callback=?",{
660
- templateRegex:/.*\/\/([\w]+).*\/wiki\/([^\/]+).*/,
661
- templateData : function(data){if(!data.parse)return false;
662
- var text = data.parse['text']['*'].replace(/href="\/wiki/g,'href="http://en.wikipedia.org/wiki');
663
- return '<div id="content"><h3><a class="nav-link" href="http://en.wikipedia.org/wiki/'+data.parse['displaytitle']+'">'+data.parse['displaytitle']+'</a></h3>'+text+'</div>';
664
- }
665
- }),
666
- new $.fn.oembed.OEmbedProvider("imdb", "rich", ["imdb.com/title/.+"], "http://www.imdbapi.com/?i=$1&callback=?",
667
- {templateRegex:/.*\/title\/([^\/]+).*/,
668
- templateData : function(data){if(!data.Title)return false;
669
- return '<div id="content"><h3><a class="nav-link" href="http://imdb.com/title/'+data.imdbID+'/">'+data.Title+'</a> ('+data.Year+')</h3><p>Rating: ' + data.imdbRating + '<br/>Genre: ' + data.Genre + '<br/>Starring: '+data.Actors+'</p></div> <div id="view-photo-caption">'+data.Plot+'</div></div>';
670
- }
671
- }),
672
- new $.fn.oembed.OEmbedProvider("livejournal", "rich", ["livejournal.com/"], "http://ljpic.seacrow.com/json/$2$4?jsonp=?"
673
- ,{templateRegex:/(http:\/\/(((?!users).)+)\.livejournal\.com|.*users\.livejournal\.com\/([^\/]+)).*/,
674
- templateData : function(data){if(!data.username)return false;
675
- return '<div><img src="'+data.image+'" align="left" style="margin-right: 1em;" /><span class="oembedall-ljuser"><a href="http://'+data.username+'.livejournal.com/profile"><img src="http://www.livejournal.com/img/userinfo.gif" alt="[info]" width="17" height="17" /></a><a href="http://'+data.username+'.livejournal.com/">'+data.username+'</a></span><br />'+data.name+'</div>';
676
- }
677
- }),
678
- new $.fn.oembed.OEmbedProvider("circuitbee", "rich", ["circuitbee\\.com/circuit/view/.+"],"http://c.circuitbee.com/build/r/schematic-embed.html?id=$1",
679
- {templateRegex:/.*circuit\/view\/(\d+).*/ ,embedtag : {tag: 'iframe', width:'500',height: '350'}
680
- }),
681
-
682
- new $.fn.oembed.OEmbedProvider("googlecalendar", "rich", ["www.google.com/calendar/embed?.+"],"$1",
683
- {templateRegex:/(.*)/ ,embedtag : {tag: 'iframe', width:'800',height: '600' }
684
- }),
685
- new $.fn.oembed.OEmbedProvider("jsfiddle", "rich", ["jsfiddle.net/[^/]+/?"],"http://jsfiddle.net/$1/embedded/result,js,resources,html,css/?",
686
- {templateRegex:/.*net\/([^\/]+).*/ ,embedtag : {tag: 'iframe', width:'100%',height: '300' }
687
- }),
688
- new $.fn.oembed.OEmbedProvider("jsbin", "rich", ["jsbin.com/.+"],"http://jsbin.com/$1/?",
689
- {templateRegex:/.*com\/([^\/]+).*/ ,embedtag : {tag: 'iframe', width:'100%',height: '300' }
690
- }),
691
-
692
- new $.fn.oembed.OEmbedProvider("jotform", "rich", ["form.jotform.co/form/.+"],"$1?",
693
- {templateRegex:/(.*)/ ,embedtag : {tag: 'iframe', width:'100%',height: '507' }
694
- }),
695
- new $.fn.oembed.OEmbedProvider("reelapp", "rich", ["reelapp\\.com/.+"],"http://www.reelapp.com/$1/embed",
696
- {templateRegex:/.*com\/(\S{6}).*/ ,embedtag : {tag: 'iframe', width:'400',height: '338'}
697
- }),
698
- new $.fn.oembed.OEmbedProvider("linkedin", "rich", ["linkedin.com/pub/.+"],"https://www.linkedin.com/cws/member/public_profile?public_profile_url=$1&format=inline&isFramed=true",
699
- {templateRegex:/(.*)/ ,embedtag : {tag: 'iframe', width:'368px',height: 'auto'}
700
- }),
701
-
702
- new $.fn.oembed.OEmbedProvider("timetoast", "rich", ["timetoast.com/timelines/[0-9]+"],"http://www.timetoast.com/flash/TimelineViewer.swf?passedTimelines=$1",
703
- {templateRegex:/.*timelines\/([0-9]*)/ ,embedtag : { width:550,height: 400,nocache:1}
704
- }),
705
- new $.fn.oembed.OEmbedProvider("pastebin", "rich", ["pastebin\\.com/[\\S]{8}"],"http://pastebin.com/embed_iframe.php?i=$1",
706
- {templateRegex:/.*\/(\S{8}).*/ ,embedtag : {tag: 'iframe', width:'100%',height: 'auto'}
707
- }),
708
- new $.fn.oembed.OEmbedProvider("mixlr", "rich", ["mixlr.com/.+"],"http://mixlr.com/embed/$1?autoplay=ae",
709
- {templateRegex:/.*com\/([^\/]+).*/ ,embedtag : {tag: 'iframe', width:'100%',height: 'auto' }
710
- }),
711
- new $.fn.oembed.OEmbedProvider("pastie", "rich", ["pastie\\.org/pastes/.+"],null,{yql:{xpath:'//pre[@class="textmate-source"]'}}),
712
- new $.fn.oembed.OEmbedProvider("github", "rich", ["gist.github.com/.+"], "https://github.com/api/oembed"),
713
- new $.fn.oembed.OEmbedProvider("github", "rich", ["github.com/[-.\\w@]+/[-.\\w@]+"], "https://api.github.com/repos/$1/$2?callback=?"
714
- ,{templateRegex:/.*\/([^\/]+)\/([^\/]+).*/,
715
- templateData : function(data){ if(!data.data.html_url)return false;
716
- return '<div class="oembedall-githubrepos"><ul class="oembedall-repo-stats"><li>'+data.data.language+'</li><li class="oembedall-watchers"><a title="Watchers" href="'+data.data.html_url+'/watchers">&#x25c9; '+data.data.watchers+'</a></li>'
717
- +'<li class="oembedall-forks"><a title="Forks" href="'+data.data.html_url+'/network">&#x0265; '+data.data.forks+'</a></li></ul><h3><a href="'+data.data.html_url+'">'+data.data.name+'</a></h3><div class="oembedall-body"><p class="oembedall-description">'+data.data.description+'</p>'
718
- +'<p class="oembedall-updated-at">Last updated: '+data.data.pushed_at+'</p></div></div>';
719
- }
720
- }),
721
-
722
- new $.fn.oembed.OEmbedProvider("facebook", "rich", ["facebook.com/(people/[^\\/]+/\\d+|[^\\/]+$)"], "https://graph.facebook.com/$2$3/?callback=?"
723
- ,{templateRegex:/.*facebook.com\/(people\/[^\/]+\/(\d+).*|([^\/]+$))/,
724
- templateData : function(data){ if(!data.id)return false;
725
- var out = '<div class="oembedall-facebook1"><div class="oembedall-facebook2"><a href="http://www.facebook.com/">facebook</a> ';
726
- if(data.from) out += '<a href="http://www.facebook.com/'+data.from.id+'">'+data.from.name+'</a>';
727
- else if(data.link) out += '<a href="'+data.link+'">'+data.name+'</a>';
728
- else if(data.username) out += '<a href="http://www.facebook.com/'+data.username+'">'+data.name+'</a>';
729
- else out += '<a href="http://www.facebook.com/'+data.id+'">'+data.name+'</a>';
730
- out += '</div><div class="oembedall-facebookBody"><div class="contents">';
731
- if(data.picture) out += '<a href="'+data.link+'"><img src="'+data.picture+'"></a>';
732
- else out += '<img src="https://graph.facebook.com/'+data.id+'/picture">';
733
- if(data.from) out += '<a href="'+data.link+'">'+data.name+'</a>';
734
- if(data.founded) out += 'Founded: <strong>'+data.founded+'</strong><br>'
735
- if(data.category) out += 'Category: <strong>'+data.category+'</strong><br>';
736
- if(data.website) out += 'Website: <strong><a href="'+data.website+'">'+data.website+'</a></strong><br>';
737
- if(data.gender) out += 'Gender: <strong>'+data.gender+'</strong><br>';
738
- if(data.description) out += data.description + '<br>';
739
- out += '</div></div>';
740
- return out;
741
- }
742
- }),
743
- new $.fn.oembed.OEmbedProvider("stackoverflow", "rich", ["stackoverflow.com/questions/[\\d]+"], "http://api.stackoverflow.com/1.1/questions/$1?body=true&jsonp=?"
744
- ,{templateRegex:/.*questions\/([\d]+).*/,
745
- templateData : function(data){
746
- if(!data.questions)return false;
747
- var q = data.questions[0];
748
- var body = $(q.body).text();
749
- var out = '<div class="oembedall-stoqembed"><div class="oembedall-statscontainer"><div class="oembedall-statsarrow"></div><div class="oembedall-stats"><div class="oembedall-vote"><div class="oembedall-votes">'
750
- +'<span class="oembedall-vote-count-post"><strong>'+ (q.up_vote_count - q.down_vote_count)+ '</strong></span><div class="oembedall-viewcount">vote(s)</div></div>'
751
- +'</div><div class="oembedall-status"><strong>'+q.answer_count+'</strong>answer</div></div><div class="oembedall-views">'+q.view_count+' view(s)</div></div>'
752
- +'<div class="oembedall-summary"><h3><a class="oembedall-question-hyperlink" href="http://stackoverflow.com/questions/'+q.question_id+'/">'+q.title+'</a></h3>'
753
- +'<div class="oembedall-excerpt">'+ body.substring(0,100)+'...</div><div class="oembedall-tags">';
754
- for(i in q.tags)
755
- out += '<a title="" class="oembedall-post-tag" href="http://stackoverflow.com/questions/tagged/'+q.tags[i]+'">'+q.tags[i]+'</a>';
756
- out += '</div><div class="oembedall-fr"><div class="oembedall-user-info"><div class="oembedall-user-gravatar32"><a href="http://stackoverflow.com/users/'+q.owner.user_id+'/'+q.owner.display_name+'">'
757
- +'<img width="32" height="32" alt="" src="http://www.gravatar.com/avatar/'+q.owner.email_hash+'?s=32&amp;d=identicon&amp;r=PG"></a></div><div class="oembedall-user-details">'
758
- +'<a href="http://stackoverflow.com/users/'+q.owner.user_id+'/'+q.owner.display_name+'">'+q.owner.display_name+'</a><br><span title="reputation score" class="oembedall-reputation-score">'
759
- +q.owner.reputation+'</span></div></div></div></div></div>';
760
- return out;
761
- }
762
- }),
763
- new $.fn.oembed.OEmbedProvider("wordpress", "rich", ["wordpress\\.com/.+","blogs\\.cnn\\.com/.+","techcrunch\\.com/.+","wp\\.me/.+"], "http://public-api.wordpress.com/oembed/1.0/?for=jquery-oembed-all"),
764
- new $.fn.oembed.OEmbedProvider("screenr", "rich", ["screenr\.com"], "http://www.screenr.com/embed/$1",
765
- {templateRegex:/.*\/([^\/]+).*/
766
- ,embedtag : {tag: 'iframe', width:'650',height: 396}
767
- }) ,
768
- new $.fn.oembed.OEmbedProvider("gigpans", "rich", ["gigapan\\.org/[-.\\w@]+/\\d+"],"http://gigapan.org/gigapans/$1/options/nosnapshots/iframe/flash.html",
769
- {templateRegex:/.*\/(\d+)\/?.*/,
770
- embedtag : {tag: 'iframe', width:'100%',height: 400 }
771
- }),
772
- new $.fn.oembed.OEmbedProvider("scribd", "rich", ["scribd\\.com/.+"],"http://www.scribd.com/embeds/$1/content?start_page=1&view_mode=list",
773
- {templateRegex:/.*doc\/([^\/]+).*/ ,
774
- embedtag : {tag: 'iframe', width:'100%',height: 600}
775
- }),
776
- new $.fn.oembed.OEmbedProvider("kickstarter", "rich", ["kickstarter\\.com/projects/.+"], "$1/widget/card.html",
777
- {templateRegex:/([^\?]+).*/ ,
778
- embedtag : {tag: 'iframe', width:'220',height: 380}
779
- }),
780
-
781
- new $.fn.oembed.OEmbedProvider("amazon", "rich", ["amzn.com/B+","amazon.com.*/(B\\S+)($|\\/.*)"], "http://rcm.amazon.com/e/cm?t=_APIKEY_&o=1&p=8&l=as1&asins=$1&ref=qf_br_asin_til&fc1=000000&IS2=1&lt1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr"
782
- ,{apikey: true,templateRegex:/.*\/(B[0-9A-Z]+)($|\/.*)/,
783
- embedtag : {tag: 'iframe', width:'120px',height: '240px'}
784
- }),
785
-
786
- new $.fn.oembed.OEmbedProvider("slideshare", "rich", ["slideshare\.net"], "http://www.slideshare.net/api/oembed/2",{format:'jsonp'}),
787
- new $.fn.oembed.OEmbedProvider("roomsharejp", "rich", ["roomshare\\.jp/(en/)?post/.*"], "http://roomshare.jp/oembed.json"),
788
-
789
- new $.fn.oembed.OEmbedProvider("lanyard", "rich", ["lanyrd.com/\\d+/.+"], null,
790
- {yql:{xpath:'(//div[@class="primary"])[1]', from: 'htmlstring'
791
- , datareturn:function(results){
792
- if(!results.result) return false;
793
- return '<div class="oembedall-lanyard">'+results.result+'</div>';
794
- }
795
- }
796
- }),
797
- new $.fn.oembed.OEmbedProvider("asciiartfarts", "rich", ["asciiartfarts.com/\\d+.html"], null,
798
- {yql:{xpath:'//pre/font', from: 'htmlstring'
799
- , datareturn:function(results){
800
- if(!results.result) return false;
801
- return '<pre style="background-color:000;">'+results.result+'</div>';
802
- }
803
- }
804
- }),
805
-
806
-
807
-
808
- //Use Open Graph Where applicable
809
- new $.fn.oembed.OEmbedProvider("opengraph", "rich", [".*"], null,
810
- {yql:{xpath:"//meta|//title|//link", from:'html'
811
- , datareturn:function(results){
812
- if(!results['og:title'] && results['title'] &&results['description'])results['og:title']=results['title'];
813
- if(!results['og:title'] && !results['title'])return false;
814
- var code = $('<p/>');
815
- if(results['og:video']) {
816
- var embed = $('<embed src="'+results['og:video']+'"/>');
817
- embed
818
- .attr('type',results['og:video:type'] || "application/x-shockwave-flash")
819
- .css('max-height', settings.maxHeight || 'auto' )
820
- .css('max-width', settings.maxWidth || 'auto' );
821
- if(results['og:video:width']) embed.attr('width',results['og:video:width']);
822
- if(results['og:video:height']) embed.attr('height',results['og:video:height']);
823
- code.append(embed);
824
- }else if(results['og:image']) {
825
- var img = $('<img src="'+results['og:image']+'">');
826
- img.css('max-height', settings.maxHeight || 'auto' ).css('max-width', settings.maxWidth || 'auto' );
827
- if(results['og:image:width']) img.attr('width',results['og:image:width']);
828
- if(results['og:image:height']) img.attr('height',results['og:image:height']);
829
- code.append(img);
544
+
545
+ //Video
546
+ new $.fn.oembed.OEmbedProvider("youtube", "video", ["youtube\\.com/watch.+v=[\\w-]+&?", "youtu\\.be/[\\w-]+", "youtube.com/embed"], 'http://www.youtube.com/embed/$1?wmode=transparent', {
547
+ templateRegex: /.*(?:v\=|be\/|embed\/)([\w\-]+)&?.*/, embedtag: {tag: 'iframe', width: '425', height: '349'}
548
+ }),
549
+
550
+ //new $.fn.oembed.OEmbedProvider("youtube", "video", ["youtube\\.com/watch.+v=[\\w-]+&?", "youtu\\.be/[\\w-]+"], 'http://www.youtube.com/oembed', {useYQL:'json'}),
551
+ //new $.fn.oembed.OEmbedProvider("youtubeiframe", "video", ["youtube.com/embed"], "$1?wmode=transparent",
552
+ // {templateRegex:/(.*)/,embedtag : {tag: 'iframe', width:'425',height: '349'}}),
553
+ new $.fn.oembed.OEmbedProvider("wistia", "video", ["wistia.com/m/.+", "wistia.com/embed/.+", "wi.st/m/.+", "wi.st/embed/.+"], 'http://fast.wistia.com/oembed', {useYQL: 'json'}),
554
+ new $.fn.oembed.OEmbedProvider("xtranormal", "video", ["xtranormal\\.com/watch/.+"], "http://www.xtranormal.com/xtraplayr/$1/$2", {
555
+ templateRegex: /.*com\/watch\/([\w\-]+)\/([\w\-]+).*/, embedtag: {tag: 'iframe', width: '320', height: '269'}}),
556
+ new $.fn.oembed.OEmbedProvider("scivee", "video", ["scivee.tv/node/.+"], "http://www.scivee.tv/flash/embedCast.swf?", {
557
+ templateRegex: /.*tv\/node\/(.+)/, embedtag: {width: '480', height: '400', flashvars: "id=$1&type=3"}}),
558
+ new $.fn.oembed.OEmbedProvider("veoh", "video", ["veoh.com/watch/.+"], "http://www.veoh.com/swf/webplayer/WebPlayer.swf?version=AFrontend.5.7.0.1337&permalinkId=$1&player=videodetailsembedded&videoAutoPlay=0&id=anonymous", {
559
+ templateRegex: /.*watch\/([^\?]+).*/, embedtag: {width: '410', height: '341'}}),
560
+ new $.fn.oembed.OEmbedProvider("gametrailers", "video", ["gametrailers\\.com/video/.+"], "http://media.mtvnservices.com/mgid:moses:video:gametrailers.com:$2", {
561
+ templateRegex: /.*com\/video\/([\w\-]+)\/([\w\-]+).*/, embedtag: {width: '512', height: '288' }}),
562
+ new $.fn.oembed.OEmbedProvider("funnyordie", "video", ["funnyordie\\.com/videos/.+"], "http://player.ordienetworks.com/flash/fodplayer.swf?", {
563
+ templateRegex: /.*videos\/([^\/]+)\/([^\/]+)?/, embedtag: {width: 512, height: 328, flashvars: "key=$1"}}),
564
+ new $.fn.oembed.OEmbedProvider("colledgehumour", "video", ["collegehumor\\.com/video/.+"], "http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=$1&use_node_id=true&fullscreen=1",
565
+ {templateRegex: /.*video\/([^\/]+).*/, embedtag: {width: 600, height: 338}}),
566
+ new $.fn.oembed.OEmbedProvider("metacafe", "video", ["metacafe\\.com/watch/.+"], "http://www.metacafe.com/fplayer/$1/$2.swf",
567
+ {templateRegex: /.*watch\/(\d+)\/(\w+)\/.*/, embedtag: {width: 400, height: 345}}),
568
+ new $.fn.oembed.OEmbedProvider("bambuser", "video", ["bambuser\\.com\/channel\/.*\/broadcast\/.*"], "http://static.bambuser.com/r/player.swf?vid=$1",
569
+ {templateRegex: /.*bambuser\.com\/channel\/.*\/broadcast\/(\w+).*/, embedtag: {width: 512, height: 339 }}),
570
+ new $.fn.oembed.OEmbedProvider("twitvid", "video", ["twitvid\\.com/.+"], "http://www.twitvid.com/embed.php?guid=$1&autoplay=0",
571
+ {templateRegex: /.*twitvid\.com\/(\w+).*/, embedtag: {tag: 'iframe', width: 480, height: 360 }}),
572
+ new $.fn.oembed.OEmbedProvider("aniboom", "video", ["aniboom\\.com/animation-video/.+"], "http://api.aniboom.com/e/$1",
573
+ {templateRegex: /.*animation-video\/(\d+).*/, embedtag: {width: 594, height: 334}}),
574
+ new $.fn.oembed.OEmbedProvider("vzaar", "video", ["vzaar\\.com/videos/.+", "vzaar.tv/.+"], "http://view.vzaar.com/$1/player?",
575
+ {templateRegex: /.*\/(\d+).*/, embedtag: {tag: 'iframe', width: 576, height: 324 }}),
576
+ new $.fn.oembed.OEmbedProvider("snotr", "video", ["snotr\\.com/video/.+"], "http://www.snotr.com/embed/$1",
577
+ {templateRegex: /.*\/(\d+).*/, embedtag: {tag: 'iframe', width: 400, height: 330}, nocache: 1 }),
578
+ new $.fn.oembed.OEmbedProvider("youku", "video", ["v.youku.com/v_show/id_.+"], "http://player.youku.com/player.php/sid/$1/v.swf",
579
+ {templateRegex: /.*id_(.+)\.html.*/, embedtag: {width: 480, height: 400}, nocache: 1 }),
580
+ new $.fn.oembed.OEmbedProvider("tudou", "video", ["tudou.com/programs/view/.+\/"], "http://www.tudou.com/v/$1/v.swf",
581
+ {templateRegex: /.*view\/(.+)\//, embedtag: {width: 480, height: 400}, nocache: 1 }),
582
+ new $.fn.oembed.OEmbedProvider("embedr", "video", ["embedr\\.com/playlist/.+"], "http://embedr.com/swf/slider/$1/425/520/default/false/std?",
583
+ {templateRegex: /.*playlist\/([^\/]+).*/, embedtag: {width: 425, height: 520}}),
584
+ new $.fn.oembed.OEmbedProvider("blip", "video", ["blip\\.tv/.+"], "//blip.tv/oembed/"),
585
+ new $.fn.oembed.OEmbedProvider("minoto-video", "video", ["http://api.minoto-video.com/publishers/.+/videos/.+", "http://dashboard.minoto-video.com/main/video/details/.+", "http://embed.minoto-video.com/.+"], "http://api.minoto-video.com/services/oembed.json", {useYQL: 'json'}),
586
+ new $.fn.oembed.OEmbedProvider("animoto", "video", ["animoto.com/play/.+"], "http://animoto.com/services/oembed"),
587
+ new $.fn.oembed.OEmbedProvider("hulu", "video", ["hulu\\.com/watch/.*"], "//www.hulu.com/api/oembed.json"),
588
+ new $.fn.oembed.OEmbedProvider("ustream", "video", ["ustream\\.tv/recorded/.*"], "http://www.ustream.tv/oembed", {useYQL: 'json'}),
589
+ new $.fn.oembed.OEmbedProvider("videojug", "video", ["videojug\\.com/(film|payer|interview).*"], "http://www.videojug.com/oembed.json", {useYQL: 'json'}),
590
+ new $.fn.oembed.OEmbedProvider("sapo", "video", ["videos\\.sapo\\.pt/.*"], "http://videos.sapo.pt/oembed", {useYQL: 'json'}),
591
+ new $.fn.oembed.OEmbedProvider("vodpod", "video", ["vodpod.com/watch/.*"], "http://vodpod.com/oembed.js", {useYQL: 'json'}),
592
+ new $.fn.oembed.OEmbedProvider("vimeo", "video", ["www\.vimeo\.com\/groups\/.*\/videos\/.*", "www\.vimeo\.com\/.*", "vimeo\.com\/groups\/.*\/videos\/.*", "vimeo\.com\/.*"], "//vimeo.com/api/oembed.json"),
593
+ new $.fn.oembed.OEmbedProvider("dailymotion", "video", ["dailymotion\\.com/.+"], '//www.dailymotion.com/services/oembed'),
594
+ new $.fn.oembed.OEmbedProvider("5min", "video", ["www\\.5min\\.com/.+"], 'http://api.5min.com/oembed.xml', {useYQL: 'xml'}),
595
+ new $.fn.oembed.OEmbedProvider("National Film Board of Canada", "video", ["nfb\\.ca/film/.+"], 'http://www.nfb.ca/remote/services/oembed/', {useYQL: 'json'}),
596
+ new $.fn.oembed.OEmbedProvider("qik", "video", ["qik\\.com/\\w+"], 'http://qik.com/api/oembed.json', {useYQL: 'json'}),
597
+ new $.fn.oembed.OEmbedProvider("revision3", "video", ["revision3\\.com"], "http://revision3.com/api/oembed/"),
598
+ new $.fn.oembed.OEmbedProvider("dotsub", "video", ["dotsub\\.com/view/.+"], "http://dotsub.com/services/oembed", {useYQL: 'json'}),
599
+ new $.fn.oembed.OEmbedProvider("clikthrough", "video", ["clikthrough\\.com/theater/video/\\d+"], "http://clikthrough.com/services/oembed"),
600
+ new $.fn.oembed.OEmbedProvider("Kinomap", "video", ["kinomap\\.com/.+"], "http://www.kinomap.com/oembed"),
601
+ new $.fn.oembed.OEmbedProvider("VHX", "video", ["vhx.tv/.+"], "http://vhx.tv/services/oembed.json"),
602
+ new $.fn.oembed.OEmbedProvider("bambuser", "video", ["bambuser.com/.+"], "http://api.bambuser.com/oembed/iframe.json"),
603
+ new $.fn.oembed.OEmbedProvider("justin.tv", "video", ["justin.tv/.+"], 'http://api.justin.tv/api/embed/from_url.json', {useYQL: 'json'}),
604
+ new $.fn.oembed.OEmbedProvider("vine", "video", ["vine.co/v/.*"], null,
605
+ {
606
+ templateRegex: /https?:\/\/w?w?w?.?vine\.co\/v\/([a-zA-Z0-9]*).*/,
607
+ template: '<iframe src="https://vine.co/v/$1/embed/postcard" width="600" height="600" allowfullscreen="true" allowscriptaccess="always" scrolling="no" frameborder="0"></iframe>' +
608
+ '<script async src="//platform.vine.co/static/scripts/embed.js" charset="utf-8"></script>',
609
+ nocache: 1
610
+ }),
611
+ new $.fn.oembed.OEmbedProvider("boxofficebuz", "video", ["boxofficebuz\\.com\\/embed/.+"], "http://boxofficebuz.com/embed/$1/$2", {templateRegex: [/.*boxofficebuz\.com\/embed\/(\w+)\/([\w*\-*]+)/], embedtag: {tag: 'iframe', width: 480, height: 360 }}),
612
+ new $.fn.oembed.OEmbedProvider("clipsyndicate", "video", ["clipsyndicate\\.com/video/play/.+", "clipsyndicate\\.com/embed/iframe\?.+"], "http://eplayer.clipsyndicate.com/embed/iframe?pf_id=1&show_title=0&va_id=$1&windows=1", {templateRegex: [/.*www\.clipsyndicate\.com\/video\/play\/(\w+)\/.*/, /.*eplayer\.clipsyndicate\.com\/embed\/iframe\?.*va_id=(\w+).*.*/], embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}),
613
+ new $.fn.oembed.OEmbedProvider("coub", "video", ["coub\\.com/.+"], "http://www.coub.com/embed/$1?muted=false&autostart=false&originalSize=false&hideTopBar=false&noSiteButtons=false&startWithHD=false", {templateRegex: [/.*coub\.com\/embed\/(\w+)\?*.*/, /.*coub\.com\/view\/(\w+).*/], embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}),
614
+ new $.fn.oembed.OEmbedProvider("discoverychannel", "video", ["snagplayer\\.video\\.dp\\.discovery\\.com/.+"], "http://snagplayer.video.dp.discovery.com/$1/snag-it-player.htm?auto=no", {templateRegex: [/.*snagplayer\.video\.dp\.discovery\/(\w+).*/], embedtag: {tag: 'iframe', width: 480, height: 360 }}),
615
+ new $.fn.oembed.OEmbedProvider("telly", "video", ["telly\\.com/.+"], "http://www.telly.com/embed.php?guid=$1&autoplay=0", {templateRegex: [/.*telly\.com\/embed\.php\?guid=(\w+).*/, /.*telly\.com\/(\w+).*/], embedtag: {tag: 'iframe', width: 480, height: 360 }}),
616
+ new $.fn.oembed.OEmbedProvider("minilogs", "video", ["minilogs\\.com/.+"], "http://www.minilogs.com/e/$1", {templateRegex: [/.*minilogs\.com\/e\/(\w+).*/, /.*minilogs\.com\/(\w+).*/], embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}),
617
+ new $.fn.oembed.OEmbedProvider("viddy", "video", ["viddy\\.com/.+"], "http://www.viddy.com/embed/video/$1", {templateRegex: [/.*viddy\.com\/embed\/video\/(\.*)/, /.*viddy\.com\/video\/(\.*)/], embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}),
618
+ new $.fn.oembed.OEmbedProvider("worldstarhiphop", "video", ["worldstarhiphop\\.com\/embed/.+"], "http://www.worldstarhiphop.com/embed/$1", {templateRegex: /.*worldstarhiphop\.com\/embed\/(\w+).*/, embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}),
619
+ new $.fn.oembed.OEmbedProvider("zapiks", "video", ["zapiks\\.fr\/.+"], "http://www.zapiks.fr/index.php?action=playerIframe&media_id=$1&autoStart=fals", {templateRegex: /.*zapiks\.fr\/index.php\?[\w\=\&]*media_id=(\w+).*/, embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}),
620
+
621
+ //Audio
622
+ new $.fn.oembed.OEmbedProvider("official.fm", "rich", ["official.fm/.+"], 'http://official.fm/services/oembed', {useYQL: 'json'}),
623
+ new $.fn.oembed.OEmbedProvider("chirbit", "rich", ["chirb.it/.+"], 'http://chirb.it/oembed.json', {useYQL: 'json'}),
624
+ new $.fn.oembed.OEmbedProvider("chirbit", "audio", ["chirb\\.it/.+"], "http://chirb.it/wp/$1", {templateRegex: [/.*chirb\.it\/wp\/(\w+).*/, /.*chirb\.it\/(\w+).*/], embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}),
625
+ new $.fn.oembed.OEmbedProvider("Huffduffer", "rich", ["huffduffer.com/[-.\\w@]+/\\d+"], "http://huffduffer.com/oembed"),
626
+ new $.fn.oembed.OEmbedProvider("Spotify", "rich", ["open.spotify.com/(track|album|user)/"], "https://embed.spotify.com/oembed/"),
627
+ new $.fn.oembed.OEmbedProvider("shoudio", "rich", ["shoudio.com/.+", "shoud.io/.+"], "http://shoudio.com/api/oembed"),
628
+ new $.fn.oembed.OEmbedProvider("mixcloud", "rich", ["mixcloud.com/.+"], 'http://www.mixcloud.com/oembed/', {useYQL: 'json'}),
629
+ new $.fn.oembed.OEmbedProvider("rdio.com", "rich", ["rd.io/.+", "rdio.com"], "http://www.rdio.com/api/oembed/"),
630
+ new $.fn.oembed.OEmbedProvider("Soundcloud", "rich", ["soundcloud.com/.+", "snd.sc/.+"], "//soundcloud.com/oembed", {format: 'js'}),
631
+ new $.fn.oembed.OEmbedProvider("bandcamp", "rich", ["bandcamp\\.com/album/.+"], null,
632
+ {
633
+ yql: {
634
+ xpath: "//meta[contains(@content, \\'EmbeddedPlayer\\')]",
635
+ from: 'html',
636
+ datareturn: function (results) {
637
+ return results.meta ? '<iframe width="400" height="100" src="' + results.meta.content + '" allowtransparency="true" frameborder="0"></iframe>' : false;
638
+ }
639
+ }
640
+ }),
641
+
642
+ //Photo
643
+ new $.fn.oembed.OEmbedProvider("deviantart", "photo", ["deviantart.com/.+", "fav.me/.+", "deviantart.com/.+"], "//backend.deviantart.com/oembed", {format: 'jsonp'}),
644
+ new $.fn.oembed.OEmbedProvider("skitch", "photo", ["skitch.com/.+"], null,
645
+ {
646
+ yql: {
647
+ xpath: "json",
648
+ from: 'json',
649
+ url: function (externalurl) {
650
+ return 'http://skitch.com/oembed/?format=json&url=' + externalurl
651
+ },
652
+ datareturn: function (data) {
653
+ return $.fn.oembed.getPhotoCode(data.json.url, data.json);
654
+ }
655
+ }
656
+ }),
657
+ new $.fn.oembed.OEmbedProvider("mobypicture", "photo", ["mobypicture.com/user/.+/view/.+", "moby.to/.+"], "http://api.mobypicture.com/oEmbed"),
658
+ new $.fn.oembed.OEmbedProvider("flickr", "photo", ["flickr\\.com/photos/.+"], "//flickr.com/services/oembed", {callbackparameter: 'jsoncallback'}),
659
+ new $.fn.oembed.OEmbedProvider("photobucket", "photo", ["photobucket\\.com/(albums|groups)/.+"], "http://photobucket.com/oembed/"),
660
+ new $.fn.oembed.OEmbedProvider("instagram", "photo", ["instagr\\.?am(\\.com)?/.+"], "//api.instagram.com/oembed"),
661
+ //new $.fn.oembed.OEmbedProvider("yfrog", "photo", ["yfrog\\.(com|ru|com\\.tr|it|fr|co\\.il|co\\.uk|com\\.pl|pl|eu|us)/.+"], "http://www.yfrog.com/api/oembed",{useYQL:"json"}),
662
+ new $.fn.oembed.OEmbedProvider("SmugMug", "photo", ["smugmug.com/[-.\\w@]+/.+"], "http://api.smugmug.com/services/oembed/"),
663
+ new $.fn.oembed.OEmbedProvider("dribbble", "photo", ["dribbble.com/shots/.+"], "http://api.dribbble.com/shots/$1?callback=?",
664
+ {
665
+ templateRegex: /.*shots\/([\d]+).*/,
666
+ templateData: function (data) {
667
+ if (!data.image_teaser_url) {
668
+ return false;
669
+ }
670
+ return '<img src="' + data.image_teaser_url + '"/>';
671
+ }
672
+ }),
673
+ new $.fn.oembed.OEmbedProvider("chart.ly", "photo", ["chart\\.ly/[a-z0-9]{6,8}"], "http://chart.ly/uploads/large_$1.png",
674
+ {templateRegex: /.*ly\/([^\/]+).*/, embedtag: {tag: 'img'}, nocache: 1}),
675
+ //new $.fn.oembed.OEmbedProvider("stocktwits.com", "photo", ["stocktwits\\.com/message/.+"], "http://charts.stocktwits.com/production/original_$1.png?",
676
+ // { templateRegex: /.*message\/([^\/]+).*/, embedtag: { tag: 'img'},nocache:1 }),
677
+ new $.fn.oembed.OEmbedProvider("circuitlab", "photo", ["circuitlab.com/circuit/.+"], "https://www.circuitlab.com/circuit/$1/screenshot/540x405/",
678
+ {templateRegex: /.*circuit\/([^\/]+).*/, embedtag: {tag: 'img'}, nocache: 1}),
679
+ new $.fn.oembed.OEmbedProvider("23hq", "photo", ["23hq.com/[-.\\w@]+/photo/.+"], "http://www.23hq.com/23/oembed", {useYQL: "json"}),
680
+ new $.fn.oembed.OEmbedProvider("img.ly", "photo", ["img\\.ly/.+"], "//img.ly/show/thumb/$1",
681
+ {templateRegex: /.*ly\/([^\/]+).*/, embedtag: {tag: 'img'}, nocache: 1}),
682
+ new $.fn.oembed.OEmbedProvider("twitgoo.com", "photo", ["twitgoo\\.com/.+"], "http://twitgoo.com/show/thumb/$1",
683
+ {templateRegex: /.*com\/([^\/]+).*/, embedtag: {tag: 'img'}, nocache: 1}),
684
+ new $.fn.oembed.OEmbedProvider("imgur.com", "photo", ["imgur\\.com/gallery/.+"], "http://imgur.com/$1l.jpg",
685
+ {templateRegex: /.*gallery\/([^\/]+).*/, embedtag: {tag: 'img'}, nocache: 1}),
686
+ new $.fn.oembed.OEmbedProvider("visual.ly", "rich", ["visual\\.ly/.+"], null,
687
+ {
688
+ yql: {
689
+ xpath: "//a[@id=\\'gc_article_graphic_image\\']/img",
690
+ from: 'htmlstring'
691
+ }
692
+ }),
693
+ new $.fn.oembed.OEmbedProvider("gravtar", "photo", ["mailto:.+"], null,
694
+ {
695
+ templateRegex: /mailto:([^\/]+).*/,
696
+ template: function (wm, email) {
697
+ return '<img src="http://gravatar.com/avatar/' + email.md5() + '.jpg" alt="on Gravtar" class="jqoaImg">';
698
+ }
699
+ }),
700
+ new $.fn.oembed.OEmbedProvider("achewood", "photo", ["achewood\\.com\\/index.php\\?date=.+"], "http://www.achewood.com/comic.php?date=$1", {templateRegex: /.*achewood\.com\/index.php\?date=(\w+).*/, embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}),
701
+ new $.fn.oembed.OEmbedProvider("fotokritik", "photo", ["fotokritik\\.com/.+"], "http://www.fotokritik.com/embed/$1", {templateRegex: [/.*fotokritik\.com\/embed\/(\w+).*/, /.*fotokritik\.com\/(\w+).*/], embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}),
702
+ new $.fn.oembed.OEmbedProvider("giflike", "photo", ["giflike\\.com/.+"], "http://www.giflike.com/embed/$1", {templateRegex: [/.*giflike\.com\/embed\/(\w+).*/, /.*giflike\.com\/a\/(\w+).*/], embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}),
703
+
704
+ //Rich
705
+ new $.fn.oembed.OEmbedProvider("twitter", "rich", ["twitter.com/.+"], "https://api.twitter.com/1/statuses/oembed.json"),
706
+ new $.fn.oembed.OEmbedProvider("gmep", "rich", ["gmep.imeducate.com/.*", "gmep.org/.*"], "http://gmep.org/oembed.json"),
707
+ new $.fn.oembed.OEmbedProvider("urtak", "rich", ["urtak.com/(u|clr)/.+"], "http://oembed.urtak.com/1/oembed"),
708
+ new $.fn.oembed.OEmbedProvider("cacoo", "rich", ["cacoo.com/.+"], "http://cacoo.com/oembed.json"),
709
+ new $.fn.oembed.OEmbedProvider("dailymile", "rich", ["dailymile.com/people/.*/entries/.*"], "http://api.dailymile.com/oembed"),
710
+ new $.fn.oembed.OEmbedProvider("dipity", "rich", ["dipity.com/timeline/.+"], 'http://www.dipity.com/oembed/timeline/', {useYQL: 'json'}),
711
+ new $.fn.oembed.OEmbedProvider("sketchfab", "rich", ["sketchfab.com/show/.+"], 'http://sketchfab.com/oembed', {useYQL: 'json'}),
712
+ new $.fn.oembed.OEmbedProvider("speakerdeck", "rich", ["speakerdeck.com/.+"], 'http://speakerdeck.com/oembed.json', {useYQL: 'json'}),
713
+ new $.fn.oembed.OEmbedProvider("popplet", "rich", ["popplet.com/app/.*"], "http://popplet.com/app/Popplet_Alpha.swf?page_id=$1&em=1",
714
+ {
715
+ templateRegex: /.*#\/([^\/]+).*/,
716
+ embedtag: {
717
+ width: 460,
718
+ height: 460
719
+ }
720
+ }),
721
+
722
+ new $.fn.oembed.OEmbedProvider("pearltrees", "rich", ["pearltrees.com/.*"], "http://cdn.pearltrees.com/s/embed/getApp?",
723
+ {
724
+ templateRegex: /.*N-f=1_(\d+).*N-p=(\d+).*/,
725
+ embedtag: {
726
+ width: 460,
727
+ height: 460,
728
+ flashvars: "lang=en_US&amp;embedId=pt-embed-$1-693&amp;treeId=$1&amp;pearlId=$2&amp;treeTitle=Diagrams%2FVisualization&amp;site=www.pearltrees.com%2FF"
729
+ }
730
+ }),
731
+
732
+ new $.fn.oembed.OEmbedProvider("prezi", "rich", ["prezi.com/.*"], "//prezi.com/bin/preziloader.swf?",
733
+ {
734
+ templateRegex: /.*com\/([^\/]+)\/.*/,
735
+ embedtag: {
736
+ width: 550,
737
+ height: 400,
738
+ flashvars: "prezi_id=$1&amp;lock_to_path=0&amp;color=ffffff&amp;autoplay=no&amp;autohide_ctrls=0"
739
+ }
740
+ }),
741
+
742
+ new $.fn.oembed.OEmbedProvider("tourwrist", "rich", ["tourwrist.com/tours/.+"], null,
743
+ {
744
+ templateRegex: /.*tours.([\d]+).*/,
745
+ template: function (wm, tourid) {
746
+ setTimeout(function () {
747
+ if (loadEmbeds)loadEmbeds();
748
+ }, 2000);
749
+ return "<div id='" + tourid + "' class='tourwrist-tour-embed direct'></div> <script type='text/javascript' src='http://tourwrist.com/tour_embed.js'></script>";
750
+ }
751
+ }),
752
+
753
+ new $.fn.oembed.OEmbedProvider("meetup", "rich", ["meetup\\.(com|ps)/.+"], "http://api.meetup.com/oembed"),
754
+ new $.fn.oembed.OEmbedProvider("ebay", "rich", ["ebay\\.*"], "http://togo.ebay.com/togo/togo.swf?2008013100",
755
+ {
756
+ templateRegex: /.*\/([^\/]+)\/(\d{10,13}).*/,
757
+ embedtag: {
758
+ width: 355,
759
+ height: 300,
760
+ flashvars: "base=http://togo.ebay.com/togo/&lang=en-us&mode=normal&itemid=$2&query=$1"
761
+ }
762
+ }),
763
+ new $.fn.oembed.OEmbedProvider("wikipedia", "rich", ["wikipedia.org/wiki/.+"], "http://$1.wikipedia.org/w/api.php?action=parse&page=$2&format=json&section=0&callback=?", {
764
+ templateRegex: /.*\/\/([\w]+).*\/wiki\/([^\/]+).*/,
765
+ templateData: function (data) {
766
+ if (!data.parse)
767
+ return false;
768
+ var text = data.parse['text']['*'].replace(/href="\/wiki/g, 'href="http://en.wikipedia.org/wiki');
769
+ return '<div id="content"><h3><a class="nav-link" href="http://en.wikipedia.org/wiki/' + data.parse['displaytitle'] + '">' + data.parse['displaytitle'] + '</a></h3>' + text + '</div>';
830
770
  }
831
- if(results['og:title']) code.append('<b>'+results['og:title']+'</b><br/>');
832
- if(results['og:description'])
833
- code.append(results['og:description']+'<br/>');
834
- else if(results['description'])
835
- code.append(results['description']+'<br/>');
836
- return code;
837
- }
838
- }
839
- })
771
+ }),
772
+ new $.fn.oembed.OEmbedProvider("imdb", "rich", ["imdb.com/title/.+"], "http://www.imdbapi.com/?i=$1&callback=?",
773
+ {
774
+ templateRegex: /.*\/title\/([^\/]+).*/,
775
+ templateData: function (data) {
776
+ if (!data.Title)
777
+ return false;
778
+ return '<div id="content"><h3><a class="nav-link" href="http://imdb.com/title/' + data.imdbID + '/">' + data.Title + '</a> (' + data.Year + ')</h3><p>Rating: ' + data.imdbRating + '<br/>Genre: ' + data.Genre + '<br/>Starring: ' + data.Actors + '</p></div> <div id="view-photo-caption">' + data.Plot + '</div></div>';
779
+ }
780
+ }),
781
+ new $.fn.oembed.OEmbedProvider("livejournal", "rich", ["livejournal.com/"], "http://ljpic.seacrow.com/json/$2$4?jsonp=?"
782
+ , {
783
+ templateRegex: /(http:\/\/(((?!users).)+)\.livejournal\.com|.*users\.livejournal\.com\/([^\/]+)).*/,
784
+ templateData: function (data) {
785
+ if (!data.username)
786
+ return false;
787
+ return '<div><img src="' + data.image + '" align="left" style="margin-right: 1em;" /><span class="oembedall-ljuser"><a href="http://' + data.username + '.livejournal.com/profile"><img src="http://www.livejournal.com/img/userinfo.gif" alt="[info]" width="17" height="17" /></a><a href="http://' + data.username + '.livejournal.com/">' + data.username + '</a></span><br />' + data.name + '</div>';
788
+ }
789
+ }),
790
+ new $.fn.oembed.OEmbedProvider("circuitbee", "rich", ["circuitbee\\.com/circuit/view/.+"], "http://c.circuitbee.com/build/r/schematic-embed.html?id=$1",
791
+ {
792
+ templateRegex: /.*circuit\/view\/(\d+).*/,
793
+ embedtag: {
794
+ tag: 'iframe',
795
+ width: '500',
796
+ height: '350'
797
+ }
798
+ }),
799
+
800
+ new $.fn.oembed.OEmbedProvider("googlecalendar", "rich", ["www.google.com/calendar/embed?.+"], "$1",
801
+ {templateRegex: /(.*)/, embedtag: {tag: 'iframe', width: '800', height: '600' }}),
802
+ new $.fn.oembed.OEmbedProvider("jsfiddle", "rich", ["jsfiddle.net/[^/]+/?"], "http://jsfiddle.net/$1/embedded/result,js,resources,html,css/?",
803
+ {templateRegex: /.*net\/([^\/]+).*/, embedtag: {tag: 'iframe', width: '100%', height: '300' }}),
804
+ new $.fn.oembed.OEmbedProvider("jsbin", "rich", ["jsbin.com/.+"], "http://jsbin.com/$1/?",
805
+ {templateRegex: /.*com\/([^\/]+).*/, embedtag: {tag: 'iframe', width: '100%', height: '300' }}),
806
+ new $.fn.oembed.OEmbedProvider("jotform", "rich", ["form.jotform.co/form/.+"], "$1?",
807
+ {templateRegex: /(.*)/, embedtag: {tag: 'iframe', width: '100%', height: '507' }}),
808
+ new $.fn.oembed.OEmbedProvider("reelapp", "rich", ["reelapp\\.com/.+"], "http://www.reelapp.com/$1/embed",
809
+ {templateRegex: /.*com\/(\S{6}).*/, embedtag: {tag: 'iframe', width: '400', height: '338'}}),
810
+ new $.fn.oembed.OEmbedProvider("linkedin", "rich", ["linkedin.com/pub/.+"], "https://www.linkedin.com/cws/member/public_profile?public_profile_url=$1&format=inline&isFramed=true",
811
+ {templateRegex: /(.*)/, embedtag: {tag: 'iframe', width: '368px', height: 'auto'}}),
812
+ new $.fn.oembed.OEmbedProvider("timetoast", "rich", ["timetoast.com/timelines/[0-9]+"], "http://www.timetoast.com/flash/TimelineViewer.swf?passedTimelines=$1",
813
+ {templateRegex: /.*timelines\/([0-9]*)/, embedtag: { width: 550, height: 400}, nocache: 1}),
814
+ new $.fn.oembed.OEmbedProvider("pastebin", "rich", ["pastebin\\.com/[\\S]{8}"], "http://pastebin.com/embed_iframe.php?i=$1",
815
+ {templateRegex: /.*\/(\S{8}).*/, embedtag: {tag: 'iframe', width: '100%', height: 'auto'}}),
816
+ new $.fn.oembed.OEmbedProvider("mixlr", "rich", ["mixlr.com/.+"], "http://mixlr.com/embed/$1?autoplay=ae",
817
+ {templateRegex: /.*com\/([^\/]+).*/, embedtag: {tag: 'iframe', width: '100%', height: 'auto' }}),
818
+ new $.fn.oembed.OEmbedProvider("pastie", "rich", ["pastie\\.org/pastes/.+"], null, {yql: {xpath: '//pre[@class="textmate-source"]'}}),
819
+ new $.fn.oembed.OEmbedProvider("github", "rich", ["gist.github.com/.+"], "https://github.com/api/oembed"),
820
+ new $.fn.oembed.OEmbedProvider("github", "rich", ["github.com/[-.\\w@]+/[-.\\w@]+"], "https://api.github.com/repos/$1/$2?callback=?"
821
+ , {templateRegex: /.*\/([^\/]+)\/([^\/]+).*/,
822
+ templateData: function (data) {
823
+ if (!data.data.html_url)return false;
824
+ return '<div class="oembedall-githubrepos"><ul class="oembedall-repo-stats"><li>' + data.data.language + '</li><li class="oembedall-watchers"><a title="Watchers" href="' + data.data.html_url + '/watchers">&#x25c9; ' + data.data.watchers + '</a></li>'
825
+ + '<li class="oembedall-forks"><a title="Forks" href="' + data.data.html_url + '/network">&#x0265; ' + data.data.forks + '</a></li></ul><h3><a href="' + data.data.html_url + '">' + data.data.name + '</a></h3><div class="oembedall-body"><p class="oembedall-description">' + data.data.description + '</p>'
826
+ + '<p class="oembedall-updated-at">Last updated: ' + data.data.pushed_at + '</p></div></div>';
827
+ }
828
+ }),
829
+ new $.fn.oembed.OEmbedProvider("facebook", "rich", ["facebook.com"], null
830
+ , {templateRegex: /.*\/([^\/]+)\/([^\/]+).*/,
831
+ template: function (url) {
832
+ // adding script directly to DOM to make sure that it is loaded correctly.
833
+ if (!$.fn.oembed.facebokScriptHasBeenAdded) {
834
+ $('<div id="fb-root"></div>').appendTo('body');
835
+ var script = document.createElement('script');
836
+ script.type = 'text/javascript';
837
+ script.text = '(function(d, s, id) {var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) return;js = d.createElement(s); js.id = id;js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0";fjs.parentNode.insertBefore(js, fjs);}(document, "script", "facebook-jssdk"));';
838
+ document.body.appendChild(script);
839
+ $.fn.oembed.facebokScriptHasBeenAdded = true;
840
+ }
841
+
842
+ // returning template with url of facebook post.
843
+ return '<div class="fb-post" data-href="' + url + '" data-width="520"><div class="fb-xfbml-parse-ignore"><a href="' + url + '"></div></div>';
844
+
845
+ }
846
+ }),
847
+ /*
848
+ // Saving old implementation of Facebook in case we will need it as example in the future.
849
+ new $.fn.oembed.OEmbedProvider("facebook", "rich", ["facebook.com/(people/[^\\/]+/\\d+|[^\\/]+$)"], "https://graph.facebook.com/$2$3/?callback=?"
850
+ ,{templateRegex:/.*facebook.com\/(people\/[^\/]+\/(\d+).*|([^\/]+$))/,
851
+ templateData : function(data){ if(!data.id)return false;
852
+ var out = '<div class="oembedall-facebook1"><div class="oembedall-facebook2"><a href="http://www.facebook.com/">facebook</a> ';
853
+ if(data.from) out += '<a href="http://www.facebook.com/'+data.from.id+'">'+data.from.name+'</a>';
854
+ else if(data.link) out += '<a href="'+data.link+'">'+data.name+'</a>';
855
+ else if(data.username) out += '<a href="http://www.facebook.com/'+data.username+'">'+data.name+'</a>';
856
+ else out += '<a href="http://www.facebook.com/'+data.id+'">'+data.name+'</a>';
857
+ out += '</div><div class="oembedall-facebookBody"><div class="contents">';
858
+ if(data.picture) out += '<a href="'+data.link+'"><img src="'+data.picture+'"></a>';
859
+ else out += '<img src="https://graph.facebook.com/'+data.id+'/picture">';
860
+ if(data.from) out += '<a href="'+data.link+'">'+data.name+'</a>';
861
+ if(data.founded) out += 'Founded: <strong>'+data.founded+'</strong><br>';
862
+ if(data.category) out += 'Category: <strong>'+data.category+'</strong><br>';
863
+ if(data.website) out += 'Website: <strong><a href="'+data.website+'">'+data.website+'</a></strong><br>';
864
+ if(data.gender) out += 'Gender: <strong>'+data.gender+'</strong><br>';
865
+ if(data.description) out += data.description + '<br>';
866
+ out += '</div></div>';
867
+ return out;
868
+ }
869
+ }),
870
+ */
871
+ new $.fn.oembed.OEmbedProvider("stackoverflow", "rich", ["stackoverflow.com/questions/[\\d]+"], "http://api.stackoverflow.com/1.1/questions/$1?body=true&jsonp=?"
872
+ , {templateRegex: /.*questions\/([\d]+).*/,
873
+ templateData: function (data) {
874
+ if (!data.questions)
875
+ return false;
876
+ var q = data.questions[0];
877
+ var body = $(q.body).text();
878
+ var out = '<div class="oembedall-stoqembed"><div class="oembedall-statscontainer"><div class="oembedall-statsarrow"></div><div class="oembedall-stats"><div class="oembedall-vote"><div class="oembedall-votes">'
879
+ + '<span class="oembedall-vote-count-post"><strong>' + (q.up_vote_count - q.down_vote_count) + '</strong></span><div class="oembedall-viewcount">vote(s)</div></div>'
880
+ + '</div><div class="oembedall-status"><strong>' + q.answer_count + '</strong>answer</div></div><div class="oembedall-views">' + q.view_count + ' view(s)</div></div>'
881
+ + '<div class="oembedall-summary"><h3><a class="oembedall-question-hyperlink" href="http://stackoverflow.com/questions/' + q.question_id + '/">' + q.title + '</a></h3>'
882
+ + '<div class="oembedall-excerpt">' + body.substring(0, 100) + '...</div><div class="oembedall-tags">';
883
+ for (i in q.tags) {
884
+ out += '<a title="" class="oembedall-post-tag" href="http://stackoverflow.com/questions/tagged/' + q.tags[i] + '">' + q.tags[i] + '</a>';
885
+ }
886
+
887
+ out += '</div><div class="oembedall-fr"><div class="oembedall-user-info"><div class="oembedall-user-gravatar32"><a href="http://stackoverflow.com/users/' + q.owner.user_id + '/' + q.owner.display_name + '">'
888
+ + '<img width="32" height="32" alt="" src="http://www.gravatar.com/avatar/' + q.owner.email_hash + '?s=32&amp;d=identicon&amp;r=PG"></a></div><div class="oembedall-user-details">'
889
+ + '<a href="http://stackoverflow.com/users/' + q.owner.user_id + '/' + q.owner.display_name + '">' + q.owner.display_name + '</a><br><span title="reputation score" class="oembedall-reputation-score">'
890
+ + q.owner.reputation + '</span></div></div></div></div></div>';
891
+ return out;
892
+ }
893
+ }),
894
+ new $.fn.oembed.OEmbedProvider("wordpress", "rich", ["wordpress\\.com/.+", "blogs\\.cnn\\.com/.+", "techcrunch\\.com/.+", "wp\\.me/.+"], "http://public-api.wordpress.com/oembed/1.0/?for=jquery-oembed-all"),
895
+ new $.fn.oembed.OEmbedProvider("screenr", "rich", ["screenr\.com"], "http://www.screenr.com/embed/$1",
896
+ {templateRegex: /.*\/([^\/]+).*/, embedtag: {tag: 'iframe', width: '650', height: 396}}) ,
897
+ new $.fn.oembed.OEmbedProvider("gigpans", "rich", ["gigapan\\.org/[-.\\w@]+/\\d+"], "http://gigapan.org/gigapans/$1/options/nosnapshots/iframe/flash.html",
898
+ {templateRegex: /.*\/(\d+)\/?.*/, embedtag: {tag: 'iframe', width: '100%', height: 400 }}),
899
+ new $.fn.oembed.OEmbedProvider("scribd", "rich", ["scribd\\.com/.+"], "http://www.scribd.com/embeds/$1/content?start_page=1&view_mode=list",
900
+ {templateRegex: /.*doc\/([^\/]+).*/, embedtag: {tag: 'iframe', width: '100%', height: 600}}),
901
+ new $.fn.oembed.OEmbedProvider("kickstarter", "rich", ["kickstarter\\.com/projects/.+"], "$1/widget/card.html",
902
+ {templateRegex: /([^\?]+).*/, embedtag: {tag: 'iframe', width: '220', height: 380}}),
903
+ new $.fn.oembed.OEmbedProvider("amazon", "rich", ["amzn.com/B+", "amazon.com.*/(B\\S+)($|\\/.*)"], "http://rcm.amazon.com/e/cm?t=_APIKEY_&o=1&p=8&l=as1&asins=$1&ref=qf_br_asin_til&fc1=000000&IS2=1&lt1=_blank&m=amazon&lc1=0000FF&bc1=000000&bg1=FFFFFF&f=ifr",
904
+ {
905
+ apikey: true,
906
+ templateRegex: /.*\/(B[0-9A-Z]+)($|\/.*)/,
907
+ embedtag: {
908
+ tag: 'iframe',
909
+ width: '120px',
910
+ height: '240px'}
911
+ }),
912
+ new $.fn.oembed.OEmbedProvider("slideshare", "rich", ["slideshare\.net"], "//www.slideshare.net/api/oembed/2", {format: 'jsonp'}),
913
+ new $.fn.oembed.OEmbedProvider("roomsharejp", "rich", ["roomshare\\.jp/(en/)?post/.*"], "http://roomshare.jp/oembed.json"),
914
+ new $.fn.oembed.OEmbedProvider("lanyard", "rich", ["lanyrd.com/\\d+/.+"], null,
915
+ {
916
+ yql: {
917
+ xpath: '(//div[@class="primary"])[1]',
918
+ from: 'htmlstring',
919
+ datareturn: function (results) {
920
+ if (!results.result)
921
+ return false;
922
+ return '<div class="oembedall-lanyard">' + results.result + '</div>';
923
+ }
924
+ }
925
+ }),
926
+ new $.fn.oembed.OEmbedProvider("asciiartfarts", "rich", ["asciiartfarts.com/\\d+.html"], null,
927
+ {
928
+ yql: {
929
+ xpath: '//pre/font',
930
+ from: 'htmlstring',
931
+ datareturn: function (results) {
932
+ if (!results.result)
933
+ return false;
934
+ return '<pre style="background-color:#000;">' + results.result + '</div>';
935
+ }
936
+ }
937
+ }),
938
+ new $.fn.oembed.OEmbedProvider("coveritlive", "rich", ["coveritlive.com/"], null, {
939
+ templateRegex: /(.*)/,
940
+ template: '<iframe src="$1" allowtransparency="true" scrolling="no" width="615px" frameborder="0" height="625px"></iframe>'}),
941
+ new $.fn.oembed.OEmbedProvider("polldaddy", "rich", ["polldaddy.com/"], null, {
942
+ templateRegex: /(?:https?:\/\/w?w?w?.?polldaddy.com\/poll\/)([0-9]*)\//,
943
+ template: '<script async type="text/javascript" charset="utf-8" src="http://static.polldaddy.com/p/$1.js"></script>',
944
+ nocache: 1
945
+ }),
946
+ new $.fn.oembed.OEmbedProvider("360io", "rich", ["360\\.io/.+"], "http://360.io/$1", {templateRegex: /.*360\.io\/(\w+).*/, embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}),
947
+ new $.fn.oembed.OEmbedProvider("bubbli", "rich", ["on\\.bubb\\.li/.+"], "http://on.bubb.li/$1", {templateRegex: /.*on\.bubb\.li\/(\w+).*/, embedtag: {tag: 'iframe', width: 480, height: 360}, nocache: 1 }),
948
+ new $.fn.oembed.OEmbedProvider("cloudup", "rich", ["cloudup\\.com/.+"], "http://cloudup.com/$1?chromeless", {templateRegex: [/.*cloudup\.com\/(\w+).*/], embedtag: {tag: 'iframe', width: 480, height: 360 }}),
949
+ new $.fn.oembed.OEmbedProvider("codepen", "rich", ["codepen.io/.+"], "http://codepen.io/$1/embed/$2", {templateRegex: [/.*io\/(\w+)\/pen\/(\w+).*/, /.*io\/(\w+)\/full\/(\w+).*/], embedtag: {tag: 'iframe', width: '100%', height: '300'}, nocache: 1 }),
950
+ new $.fn.oembed.OEmbedProvider("googleviews", "rich", ["(.*maps\\.google\\.com\\/maps\\?).+(output=svembed).+(cbp=(.*)).*"], "https://maps.google.com/maps?layer=c&panoid=$3&ie=UTF8&source=embed&output=svembed&cbp=$5", {templateRegex: /(.*maps\.google\.com\/maps\?).+(panoid=(\w+)&).*(cbp=(.*)).*/, embedtag: {tag: 'iframe', width: 480, height: 360}, nocache: 1 }),
951
+ new $.fn.oembed.OEmbedProvider("googlemaps", "rich", ["google\\.com\/maps\/place/.+"], "http://maps.google.com/maps?t=m&q=$1&output=embed", {templateRegex: /.*google\.com\/maps\/place\/([\w\+]*)\/.*/, embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}),
952
+ new $.fn.oembed.OEmbedProvider("imajize", "rich", ["embed\\.imajize\\.com/.+"], "http://embed.imajize.com/$1", {templateRegex: /.*embed\.imajize\.com\/(.*)/, embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}),
953
+ new $.fn.oembed.OEmbedProvider("mapjam", "rich", ["mapjam\\.com/.+"], "http://www.mapjam.com/$1", {templateRegex: /.*mapjam\.com\/(.*)/, embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}),
954
+ new $.fn.oembed.OEmbedProvider("polar", "rich", ["polarb\\.com/.+"], "http://assets-polarb-com.a.ssl.fastly.net/api/v4/publishers/unknown/embedded_polls/iframe?poll_id=$1", {templateRegex: /.*polarb\.com\/polls\/(\w+).*/, embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}),
955
+ new $.fn.oembed.OEmbedProvider("ponga", "rich", ["ponga\\.com/.+"], "https://www.ponga.com/embedded?id=$1", {templateRegex: [/.*ponga\.com\/embedded\?id=(\w+).*/, /.*ponga\.com\/(\w+).*/], embedtag: {tag: 'iframe', width: 480, height: 360 }, nocache: 1}),
956
+
957
+ //Use Open Graph Where applicable
958
+ new $.fn.oembed.OEmbedProvider("opengraph", "rich", [".*"], null,
959
+ {
960
+ yql: {
961
+ xpath: "//meta|//title|//link",
962
+ from: 'html',
963
+ datareturn: function (results) {
964
+ if (!results['og:title'] && results['title'] && results['description'])
965
+ results['og:title'] = results['title'];
966
+
967
+ if (!results['og:title'] && !results['title'])
968
+ return false;
969
+
970
+ var code = $('<p/>');
971
+ if (results['og:video']) {
972
+ var embed = $('<embed src="' + results['og:video'] + '"/>');
973
+ embed.attr('type', results['og:video:type'] || "application/x-shockwave-flash")
974
+ .css('max-height', settings.maxHeight || 'auto')
975
+ .css('max-width', settings.maxWidth || 'auto');
976
+ if (results['og:video:width'])
977
+ embed.attr('width', results['og:video:width']);
978
+ if (results['og:video:height'])
979
+ embed.attr('height', results['og:video:height']);
980
+ code.append(embed);
981
+ } else if (results['og:image']) {
982
+ var img = $('<img src="' + results['og:image'] + '">');
983
+ img.css('max-height', settings.maxHeight || 'auto').css('max-width', settings.maxWidth || 'auto');
984
+ if (results['og:image:width'])
985
+ img.attr('width', results['og:image:width']);
986
+ if (results['og:image:height'])
987
+ img.attr('height', results['og:image:height']);
988
+ code.append(img);
989
+ }
990
+
991
+ if (results['og:title'])
992
+ code.append('<b>' + results['og:title'] + '</b><br/>');
993
+
994
+ if (results['og:description'])
995
+ code.append(results['og:description'] + '<br/>');
996
+ else if (results['description'])
997
+ code.append(results['description'] + '<br/>');
998
+
999
+ return code;
1000
+ }
1001
+ }
1002
+ }
1003
+ )
840
1004
 
841
1005
  ];
842
1006
  })(jQuery);
843
-
844
1007
  //This is needed for gravatar :(
845
- String.prototype.md5=function(){var a=function(a,b){var c=(a&65535)+(b&65535);var d=(a>>16)+(b>>16)+(c>>16);return d<<16|c&65535};var b=function(a,b){return a<<b|a>>>32-b};var c=function(c,d,e,f,g,h){return a(b(a(a(d,c),a(f,h)),g),e)};var d=function(a,b,d,e,f,g,h){return c(b&d|~b&e,a,b,f,g,h)};var e=function(a,b,d,e,f,g,h){return c(b&e|d&~e,a,b,f,g,h)};var f=function(a,b,d,e,f,g,h){return c(b^d^e,a,b,f,g,h)};var g=function(a,b,d,e,f,g,h){return c(d^(b|~e),a,b,f,g,h)};var h=function(b){var c,h,i,j,k,l=b.length;var m=1732584193;var n=-271733879;var o=-1732584194;var p=271733878;for(k=0;k<l;k+=16){c=m;h=n;i=o;j=p;m=d(m,n,o,p,b[k+0],7,-680876936);p=d(p,m,n,o,b[k+1],12,-389564586);o=d(o,p,m,n,b[k+2],17,606105819);n=d(n,o,p,m,b[k+3],22,-1044525330);m=d(m,n,o,p,b[k+4],7,-176418897);p=d(p,m,n,o,b[k+5],12,1200080426);o=d(o,p,m,n,b[k+6],17,-1473231341);n=d(n,o,p,m,b[k+7],22,-45705983);m=d(m,n,o,p,b[k+8],7,1770035416);p=d(p,m,n,o,b[k+9],12,-1958414417);o=d(o,p,m,n,b[k+10],17,-42063);n=d(n,o,p,m,b[k+11],22,-1990404162);m=d(m,n,o,p,b[k+12],7,1804603682);p=d(p,m,n,o,b[k+13],12,-40341101);o=d(o,p,m,n,b[k+14],17,-1502002290);n=d(n,o,p,m,b[k+15],22,1236535329);m=e(m,n,o,p,b[k+1],5,-165796510);p=e(p,m,n,o,b[k+6],9,-1069501632);o=e(o,p,m,n,b[k+11],14,643717713);n=e(n,o,p,m,b[k+0],20,-373897302);m=e(m,n,o,p,b[k+5],5,-701558691);p=e(p,m,n,o,b[k+10],9,38016083);o=e(o,p,m,n,b[k+15],14,-660478335);n=e(n,o,p,m,b[k+4],20,-405537848);m=e(m,n,o,p,b[k+9],5,568446438);p=e(p,m,n,o,b[k+14],9,-1019803690);o=e(o,p,m,n,b[k+3],14,-187363961);n=e(n,o,p,m,b[k+8],20,1163531501);m=e(m,n,o,p,b[k+13],5,-1444681467);p=e(p,m,n,o,b[k+2],9,-51403784);o=e(o,p,m,n,b[k+7],14,1735328473);n=e(n,o,p,m,b[k+12],20,-1926607734);m=f(m,n,o,p,b[k+5],4,-378558);p=f(p,m,n,o,b[k+8],11,-2022574463);o=f(o,p,m,n,b[k+11],16,1839030562);n=f(n,o,p,m,b[k+14],23,-35309556);m=f(m,n,o,p,b[k+1],4,-1530992060);p=f(p,m,n,o,b[k+4],11,1272893353);o=f(o,p,m,n,b[k+7],16,-155497632);n=f(n,o,p,m,b[k+10],23,-1094730640);m=f(m,n,o,p,b[k+13],4,681279174);p=f(p,m,n,o,b[k+0],11,-358537222);o=f(o,p,m,n,b[k+3],16,-722521979);n=f(n,o,p,m,b[k+6],23,76029189);m=f(m,n,o,p,b[k+9],4,-640364487);p=f(p,m,n,o,b[k+12],11,-421815835);o=f(o,p,m,n,b[k+15],16,530742520);n=f(n,o,p,m,b[k+2],23,-995338651);m=g(m,n,o,p,b[k+0],6,-198630844);p=g(p,m,n,o,b[k+7],10,1126891415);o=g(o,p,m,n,b[k+14],15,-1416354905);n=g(n,o,p,m,b[k+5],21,-57434055);m=g(m,n,o,p,b[k+12],6,1700485571);p=g(p,m,n,o,b[k+3],10,-1894986606);o=g(o,p,m,n,b[k+10],15,-1051523);n=g(n,o,p,m,b[k+1],21,-2054922799);m=g(m,n,o,p,b[k+8],6,1873313359);p=g(p,m,n,o,b[k+15],10,-30611744);o=g(o,p,m,n,b[k+6],15,-1560198380);n=g(n,o,p,m,b[k+13],21,1309151649);m=g(m,n,o,p,b[k+4],6,-145523070);p=g(p,m,n,o,b[k+11],10,-1120210379);o=g(o,p,m,n,b[k+2],15,718787259);n=g(n,o,p,m,b[k+9],21,-343485551);m=a(m,c);n=a(n,h);o=a(o,i);p=a(p,j)}return[m,n,o,p]};var i=function(a){var b="0123456789abcdef",c="",d,e=a.length*4;for(d=0;d<e;d++){c+=b.charAt(a[d>>2]>>d%4*8+4&15)+b.charAt(a[d>>2]>>d%4*8&15)}return c};var j=function(a){var b=(a.length+8>>6)+1;var c=[],d,e=b*16,f,g=a.length;for(d=0;d<e;d++){c.push(0)}for(f=0;f<g;f++){c[f>>2]|=(a.charCodeAt(f)&255)<<f%4*8}c[f>>2]|=128<<f%4*8;c[b*16-2]=g*8;return c};return i(h(j(this)))}
1008
+ String.prototype.md5=function(){var a=function(a,b){var c=(a&65535)+(b&65535);var d=(a>>16)+(b>>16)+(c>>16);return d<<16|c&65535};var b=function(a,b){return a<<b|a>>>32-b};var c=function(c,d,e,f,g,h){return a(b(a(a(d,c),a(f,h)),g),e)};var d=function(a,b,d,e,f,g,h){return c(b&d|~b&e,a,b,f,g,h)};var e=function(a,b,d,e,f,g,h){return c(b&e|d&~e,a,b,f,g,h)};var f=function(a,b,d,e,f,g,h){return c(b^d^e,a,b,f,g,h)};var g=function(a,b,d,e,f,g,h){return c(d^(b|~e),a,b,f,g,h)};var h=function(b){var c,h,i,j,k,l=b.length;var m=1732584193;var n=-271733879;var o=-1732584194;var p=271733878;for(k=0;k<l;k+=16){c=m;h=n;i=o;j=p;m=d(m,n,o,p,b[k+0],7,-680876936);p=d(p,m,n,o,b[k+1],12,-389564586);o=d(o,p,m,n,b[k+2],17,606105819);n=d(n,o,p,m,b[k+3],22,-1044525330);m=d(m,n,o,p,b[k+4],7,-176418897);p=d(p,m,n,o,b[k+5],12,1200080426);o=d(o,p,m,n,b[k+6],17,-1473231341);n=d(n,o,p,m,b[k+7],22,-45705983);m=d(m,n,o,p,b[k+8],7,1770035416);p=d(p,m,n,o,b[k+9],12,-1958414417);o=d(o,p,m,n,b[k+10],17,-42063);n=d(n,o,p,m,b[k+11],22,-1990404162);m=d(m,n,o,p,b[k+12],7,1804603682);p=d(p,m,n,o,b[k+13],12,-40341101);o=d(o,p,m,n,b[k+14],17,-1502002290);n=d(n,o,p,m,b[k+15],22,1236535329);m=e(m,n,o,p,b[k+1],5,-165796510);p=e(p,m,n,o,b[k+6],9,-1069501632);o=e(o,p,m,n,b[k+11],14,643717713);n=e(n,o,p,m,b[k+0],20,-373897302);m=e(m,n,o,p,b[k+5],5,-701558691);p=e(p,m,n,o,b[k+10],9,38016083);o=e(o,p,m,n,b[k+15],14,-660478335);n=e(n,o,p,m,b[k+4],20,-405537848);m=e(m,n,o,p,b[k+9],5,568446438);p=e(p,m,n,o,b[k+14],9,-1019803690);o=e(o,p,m,n,b[k+3],14,-187363961);n=e(n,o,p,m,b[k+8],20,1163531501);m=e(m,n,o,p,b[k+13],5,-1444681467);p=e(p,m,n,o,b[k+2],9,-51403784);o=e(o,p,m,n,b[k+7],14,1735328473);n=e(n,o,p,m,b[k+12],20,-1926607734);m=f(m,n,o,p,b[k+5],4,-378558);p=f(p,m,n,o,b[k+8],11,-2022574463);o=f(o,p,m,n,b[k+11],16,1839030562);n=f(n,o,p,m,b[k+14],23,-35309556);m=f(m,n,o,p,b[k+1],4,-1530992060);p=f(p,m,n,o,b[k+4],11,1272893353);o=f(o,p,m,n,b[k+7],16,-155497632);n=f(n,o,p,m,b[k+10],23,-1094730640);m=f(m,n,o,p,b[k+13],4,681279174);p=f(p,m,n,o,b[k+0],11,-358537222);o=f(o,p,m,n,b[k+3],16,-722521979);n=f(n,o,p,m,b[k+6],23,76029189);m=f(m,n,o,p,b[k+9],4,-640364487);p=f(p,m,n,o,b[k+12],11,-421815835);o=f(o,p,m,n,b[k+15],16,530742520);n=f(n,o,p,m,b[k+2],23,-995338651);m=g(m,n,o,p,b[k+0],6,-198630844);p=g(p,m,n,o,b[k+7],10,1126891415);o=g(o,p,m,n,b[k+14],15,-1416354905);n=g(n,o,p,m,b[k+5],21,-57434055);m=g(m,n,o,p,b[k+12],6,1700485571);p=g(p,m,n,o,b[k+3],10,-1894986606);o=g(o,p,m,n,b[k+10],15,-1051523);n=g(n,o,p,m,b[k+1],21,-2054922799);m=g(m,n,o,p,b[k+8],6,1873313359);p=g(p,m,n,o,b[k+15],10,-30611744);o=g(o,p,m,n,b[k+6],15,-1560198380);n=g(n,o,p,m,b[k+13],21,1309151649);m=g(m,n,o,p,b[k+4],6,-145523070);p=g(p,m,n,o,b[k+11],10,-1120210379);o=g(o,p,m,n,b[k+2],15,718787259);n=g(n,o,p,m,b[k+9],21,-343485551);m=a(m,c);n=a(n,h);o=a(o,i);p=a(p,j)}return[m,n,o,p]};var i=function(a){var b="0123456789abcdef",c="",d,e=a.length*4;for(d=0;d<e;d++){c+=b.charAt(a[d>>2]>>d%4*8+4&15)+b.charAt(a[d>>2]>>d%4*8&15)}return c};var j=function(a){var b=(a.length+8>>6)+1;var c=[],d,e=b*16,f,g=a.length;for(d=0;d<e;d++){c.push(0)}for(f=0;f<g;f++){c[f>>2]|=(a.charCodeAt(f)&255)<<f%4*8}c[f>>2]|=128<<f%4*8;c[b*16-2]=g*8;return c};return i(h(j(this)))};