Embed images when no oembed provider is found
+ imgur update
This commit is contained in:
parent
d3d2a1b2ae
commit
f714c954fe
|
@ -4,11 +4,20 @@ module.exports = function ($html, cb) {
|
||||||
cb = cb || function () {};
|
cb = cb || function () {};
|
||||||
|
|
||||||
$($html).find("a.source").oembed(null, {
|
$($html).find("a.source").oembed(null, {
|
||||||
fallback : true,
|
fallback : false,
|
||||||
includeHandle: false,
|
includeHandle: false,
|
||||||
maxWidth: 490,
|
maxWidth: 500,
|
||||||
afterEmbed: function() {
|
maxHeight: 350,
|
||||||
$($html).find(".embeds").show();
|
afterEmbed: function(container, oembedData) {
|
||||||
}
|
this.parent().parent().parent().show();
|
||||||
|
},
|
||||||
|
onProviderNotFound: function() {
|
||||||
|
var link = $($html).find("a.source");
|
||||||
|
var resourceURL = link.attr("href");
|
||||||
|
if (resourceURL.match(/\.(jpg|png|gif)\b/)) {
|
||||||
|
link.parent().append("<div class='oembedall-container'><a href='" + resourceURL + "' target='_blank'><img src='" + resourceURL + "' / style='max-width:500px; max-height:350px; width: auto; height: auto;'></a></div>");
|
||||||
|
this.parent().parent().show();
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -285,6 +285,12 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tag == 'img') {
|
||||||
|
var link = $('<a target="_blank" href="' + src + '" />');
|
||||||
|
link.append(code);
|
||||||
|
code = link;
|
||||||
|
}
|
||||||
|
|
||||||
success({code: code}, externalUrl, container);
|
success({code: code}, externalUrl, container);
|
||||||
} else if (embedProvider.apiendpoint) {
|
} else if (embedProvider.apiendpoint) {
|
||||||
//Add APIkey if true
|
//Add APIkey if true
|
||||||
|
@ -682,8 +688,10 @@
|
||||||
{templateRegex: /.*ly\/([^\/]+).*/, embedtag: {tag: 'img'}, nocache: 1}),
|
{templateRegex: /.*ly\/([^\/]+).*/, embedtag: {tag: 'img'}, nocache: 1}),
|
||||||
new $.fn.oembed.OEmbedProvider("twitgoo.com", "photo", ["twitgoo\\.com/.+"], "http://twitgoo.com/show/thumb/$1",
|
new $.fn.oembed.OEmbedProvider("twitgoo.com", "photo", ["twitgoo\\.com/.+"], "http://twitgoo.com/show/thumb/$1",
|
||||||
{templateRegex: /.*com\/([^\/]+).*/, embedtag: {tag: 'img'}, nocache: 1}),
|
{templateRegex: /.*com\/([^\/]+).*/, embedtag: {tag: 'img'}, nocache: 1}),
|
||||||
new $.fn.oembed.OEmbedProvider("imgur.com", "photo", ["imgur\\.com/gallery/.+"], "http://imgur.com/$1l.jpg",
|
new $.fn.oembed.OEmbedProvider("imgur.com", "photo", ["imgur\\.com/gallery/.+"], "https://imgur.com/$1l.jpg",
|
||||||
{templateRegex: /.*gallery\/([^\/]+).*/, embedtag: {tag: 'img'}, nocache: 1}),
|
{templateRegex: /.*gallery\/([^\/]+).*/, embedtag: {tag: 'img'}, nocache: 1}),
|
||||||
|
new $.fn.oembed.OEmbedProvider("imgur.com", "photo", ["imgur\\.com/.+"], "https://imgur.com/$1.png",
|
||||||
|
{templateRegex: /.*\/([^\/]+).*/, embedtag: {tag: 'img'}, nocache: 1}),
|
||||||
new $.fn.oembed.OEmbedProvider("visual.ly", "rich", ["visual\\.ly/.+"], null,
|
new $.fn.oembed.OEmbedProvider("visual.ly", "rich", ["visual\\.ly/.+"], null,
|
||||||
{
|
{
|
||||||
yql: {
|
yql: {
|
||||||
|
|
Loading…
Reference in New Issue