diff --git a/src/_h5ai/public/js/lib/ext/autorefresh.js b/src/_h5ai/public/js/lib/ext/autorefresh.js index 3f4c485b..719533e4 100644 --- a/src/_h5ai/public/js/lib/ext/autorefresh.js +++ b/src/_h5ai/public/js/lib/ext/autorefresh.js @@ -3,7 +3,6 @@ const event = require('../core/event'); const location = require('../core/location'); const allsettings = require('../core/settings'); - const settings = Object.assign({ enabled: false, interval: 5000 @@ -11,20 +10,20 @@ const settings = Object.assign({ let timeoutId = null; -function heartbeat() { +const heartbeat = () => { location.refresh(); -} +}; -function before() { +const before = () => { win.clearTimeout(timeoutId); -} +}; -function after() { +const after = () => { win.clearTimeout(timeoutId); timeoutId = win.setTimeout(heartbeat, settings.interval); -} +}; -function init() { +const init = () => { if (!settings.enabled) { return; } @@ -35,7 +34,7 @@ function init() { event.sub('location.beforeRefresh', before); event.sub('location.changed', after); event.sub('location.refreshed', after); -} +}; init(); diff --git a/src/_h5ai/public/js/lib/ext/crumb.js b/src/_h5ai/public/js/lib/ext/crumb.js index 6ed2ad57..1b729732 100644 --- a/src/_h5ai/public/js/lib/ext/crumb.js +++ b/src/_h5ai/public/js/lib/ext/crumb.js @@ -20,7 +20,7 @@ const pageHintTemplate = let $crumbbar; -function createHtml(item) { +const createHtml = item => { const $html = jq(crumbTemplate); $html[0]._item = item; item.elCrumb = $html[0]; @@ -37,9 +37,9 @@ function createHtml(item) { } return $html; -} +}; -function onLocationChanged(item) { +const onLocationChanged = item => { const $crumb = jq(item.elCrumb); if ($crumb && $crumb.parent()[0] === $crumbbar[0]) { @@ -51,9 +51,9 @@ function onLocationChanged(item) { $crumbbar.append(createHtml(crumbItem)); }); } -} +}; -function init() { +const init = () => { if (!settings.enabled) { return; } @@ -61,7 +61,7 @@ function init() { $crumbbar = jq('
').appendTo(base.$flowbar); event.sub('location.changed', onLocationChanged); -} +}; init(); diff --git a/src/_h5ai/public/js/lib/ext/custom.js b/src/_h5ai/public/js/lib/ext/custom.js index cbe61b69..7250b64a 100644 --- a/src/_h5ai/public/js/lib/ext/custom.js +++ b/src/_h5ai/public/js/lib/ext/custom.js @@ -12,7 +12,7 @@ let $footer; const duration = 200; -function onLocationChanged(item) { +const onLocationChanged = item => { server.request({action: 'get', custom: item.absHref}).then(response => { const custom = response && response.custom; let hasHeader; @@ -49,9 +49,9 @@ function onLocationChanged(item) { $footer.stop().slideUp(duration); } }); -} +}; -function init() { +const init = () => { if (!settings.enabled) { return; } @@ -60,7 +60,7 @@ function init() { $footer = jq('