2023-09-10 10:00:55 +00:00
title: $:/plugins/tiddlywiki/tour/globals
tags: $:/tags/Global
2023-09-21 10:31:23 +00:00
\whitespace trim
2023-09-10 14:23:05 +00:00
<!--
2023-10-03 17:40:48 +00:00
The following state tiddlers control the tour. They should not be directly modified, but rather use the appropriate procedure to ensure that all the associated actions are performed.
2023-09-10 14:23:05 +00:00
2023-10-03 17:40:48 +00:00
* $:/config/CurrentTour: title of current tour definition tiddler
* $:/state/tour/step: title of current step of the tour
2023-09-10 14:23:05 +00:00
2023-09-10 17:27:01 +00:00
These config tiddlers may be changed directly as required:
2023-10-03 17:40:48 +00:00
* $:/config/ShowTour: "show" (default) or "hide"
* $:/config/AutoStartTour: "no" (default) or "yes"
2023-09-10 14:23:05 +00:00
-->
\function tour-current-tag()
[{$:/config/CurrentTour}get[tour-tag]]
\end
\function tour-is-not-first-step()
2023-10-03 17:22:57 +00:00
[all[shadows+tiddlers]tag<tour-current-tag>before{$:/state/tour/step}count[]compare:number:gt[0]]
\end
\function tour-is-last-step()
[all[shadows+tiddlers]tag<tour-current-tag>after{$:/state/tour/step}count[]compare:number:eq[0]]
\end
\function tour-is-not-last-step()
[all[shadows+tiddlers]tag<tour-current-tag>after{$:/state/tour/step}count[]compare:number:gt[0]]
2023-09-10 14:23:05 +00:00
\end
2023-09-10 10:28:23 +00:00
\procedure tour-initialise-current-tour-step()
2023-09-10 10:34:34 +00:00
<$transclude $tiddler={{$:/state/tour/step}} $field="enter-actions"/>
2023-09-10 10:28:23 +00:00
\end
2023-09-21 08:59:28 +00:00
\procedure tour-chooser(filter:"[all[shadows+tiddlers]tag[$:/tags/Tour]]")
\define choose-tour-actions()
<$transclude $variable="tour-start" title=<<currentTiddler>>/>
\end choose-tour-actions
<div class="tc-tour-panel-chooser-wrapper">
<$list filter=<<filter>>>
<div class="tc-tour-panel-chooser-item">
<div class="tc-tour-panel-chooser-item-text">
<$transclude $field="description">
<$text text=<<currentTiddler>>/>
</$transclude>
</div>
<$button class="tc-btn-invisible tc-tour-panel-chooser-start-button" actions=<<choose-tour-actions>>>
start {{$:/core/images/chevron-right}}
</$button>
</div>
</$list>
</div>
\end tour-chooser
\procedure tour-start(title)
<$action-setfield $tiddler="$:/config/CurrentTour" text=<<title>>/>
<<tour-restart>>
\end
2023-09-10 10:00:55 +00:00
\procedure tour-restart()
<$action-setfield $tiddler="$:/config/ShowTour" text="show"/>
2023-09-10 14:23:05 +00:00
<$action-setfield $tiddler="$:/state/tour/step" $field="text" $value={{{ [all[shadows+tiddlers]tag<tour-current-tag>first[]] }}}/>
2023-09-10 10:28:23 +00:00
<<tour-initialise-current-tour-step>>
\end
\procedure tour-next-step()
2023-09-27 13:22:44 +00:00
<$action-setfield $tiddler="$:/state/tour/step" $field="text" $value={{{ [all[shadows+tiddlers]tag<tour-current-tag>after{$:/state/tour/step}else[$:/plugins/tiddlywiki/tour/introduction-to-tiddlywiki/steps/finished]] }}}/>
2023-09-10 10:28:23 +00:00
<<tour-initialise-current-tour-step>>
2023-09-10 10:00:55 +00:00
\end
2023-09-10 10:28:23 +00:00
\procedure tour-previous-step()
2023-09-10 14:23:05 +00:00
<$action-setfield $tiddler="$:/state/tour/step" $field="text" $value={{{ [all[shadows+tiddlers]tag<tour-current-tag>before{$:/state/tour/step}] :else[all[shadows+tiddlers]tag<tour-current-tag>first[]] }}}/>
2023-09-10 10:28:23 +00:00
<<tour-initialise-current-tour-step>>
\end
2023-09-21 08:59:28 +00:00
\procedure tour-display-current-tour()
<$transclude $tiddler={{$:/config/CurrentTour}} $field="description">
<$text text={{$:/config/CurrentTour}}/>
</$transclude>
\end