notes and experimenting...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-11-22 02:26:28 +03:00
parent 77e9f0819e
commit d9ab1f3349
2 changed files with 11 additions and 14 deletions

View File

@ -378,22 +378,18 @@ require(['./browser'], function(browser){
// scroll...
// NOTE: we restore scroll position only on history navigation...
var save_scroll = function(){
history.replaceState(
{
var save_scroll = async function(){
history.replaceState({
path: pwiki.location,
// XXX HACK this will work only on full page...
scroll: document.scrollingElement.scrollTop,
},
'',
// XXX
window.location.hash) }
}, '', 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 })

View File

@ -49,6 +49,7 @@
* await pwiki.parse('<macro src=../tags join=", ">@source(.)</macro>')
* This will not:
* await pwiki.parse('<macro src="../tags" join=", ">@source(.)</macro>')
* 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...