More changes in js.
This commit is contained in:
parent
318fefbbfd
commit
abb9b7bd0e
14 changed files with 597 additions and 543 deletions
|
@ -97,62 +97,6 @@ modulejs.define('core/ajax', ['$', 'amplify', 'base64', 'core/resource'], functi
|
|||
});
|
||||
},
|
||||
|
||||
getThumbSrc = function (data, callback) {
|
||||
|
||||
$.ajax({
|
||||
url: resource.api(),
|
||||
data: {
|
||||
action: 'getthumbsrc',
|
||||
type: data.type,
|
||||
href: data.href,
|
||||
mode: data.mode,
|
||||
width: data.width,
|
||||
height: data.height
|
||||
},
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
success: function (json) {
|
||||
|
||||
if (json.code === 0) {
|
||||
callback(json.absHref);
|
||||
}
|
||||
callback();
|
||||
},
|
||||
error: function () {
|
||||
|
||||
callback();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getThumbSrcSmall = function (type, href, callback) {
|
||||
|
||||
getThumbSrc(
|
||||
{
|
||||
type: type,
|
||||
href: href,
|
||||
mode: 'square',
|
||||
width: 16,
|
||||
height: 16
|
||||
},
|
||||
callback
|
||||
);
|
||||
},
|
||||
|
||||
getThumbSrcBig = function (type, href, callback) {
|
||||
|
||||
getThumbSrc(
|
||||
{
|
||||
type: type,
|
||||
href: href,
|
||||
mode: 'rational',
|
||||
width: 100,
|
||||
height: 48
|
||||
},
|
||||
callback
|
||||
);
|
||||
},
|
||||
|
||||
getHtml = function (url, callback) {
|
||||
|
||||
$.ajax({
|
||||
|
@ -176,8 +120,6 @@ modulejs.define('core/ajax', ['$', 'amplify', 'base64', 'core/resource'], functi
|
|||
getChecks: getChecks,
|
||||
getEntries: getEntries,
|
||||
getArchive: getArchive,
|
||||
getThumbSrcSmall: getThumbSrcSmall,
|
||||
getThumbSrcBig: getThumbSrcBig,
|
||||
getHtml: getHtml
|
||||
};
|
||||
});
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
|
||||
modulejs.define('core/refresh', ['_', 'core/mode', 'core/ajax', 'model/entry'], function (_, mode, ajax, Entry) {
|
||||
modulejs.define('core/refresh', ['_', 'core/server', 'model/entry'], function (_, server, Entry) {
|
||||
|
||||
var parseJson = function (entry, json) {
|
||||
|
||||
var found = {};
|
||||
|
||||
_.each(json, function (jsonEntry) {
|
||||
_.each(json.entries, function (jsonEntry) {
|
||||
|
||||
found[jsonEntry.absHref] = true;
|
||||
Entry.get(jsonEntry.absHref, jsonEntry.time, jsonEntry.size, jsonEntry.status, jsonEntry.content);
|
||||
|
@ -18,16 +18,18 @@ modulejs.define('core/refresh', ['_', 'core/mode', 'core/ajax', 'model/entry'],
|
|||
});
|
||||
},
|
||||
|
||||
refresh = function () {
|
||||
|
||||
if (mode.id !== 'php') {
|
||||
return;
|
||||
}
|
||||
refresh = function (callback) {
|
||||
|
||||
var entry = Entry.get();
|
||||
ajax.getEntries(entry.absHref, 1, function (json) {
|
||||
|
||||
server.request({action: 'get', entries: true, entriesHref: entry.absHref, entriesWhat: 1}, function (json) {
|
||||
|
||||
if (json) {
|
||||
parseJson(entry, json);
|
||||
}
|
||||
if (_.isFunction(callback)) {
|
||||
callback(entry);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
|
108
src/_h5ai/client/js/inc/core/server.js
Normal file
108
src/_h5ai/client/js/inc/core/server.js
Normal file
|
@ -0,0 +1,108 @@
|
|||
|
||||
modulejs.define('core/server', ['$', '_', 'config', 'base64'], function ($, _, config, base64) {
|
||||
|
||||
var server = _.extend({}, config.server, {
|
||||
|
||||
request: function (data, callback) {
|
||||
|
||||
if (!server.apiHref) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: server.apiHref,
|
||||
data: data,
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
success: function (json) {
|
||||
|
||||
callback(json);
|
||||
},
|
||||
error: function () {
|
||||
|
||||
callback();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
requestArchive: function (data, callback) {
|
||||
|
||||
if (!server.apiHref) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: server.apiHref,
|
||||
data: {
|
||||
action: 'archive',
|
||||
execution: data.execution,
|
||||
format: data.format,
|
||||
hrefs: data.hrefs
|
||||
},
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
beforeSend: function (xhr) {
|
||||
|
||||
if (data.user) {
|
||||
xhr.setRequestHeader('Authorization', 'Basic ' + base64.encode(data.user + ':' + data.password));
|
||||
}
|
||||
},
|
||||
success: function (json) {
|
||||
|
||||
callback(json);
|
||||
},
|
||||
error: function () {
|
||||
|
||||
callback();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
requestThumb: function (data, callback) {
|
||||
|
||||
server.request({
|
||||
action: 'getthumbsrc',
|
||||
type: data.type,
|
||||
href: data.href,
|
||||
mode: data.mode,
|
||||
width: data.width,
|
||||
height: data.height
|
||||
}, function (json) {
|
||||
|
||||
callback(json && json.code === 0 ? json.absHref : null);
|
||||
});
|
||||
},
|
||||
|
||||
requestThumbSmall: function (type, href, callback) {
|
||||
|
||||
server.requestThumb(
|
||||
{
|
||||
type: type,
|
||||
href: href,
|
||||
mode: 'square',
|
||||
width: 16,
|
||||
height: 16
|
||||
},
|
||||
callback
|
||||
);
|
||||
},
|
||||
|
||||
requestThumbBig: function (type, href, callback) {
|
||||
|
||||
server.requestThumb(
|
||||
{
|
||||
type: type,
|
||||
href: href,
|
||||
mode: 'rational',
|
||||
width: 100,
|
||||
height: 48
|
||||
},
|
||||
callback
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
return server;
|
||||
});
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
modulejs.define('ext/mode', ['_', '$', 'core/mode', 'core/settings'], function (_, $, mode, allsettings) {
|
||||
modulejs.define('ext/mode', ['_', '$', 'core/settings', 'core/server'], function (_, $, allsettings, server) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
|
@ -14,18 +14,18 @@ modulejs.define('ext/mode', ['_', '$', 'core/mode', 'core/settings'], function (
|
|||
|
||||
var info = '';
|
||||
|
||||
if (mode.id) {
|
||||
info += mode.id;
|
||||
if (server.backend) {
|
||||
info += server.backend;
|
||||
}
|
||||
if (settings.display > 0 && mode.serverName) {
|
||||
info += (info ? ' on ' : '') + mode.serverName;
|
||||
if (settings.display > 0 && server.name) {
|
||||
info += (info ? ' on ' : '') + server.name;
|
||||
}
|
||||
if (settings.display > 1 && mode.serverVersion) {
|
||||
info += (info ? '-' : '') + mode.serverVersion;
|
||||
if (settings.display > 1 && server.version) {
|
||||
info += (info ? '-' : '') + server.version;
|
||||
}
|
||||
|
||||
if (info) {
|
||||
$('#h5ai-reference').append(' (' + info + ')');
|
||||
$('#bottombar .left').append('<span id="server-mode"> (' + info + ') </span>');
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
modulejs.define('ext/thumbnails', ['_', 'core/settings', 'core/entry', 'core/event', 'core/ajax'], function (_, allsettings, entry, event, ajax) {
|
||||
modulejs.define('ext/thumbnails', ['_', 'core/settings', 'core/entry', 'core/event', 'core/server'], function (_, allsettings, entry, event, server) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
|
@ -24,13 +24,13 @@ modulejs.define('ext/thumbnails', ['_', 'core/settings', 'core/entry', 'core/eve
|
|||
}
|
||||
|
||||
if (type) {
|
||||
ajax.getThumbSrcSmall(type, entry.absHref, function (src) {
|
||||
server.requestThumbSmall(type, entry.absHref, function (src) {
|
||||
|
||||
if (src) {
|
||||
entry.$extended.find('.icon.small img').addClass('thumb').attr('src', src);
|
||||
}
|
||||
});
|
||||
ajax.getThumbSrcBig(type, entry.absHref, function (src) {
|
||||
server.requestThumbBig(type, entry.absHref, function (src) {
|
||||
|
||||
if (src) {
|
||||
entry.$extended.find('.icon.big img').addClass('thumb').attr('src', src);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
modulejs.define('h5ai-info', ['$', 'core/ajax'], function ($, ajax) {
|
||||
modulejs.define('h5ai-info', ['$', 'core/server'], function ($, server) {
|
||||
|
||||
var setCheckResult = function (id, result) {
|
||||
|
||||
|
@ -14,7 +14,7 @@ modulejs.define('h5ai-info', ['$', 'core/ajax'], function ($, ajax) {
|
|||
|
||||
init = function () {
|
||||
|
||||
ajax.getChecks(function (json) {
|
||||
server.request({action: 'get', checks: true}, function (json) {
|
||||
|
||||
if (json) {
|
||||
$('.test').each(function () {
|
||||
|
|
|
@ -15,54 +15,27 @@
|
|||
// @include "lib/base64.js"
|
||||
// @include "lib/spin-*.js"
|
||||
|
||||
// h5ai
|
||||
// ----
|
||||
// app
|
||||
// ---
|
||||
(function ($) {
|
||||
'use strict';
|
||||
|
||||
// @include "inc/**/*.js"
|
||||
|
||||
var $scriptTag = $('script[src$="scripts.js"]'),
|
||||
globalConfigHref = $scriptTag.attr('src').replace(/scripts.js$/, '../../conf/config.json'),
|
||||
localConfigHref = $scriptTag.data('config') || './_h5ai.config.json',
|
||||
var filename = 'client/js/scripts.js',
|
||||
$scriptTag = $('script[src$="' + filename + '"]'),
|
||||
src = $scriptTag.attr('src'),
|
||||
main = $scriptTag.data('main'),
|
||||
backend = $scriptTag.data('backend'),
|
||||
|
||||
parse = function (response) {
|
||||
appHref = src.substr(0, src.length - filename.length),
|
||||
|
||||
return response.replace ? JSON.parse(response.replace(/\/\*[\s\S]*?\*\/|\/\/.*?(\n|$)/g, '')) : {};
|
||||
},
|
||||
loadCommentedJson = function (href, callback) {
|
||||
|
||||
extendLevel1 = function (a, b) {
|
||||
$.ajax(href, {dataType: 'text'}).always(function (response) {
|
||||
|
||||
$.each(b, function (key) {
|
||||
|
||||
$.extend(a[key], b[key]);
|
||||
});
|
||||
},
|
||||
|
||||
loadConfig = function (callback) {
|
||||
|
||||
var ajaxOpts = {
|
||||
dataType: 'text'
|
||||
},
|
||||
config = {
|
||||
options: {},
|
||||
types: {},
|
||||
langs: {}
|
||||
};
|
||||
|
||||
$.ajax(globalConfigHref, ajaxOpts).always(function (g) {
|
||||
|
||||
extendLevel1(config, parse(g));
|
||||
if (localConfigHref === 'ignore') {
|
||||
callback(config);
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax(localConfigHref, ajaxOpts).always(function (l) {
|
||||
|
||||
extendLevel1(config, parse(l));
|
||||
callback(config);
|
||||
});
|
||||
var json = response.replace ? JSON.parse(response.replace(/\/\*[\s\S]*?\*\/|\/\/.*?(\n|$)/g, '')) : {};
|
||||
callback(json);
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -79,12 +52,42 @@
|
|||
modulejs.define('moment', function () { return moment; });
|
||||
modulejs.define('_', function () { return _; });
|
||||
|
||||
$(function () {
|
||||
|
||||
modulejs.require($('body').attr('id'));
|
||||
});
|
||||
$(function () { modulejs.require(main); });
|
||||
};
|
||||
|
||||
loadConfig(run);
|
||||
|
||||
if (backend === 'php') {
|
||||
|
||||
$.getJSON(appHref + 'server/php/api.php', {
|
||||
action: 'get',
|
||||
options: true,
|
||||
types: true,
|
||||
langs: true,
|
||||
server: true
|
||||
}, run);
|
||||
|
||||
} else if (backend === 'aai') {
|
||||
|
||||
loadCommentedJson(appHref + 'conf/options.json', function (options) {
|
||||
loadCommentedJson(appHref + 'conf/types.json', function (types) {
|
||||
loadCommentedJson(appHref + 'conf/langs.json', function (langs) {
|
||||
|
||||
var config = {
|
||||
options: options,
|
||||
types: types,
|
||||
langs: langs,
|
||||
server: {
|
||||
backend: backend,
|
||||
apiHref: null,
|
||||
name: 'apache',
|
||||
version: null
|
||||
}
|
||||
};
|
||||
|
||||
run(config);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}(jQuery));
|
||||
|
|
|
@ -1,417 +0,0 @@
|
|||
/*
|
||||
{{pkg.name}} {{pkg.version}}
|
||||
{{pkg.url}}
|
||||
|
||||
Configuration
|
||||
options, types and langs
|
||||
*/
|
||||
|
||||
{
|
||||
"options": {
|
||||
|
||||
/*
|
||||
The absolute link to {{pkg.name}}.
|
||||
Must point to the "_{{pkg.name}}" directory.
|
||||
*/
|
||||
"h5aiAbsHref": "/_{{pkg.name}}/",
|
||||
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
"spacing": {
|
||||
"maxWidth": 960,
|
||||
"top": 50,
|
||||
"right": "auto",
|
||||
"bottom": 50,
|
||||
"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.
|
||||
|
||||
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).
|
||||
*/
|
||||
"view": {
|
||||
"modes": ["details", "list", "grid", "icons"],
|
||||
"setParentFolderLabels": true,
|
||||
"binaryPrefix": false,
|
||||
"indexFiles": ["index.html", "index.htm", "index.php"],
|
||||
"ignore": ["^\\.", "^_{{pkg.name}}"]
|
||||
},
|
||||
|
||||
|
||||
|
||||
/*** 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.
|
||||
|
||||
Interval will be a least 1000 milliseconds.
|
||||
*/
|
||||
"autorefresh": {
|
||||
"enabled": true,
|
||||
"interval": 5000
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Show a clickable breadcrumb.
|
||||
*/
|
||||
"crumb": {
|
||||
"enabled": true
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Filenames of customized header and footer files to look for
|
||||
in each folder.
|
||||
*/
|
||||
"custom": {
|
||||
"enabled": true,
|
||||
"header": "_{{pkg.name}}.header.html",
|
||||
"footer": "_{{pkg.name}}.footer.html"
|
||||
},
|
||||
|
||||
/* [php]
|
||||
Allow file deletion.
|
||||
*/
|
||||
"delete": {
|
||||
"enabled": true
|
||||
},
|
||||
|
||||
/* [php]
|
||||
File upload via drag'n'drop. Folders are not supported.
|
||||
The working file size seems to be very browser dependent.
|
||||
|
||||
Max file size is in MB.
|
||||
*/
|
||||
"dropbox": {
|
||||
"enabled": true,
|
||||
"maxfiles": 10,
|
||||
"maxfilesize": 1000
|
||||
},
|
||||
|
||||
/* [php]
|
||||
Enable packaged download of selected entries.
|
||||
Execution: "php", "shell".
|
||||
Supported formats: "tar", "zip".
|
||||
*/
|
||||
"download": {
|
||||
"enabled": true,
|
||||
"execution": "php",
|
||||
"format": "zip"
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Allow filtering the displayed files and folders.
|
||||
Will check entries for right order of characters, i.e.
|
||||
"ab" matches "ab", "axb", "xaxbx" but not "ba".
|
||||
Space separated sequences get OR-ed.
|
||||
|
||||
Filters will be treated as JavaScript regular expressions
|
||||
if you prefix them with "re:".
|
||||
*/
|
||||
"filter": {
|
||||
"enabled": true
|
||||
},
|
||||
|
||||
/* [php]
|
||||
Calc the size of folders.
|
||||
Depends on du.
|
||||
*/
|
||||
"foldersize": {
|
||||
"enabled": true
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Adds Google Analytics asynchronous tracking code.
|
||||
|
||||
for example:
|
||||
"gaq": [
|
||||
["_setAccount", "UA-xxxxxx-x"],
|
||||
["_setDomainName", ".your-domain.tld"],
|
||||
["_trackPageview"],
|
||||
["_trackPageLoadTime"]
|
||||
]
|
||||
|
||||
see: http://support.google.com/googleanalytics/bin/topic.py?hl=en&topic=27612
|
||||
*/
|
||||
"google-analytics": {
|
||||
"enabled": true,
|
||||
"gaq": []
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Localization, for example "en", "de" etc. - see "langs" below for
|
||||
possible values. Adjust it to your needs. If lang is not found in
|
||||
"langs" it defaults to "en".
|
||||
|
||||
Optionally try to use browser language, falls back to previous
|
||||
specified language.
|
||||
*/
|
||||
"l10n": {
|
||||
"enabled": true,
|
||||
"lang": "en",
|
||||
"useBrowserLang": true
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Link the hover effects between crumb, main view and tree.
|
||||
*/
|
||||
"link-hover-states": {
|
||||
"enabled": true
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Shows the server mode in the bottom left corner.
|
||||
display values:
|
||||
0: only show mode
|
||||
1: mode and servername
|
||||
2: mode, servername and -version
|
||||
*/
|
||||
"mode": {
|
||||
"enabled": true,
|
||||
"display": 2
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Adds Piwik tracker javascript code.
|
||||
"baseURL" without protocol
|
||||
*/
|
||||
"piwik-analytics": {
|
||||
"enabled": false,
|
||||
"baseURL": "mydomain.tld/piwik",
|
||||
"idSite": 1
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Show an image preview on click.
|
||||
*/
|
||||
"preview-img": {
|
||||
"enabled": true,
|
||||
"types": ["bmp", "gif", "ico", "image", "jpg", "png", "tiff"]
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Show text file preview on click.
|
||||
"types" maps file types to SyntaxHighligher brushes. Special case: "markdown" will
|
||||
be rendered as HTML.
|
||||
|
||||
For available brushes see http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/
|
||||
*/
|
||||
"preview-txt": {
|
||||
"enabled": true,
|
||||
"types": {
|
||||
"authors": "plain",
|
||||
"copying": "plain",
|
||||
"c": "c",
|
||||
"cpp": "cpp",
|
||||
"css": "css",
|
||||
"diff": "diff",
|
||||
"h": "c",
|
||||
"hpp": "cpp",
|
||||
"install": "plain",
|
||||
"log": "plain",
|
||||
"java": "java",
|
||||
"makefile": "xml",
|
||||
"markdown": "plain",
|
||||
/*"php": "php",*/
|
||||
"python": "python",
|
||||
"readme": "plain",
|
||||
"rb": "ruby",
|
||||
"rtf": "plain",
|
||||
"script": "shell",
|
||||
"text": "plain",
|
||||
"js": "js",
|
||||
"xml": "xml"
|
||||
}
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Show QRCodes on hovering files.
|
||||
*/
|
||||
"qrcode": {
|
||||
"enabled": true,
|
||||
"size": 150
|
||||
},
|
||||
|
||||
/* [php]
|
||||
Allow to rename files.
|
||||
*/
|
||||
"rename": {
|
||||
"enabled": false
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Make entries selectable. At the moment only needed for packaged download and delete.
|
||||
*/
|
||||
"select": {
|
||||
"enabled": true
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Default sort order is a two letter code. The first letter specifies
|
||||
the column: "n" for "Name", "d" for "Date" or "s" for "Size". The
|
||||
second letter specifies the sort order: "a" for "ascending" or "d"
|
||||
for "descending".
|
||||
*/
|
||||
"sort": {
|
||||
"enabled": true,
|
||||
"order": "na"
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Show additional info in a statusbar.
|
||||
*/
|
||||
"statusbar": {
|
||||
"enabled": true
|
||||
},
|
||||
|
||||
/* [php]
|
||||
Show thumbnails for image files. Needs the "/_h5ai/cache" folder to be
|
||||
writable for the web Server.
|
||||
- img thumbnails depend on PHP-GD
|
||||
- mov thumbnails depend on ffmpeg
|
||||
- doc thumbnails depend on convert
|
||||
*/
|
||||
"thumbnails": {
|
||||
"enabled": true,
|
||||
"img": ["bmp", "gif", "ico", "image", "jpg", "png", "tiff"],
|
||||
"mov": ["video"],
|
||||
"doc": ["pdf", "ps"],
|
||||
"delay": 1
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Replace window title with current breadcrumb.
|
||||
*/
|
||||
"title": {
|
||||
"enabled": true
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Show a folder tree.
|
||||
Note that this might affect performance significantly.
|
||||
|
||||
Slide tree bar into viewport if there is enough space.
|
||||
*/
|
||||
"tree": {
|
||||
"enabled": true,
|
||||
"slide": true
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
/*** File types mapped to file extensions ***/
|
||||
|
||||
"types": {
|
||||
"archive": [".tar.bz2", ".tar.gz", ".tgz"],
|
||||
"audio": [".aif", ".flac", ".m4a", ".mid", ".mp3", ".mpa", ".ra", ".ogg", ".wav", ".wma"],
|
||||
"authors": ["authors"],
|
||||
"bin": [".class", ".o", ".so"],
|
||||
"blank": [],
|
||||
"bmp": [".bmp"],
|
||||
"c": [".c"],
|
||||
"calc": [".ods", ".ots", ".xlr", ".xls", ".xlsx"],
|
||||
"cd": [".cue", ".iso"],
|
||||
"copying": ["copying", "license"],
|
||||
"cpp": [".cpp"],
|
||||
"css": [".css", ".less"],
|
||||
"deb": [".deb"],
|
||||
"default": [],
|
||||
"diff": [".diff", ".patch"],
|
||||
"doc": [".doc", ".docx", ".odm", ".odt", ".ott"],
|
||||
"draw": [".drw"],
|
||||
"eps": [".eps"],
|
||||
"exe": [".bat", ".cmd", ".exe"],
|
||||
"folder": [],
|
||||
"folder-home": [],
|
||||
"folder-open": [],
|
||||
"folder-page": [],
|
||||
"folder-parent": [],
|
||||
"gif": [".gif"],
|
||||
"gzip": [".gz"],
|
||||
"h": [".h"],
|
||||
"hpp": [".hpp"],
|
||||
"html": [".htm", ".html", ".shtml"],
|
||||
"ico": [".ico"],
|
||||
"image": [".svg", ".xpm"],
|
||||
"install": ["install"],
|
||||
"java": [".java"],
|
||||
"jpg": [".jpg", ".jpeg"],
|
||||
"js": [".js", ".json"],
|
||||
"log": [".log", "changelog"],
|
||||
"makefile": [".pom", "build.xml", "pom.xml"],
|
||||
"markdown": [".markdown", ".md"],
|
||||
"package": [],
|
||||
"pdf": [".pdf"],
|
||||
"php": [".php"],
|
||||
"playlist": [".m3u", ".m3u8", ".pls"],
|
||||
"png": [".png"],
|
||||
"pres": [".odp", ".otp", ".pps", ".ppt", ".pptx"],
|
||||
"ps": [".ps"],
|
||||
"psd": [".psd"],
|
||||
"py": [".py"],
|
||||
"rar": [".rar"],
|
||||
"rb": [".rb"],
|
||||
"readme": ["readme"],
|
||||
"rpm": [".rpm"],
|
||||
"rss": [".rss"],
|
||||
"rtf": [".rtf"],
|
||||
"script": [".conf", ".csh", ".ini", ".ksh", ".sh", ".shar", ".tcl"],
|
||||
"source": [],
|
||||
"sql": [],
|
||||
"tar": [".tar"],
|
||||
"tex": [".tex"],
|
||||
"text": [".text", ".txt"],
|
||||
"tiff": [".tiff"],
|
||||
"unknown": [],
|
||||
"vcal": [".vcal"],
|
||||
"video": [".avi", ".flv", ".mkv", ".mov", ".mp4", ".mpg", ".rm", ".swf", ".vob", ".wmv"],
|
||||
"xml": [".xml"],
|
||||
"zip": [".7z", ".bz2", ".jar", ".lzma", ".war", ".z", ".Z", ".zip"]
|
||||
},
|
||||
|
||||
|
||||
|
||||
/*** Available translations ***/
|
||||
|
||||
"langs": {
|
||||
/* defaults */
|
||||
"en": "english",
|
||||
|
||||
"bg": "български",
|
||||
"cs": "čeština",
|
||||
"de": "deutsch",
|
||||
"el": "ελληνικά",
|
||||
"es": "español",
|
||||
"fr": "français",
|
||||
"he": "עברית",
|
||||
"hu": "magyar",
|
||||
"it": "italiano",
|
||||
"ja": "日本語",
|
||||
"lv": "latviešu",
|
||||
"nb": "norwegian",
|
||||
"nl": "nederlands",
|
||||
"pl": "polski",
|
||||
"pt": "português",
|
||||
"ro": "română",
|
||||
"ru": "русский",
|
||||
"sk": "slovenčina",
|
||||
"sr": "srpski",
|
||||
"sv": "svenska",
|
||||
"tr": "türkçe",
|
||||
"zh-cn": "简体中文",
|
||||
"zh-tw": "正體中文"
|
||||
}
|
||||
}
|
34
src/_h5ai/conf/langs.json
Normal file
34
src/_h5ai/conf/langs.json
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
{{pkg.name}} {{pkg.version}}
|
||||
{{pkg.url}}
|
||||
|
||||
Available translations
|
||||
*/
|
||||
|
||||
{
|
||||
"en": "english",
|
||||
|
||||
"bg": "български",
|
||||
"cs": "čeština",
|
||||
"de": "deutsch",
|
||||
"el": "ελληνικά",
|
||||
"es": "español",
|
||||
"fr": "français",
|
||||
"he": "עברית",
|
||||
"hu": "magyar",
|
||||
"it": "italiano",
|
||||
"ja": "日本語",
|
||||
"lv": "latviešu",
|
||||
"nb": "norwegian",
|
||||
"nl": "nederlands",
|
||||
"pl": "polski",
|
||||
"pt": "português",
|
||||
"ro": "română",
|
||||
"ru": "русский",
|
||||
"sk": "slovenčina",
|
||||
"sr": "srpski",
|
||||
"sv": "svenska",
|
||||
"tr": "türkçe",
|
||||
"zh-cn": "简体中文",
|
||||
"zh-tw": "正體中文"
|
||||
}
|
308
src/_h5ai/conf/options.json
Normal file
308
src/_h5ai/conf/options.json
Normal file
|
@ -0,0 +1,308 @@
|
|||
/*
|
||||
{{pkg.name}} {{pkg.version}}
|
||||
{{pkg.url}}
|
||||
|
||||
Options
|
||||
*/
|
||||
|
||||
{
|
||||
/*
|
||||
The absolute link to {{pkg.name}}.
|
||||
Must point to the "_{{pkg.name}}" directory.
|
||||
*/
|
||||
"h5aiAbsHref": "/_{{pkg.name}}/",
|
||||
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
"spacing": {
|
||||
"maxWidth": 960,
|
||||
"top": 50,
|
||||
"right": "auto",
|
||||
"bottom": 50,
|
||||
"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.
|
||||
|
||||
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).
|
||||
*/
|
||||
"view": {
|
||||
"modes": ["details", "list", "grid", "icons"],
|
||||
"setParentFolderLabels": true,
|
||||
"binaryPrefix": false,
|
||||
"indexFiles": ["index.html", "index.htm", "index.php"],
|
||||
"ignore": ["^\\.", "^_{{pkg.name}}"]
|
||||
},
|
||||
|
||||
|
||||
|
||||
/*** 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.
|
||||
|
||||
Interval will be a least 1000 milliseconds.
|
||||
*/
|
||||
"autorefresh": {
|
||||
"enabled": true,
|
||||
"interval": 5000
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Show a clickable breadcrumb.
|
||||
*/
|
||||
"crumb": {
|
||||
"enabled": true
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Filenames of customized header and footer files to look for
|
||||
in each folder.
|
||||
*/
|
||||
"custom": {
|
||||
"enabled": true,
|
||||
"header": "_{{pkg.name}}.header.html",
|
||||
"footer": "_{{pkg.name}}.footer.html"
|
||||
},
|
||||
|
||||
/* [php]
|
||||
Allow file deletion.
|
||||
*/
|
||||
"delete": {
|
||||
"enabled": true
|
||||
},
|
||||
|
||||
/* [php]
|
||||
File upload via drag'n'drop. Folders are not supported.
|
||||
The working file size seems to be very browser dependent.
|
||||
|
||||
Max file size is in MB.
|
||||
*/
|
||||
"dropbox": {
|
||||
"enabled": true,
|
||||
"maxfiles": 10,
|
||||
"maxfilesize": 1000
|
||||
},
|
||||
|
||||
/* [php]
|
||||
Enable packaged download of selected entries.
|
||||
Execution: "php", "shell".
|
||||
Supported formats: "tar", "zip".
|
||||
*/
|
||||
"download": {
|
||||
"enabled": true,
|
||||
"execution": "php",
|
||||
"format": "zip"
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Allow filtering the displayed files and folders.
|
||||
Will check entries for right order of characters, i.e.
|
||||
"ab" matches "ab", "axb", "xaxbx" but not "ba".
|
||||
Space separated sequences get OR-ed.
|
||||
|
||||
Filters will be treated as JavaScript regular expressions
|
||||
if you prefix them with "re:".
|
||||
*/
|
||||
"filter": {
|
||||
"enabled": true
|
||||
},
|
||||
|
||||
/* [php]
|
||||
Calc the size of folders.
|
||||
Depends on du.
|
||||
*/
|
||||
"foldersize": {
|
||||
"enabled": true
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Adds Google Analytics asynchronous tracking code.
|
||||
|
||||
for example:
|
||||
"gaq": [
|
||||
["_setAccount", "UA-xxxxxx-x"],
|
||||
["_setDomainName", ".your-domain.tld"],
|
||||
["_trackPageview"],
|
||||
["_trackPageLoadTime"]
|
||||
]
|
||||
|
||||
see: http://support.google.com/googleanalytics/bin/topic.py?hl=en&topic=27612
|
||||
*/
|
||||
"google-analytics": {
|
||||
"enabled": true,
|
||||
"gaq": []
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Localization, for example "en", "de" etc. - see "langs" below for
|
||||
possible values. Adjust it to your needs. If lang is not found in
|
||||
"langs" it defaults to "en".
|
||||
|
||||
Optionally try to use browser language, falls back to previous
|
||||
specified language.
|
||||
*/
|
||||
"l10n": {
|
||||
"enabled": true,
|
||||
"lang": "en",
|
||||
"useBrowserLang": true
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Link the hover effects between crumb, main view and tree.
|
||||
*/
|
||||
"link-hover-states": {
|
||||
"enabled": true
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Shows the server mode in the bottom left corner.
|
||||
display values:
|
||||
0: only show mode
|
||||
1: mode and servername
|
||||
2: mode, servername and -version
|
||||
*/
|
||||
"mode": {
|
||||
"enabled": true,
|
||||
"display": 2
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Adds Piwik tracker javascript code.
|
||||
"baseURL" without protocol
|
||||
*/
|
||||
"piwik-analytics": {
|
||||
"enabled": false,
|
||||
"baseURL": "mydomain.tld/piwik",
|
||||
"idSite": 1
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Show an image preview on click.
|
||||
*/
|
||||
"preview-img": {
|
||||
"enabled": true,
|
||||
"types": ["bmp", "gif", "ico", "image", "jpg", "png", "tiff"]
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Show text file preview on click.
|
||||
"types" maps file types to SyntaxHighligher brushes. Special case: "markdown" will
|
||||
be rendered as HTML.
|
||||
|
||||
For available brushes see http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/
|
||||
*/
|
||||
"preview-txt": {
|
||||
"enabled": true,
|
||||
"types": {
|
||||
"authors": "plain",
|
||||
"copying": "plain",
|
||||
"c": "c",
|
||||
"cpp": "cpp",
|
||||
"css": "css",
|
||||
"diff": "diff",
|
||||
"h": "c",
|
||||
"hpp": "cpp",
|
||||
"install": "plain",
|
||||
"log": "plain",
|
||||
"java": "java",
|
||||
"makefile": "xml",
|
||||
"markdown": "plain",
|
||||
/*"php": "php",*/
|
||||
"python": "python",
|
||||
"readme": "plain",
|
||||
"rb": "ruby",
|
||||
"rtf": "plain",
|
||||
"script": "shell",
|
||||
"text": "plain",
|
||||
"js": "js",
|
||||
"xml": "xml"
|
||||
}
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Show QRCodes on hovering files.
|
||||
*/
|
||||
"qrcode": {
|
||||
"enabled": true,
|
||||
"size": 150
|
||||
},
|
||||
|
||||
/* [php]
|
||||
Allow to rename files.
|
||||
*/
|
||||
"rename": {
|
||||
"enabled": false
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Make entries selectable. At the moment only needed for packaged download and delete.
|
||||
*/
|
||||
"select": {
|
||||
"enabled": true
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Default sort order is a two letter code. The first letter specifies
|
||||
the column: "n" for "Name", "d" for "Date" or "s" for "Size". The
|
||||
second letter specifies the sort order: "a" for "ascending" or "d"
|
||||
for "descending".
|
||||
*/
|
||||
"sort": {
|
||||
"enabled": true,
|
||||
"order": "na"
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Show additional info in a statusbar.
|
||||
*/
|
||||
"statusbar": {
|
||||
"enabled": true
|
||||
},
|
||||
|
||||
/* [php]
|
||||
Show thumbnails for image files. Needs the "/_h5ai/cache" folder to be
|
||||
writable for the web Server.
|
||||
- img thumbnails depend on PHP-GD
|
||||
- mov thumbnails depend on ffmpeg
|
||||
- doc thumbnails depend on convert
|
||||
*/
|
||||
"thumbnails": {
|
||||
"enabled": true,
|
||||
"img": ["bmp", "gif", "ico", "image", "jpg", "png", "tiff"],
|
||||
"mov": ["video"],
|
||||
"doc": ["pdf", "ps"],
|
||||
"delay": 1
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Replace window title with current breadcrumb.
|
||||
*/
|
||||
"title": {
|
||||
"enabled": true
|
||||
},
|
||||
|
||||
/* [all]
|
||||
Show a folder tree.
|
||||
Note that this might affect performance significantly.
|
||||
|
||||
Slide tree bar into viewport if there is enough space.
|
||||
*/
|
||||
"tree": {
|
||||
"enabled": true,
|
||||
"slide": true
|
||||
}
|
||||
}
|
74
src/_h5ai/conf/types.json
Normal file
74
src/_h5ai/conf/types.json
Normal file
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
{{pkg.name}} {{pkg.version}}
|
||||
{{pkg.url}}
|
||||
|
||||
File types mapped to file extensions
|
||||
*/
|
||||
|
||||
{
|
||||
"archive": [".tar.bz2", ".tar.gz", ".tgz"],
|
||||
"audio": [".aif", ".flac", ".m4a", ".mid", ".mp3", ".mpa", ".ra", ".ogg", ".wav", ".wma"],
|
||||
"authors": ["authors"],
|
||||
"bin": [".class", ".o", ".so"],
|
||||
"blank": [],
|
||||
"bmp": [".bmp"],
|
||||
"c": [".c"],
|
||||
"calc": [".ods", ".ots", ".xlr", ".xls", ".xlsx"],
|
||||
"cd": [".cue", ".iso"],
|
||||
"copying": ["copying", "license"],
|
||||
"cpp": [".cpp"],
|
||||
"css": [".css", ".less"],
|
||||
"deb": [".deb"],
|
||||
"default": [],
|
||||
"diff": [".diff", ".patch"],
|
||||
"doc": [".doc", ".docx", ".odm", ".odt", ".ott"],
|
||||
"draw": [".drw"],
|
||||
"eps": [".eps"],
|
||||
"exe": [".bat", ".cmd", ".exe"],
|
||||
"folder": [],
|
||||
"folder-home": [],
|
||||
"folder-open": [],
|
||||
"folder-page": [],
|
||||
"folder-parent": [],
|
||||
"gif": [".gif"],
|
||||
"gzip": [".gz"],
|
||||
"h": [".h"],
|
||||
"hpp": [".hpp"],
|
||||
"html": [".htm", ".html", ".shtml"],
|
||||
"ico": [".ico"],
|
||||
"image": [".svg", ".xpm"],
|
||||
"install": ["install"],
|
||||
"java": [".java"],
|
||||
"jpg": [".jpg", ".jpeg"],
|
||||
"js": [".js", ".json"],
|
||||
"log": [".log", "changelog"],
|
||||
"makefile": [".pom", "build.xml", "pom.xml"],
|
||||
"markdown": [".markdown", ".md"],
|
||||
"package": [],
|
||||
"pdf": [".pdf"],
|
||||
"php": [".php"],
|
||||
"playlist": [".m3u", ".m3u8", ".pls"],
|
||||
"png": [".png"],
|
||||
"pres": [".odp", ".otp", ".pps", ".ppt", ".pptx"],
|
||||
"ps": [".ps"],
|
||||
"psd": [".psd"],
|
||||
"py": [".py"],
|
||||
"rar": [".rar"],
|
||||
"rb": [".rb"],
|
||||
"readme": ["readme"],
|
||||
"rpm": [".rpm"],
|
||||
"rss": [".rss"],
|
||||
"rtf": [".rtf"],
|
||||
"script": [".conf", ".csh", ".ini", ".ksh", ".sh", ".shar", ".tcl"],
|
||||
"source": [],
|
||||
"sql": [],
|
||||
"tar": [".tar"],
|
||||
"tex": [".tex"],
|
||||
"text": [".text", ".txt"],
|
||||
"tiff": [".tiff"],
|
||||
"unknown": [],
|
||||
"vcal": [".vcal"],
|
||||
"video": [".avi", ".flv", ".mkv", ".mov", ".mp4", ".mpg", ".rm", ".swf", ".vob", ".wmv"],
|
||||
"xml": [".xml"],
|
||||
"zip": [".7z", ".bz2", ".jar", ".lzma", ".war", ".z", ".Z", ".zip"]
|
||||
}
|
|
@ -15,7 +15,7 @@ html.no-js( lang="en" )
|
|||
link( rel="apple-touch-icon", type="image/png", href="client/images/app-48x48.png" )
|
||||
link( rel="stylesheet", href="//fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic,700italic|Ubuntu:400,700,400italic,700italic" )
|
||||
link( rel="stylesheet", href="client/css/styles.css" )
|
||||
script( src="client/js/scripts.js" )
|
||||
script( src="client/js/scripts.js", data-main="h5ai-info", data-backend="php" )
|
||||
|
||||
body#h5ai-info
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ head
|
|||
link( rel="apple-touch-icon", type="image/png", href="#{href}client/images/app-48x48.png" )
|
||||
link( rel="stylesheet", href="//fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic,700italic|Ubuntu:400,700,400italic,700italic" )
|
||||
link( rel="stylesheet", href="#{href}client/css/styles.css" )
|
||||
script( src="#{href}client/js/scripts.js" )
|
||||
script( src="#{href}client/js/scripts.js", data-main="h5ai-main", data-backend="aai" )
|
||||
|
||||
|<body id="h5ai-main">
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ html.no-js( lang="en" )
|
|||
link( rel="apple-touch-icon", type="image/png", href!="#{href}client/images/app-48x48.png" )
|
||||
link( rel="stylesheet", href="//fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic,700italic|Ubuntu:400,700,400italic,700italic" )
|
||||
link( rel="stylesheet", href!="#{href}client/css/styles.css" )
|
||||
script( src!="#{href}client/js/scripts.js", data-config!="#{config}" )
|
||||
script( src!="#{href}client/js/scripts.js", data-main="h5ai-main", data-backend="php" )
|
||||
|
||||
body#h5ai-main
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue