@Albert, 

The modification that I made here are dangerous with TiddlyWeb, 
TiddlySpace. I did a "tiddlyweb" check so the code is deactivated for 
TiddlyWeb, TiddlySpace.

... and just to be sure ...

I did comment to 2 lines that write the scroll position to the active 
tiddler.
So everyone that does a copy paste, but doesn't read the docs, can't say 
I'm the one who caused problems.
Everyone who wants to use the code needs to remove the "store.setValue()" 
comments below.


IMPORTANT: If you use it that way, make sure, that you rename your plugin, 
and make it clear, that it won't work with TiddlySpace and TiddlyWeb.



story.displayTiddler = 
function(srcElement,tiddler,template,animate,unused,customFields,toggle){
   
 
story.coreDisplayTiddler(config.macros.tiddlersBar.tabsAnimationSource,tiddler,template,animate,unused,customFields,toggle);
    var title = (tiddler instanceof Tiddler)? tiddler.title : tiddler;  
    if (config.macros.tiddlersBar.isShown()) {
        story.forEachTiddler(function(t,e){
            if (t!=title) e.style.display="none";
            else {
                // DON'T allow modification on TiddlyWeb, TiddlySpace ... 
because it may clone tiddlers if you view them. 
                if (tiddlyweb) {
                    // WARNING don't remove this security check !!
                    // do nothing
                }
                else {
                    // save scroll position
//                    
store.setValue(config.macros.tiddlersBar.currentTiddler, "scrollPosX", 
findScrollX());
//                    
store.setValue(config.macros.tiddlersBar.currentTiddler, "scrollPosY", 
findScrollY());

                    // load and set scroll position
                    var scrX = store.getValue(title, "scrollPosX");
                    var scrY = store.getValue(title, "scrollPosY");

                    // if undefined .. don't scroll to 0
                    if (scrX && scrY) window.scrollTo(scrX, scrY);
                }
                e.style.display="";
            }
        })
        config.macros.tiddlersBar.currentTiddler=title;
    }
    var e=document.getElementById("tiddlersBar");
    if (e) config.macros.tiddlersBar.refresh(e,null);
}

have fun!
mario

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to