diff options
Diffstat (limited to 'src/js/dashboard.js')
-rw-r--r-- | src/js/dashboard.js | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/js/dashboard.js b/src/js/dashboard.js index e82ec28..3ba16f0 100644 --- a/src/js/dashboard.js +++ b/src/js/dashboard.js @@ -25,7 +25,7 @@ import { dom, qs$ } from './dom.js'; /******************************************************************************/ -const discardUnsavedData = function(synchronous = false) { +function discardUnsavedData(synchronous = false) { const paneFrame = qs$('#iframe'); const paneWindow = paneFrame.contentWindow; if ( @@ -66,9 +66,9 @@ const discardUnsavedData = function(synchronous = false) { dom.on(document, 'click', onClick, true); }); -}; +} -const loadDashboardPanel = function(pane, first) { +function loadDashboardPanel(pane, first) { const tabButton = qs$(`[data-pane="${pane}"]`); if ( tabButton === null || dom.cl.has(tabButton, 'selected') ) { return; } const loadPane = ( ) => { @@ -76,8 +76,12 @@ const loadDashboardPanel = function(pane, first) { dom.cl.remove('.tabButton.selected', 'selected'); dom.cl.add(tabButton, 'selected'); tabButton.scrollIntoView(); - qs$('#iframe').contentWindow.location.replace(pane); + const iframe = qs$('#iframe'); + iframe.contentWindow.location.replace(pane); if ( pane !== 'no-dashboard.html' ) { + iframe.addEventListener('load', ( ) => { + qs$('.wikilink').href = iframe.contentWindow.wikilink || ''; + }, { once: true }); vAPI.localStorage.setItem('dashboardLastVisitedPane', pane); } }; @@ -91,11 +95,11 @@ const loadDashboardPanel = function(pane, first) { if ( status === false ) { return; } loadPane(); }); -}; +} -const onTabClickHandler = function(ev) { +function onTabClickHandler(ev) { loadDashboardPanel(dom.attr(ev.target, 'data-pane')); -}; +} if ( self.location.hash.slice(1) === 'no-dashboard.html' ) { dom.cl.add(dom.body, 'noDashboard'); |