Update options.

This commit is contained in:
Lars Jung
2015-04-03 02:33:55 +02:00
parent 2d54c23a2c
commit 0022264a8e
3 changed files with 48 additions and 37 deletions

View File

@@ -2,6 +2,7 @@ modulejs.define('ext/info', ['_', '$', 'modernizr', 'core/settings', 'core/resou
var settings = _.extend({ var settings = _.extend({
enabled: false, enabled: false,
show: false,
qrcode: true, qrcode: true,
qrColor: "#999" qrColor: "#999"
}, allsettings.info); }, allsettings.info);
@@ -141,8 +142,10 @@ modulejs.define('ext/info', ['_', '$', 'modernizr', 'core/settings', 'core/resou
ev.preventDefault(); ev.preventDefault();
}); });
// ensure stored value is boolean, default to true // ensure stored value is boolean, otherwise set default
store.put(storekey, store.get(storekey) !== false); if (typeof(store.get(storekey)) !== 'boolean') {
store.put(storekey, settings.show);
}
updateSettings(); updateSettings();
event.sub('location.changed', onLocationChanged); event.sub('location.changed', onLocationChanged);

View File

@@ -2,6 +2,7 @@ modulejs.define('ext/tree', ['_', '$', 'core/settings', 'core/resource', 'core/s
var settings = _.extend({ var settings = _.extend({
enabled: false, enabled: false,
show: true,
maxSubfolders: 50 maxSubfolders: 50
}, allsettings.tree); }, allsettings.tree);
var template = var template =
@@ -192,8 +193,10 @@ modulejs.define('ext/tree', ['_', '$', 'core/settings', 'core/resource', 'core/s
ev.preventDefault(); ev.preventDefault();
}); });
// ensure stored value is boolean, default to true // ensure stored value is boolean, otherwise set default
store.put(storekey, store.get(storekey) !== false); if (typeof(store.get(storekey)) !== 'boolean') {
store.put(storekey, settings.show);
}
updateSettings(); updateSettings();
event.sub('location.changed', onLocationChanged); event.sub('location.changed', onLocationChanged);

View File

