How to click on a link and close all other tiddler

I’ve searched the forums for information on this and tried a lot, (nearly four or five hours) but I’ve found that it either doesn’t work or TiddlyWiki issues an error warning. So eventually I chose to come here for help.

I would like the history to remain only this one entry when opened, no matter what link I go through. Because I need the following expression to take effect.

[list<tv-story-list>first[]]

Feel free to ask additional questions.

I am confused about what you mean by wanting this to “take effect” (and also I’m confused about what you’ve been trying that causes system errors).

If you want only the most recent story in the story river, then it seems you just want zoomin story view:

If it’s not that, I’m not sure what you’re looking for…

I’m picturing a link (or anything1, for that matter) that when clicked, closes everything, then navigates to the target.

  1. $linkcatcher or $eventcatcher bound to anything – e.g. even just a <span>.

Ah, different interpretation!

I think OP can be clearer: is it about how links in general behave? (They should behave like zoomin)?

Or is there a particular place in a standard-story-river wiki where you’d like to have a special button-like link — one that looks like any other link, but actually closes everything else first?

Feel free to explain more. Seriously.

This might be useful…Variant of close-other view toolbar button - #14 by pmario

I’m using the zoomin view, but at the same time I need to keep the breadcrumbs functional.Here is the code I am currently using.

<$let a={{$:/temp/focussedTiddler}} b={{{ [list<tv-story-list>first[]] }}} >
<$list filter="[<b>!prefix[$:/]in-tagtree-of:inclusive[Index]]">
	<div style='width:100%'>
		<$set name=CurrentTag value={{!!title}} >
			<$set name=TheFilter filter='[is[current]]' >
				<$transclude $variable="breadcrumbs" apex_tag-4="Index" tid-4=<<currentTiddler>>  use_apex_tag-4="Index" length_limit-2="15"/>
			</$set>
		</$set>
	</div>
</$list>
</$let>

The main function in the code is to display a breadcrumb of an entry, adapted from another user on the forum, but the source I forgot, sorry.

The main problem at the moment is that whenever I open many entries, this breadcrumb doesn’t change accordingly. This is because based on the expression, [list<tv-story-list>first[]] , only the first story river list will be read. But this is not what I was hoping for.

For example, if there are A,B,C, three tiddlers in the story river and they are all open. All of them will only show one in zoomin view. But they are in the Story River in the right order. That is, if I open tiddler B, and at the same time C and A are also open, only the breadcrumbs of either C or A will appear according to the expression and the code above.

So I want a global way that I can open a certain link and close the presence of other tiddlers.

\define yetAgain(use_apex_tag:"true",apex_tag,tid)
<$reveal type='match' state="$use_apex_tag$" text='true'>
	<$reveal type='match' state="$tid$" text="$apex_tag$">
		<$link to=<<currentTiddler>>>
			<$view field='title'/>
		</$link>
		> 
		<$list filter=<<Extra>> emptyMessage=''>
			... > 
		</$list>
		<$list filter="""$(End)$""">
			<$link to=<<currentTiddler>>>
				<$view field='title'/>
			</$link>
			> 
		</$list>
		<br>
	</$reveal>
</$reveal>
<$reveal type='nomatch' state={{$use_apex_tag$}} text='true'>
	<$link to=<<currentTiddler>>>
		<$view field='title'/>
	</$link>
	> 
	<$list filter=<<Extra>> emptyMessage=''>
			.. > 
	</$list>
	<$list filter="""$(End)$""">
		<$link to=<<currentTiddler>>>
			<$view field='title'/>
		</$link>
		> 
	</$list>
	<br>
</$reveal>
\end

\define again(use_apex_tag-2:"true",apex_tag-2,tid-2)
<$list filter=<<First>> >
    <$transclude $variable="yetAgain" apex_tag="$apex_tag-2$" tid="$tid-2$" use_apex_tag="$use_apex_tag-2$"/>
</$list>
\end

