I made a quick test of using tiddlywiki as an ebook viewer than does some similar things to what your button does.
https://ooktech.com/jed/ExampleWikis/TiddlyBook/ It isn't really laid out well but it has macros that set the story list to a list of tiddlers in order based on the book definitions. You could probably pull out pieces of it to make a more flexible version of the button. -- 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 post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/tiddlywiki. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/31d0ae9b-5248-4dc4-87eb-9c6ea0722f37%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

