diff --git a/pwiki2.html b/pwiki2.html index 32dc9cd..a02143d 100755 --- a/pwiki2.html +++ b/pwiki2.html @@ -378,22 +378,18 @@ require(['./browser'], function(browser){ // scroll... // NOTE: we restore scroll position only on history navigation... - var save_scroll = function(){ - history.replaceState( - { - path: pwiki.location, - // XXX HACK this will work only on full page... - scroll: document.scrollingElement.scrollTop, - }, - '', - // XXX - window.location.hash) } + var save_scroll = async function(){ + history.replaceState({ + path: pwiki.location, + // XXX HACK this will work only on full page... + scroll: document.scrollingElement.scrollTop, + }, '', window.location.hash) } // save scroll position just after scroll is done... - var scrolling + var _scrolling window.addEventListener('scroll', function(evt){ - scrolling - && clearTimeout(scrolling) - scrolling = setTimeout(save_scroll, 200) }) + _scrolling + && clearTimeout(_scrolling) + _scrolling = setTimeout(save_scroll, 200) }) // get scroll position from history state... window.addEventListener('popstate', function(evt){ pwiki.__scroll = (evt.state ?? {}).scroll }) diff --git a/pwiki2.js b/pwiki2.js index f27537f..044f4f5 100755 --- a/pwiki2.js +++ b/pwiki2.js @@ -49,6 +49,7 @@ * await pwiki.parse('@source(.)') * This will not: * await pwiki.parse('@source(.)') +* XXX might be a good idea to add a default template to draw a list... * XXX FEATURE: make the pwiki "widget" work bot as an element and as a * full page (current)... * ...would need to handle stuff like history, url, nav locally...