Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
39 lines (24 sloc) 1.17 KB

"Programmatic Undo": Snowman (v1.3.0)

Summary

Snowman comes with no user-facing functionality for undoing and re-doing actions. However, though using jQuery and a combination of the window.story.checkpoint() and window.history.back() functions, this can be emulated.

Note: Checkpoints will only affect properties of the 's' (state) global variable.

Live Example

<iframe src="snowman_programmaticundo_example.html" height=400 width=90%></iframe>

Download: Live Example

Twee Code

:: StoryTitle
Programmatic Undo in Snowman

:: UserScript[script]
$(window).on('showpassage:after', function (e, data)
{
    window.story.checkpoint(data.passage.name);
});

:: Start
[[Enter the Darkness]]

:: Enter the Darkness
<a href="javascript: window.history.back();">You are not ready! Go back!</a>

Download: Twee Code