UI now loads the 250px image if available, and reverts to full size otherwise.

This commit is contained in:
Taloth Saldono
2015-01-29 21:13:24 +01:00
parent 35ab3a28fd
commit b145ea1a70
4 changed files with 46 additions and 4 deletions
+10 -2
View File
@@ -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 () {