Skip to content

Instantly share code, notes, and snippets.

@fczbkk
Last active June 27, 2017 06:03
Show Gist options
  • Save fczbkk/1563a0b42b6092f3bded5d6496619520 to your computer and use it in GitHub Desktop.
Save fczbkk/1563a0b42b6092f3bded5d6496619520 to your computer and use it in GitHub Desktop.
Inline Manual Player: simple undo
// call this function to display previous step
function activatePreviousStep () {
var previous_topic = localStorage.getItem('inm_previous_topic');
var previous_step = localStorage.getItem('inm_previous_step');
inline_manual_player.activateStep(previous_topic, previous_step);
}
// remember topic/step whenever step is deactivated
// e.g. when user goes to next step
inline_manual_player.setOptions({
callbacks: {
onStepDeactivate: function (player, topic_id, step_index) {
localStorage.setItem('inm_previous_topic', topic_id);
localStorage.setItem('inm_previous_step', step_index);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment