plugins: (image) support :size suffix
Some images URL (such as Twitter hosting site twimg.com) are suffixed with :size where size can be small, medium or large.
This commit is contained in:
parent
638a4595c7
commit
b365272aa6
2 changed files with 4 additions and 2 deletions
|
@ -257,7 +257,7 @@ plugins.factory('userPlugins', function() {
|
||||||
var embed = false;
|
var embed = false;
|
||||||
// Check the get parameters as well, they might contain an image to load
|
// Check the get parameters as well, they might contain an image to load
|
||||||
var segments = url.split(/[?&]/).forEach(function(param) {
|
var segments = url.split(/[?&]/).forEach(function(param) {
|
||||||
if (param.match(/\.(png|gif|jpg|jpeg)$/i)) {
|
if (param.match(/\.(png|gif|jpg|jpeg)(:(small|medium|large))?$/i)) {
|
||||||
embed = true;
|
embed = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -80,7 +80,9 @@ describe('filter', function() {
|
||||||
'https://4z2.de/gb-mobile-new.png',
|
'https://4z2.de/gb-mobile-new.png',
|
||||||
'http://static.weechat.org/images/screenshots/relay/medium/glowing-bear.png',
|
'http://static.weechat.org/images/screenshots/relay/medium/glowing-bear.png',
|
||||||
'http://foo.bar/baz.php?img=trololo.png&dummy=yes',
|
'http://foo.bar/baz.php?img=trololo.png&dummy=yes',
|
||||||
'https://tro.lo.lo/images/rick.png?size=123x45'
|
'https://tro.lo.lo/images/rick.png?size=123x45',
|
||||||
|
'https://pbs.twimg.com/media/B66rbCuIMAAxiFF.jpg:large',
|
||||||
|
'https://pbs.twimg.com/media/B6OZuCYCEAEV8SA.jpg:medium'
|
||||||
],
|
],
|
||||||
'image',
|
'image',
|
||||||
plugins);
|
plugins);
|
||||||
|
|
Loading…
Reference in a new issue