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.
rewrite-with-urlplugin
Vivien Didelot 11 years ago
parent 638a4595c7
commit b365272aa6
  1. 2
      js/plugins.js
  2. 4
      test/unit/plugins.js

@ -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;
}
});

@ -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);

Loading…
Cancel
Save