+1 vote
by (160 points)
Hello!

I've found a bit of information on this in the past but it doesn't seem to have any answers in the latest version of Harlowe. In addition, looking through the Q&A boards here hasn't given me results I'm looking for either. I'd like to have my back button disable permanently at a particular passage. If possible, Id also like to know if it can then be re-enabled at a later passage, kind of like an on/off switch.

Thanks in advance!

2 Answers

0 votes
by (159k points)
selected by
 
Best answer

You can't disable the History system but you can hide the Undo and Redo links that it displays within the tw-sidebar element, and the Basic Harlowe Passage Tag Based Styling thread in the old Forums Archive contains all the information and some of the components needed to achieve this.

1. Using Javascript within a Passage to assign a known CSS class to an HTML element.
The following assigns a no-navigation CSS class to the main tw-story element of the story, you would use it in the first passage of the set of passages you don't want the History navigation links be available in.
You will also need to use it within the last passage of that set to handle the situation where the Reader uses the Undo link to rewind History back to that last passage.

<script>$('tw-story').addClass('no-navigation')</script>

2. Using Javascript within a Passage to remove a known CSS class from an HTML element.
The following removes the no-navigation CSS class from the main tw-story element of the story, you would use it in the first passage of your story where you want the History navigation links to be available again.

<script>$('tw-story').removeClass('no-navigation')</script>

3. Using CSS based on the no-navigation CSS class to hide the contents of the tw-sidebar element.
Place the following within your story's Story Stylesheet area.

tw-story.no-navigation tw-sidebar {
	display: none;
}

 

by (160 points)
Thanks for this! I managed to read up on the post here and finagled it appropriately. Cheers!
0 votes
by (1.1k points)
Why not keep a Boolean variable that checks at the start of each passage, if disabled == true and if so, render the appropriate CSS to disable it. Then just flick the Boolean between true/false as needed.
...