diff --git a/CHANGELOG.md b/CHANGELOG.md index 658d8617..d28b922e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ # Changelog -* add options to filter/search ignore case -* replace PHP `getenv` calls with `$_SERVER` lookups +* adds option to disable sidebar +* adds options to filter/search ignore case +* replaces PHP `getenv` calls with `$_SERVER` lookups * adds `view.fallbackMode` option to generally serve only fallback mode * serves fallback mode for text browsers (`curl`, `links`, `lynx`, `w3m`) * change type `txt-svg` to `img-svg`, no thumbs but preview diff --git a/src/_h5ai/private/conf/options.json b/src/_h5ai/private/conf/options.json index c700893d..5ccc752d 100644 --- a/src/_h5ai/private/conf/options.json +++ b/src/_h5ai/private/conf/options.json @@ -32,6 +32,7 @@ General view options. - binaryPrefix: boolean, set to true uses 1024B=1KiB when formatting file sizes (see http://en.wikipedia.org/wiki/Binary_prefix) + - disableSidebar: boolean, hides sidebar and toggle button - fallbackMode: boolean, serve fallback mode - fastBrowsing: boolean, use History API if available (no need to reload the whole page) - fonts: array of strings, fonts to use in regular context @@ -59,6 +60,7 @@ */ "view": { "binaryPrefix": false, + "disableSidebar": false, "fallbackMode": false, "fastBrowsing": true, "fonts": ["Ubuntu", "Roboto", "Helvetica", "Arial", "sans-serif"], diff --git a/src/_h5ai/public/js/lib/ext/crumb.js b/src/_h5ai/public/js/lib/ext/crumb.js index 728d82b2..d8a3f091 100644 --- a/src/_h5ai/public/js/lib/ext/crumb.js +++ b/src/_h5ai/public/js/lib/ext/crumb.js @@ -3,7 +3,7 @@ const event = require('../core/event'); const location = require('../core/location'); const resource = require('../core/resource'); const allsettings = require('../core/settings'); -const topbar = require('../view/topbar'); +const base = require('../view/base'); const settings = lo.extend({ @@ -56,7 +56,7 @@ function init() { return; } - $crumbbar = jq('
').appendTo(topbar.$flowbar); + $crumbbar = jq('
').appendTo(base.$flowbar); event.sub('location.changed', onLocationChanged); } diff --git a/src/_h5ai/public/js/lib/view/base.js b/src/_h5ai/public/js/lib/view/base.js new file mode 100644 index 00000000..171b31b8 --- /dev/null +++ b/src/_h5ai/public/js/lib/view/base.js @@ -0,0 +1,36 @@ +const {jq} = require('../globals'); + +const rootSelector = 'body'; +const tplTopbar = + `
+
+ `; +const tplMainrow = + `
+
+
`; + +const init = () => { + jq('#fallback, #fallback-hints').remove(); + + const $root = jq(rootSelector) + .attr('id', 'root') + .append(tplTopbar) + .append(tplMainrow); + + return { + $root, + $topbar: $root.find('#topbar'), + $toolbar: $root.find('#toolbar'), + $flowbar: $root.find('#flowbar'), + $mainrow: $root.find('#mainrow'), + $content: $root.find('#content') + }; +}; + +module.exports = init(); diff --git a/src/_h5ai/public/js/lib/view/content.js b/src/_h5ai/public/js/lib/view/content.js deleted file mode 100644 index 195d277a..00000000 --- a/src/_h5ai/public/js/lib/view/content.js +++ /dev/null @@ -1,8 +0,0 @@ -const {jq} = require('../globals'); -const mainrow = require('./mainrow'); - -const $el = jq('
').appendTo(mainrow.$el); - -module.exports = { - $el -}; diff --git a/src/_h5ai/public/js/lib/view/mainrow.js b/src/_h5ai/public/js/lib/view/mainrow.js deleted file mode 100644 index 059f68aa..00000000 --- a/src/_h5ai/public/js/lib/view/mainrow.js +++ /dev/null @@ -1,8 +0,0 @@ -const {jq} = require('../globals'); -const root = require('./root'); - -const $el = jq('
').appendTo(root.$el); - -module.exports = { - $el -}; diff --git a/src/_h5ai/public/js/lib/view/notification.js b/src/_h5ai/public/js/lib/view/notification.js index d99bb236..4a6db92d 100644 --- a/src/_h5ai/public/js/lib/view/notification.js +++ b/src/_h5ai/public/js/lib/view/notification.js @@ -1,7 +1,7 @@ const {jq} = require('../globals'); -const root = require('./root'); +const base = require('./base'); -const $el = jq('
').hide().appendTo(root.$el); +const $el = jq('
').hide().appendTo(base.$root); function set(content) { if (content) { diff --git a/src/_h5ai/public/js/lib/view/root.js b/src/_h5ai/public/js/lib/view/root.js deleted file mode 100644 index 7c417443..00000000 --- a/src/_h5ai/public/js/lib/view/root.js +++ /dev/null @@ -1,9 +0,0 @@ -const {jq} = require('../globals'); - -const $el = jq('body').attr('id', 'root'); - -jq('#fallback, #fallback-hints').remove(); - -module.exports = { - $el -}; diff --git a/src/_h5ai/public/js/lib/view/sidebar.js b/src/_h5ai/public/js/lib/view/sidebar.js index 97bb46c3..f2c96012 100644 --- a/src/_h5ai/public/js/lib/view/sidebar.js +++ b/src/_h5ai/public/js/lib/view/sidebar.js @@ -1,45 +1,52 @@ const {jq} = require('../globals'); const resource = require('../core/resource'); +const allsettings = require('../core/settings'); const store = require('../core/store'); -const mainrow = require('./mainrow'); -const topbar = require('./topbar'); - +const base = require('./base'); +const disabled = !!(allsettings.view && allsettings.view.disableSidebar); const storekey = 'sidebarIsVisible'; const tplSidebar = '