Performance improvements in aai mode. Minor changes.

This commit is contained in:
Lars Jung 2012-10-11 00:37:08 +02:00
parent d7f1c68366
commit 15dd200b28
6 changed files with 53 additions and 16 deletions

View file

@ -3,6 +3,7 @@
position: fixed; position: fixed;
z-index: 5; z-index: 5;
width: 100%; width: 100%;
height: 30px;
left: 0; left: 0;
top: 0; top: 0;
.vert-gradient(rgb(241,241,241), rgb(228,228,228)); .vert-gradient(rgb(241,241,241), rgb(228,228,228));

View file

@ -93,6 +93,11 @@
margin: 0; margin: 0;
padding: 0 0 0 24px; padding: 0 0 0 24px;
} }
.summary {
margin: 0 0 0 24px;
color: #999;
font-style: italic;
}
.current { .current {
> a, > a:active, > a:visited { > a, > a:active, > a:visited {
background-color: rgba(255,255,255,0.5); background-color: rgba(255,255,255,0.5);

View file

@ -82,6 +82,9 @@ modulejs.define('ext/crumb', ['_', '$', 'core/settings', 'core/resource', 'core/
_.each(crumb, function (e) { _.each(crumb, function (e) {
$ul.append(update(e)); $ul.append(update(e));
// needed by aai
// e.fetchStatus(function (e) { update(e); });
}); });
event.sub('entry.created', onContentChanged); event.sub('entry.created', onContentChanged);

View file

@ -3,7 +3,8 @@ modulejs.define('ext/tree', ['_', '$', 'core/settings', 'core/resource', 'core/e
var settings = _.extend({ var settings = _.extend({
enabled: false, enabled: false,
slide: true slide: true,
maxSubfolders: 50
}, allsettings.tree), }, allsettings.tree),
template = '<div class="entry">' + template = '<div class="entry">' +
@ -75,10 +76,17 @@ modulejs.define('ext/tree', ['_', '$', 'core/settings', 'core/resource', 'core/e
// does it have subfolders? // does it have subfolders?
if (subfolders.length) { if (subfolders.length) {
var $ul = $('<ul class="content"/>').appendTo($html); var $ul = $('<ul class="content"/>').appendTo($html),
counter = 0;
_.each(subfolders, function (e) { _.each(subfolders, function (e) {
$('<li />').append(update(e)).appendTo($ul); counter += 1;
if (counter <= settings.maxSubfolders) {
$('<li/>').append(update(e)).appendTo($ul);
}
}); });
if (subfolders.length > settings.maxSubfolders) {
$('<li class="summary">… ' + (subfolders.length - settings.maxSubfolders) + ' more subfolders</li>').appendTo($ul);
}
if (!entry.isContentVisible) { if (!entry.isContentVisible) {
$ul.hide(); $ul.hide();
} }
@ -232,9 +240,11 @@ modulejs.define('ext/tree', ['_', '$', 'core/settings', 'core/resource', 'core/e
}); });
event.sub('ready', adjustSpacing); event.sub('ready', adjustSpacing);
event.sub('entry.changed', onContentChanged);
event.sub('entry.created', onContentChanged); // strong negative performance impact in aai mode
event.sub('entry.removed', onContentChanged); // event.sub('entry.changed', onContentChanged);
// event.sub('entry.created', onContentChanged);
// event.sub('entry.removed', onContentChanged);
$(window).on('resize', function () { $(window).on('resize', function () {

View file

@ -4,7 +4,9 @@ modulejs.define('view/extended', ['_', '$', 'core/settings', 'core/resource', 'c
var settings = _.extend({ var settings = _.extend({
modes: ['details', 'icons'], modes: ['details', 'icons'],
setParentFolderLabels: false, setParentFolderLabels: false,
binaryPrefix: false binaryPrefix: false,
maxFolders: 16,
delay: 2000
}, allsettings.view), }, allsettings.view),
template = '<li class="entry">' + template = '<li class="entry">' +
@ -111,9 +113,6 @@ modulejs.define('view/extended', ['_', '$', 'core/settings', 'core/resource', 'c
_.each(entry.content, function (e) { _.each(entry.content, function (e) {
$ul.append(update(e)); $ul.append(update(e));
// needed by aai
e.fetchStatus(function (e) { update(e); });
}); });
$extended.append($ul); $extended.append($ul);
@ -154,6 +153,20 @@ modulejs.define('view/extended', ['_', '$', 'core/settings', 'core/resource', 'c
}); });
} }
}); });
// needed by aai
if (_.size(entry.content) <= settings.maxFolders) {
_.each(entry.content, function (e) {
if (e.isFolder() && e.status === null) {
setTimeout(function () {
e.fetchStatus(function (e) { update(e); });
}, settings.delay);
}
});
}
}; };
init(entry); init(entry);

View file

@ -33,16 +33,20 @@ Options
The user selected view mode is also stored local in modern browsers The user selected view mode is also stored local in modern browsers
so that it will be persistent. so that it will be persistent.
Set parent folder labels to real folder names. - setParentFolderLabels [all]: set parent folder labels to real folder names
Binary prefix set to true uses 1024B=1KiB when formatting - binaryPrefix [all]: set to true uses 1024B=1KiB when formatting file sizes
file sizes (see http://en.wikipedia.org/wiki/Binary_prefix). (see http://en.wikipedia.org/wiki/Binary_prefix)
- indexFiles [php]: consider folder with those files as non {{pkg.name}} folders
- ignore [php]: don't list items matching these regular expressions
- maxFolders [aai]: max folders to trigger folder status checks
*/ */
"view": { "view": {
"modes": ["details", "list", "grid", "icons"], "modes": ["details", "list", "grid", "icons"],
"setParentFolderLabels": true, "setParentFolderLabels": true,
"binaryPrefix": false, "binaryPrefix": false,
"indexFiles": ["index.html", "index.htm", "index.php"], "indexFiles": ["index.html", "index.htm", "index.php"],
"ignore": ["^\\.", "^_{{pkg.name}}"] "ignore": ["^\\.", "^_{{pkg.name}}"],
"maxFolders": 16
}, },
@ -274,7 +278,7 @@ Options
}, },
/* [php] /* [php]
Show thumbnails for image files. Needs the "/_h5ai/cache" folder to be Show thumbnails for image files. Needs the "/_{{pkg.name}}/cache" folder to be
writable for the web Server. writable for the web Server.
- img thumbnails depend on PHP-GD - img thumbnails depend on PHP-GD
- mov thumbnails depend on ffmpeg - mov thumbnails depend on ffmpeg
@ -303,6 +307,7 @@ Options
*/ */
"tree": { "tree": {
"enabled": true, "enabled": true,
"slide": true "slide": true,
"maxSubfolders": 50
} }
} }