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 () {};
|
||||
|
||||
$($html).find("a.source").oembed(null, {
|
||||
fallback : true,
|
||||
includeHandle: false,
|
||||
maxWidth: 490,
|
||||
afterEmbed: function() {
|
||||
$($html).find(".embeds").show();
|
||||
}
|
||||
fallback : false,
|
||||
includeHandle: false,
|
||||
maxWidth: 500,
|
||||
maxHeight: 350,
|
||||
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);
|
||||
} else if (embedProvider.apiendpoint) {
|
||||
//Add APIkey if true
|
||||
|
@ -682,8 +688,10 @@
|
|||
{templateRegex: /.*ly\/([^\/]+).*/, embedtag: {tag: 'img'}, nocache: 1}),
|
||||
new $.fn.oembed.OEmbedProvider("twitgoo.com", "photo", ["twitgoo\\.com/.+"], "http://twitgoo.com/show/thumb/$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}),
|
||||
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,
|
||||
{
|
||||
yql: {
|
||||
|
|
Loading…
Reference in New Issue