I would like to be able to set “Action on open, reopen or close tiddler in a story” to complement my work here https://all-button-actions.tiddlyhost.com/ which allows you to assign additional actions to almost any button.
- This is a new thread but some what of a continuation of Is it possible to execute an action widget on tiddler load/render/open?
- This New Topic exposes possibly a new way to handle this, rather than via event/message capture, and needing to modify core tiddlers.
On reflection I realised that “actions on open tiddler” is actually about when a tiddler enters a story (is opened) or is reopened (already in the story). This can be seen by reference to these two fields $:/StoryList!!list
(in story) and $:/HistoryList!!current-tiddler
(the recently opened or “focused tiddler”).
Can anyone suggest a way monitor these fields and generate an action according to the open and reopen “occurring” and close? We also need to identify the tiddler title in question.
- From this we could meet the “action on open/reopen/close”, by trapping the “result of navigation events” rather than “capture all navigation events”.
- We could also use this to work with substories and alternative stories.
- Thus a user could use the default story or an alternative story in which open and reopen are detectable.
- This seems to me a solution with less interference in the default behaviours and code.
Closing a tiddler;
- By what ever means a user may close a tiddler they key fact is it is removed from
$:/StoryList!!list
so being able to detect this and trigger an action would also be helpful,- One could use additional actions on the close button such as in my all button actions solution however it would be easier and more comprehensive and efficient to detect when a title leaves the story.
Examples
- Recording the time a given tiddler is open in the story.
- Or We could start a timer when opened in the story
$:/StoryList!!list
.- and We could stop and accumulate a timer when removed from a story list
$:/StoryList!!list
.
- and We could stop and accumulate a timer when removed from a story list
- Or We could start a timer when opened in the story
- An action triggered when a tiddler is first opened in a story could check if that tiddler has an “on-open-actions field” and trigger any actions named therein.