mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-03-22 05:19:56 +01:00
Adds folderstatus extension for aai mode. Updates default options for upcoming release.
This commit is contained in:
parent
57d6ef9520
commit
138fc4d43c
@ -82,13 +82,10 @@ 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);
|
||||
event.sub('entry.removed', onContentChanged);
|
||||
// event.sub('entry.created', onContentChanged);
|
||||
// event.sub('entry.removed', onContentChanged);
|
||||
event.sub('entry.changed', onContentChanged);
|
||||
};
|
||||
|
||||
|
30
src/_h5ai/client/js/inc/ext/folderstatus.js
Normal file
30
src/_h5ai/client/js/inc/ext/folderstatus.js
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
modulejs.define('ext/folderstatus', ['_', '$', 'core/settings', 'core/event', 'core/entry'], function (_, $, allsettings, event, entry) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
maxChecks: 16,
|
||||
delay: 2000
|
||||
}, allsettings.folderstatus),
|
||||
|
||||
init = function () {
|
||||
|
||||
if (!settings.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.sub('ready', function () {
|
||||
|
||||
var count = 0;
|
||||
_.each(entry.content, function (e) {
|
||||
|
||||
if (e.isFolder() && e.status === null && count <= settings.maxChecks) {
|
||||
count += 1;
|
||||
setTimeout(function () { e.fetchStatus(); }, settings.delay);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
init();
|
||||
});
|
@ -110,6 +110,10 @@ modulejs.define('model/entry', ['$', '_', 'core/types', 'core/event', 'core/sett
|
||||
|
||||
var self = getEntry(absHref);
|
||||
|
||||
if (!_.isFunction(callback)) {
|
||||
callback = function () {};
|
||||
}
|
||||
|
||||
if (self.status !== null) {
|
||||
callback(self);
|
||||
} else {
|
||||
@ -130,6 +134,10 @@ modulejs.define('model/entry', ['$', '_', 'core/types', 'core/event', 'core/sett
|
||||
|
||||
var self = getEntry(absHref);
|
||||
|
||||
if (!_.isFunction(callback)) {
|
||||
callback = function () {};
|
||||
}
|
||||
|
||||
if (self.isContentFetched) {
|
||||
callback(self);
|
||||
} else {
|
||||
|
@ -2,11 +2,8 @@
|
||||
modulejs.define('view/extended', ['_', '$', 'core/settings', 'core/resource', 'core/format', 'core/event', 'core/entry'], function (_, $, allsettings, resource, format, event, entry) {
|
||||
|
||||
var settings = _.extend({
|
||||
modes: ['details', 'icons'],
|
||||
setParentFolderLabels: false,
|
||||
binaryPrefix: false,
|
||||
maxFolders: 16,
|
||||
delay: 2000
|
||||
binaryPrefix: false
|
||||
}, allsettings.view),
|
||||
|
||||
template = '<li class="entry">' +
|
||||
@ -153,20 +150,6 @@ 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);
|
||||
|
@ -1,12 +1,11 @@
|
||||
|
||||
modulejs.define('view/viewmode', ['_', '$', 'core/settings', 'core/resource', 'core/store'], function (_, $, allsettings, resource, store) {
|
||||
|
||||
var defaults = {
|
||||
modes: ['details', 'list', 'grid', 'icons'],
|
||||
setParentFolderLabels: false
|
||||
},
|
||||
var modes = ['details', 'list', 'grid', 'icons'],
|
||||
|
||||
settings = _.extend({}, defaults, allsettings.view),
|
||||
settings = _.extend({}, {
|
||||
modes: modes
|
||||
}, allsettings.view),
|
||||
|
||||
storekey = 'h5ai.viewmode',
|
||||
|
||||
@ -24,7 +23,7 @@ modulejs.define('view/viewmode', ['_', '$', 'core/settings', 'core/resource', 'c
|
||||
viewmode = _.indexOf(settings.modes, viewmode) >= 0 ? viewmode : settings.modes[0];
|
||||
store.put(storekey, viewmode);
|
||||
|
||||
_.each(defaults.modes, function (mode) {
|
||||
_.each(modes, function (mode) {
|
||||
if (mode === viewmode) {
|
||||
$('#view-' + mode).addClass('current');
|
||||
$extended.addClass('view-' + mode).show();
|
||||
@ -39,10 +38,10 @@ modulejs.define('view/viewmode', ['_', '$', 'core/settings', 'core/resource', 'c
|
||||
|
||||
var $navbar = $('#navbar');
|
||||
|
||||
settings.modes = _.intersection(settings.modes, defaults.modes);
|
||||
settings.modes = _.intersection(settings.modes, modes);
|
||||
|
||||
if (settings.modes.length > 1) {
|
||||
_.each(defaults.modes.reverse(), function (mode) {
|
||||
_.each(modes.reverse(), function (mode) {
|
||||
if (_.indexOf(settings.modes, mode) >= 0) {
|
||||
$(template.replace(/\[MODE\]/g, mode))
|
||||
.appendTo($navbar)
|
||||
|
@ -6,8 +6,9 @@ Options
|
||||
*/
|
||||
|
||||
{
|
||||
/*
|
||||
/* [all]
|
||||
Spacing of the main content.
|
||||
|
||||
Left and right will be added to a minimum of 30px. Top and bottom
|
||||
are calculated relative to the top and bottom bar heights.
|
||||
*/
|
||||
@ -19,28 +20,25 @@ Options
|
||||
"left": "auto"
|
||||
},
|
||||
|
||||
/*
|
||||
An array of view modes the user may choose from. Currently there
|
||||
are two possible values: "details", "icons", "grid", and "list".
|
||||
The first value indicates the default view mode. If only one value
|
||||
is given the view mode is fixed and the selector buttons are hidden.
|
||||
The user selected view mode is also stored local in modern browsers
|
||||
so that it will be persistent.
|
||||
/* [all]
|
||||
General view options.
|
||||
|
||||
- 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
|
||||
- modes: array of "details", "icons", "grid" and/or "list"
|
||||
the first value indicates the default view mode. If only one value
|
||||
is given the view mode is fixed and the selector buttons are hidden.
|
||||
The user selected view mode is also stored local in modern browsers
|
||||
so that it will be persistent.
|
||||
- setParentFolderLabels: set parent folder labels to real folder names
|
||||
- binaryPrefix: set to true uses 1024B=1KiB when formatting file sizes (see http://en.wikipedia.org/wiki/Binary_prefix)
|
||||
- indexFiles [php only]: consider folder with those files as non {{pkg.name}} folders
|
||||
- ignore [php only]: don't list items matching these regular expressions
|
||||
*/
|
||||
"view": {
|
||||
"modes": ["details", "list", "grid", "icons"],
|
||||
"modes": ["details", "icons"],
|
||||
"setParentFolderLabels": true,
|
||||
"binaryPrefix": false,
|
||||
"indexFiles": ["index.html", "index.htm", "index.php"],
|
||||
"ignore": ["^\\.", "^_{{pkg.name}}"],
|
||||
"maxFolders": 16
|
||||
"ignore": ["^\\.", "^_{{pkg.name}}"]
|
||||
},
|
||||
|
||||
|
||||
@ -48,14 +46,12 @@ Options
|
||||
/*** Extensions (in alphabetical order) ***/
|
||||
|
||||
/* [php]
|
||||
Watch current folder content.
|
||||
Folders possibly visible in the tree view that are not the
|
||||
current folder might not be updated.
|
||||
Watch and update current folder content.
|
||||
|
||||
- interval: number, update interval in milliseconds, at least 1000
|
||||
*/
|
||||
"autorefresh": {
|
||||
"enabled": true,
|
||||
"enabled": false,
|
||||
"interval": 5000
|
||||
},
|
||||
|
||||
@ -71,7 +67,7 @@ Options
|
||||
in each folder.
|
||||
*/
|
||||
"custom": {
|
||||
"enabled": true,
|
||||
"enabled": false,
|
||||
"header": "_{{pkg.name}}.header.html",
|
||||
"footer": "_{{pkg.name}}.footer.html"
|
||||
},
|
||||
@ -80,7 +76,7 @@ Options
|
||||
Allow file deletion.
|
||||
*/
|
||||
"delete": {
|
||||
"enabled": true
|
||||
"enabled": false
|
||||
},
|
||||
|
||||
/* [php, EXPERIMENTAL]
|
||||
@ -91,7 +87,7 @@ Options
|
||||
- maxfilesize: number, file size is in MB
|
||||
*/
|
||||
"dropbox": {
|
||||
"enabled": true,
|
||||
"enabled": false,
|
||||
"maxfiles": 10,
|
||||
"maxfilesize": 1000
|
||||
},
|
||||
@ -104,7 +100,7 @@ Options
|
||||
- packageName: basename of the download package, null for current foldername
|
||||
*/
|
||||
"download": {
|
||||
"enabled": true,
|
||||
"enabled": false,
|
||||
"execution": "shell",
|
||||
"format": "zip",
|
||||
"packageName": null
|
||||
@ -130,6 +126,18 @@ Options
|
||||
"enabled": true
|
||||
},
|
||||
|
||||
/* [aai]
|
||||
Fetch status for subfolders of the current folder.
|
||||
|
||||
- maxChecks: number, max number of status requests in the current folder
|
||||
- delay: number, delay in milliseconds after "dom-ready" before starting the requests
|
||||
*/
|
||||
"folderstatus": {
|
||||
"enabled": false,
|
||||
"maxChecks": 16,
|
||||
"delay": 2000
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Adds Google Analytics asynchronous tracking code.
|
||||
|
||||
@ -144,7 +152,7 @@ Options
|
||||
see: http://support.google.com/googleanalytics/bin/topic.py?hl=en&topic=27612
|
||||
*/
|
||||
"google-analytics": {
|
||||
"enabled": true,
|
||||
"enabled": false,
|
||||
"gaq": []
|
||||
},
|
||||
|
||||
@ -178,7 +186,7 @@ Options
|
||||
2: mode, servername and -version
|
||||
*/
|
||||
"mode": {
|
||||
"enabled": true,
|
||||
"enabled": false,
|
||||
"display": 2
|
||||
},
|
||||
|
||||
@ -248,7 +256,7 @@ Options
|
||||
- size: width and height in pixel
|
||||
*/
|
||||
"qrcode": {
|
||||
"enabled": true,
|
||||
"enabled": false,
|
||||
"size": 150
|
||||
},
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user