@@ -9,26 +9,26 @@ Options
/* /*
General view options. General view options.
- binaryPrefix: set to true uses 1024B=1KiB when formatting file sizes (see http://en.wikipedia.org/wiki/Binary_prefix) - binaryPrefix: boolean, set to true uses 1024B=1KiB when formatting file sizes (see http://en.wikipedia.org/wiki/Binary_prefix)
- hidden: don't list items matching these regular expressions - hidden: array of strings, don't list items matching these regular expressions
- hideFolders: hide all folders in the main view - hideFolders: boolean, hide all folders in the main view
- hideIf403: hide files and folders that are not readable by the server - hideIf403: boolean, hide files and folders that are not readable by the server
- hideParentFolder: hide parent folder links in the main view - hideParentFolder: boolean, hide parent folder links in the main view
- modes: array, subset of ["details", "grid", "icons"] - modes: array of strings, subset of ["details", "grid", "icons"]
the first value indicates the default view mode. If only one value 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. 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 The user selected view mode is also stored local in modern browsers
so that it will be persistent. so that it will be persistent.
- setParentFolderLabels: set parent folder labels to real folder names - setParentFolderLabels: boolean, set parent folder labels to real folder names
- sizes: array of positive integers - sizes: array of numbers
the first value indicates the default view size. If only one value the first value indicates the default view size. If only one value
is given the view size is fixed and the selector buttons are hidden. is given the view size is fixed and the selector buttons are hidden.
The user selected view size is also stored local in modern browsers The user selected view size is also stored local in modern browsers
so that it will be persistent. so that it will be persistent.
- smartBrowsing: use History API if available (no need to reload the whole page) - smartBrowsing: boolean, use History API if available (no need to reload the whole page)
- theme: name of one of the folders in "_{{pkg.name}}/images/themes", defaults to "default" - theme: string, name of one of the folders in "_{{pkg.name}}/images/themes", defaults to "default"
- unmanaged: don't manage folders containing one of those files - unmanaged: array of strings, don't manage folders containing one of those files
- unmanagedInNewWindow: open unmanaged links in new window/tab - unmanagedInNewWindow: boolean, open unmanaged links in new window/tab
*/ */
"view": { "view": {
"binaryPrefix": false, "binaryPrefix": false,
@@ -90,9 +90,9 @@ Options
Enable packaged download of selected entries. Enable packaged download of selected entries.
To select files the "select"-extension needs to be enabled. To select files the "select"-extension needs to be enabled.
- type: "php-tar", "shell-tar" or "shell-zip" - type: string, "php-tar", "shell-tar" or "shell-zip"
- packageName: basename of the download package, null for current filename or foldername - packageName: string, basename of the download package, null for current filename or foldername
- alwaysVisible: always show download button (defaults to download the current folder) - alwaysVisible: boolean, always show download button (defaults to download the current folder)
*/ */
"download": { "download": {
"enabled": true, "enabled": true,
@@ -120,7 +120,7 @@ Options
calculation types since "php" only adds the file size, while "shell-du" calculation types since "php" only adds the file size, while "shell-du"
also adds the sizes for the actual folder files. also adds the sizes for the actual folder files.
- type: "php" (sloooow) or "shell-du" (sloow) - type: string, "php" (sloooow) or "shell-du" (sloow)
*/ */
"foldersize": { "foldersize": {
"enabled": false, "enabled": false,
@@ -129,8 +129,9 @@ Options
/* /*
Adds Google Universial Analytics asynchronous tracking code. Adds Google Universial Analytics asynchronous tracking code.
see: https://developers.google.com/analytics/devguides/collection/analyticsjs/ see: https://developers.google.com/analytics/devguides/collection/analyticsjs/
- id: string, account ID
*/ */
"google-analytics-ua": { "google-analytics-ua": {
"enabled": false, "enabled": false,
@@ -140,11 +141,13 @@ Options
/* /*
Enable a generic info side bar. Enable a generic info side bar.
- qrcode: show a QR-Code - show: boolean, initial visible to first time users
- qrColor: QR-Code fill color - qrcode: boolean, show a QR-Code
- qrColor: string, QR-Code fill color
*/ */
"info": { "info": {
"enabled": true, "enabled": true,
"show": false,
"qrcode": true, "qrcode": true,
"qrColor": "#999" "qrColor": "#999"
}, },
@@ -154,7 +157,7 @@ Options
possible values. Adjust it to your needs. If lang is not found possible values. Adjust it to your needs. If lang is not found
it defaults to "en". it defaults to "en".
- lang: default language - lang: string, default language
- useBroserLang: boolean, try to use browser language - useBroserLang: boolean, try to use browser language
*/ */
"l10n": { "l10n": {
@@ -166,7 +169,7 @@ Options
/* /*
Adds peer5 p2p downloader which is based on webrtc (see peer5.com). Adds peer5 p2p downloader which is based on webrtc (see peer5.com).
- id: the API key - get your own key - http://peer5.com/downloader - id: string, the API key
*/ */
"peer5": { "peer5": {
"enabled": false, "enabled": false,
@@ -176,7 +179,7 @@ Options
/* /*
Adds Piwik tracker javascript code. Adds Piwik tracker javascript code.
- baseURL: do not include the protocol, e.g. "mydomain.tld/piwik" - baseURL: string, do not include the protocol, e.g. "mydomain.tld/piwik"
- idSite: number - idSite: number
*/ */
"piwik-analytics": { "piwik-analytics": {
@@ -188,7 +191,7 @@ Options
/* /*
Play a audio preview on click. Play a audio preview on click.
- types: array of types - types: array of strings
*/ */
"preview-aud": { "preview-aud": {
"enabled": true, "enabled": true,
@@ -198,7 +201,7 @@ Options
/* /*
Show an image preview on click. Show an image preview on click.
- types: array of types - types: array of strings
*/ */
"preview-img": { "preview-img": {
"enabled": true, "enabled": true,
@@ -214,7 +217,7 @@ Options
- "none" for floating text - "none" for floating text
- "fixed" for fixed width text - "fixed" for fixed width text
- types: maps types to languages - types: dict string to string, maps types to languages
*/ */
"preview-txt": { "preview-txt": {
"enabled": true, "enabled": true,
@@ -249,7 +252,7 @@ Options
/* /*
Play a video preview on click. Play a video preview on click.
- types: array of types - types: array of strings
*/ */
"preview-vid": { "preview-vid": {
"enabled": true, "enabled": true,
@@ -273,11 +276,11 @@ Options
Default sort order. Default sort order.
"column" and "reverse" are locally stored. "column" and "reverse" are locally stored.
- column: int, 0 for "Name", 1 for "Date", 2 for "Size" - column: number, 0 for "Name", 1 for "Date", 2 for "Size"
- reverse: boolean, false for ascending, true for descending - reverse: boolean, false for ascending, true for descending
- ignorecase: boolean, compare ignorecase - ignorecase: boolean, compare ignorecase
- natural: boolean, use natural sort order - natural: boolean, use natural sort order
- folders: where to place folders, 0 for "top", 1 for "in place", 2 for "bottom" - folders: number, where to place folders, 0 for "top", 1 for "in place", 2 for "bottom"
*/ */
"sort": { "sort": {
"enabled": true, "enabled": true,
@@ -292,10 +295,10 @@ Options
Show thumbnails for image files. Needs the "/_{{pkg.name}}/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: array of types - img: array of strings
- mov: array of types - mov: array of strings
- doc: array of types - doc: array of strings
- delay: delay in milliseconds after "dom-ready" before thumb-requesting starts - delay: number, delay in milliseconds after "dom-ready" before thumb-requesting starts
- size: number, size in pixel of the generated thumbnails - size: number, size in pixel of the generated thumbnails
- exif: boolean, use included EXIF thumbs if possible - exif: boolean, use included EXIF thumbs if possible
*/ */
@@ -320,10 +323,12 @@ Options
Show a folder tree. Show a folder tree.
Note that this might affect performance significantly. Note that this might affect performance significantly.
- maxSubfolders: max number of subfolders to show in tree - show: boolean, initial visible to first time users
- maxSubfolders: number, max number of subfolders to show in tree
*/ */
"tree": { "tree": {
"enabled": true, "enabled": true,
"show": true,
"maxSubfolders": 50 "maxSubfolders": 50
} }
} }