Ha! It works! And of course it goes well with CollpaseTiddlersPlugin. 
Thanks a lot! This way I can use ToggleTagPlugin to have a check box for 
each tiddler to toggle "pinned" status on the run, and also save them 
across sessions. Great!

>From your code, I just came up with another idea using storage other than 
the tag field: using a "PinnedTiddlers" tiddler to list and store all 
tiddlers toggled as true on the checkbox, and thus can be read by the 
modified closeAllTiddlers function. I think this can reduce the transfers 
needed with remote servers, especially for enviroments like TSpace. :-)

Eric Shulman於 2013年5月31日星期五UTC+8上午12時16分22秒寫道:
>
>
>
> On May 30, 5:45 am, "G.J.Robert" <[email protected]> wrote: 
> > I frequently open quite a few tiddlers during my note taking and 
> editing, 
> > and I use "close all" a lot. What if I want to pin certain tiddlers from 
> > getting closed by "close all" command/macro? Is there any plugin out 
> there 
> > able to do this? Thanks in advance :) 
>
> Here you go: 
> ----------------------------- 
> Story.prototype.closeAllTiddlers = function(exclude) { 
>         clearMessage(); 
>         this.forEachTiddler(function(title,element) { 
>                 var t=store.getTiddler(title); 
>                 var excluded = title == exclude; 
>                 var dirty    = element.getAttribute("dirty") == "true" 
>                 var pinned   = t && t.isTagged("pinned"); 
>                 if(!excluded && !dirty && !pinned) 
>                         this.closeTiddler(title); 
>         }); 
>         window.scrollTo(0,ensureVisible(this.container)); 
> }; 
> ------------------------------ 
> To use, simply tag a tiddler with "pinned".  You can still close it 
> individually with the "close" toolbar command, but it will be skipped 
> over when either the "close all" sidebar command or "close others" 
> toolbar command is invoked. 
>
> Note: when triggered by "close others", the "exclude" value passed 
> into the function is the title of the tiddler from which the command 
> was triggered, so that tiddler will not be closed along with the 
> others.  However, when triggered by "close all", the "exclude" value 
> is null, so that all tiddlers are closed, except for "dirty" tiddlers 
> (i.e., tiddlers currently being edited) and tiddlers that are tagged 
> with "pinned" (the new feature you requested). 
>
> enjoy, 
> -e 
> Eric Shulman 
> TiddlyTools / ELS Design Studios 
>
> HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY "TIP JAR"... 
>    http://www.TiddlyTools.com/#Donations 
>
> Professional TiddlyWiki Consulting Services... 
> Analysis, Design, and Custom Solutions: 
>    http://www.TiddlyTools.com/#Contact 
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to