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:
Vivien Didelot 2015-01-14 10:36:03 -05:00
parent 638a4595c7
commit b365272aa6
2 changed files with 4 additions and 2 deletions

View file

@ -257,7 +257,7 @@ plugins.factory('userPlugins', function() {
var embed = false;
// Check the get parameters as well, they might contain an image to load
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;
}
});

View file

@ -80,7 +80,9 @@ describe('filter', function() {
'https://4z2.de/gb-mobile-new.png',
'http://static.weechat.org/images/screenshots/relay/medium/glowing-bear.png',
'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',
plugins);