Fixes problems with misalgined image previews.

This commit is contained in:
Lars Jung 2012-07-14 19:45:30 +02:00
parent 864687aedf
commit 2282a0ba71
3 changed files with 16 additions and 22 deletions

View file

@ -129,9 +129,15 @@ modulejs.define('ext/preview-img', ['_', '$', 'core/settings', 'core/resource',
clearTimeout(spinnerTimeout); clearTimeout(spinnerTimeout);
$container.spin(false); $container.spin(false);
$img.attr('src', src).show(); // $img.hide().attr('src', src).fadeIn(100);
$img.fadeOut(100, function () {
adjustSize(); $img.attr('src', src).fadeIn(200);
setTimeout(adjustSize, 1);
});
// adjustSize();
// setTimeout(adjustSize, 1);
$('#preview-bar-label').text(currentEntries[currentIdx].label); $('#preview-bar-label').text(currentEntries[currentIdx].label);
$('#preview-bar-percent').text('' + (100 * $img.width() / width).toFixed(0) + '%'); $('#preview-bar-percent').text('' + (100 * $img.width() / width).toFixed(0) + '%');

View file

@ -31,27 +31,15 @@ modulejs.define('model/entry', ['_', 'core/types', 'core/ajax'], function (_, ty
sequence = sequence.replace(/\/+/g, '/'); sequence = sequence.replace(/\/+/g, '/');
if (sequence === '/') { if (sequence === '/') {
return { return { parent: null, name: '/' };
parent: null,
parentname: null,
name: '/'
};
} }
match = reSplitPath2.exec(sequence); match = reSplitPath2.exec(sequence);
if (match) { if (match) {
return { return { parent: match[1], name: match[3] };
parent: match[1],
parentname: match[2],
name: match[3]
};
} }
match = reSplitPath.exec(sequence); match = reSplitPath.exec(sequence);
if (match) { if (match) {
return { return { parent: '/', name: match[1] };
parent: '/',
parentname: '/',
name: match[1]
};
} }
}, },
@ -127,7 +115,7 @@ modulejs.define('model/entry', ['_', 'core/types', 'core/ajax'], function (_, ty
return modulejs.require('ext/folderstatus'); return modulejs.require('ext/folderstatus');
} catch (e) {} } catch (e) {}
return []; return {};
}()), }()),
fetchStatus = function (absHref, callback) { fetchStatus = function (absHref, callback) {

View file

@ -12,16 +12,16 @@ modulejs.define('parser/generic-json', ['_', '$', 'core/settings', 'model/entry'
parseJson = function (absHref, json) { parseJson = function (absHref, json) {
if (json.hasOwnProperty('customHeader')) { if (_.has(json, 'customHeader')) {
settings.custom.header = json.customHeader; settings.custom.header = json.customHeader;
} }
if (json.hasOwnProperty('customFooter')) { if (_.has(json, 'customFooter')) {
settings.custom.footer = json.customFooter; settings.custom.footer = json.customFooter;
} }
if (json.hasOwnProperty('mode')) { if (_.has(json, 'mode')) {
parser.mode = json.mode; parser.mode = json.mode;
} }
if (json.hasOwnProperty('server')) { if (_.has(json, 'server')) {
parser.server = json.server; parser.server = json.server;
} }