Hi Tony
Try this one
\define slider-toc(title, content)
<$set name="revealState" value=<<qualify "$:/state-reveal-$title$">>>
<$reveal type="nomatch" state=<<revealState>> text="yes">
<$button class="tc-btn-invisible tc-tiddlylink" set=<<revealState>>
setTo="yes">
{{$:/core/images/right-arrow}}
</$button>
</$reveal>
<$reveal type="match" state=<<revealState>> text="yes">
<$button class="tc-btn-invisible tc-tiddlylink" set=<<revealState>>
setTo="no">
{{$:/core/images/down-arrow}}
</$button>
</$reveal>
<$link to=<<__title__>>><$view tiddler="""$title$""" field="caption">
<$view tiddler="""$title$""" field="title"></$view>
</$view></$link><br>
<$reveal type="match" state=<<revealState>> text="yes">
$content$
</$reveal>
</$set>
\end
\define each-other-level(filter)
<$macrocall $name=slider-toc title=<<currentTiddler>>
content="""<ul>
<$list filter="$filter$">
<$list filter="[<currentTiddler>tagging[]count[]match[0]]" variable=ignore
emptyMessage=<<each-other-level $filter$>> >
<$link to=<<currentTiddler>>><$view field="caption">
<$view field="title"></$view>
</$view></$link><br>
</$list>
</$list>
</ul>
"""/>
\end
\define level-content(filter)
<ul>
<$list filter="$filter$">
<$list filter="[<currentTiddler>tagging[]count[]match[0]]" variable=ignore
emptyMessage=<<each-other-level $filter$>> >
<$link to=<<currentTiddler>>><$view field="caption">
<$view field="title"></$view>
</$view></$link><br>
</$list>
</$list>
</ul>
\end
\define first-level(filter)
<ul>
<$list filter="$filter$">
<<each-other-level $filter$>>
</$list>
</ul>
\end
Start in TableOfContents<br>
<$tiddler tiddler="TableOfContents">
<<first-level "[is[current]tagging[]]">>
</$tiddler>
On Wednesday, January 22, 2020 at 1:17:32 AM UTC+3:30, TonyM wrote:
>
> Mohammad,
>
> Thanks for sharing. I note however there is no indicator if their is, or
> is not, any subtiddlers. If you are happy to provide a fix and a minimal
> example, as you have so far, then have a go of adding your slider to the
> bigger example it would be interesting.
>
> What are the changes to this example
> <https://groups.google.com/d/msg/tiddlywiki/RTzc2MGT__Y/H9qxL6MvEgAJ> to
> add sliders ?
>
> eg at at the top of \define each-other-level(filter)
> <$macrocall $name=slider-toc title=<<currentTiddler>>
> content="""<ul>
>
> then add
> the macro slider-toc to the tiddler
>
> Regards
> Tony
>
> On Sunday, January 19, 2020 at 1:48:37 AM UTC+11, Mohammad wrote:
>>
>> *A Clone of TOC-EXPANDABLE*
>> *but very simple and easy to customize*
>>
>>
>> Hi again Tony!
>> I just added a slider macro from TW-Scripts to your simple to understand
>> toc macro to improve it
>>
>> - the current code shows all entries and it takes time and make TW slow
>> - the new code
>> -- uses a slider macro so every first entry is in collapsed mode
>> -- as it does not render all the entries at once, TW seems faster as
>> little rendering required
>> -- the code still is very easy to customize like colorifying, ...
>>
>> Cheers
>> Mohammad
>>
>> The improved code: equivalent to toc-expandable
>> --------------------------------------------------------
>>
>> \define slider-toc(title, content)
>> <$set name="revealState" value=<<qualify "$:/state-reveal-$title$">>>
>> <$reveal type="nomatch" state=<<revealState>> text="yes">
>> <$button class="tc-btn-invisible tc-tiddlylink" set=<<revealState>>
>> setTo="yes">
>> {{$:/core/images/right-arrow}}
>> </$button>
>> </$reveal>
>> <$reveal type="match" state=<<revealState>> text="yes">
>> <$button class="tc-btn-invisible tc-tiddlylink" set=<<revealState>>
>> setTo="no">
>> {{$:/core/images/down-arrow}}
>> </$button>
>> </$reveal>
>> <$link to=<<__title__>>><$view tiddler="""$title$""" field="caption">
>> <$view tiddler="""$title$""" field="title"></$view>
>> </$view></$link><br>
>> <$reveal type="match" state=<<revealState>> text="yes">
>> $content$
>> </$reveal>
>> </$set>
>> \end
>>
>> \define each-other-level(filter)
>> <$macrocall $name=slider-toc title=<<currentTiddler>>
>> content="""<ul>
>> <$list filter="$filter$">
>> <<each-other-level $filter$>>
>> </$list>
>> </ul>"""/>
>> \end
>>
>> \define first-level(filter)
>> <ul>
>> <$list filter="$filter$">
>> <<each-other-level $filter$>>
>> </$list>
>> </ul>
>> \end
>>
>> Start in TableOfContents<br>
>> <$tiddler tiddler="TableOfContents">
>>
>> <<first-level "[is[current]tagging[]]">>
>>
>> </$tiddler>
>>
>>
>>
>>>
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/0319e60c-9ff5-425a-a2c5-4c9cff7cd7c5%40googlegroups.com.