EragonJ/Trip.js — pull request #6 by JvrBaena (2013-05-07 19:07:03+00:00)
Title: Handle wrong tripData correctly

Hi again!

If have thought a way to handle steps with wrong data.

- We store the current direction of the flow, in a var that tells us if we are going forward of backwards, and set this var in next and prev functions.

- When we find a wrong trip data, instead of repeating current step, we check the current direction of the Trip and increase or decrease the index, and try to showCurrentTrip again. If we are in the last step, we only doLastOperation(). Also, what before was the local var tripDataOk, is now a property that tells us if the last checked step was correct.

- In showCurrentTrip, we check the property $tripDataOk to see if we have to set a timer and run the callback for the current step. If this was a wrong step, we should not set any timer, as we are calling showCurrentTrip with the next step already.

As before, you can check this change here: https://dl.dropboxusercontent.com/u/11769257/Trip.js/index.html

The step after step 0 is WRONG (as before). Also, if you skip step0, thus, not executing its callback, then for the last step, the div that was inserted in step0 callback won't exist, so the last step will fail, and you will be able to check that the Trip succesfully ends even if the last step is wrong.

I hope you find everything ok, and if something is wrong, please don't hesitate to close the pull request and tell me any error :D

Regards.