1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-08 02:49:56 +00:00
TiddlyWiki5/plugins/tiddlywiki/tour/globals.tid
Jeremy Ruston ef5b3a8840 Use whitespace trim
Note that the setting is inherited by procedure and widget definitions
2023-09-21 11:31:23 +01:00

86 lines
2.9 KiB
Plaintext

title: $:/plugins/tiddlywiki/tour/globals
tags: $:/tags/Global
\whitespace trim
<!--
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.
$:/config/CurrentTour: title of current tour definition tiddler
$:/state/tour/step: title of current step of the tour
These config tiddlers may be changed directly as required:
$:/config/ShowTour: "show" (default) or "hide"
$:/config/AutoStartTour: "no" (default) or "yes"
Tour definition tiddlers have the following fields:
tags: must include $:/tags/Tour
tour-tag: name of tag used to define tour step sequence
logo: title of tiddler containing logo of tour
description: brief description of the tour
text: longer description of the tour
-->
\function tour-current-tag()
[{$:/config/CurrentTour}get[tour-tag]]
\end
\function tour-is-not-first-step()
[all[shadows+tiddlers]tag[$:/tags/Tour/IntroductionToTiddlyWiki]before{$:/state/tour/step}count[]compare:number:gt[0]]
\end
\procedure tour-initialise-current-tour-step()
<$transclude $tiddler={{$:/state/tour/step}} $field="enter-actions"/>
\end
\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&nbsp;{{$:/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
\procedure tour-restart()
<$action-setfield $tiddler="$:/config/ShowTour" text="show"/>
<$action-setfield $tiddler="$:/state/tour/step" $field="text" $value={{{ [all[shadows+tiddlers]tag<tour-current-tag>first[]] }}}/>
<<tour-initialise-current-tour-step>>
\end
\procedure tour-next-step()
<$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/finished]] }}}/>
<<tour-initialise-current-tour-step>>
\end
\procedure tour-previous-step()
<$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[]] }}}/>
<<tour-initialise-current-tour-step>>
\end
\procedure tour-display-current-tour()
<$transclude $tiddler={{$:/config/CurrentTour}} $field="description">
<$text text={{$:/config/CurrentTour}}/>
</$transclude>
\end