\define finalFilter(use_apex_tag-3:"true",apex_tag-3,tid-3,length_limit)
<$set name=First filter="""$(TheFilter)$ +[last[]]""">
	<$set name=End filter="""$(TheFilter)$ +[butlast[]]  +[butfirst[]] +[first[$length_limit$]] +[reverse[]]""">
		<$set name=Extra filter="""$(TheFilter)$ +[butlast[]] +[butfirst[]] +[butfirst[$length_limit$]] +[limit[1]]""" emptyValue='[is[system]!is[system]]'>
			<$transclude $variable="again" apex_tag-2="$apex_tag-3$" tid-2="$tid-3$" use_apex_tag-2="$use_apex_tag-3$" />
		</$set>
	</$set>
</$set>
\end

\define breadcrumbsEmptyMessage(use_apex_tag-5:"true",apex_tag-5,tid-5,length_limit-3)
<$set name=TheFilter filter="""$(TheFilter)$ [<CurrentTag>]""">
    <$transclude $variable="breadcrumbs" apex_tag-4="$apex_tag-5$" tid-4="$tid-5$" use_apex_tag-4="$use_apex_tag-5$" length_limit-2="$length_limit-3$"/>
</$set>
\end

\define breadcrumbs(use_apex_tag-4:"true",apex_tag-4,tid-4,length_limit-2)
<$list filter='[<CurrentTag>tags[]in-tagtree-of:inclusive[$apex_tag-4$]] -[[$:/tags/SideBar]]' variable=CurrentTag emptyMessage=""" <$transclude $variable="finalFilter" apex_tag-3="$apex_tag-4$" tid-3="$tid-4$" use_apex_tag-3="$use_apex_tag-4$" length_limit="$length_limit-2$" /> """>
	<$list filter="""$(TheFilter)$ +[field:title<CurrentTag>]""" emptyMessage=""" <$transclude $variable="breadcrumbsEmptyMessage" apex_tag-5="$apex_tag-4$" tid-5="$tid-4$" use_apex_tag-5="$use_apex_tag-4$" length_limit-3="$length_limit-2$" />  """>
	</$list>
</$list>
\end


\define cell-rock(root,namx,true-gate,long,text)

<$list filter="[<currentTiddler>!prefix[$:/]in-tagtree-of:inclusive[$root$]]">
<div style='width:100%'>
<$reveal type='nomatch' state={{{ [[$:/state/Global/ShowBreadcrumbs/]addsuffix[$root$]] }}} text=true>
	<$button class='tc-btn-invisible' set={{{ [[$:/state/Global/ShowBreadcrumbs/]addsuffix[$root$]] }}} setTo='true'>
		{{$:/core/images/right-arrow}} <$text text="$text$"/>
	</$button>
</$reveal>

<$reveal type='match' state={{{ [[$:/state/Global/ShowBreadcrumbs/]addsuffix[$root$]] }}} text=true>
	<$button class='tc-btn-invisible' set={{{ [[$:/state/Global/ShowBreadcrumbs/]addsuffix[$root$]] }}} setTo='false'>
		{{$:/core/images/down-arrow}} <$text text="$text$"/>
	</$button><br>
		<$set name=CurrentTag value={{!!title}} >
		<$set name=TheFilter filter='[is[current]]' >
			<$transclude $variable="breadcrumbs" apex_tag-4="$root$" tid-4="$namx$" use_apex_tag-4="$true-gate$" length_limit-2="$long$" />
		</$set>
	</$set>
</$reveal>
</div>
</$list>

\end

The above is my adapted code. But to be honest, I don’t really understand the logic in it, I just adapted it to be able to apply it in a wider range of situations.

That’s close to what I was trying to say. I checked some forums and modified $:/core/ui/PageTemplate in various ways. But in the end, none of them were productive.

Because I can’t understand something like $linkcatcher or $eventcatcher or messagecatcher, and it takes a lot of experience to use that code well, and to run it with code like define.

you could modify the $:/core/ui/PageTemplate like so

Did you try [{$:/HistoryList!!current-tiddler}] for your breadcrumbs instead of your filter?

Did you try my trails-plugin? It will be added to the tiddler ViewTemplate. So you do not need to mess with the page template, wich does not really know, what’s going on in the story river.

2 Likes

I’ve tried this before, but TiddlyWiki pops up to report an error, and nothing shows up in the Story River area.

Thanks, this approach addresses my needs.

I’ll check it out and maybe I can use the plugin.