From 21528dc50bcf638f62b94c35ab38d73a89c7e731 Mon Sep 17 00:00:00 2001 From: Lars Jung Date: Tue, 27 Aug 2013 21:27:31 +0200 Subject: [PATCH] Updates thumbs. --- src/_h5ai/client/css/inc/view-details.less | 2 +- src/_h5ai/client/css/inc/view-list.less | 2 +- src/_h5ai/client/css/inc/view.less | 3 ++- src/_h5ai/client/js/inc/ext/thumbnails.js | 26 +++++++++++----------- src/_h5ai/conf/options.json | 4 +++- 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/_h5ai/client/css/inc/view-details.less b/src/_h5ai/client/css/inc/view-details.less index e438d0eb..ae81517b 100644 --- a/src/_h5ai/client/css/inc/view-details.less +++ b/src/_h5ai/client/css/inc/view-details.less @@ -49,7 +49,7 @@ } .label { - margin: 0 230px 0 (@small-icon-size + 8px); + margin: 0 230px 0 (@small-icon-size + 16px); } .date { diff --git a/src/_h5ai/client/css/inc/view-list.less b/src/_h5ai/client/css/inc/view-list.less index e73a46b2..4c2cd539 100644 --- a/src/_h5ai/client/css/inc/view-list.less +++ b/src/_h5ai/client/css/inc/view-list.less @@ -49,7 +49,7 @@ } .label { - margin: 0 230px 0 (@big-icon-size + 8px); + margin: 0 230px 0 (@big-icon-size + 16px); } .date { diff --git a/src/_h5ai/client/css/inc/view.less b/src/_h5ai/client/css/inc/view.less index 88ed55f8..44ee1f15 100644 --- a/src/_h5ai/client/css/inc/view.less +++ b/src/_h5ai/client/css/inc/view.less @@ -56,9 +56,10 @@ @item-background-col-sel: rgba(0,0,0,0.02); @item-border-col-sel: @col-border-strong; -@small-icon-size: 32px; // @small-icon-size: 16px; +@small-icon-size: 32px; @big-icon-size: 48px; +// @big-icon-size: 56px; // @big-icon-size: 64px; // @big-icon-size: 80px; // @big-icon-size: 96px; diff --git a/src/_h5ai/client/js/inc/ext/thumbnails.js b/src/_h5ai/client/js/inc/ext/thumbnails.js index c5c65547..22379989 100644 --- a/src/_h5ai/client/js/inc/ext/thumbnails.js +++ b/src/_h5ai/client/js/inc/ext/thumbnails.js @@ -6,20 +6,20 @@ modulejs.define('ext/thumbnails', ['_', 'core/settings', 'core/event', 'core/ser img: ['bmp', 'gif', 'ico', 'image', 'jpg', 'png', 'tiff'], mov: ['video'], doc: ['pdf', 'ps'], - delay: 1000 + delay: 1000, + size: 96 }, allsettings.thumbnails), - requestThumbSquare = function (type, href, callback) { + requestThumb = function (type, href, mode, ratio, callback) { - server.request({action: 'getThumbHref', type: type, href: href, mode: 'square', width: 96, height: 96}, function (json) { - - callback(json && json.code === 0 ? json.absHref : null); - }); - }, - - requestThumbRational = function (type, href, callback) { - - server.request({action: 'getThumbHref', type: type, href: href, mode: 'rational', width: 96 * 2, height: 96}, function (json) { + server.request({ + action: 'getThumbHref', + type: type, + href: href, + mode: mode, + width: settings.size * ratio, + height: settings.size + }, function (json) { callback(json && json.code === 0 ? json.absHref : null); }); @@ -41,7 +41,7 @@ modulejs.define('ext/thumbnails', ['_', 'core/settings', 'core/event', 'core/ser if (item.thumbSquare) { item.$view.find('.icon.square img').addClass('thumb').attr('src', item.thumbSquare); } else { - requestThumbSquare(type, item.absHref, function (src) { + requestThumb(type, item.absHref, 'square', 1, function (src) { if (src && item.$view) { item.thumbSquare = src; @@ -52,7 +52,7 @@ modulejs.define('ext/thumbnails', ['_', 'core/settings', 'core/event', 'core/ser if (item.thumbRational) { item.$view.find('.icon.rational img').addClass('thumb').attr('src', item.thumbRational); } else { - requestThumbRational(type, item.absHref, function (src) { + requestThumb(type, item.absHref, 'rational', 2, function (src) { if (src && item.$view) { item.thumbRational = src; diff --git a/src/_h5ai/conf/options.json b/src/_h5ai/conf/options.json index 9eb71d72..ba881e15 100644 --- a/src/_h5ai/conf/options.json +++ b/src/_h5ai/conf/options.json @@ -301,13 +301,15 @@ Options - mov: array of types - doc: array of types - delay: delay in milliseconds after "dom-ready" before thumb-requesting starts + - size: number, size in pixel of the generated thumbnails */ "thumbnails": { "enabled": true, "img": ["bmp", "gif", "ico", "image", "jpg", "png"], "mov": ["video"], "doc": ["pdf", "ps"], - "delay": 1 + "delay": 1, + "size": 96 }, /*