*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/b4f05ebc-62ae-49cf-a20d-a17d3c818f63%40googlegroups.com.
Tony-TOC-Expandable.tid
Description: Binary data

