mirror of
https://github.com/flynx/pWiki.git
synced 2025-12-21 02:21:40 +00:00
notes and experimenting...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
77e9f0819e
commit
d9ab1f3349
24
pwiki2.html
24
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 })
|
||||
|
||||
@ -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...
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user