mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-17 21:25:39 -04:00
UI now loads the 250px image if available, and reverts to full size otherwise.
This commit is contained in:
@@ -17,8 +17,16 @@ define(
|
||||
img.onerror = null;
|
||||
};
|
||||
|
||||
Handlebars.registerHelper('defaultImg', function () {
|
||||
return new Handlebars.SafeString('onerror=window.NzbDrone.imageError(this)');
|
||||
Handlebars.registerHelper('defaultImg', function (src, size) {
|
||||
if (!src) {
|
||||
return new Handlebars.SafeString('onerror="window.NzbDrone.imageError(this);"');
|
||||
}
|
||||
|
||||
if (size) {
|
||||
src = src.replace(/\.jpg($|\?)/g, '-' + size + '.jpg$1');
|
||||
}
|
||||
|
||||
return new Handlebars.SafeString('src="{0}" onerror="window.NzbDrone.imageError(this);"'.format(src));
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('UrlBase', function () {
|
||||
|
||||
@@ -11,7 +11,7 @@ define(
|
||||
var poster = _.where(this.images, {coverType: 'poster'});
|
||||
|
||||
if (poster[0]) {
|
||||
return new Handlebars.SafeString('<img class="series-poster" src="{0}" {1}>'.format(poster[0].url, Handlebars.helpers.defaultImg.call()));
|
||||
return new Handlebars.SafeString('<img class="series-poster" {0}>'.format(Handlebars.helpers.defaultImg.call(null, poster[0].url, 250)));
|
||||
}
|
||||
|
||||
return new Handlebars.SafeString('<img class="series-poster placeholder-image" src="{0}">'.format(placeholder));
|
||||
|
||||
Reference in New Issue
Block a user