mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-03-24 06:20:07 +01:00
Performance improvements in aai mode. Minor changes.
This commit is contained in:
parent
d7f1c68366
commit
15dd200b28
@ -3,6 +3,7 @@
|
||||
position: fixed;
|
||||
z-index: 5;
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
left: 0;
|
||||
top: 0;
|
||||
.vert-gradient(rgb(241,241,241), rgb(228,228,228));
|
||||
|
@ -93,6 +93,11 @@
|
||||
margin: 0;
|
||||
padding: 0 0 0 24px;
|
||||
}
|
||||
.summary {
|
||||
margin: 0 0 0 24px;
|
||||
color: #999;
|
||||
font-style: italic;
|
||||
}
|
||||
.current {
|
||||
> a, > a:active, > a:visited {
|
||||
background-color: rgba(255,255,255,0.5);
|
||||
|
@ -82,6 +82,9 @@ modulejs.define('ext/crumb', ['_', '$', 'core/settings', 'core/resource', 'core/
|
||||
_.each(crumb, function (e) {
|
||||
|
||||
$ul.append(update(e));
|
||||
|
||||
// needed by aai
|
||||
// e.fetchStatus(function (e) { update(e); });
|
||||
});
|
||||
|
||||
event.sub('entry.created', onContentChanged);
|
||||
|
@ -3,7 +3,8 @@ modulejs.define('ext/tree', ['_', '$', 'core/settings', 'core/resource', 'core/e
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
slide: true
|
||||
slide: true,
|
||||
maxSubfolders: 50
|
||||
}, allsettings.tree),
|
||||
|
||||
template = '<div class="entry">' +
|
||||
@ -75,10 +76,17 @@ modulejs.define('ext/tree', ['_', '$', 'core/settings', 'core/resource', 'core/e
|
||||
|
||||
// does it have subfolders?
|
||||
if (subfolders.length) {
|
||||
var $ul = $('<ul class="content"/>').appendTo($html);
|
||||
var $ul = $('<ul class="content"/>').appendTo($html),
|
||||
counter = 0;
|
||||
_.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) {
|
||||
$ul.hide();
|
||||
}
|
||||
@ -232,9 +240,11 @@ modulejs.define('ext/tree', ['_', '$', 'core/settings', 'core/resource', 'core/e
|
||||
});
|
||||
|
||||
event.sub('ready', adjustSpacing);
|
||||
event.sub('entry.changed', onContentChanged);
|
||||
event.sub('entry.created', onContentChanged);
|
||||
event.sub('entry.removed', onContentChanged);
|
||||
|
||||
// strong negative performance impact in aai mode
|
||||
// event.sub('entry.changed', onContentChanged);
|
||||
// event.sub('entry.created', onContentChanged);
|
||||
// event.sub('entry.removed', onContentChanged);
|
||||
|
||||
$(window).on('resize', function () {
|
||||
|
||||
|
@ -4,7 +4,9 @@ modulejs.define('view/extended', ['_', '$', 'core/settings', 'core/resource', 'c
|
||||
var settings = _.extend({
|
||||
modes: ['details', 'icons'],
|
||||
setParentFolderLabels: false,
|
||||
binaryPrefix: false
|
||||
binaryPrefix: false,
|
||||
maxFolders: 16,
|
||||
delay: 2000
|
||||
}, allsettings.view),
|
||||
|
||||
template = '<li class="entry">' +
|
||||
@ -111,9 +113,6 @@ modulejs.define('view/extended', ['_', '$', 'core/settings', 'core/resource', 'c
|
||||
_.each(entry.content, function (e) {
|
||||
|
||||
$ul.append(update(e));
|
||||
|
||||
// needed by aai
|
||||
e.fetchStatus(function (e) { update(e); });
|
||||
});
|
||||
|
||||
$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);
|
||||
|
@ -33,16 +33,20 @@ Options
|
||||
The user selected view mode is also stored local in modern browsers
|
||||
so that it will be persistent.
|
||||
|
||||
Set parent folder labels to real folder names.
|
||||
Binary prefix set to true uses 1024B=1KiB when formatting
|
||||
file sizes (see http://en.wikipedia.org/wiki/Binary_prefix).
|
||||
- setParentFolderLabels [all]: set parent folder labels to real folder names
|
||||
- binaryPrefix [all]: set to true uses 1024B=1KiB when formatting file sizes
|
||||
(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": {
|
||||
"modes": ["details", "list", "grid", "icons"],
|
||||
"setParentFolderLabels": true,
|
||||
"binaryPrefix": false,
|
||||
"indexFiles": ["index.html", "index.htm", "index.php"],
|
||||
"ignore": ["^\\.", "^_{{pkg.name}}"]
|
||||
"ignore": ["^\\.", "^_{{pkg.name}}"],
|
||||
"maxFolders": 16
|
||||
},
|
||||
|
||||
|
||||
@ -274,7 +278,7 @@ Options
|
||||
},
|
||||
|
||||
/* [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.
|
||||
- img thumbnails depend on PHP-GD
|
||||
- mov thumbnails depend on ffmpeg
|
||||
@ -303,6 +307,7 @@ Options
|
||||
*/
|
||||
"tree": {
|
||||
"enabled": true,
|
||||
"slide": true
|
||||
"slide": true,
|
||||
"maxSubfolders": 50
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user