function goBack() {
    // Can't do anything since the only entry is myself
    if (currentState.history.length <= 1) {
	return;
    }

    // Sanity check
    if (!sameId(currentState.history[currentState.history.length - 1], 
		currentState.id)) {
	alert("goBack: Current state id (" + currentState.id + 
	      ") and the last history id (" + 
	      currentState.history[currentState.history.length - 1] + 
	      ") are not the same!");
	return;
    }
    currentState.history.pop();

    // Add to the future
    currentState.future.push(currentState.id);

    currentState.id = currentState.history[currentState.history.length - 1];
    showContent();
}
// Tries to go back, but not guaranteed if no more history
Tries to go back, but not guaranteed if no more history
Tries to go back but not guaranteed if no more history
function goBack() {
    if (currentState.history.length <= 1) {
	return;
    }
    if (!sameId(currentState.history[currentState.history.length - 1], 
		currentState.id)) {
	alert("goBack: Current state id (" + currentState.id + 
	      ") and the last history id (" + 
	      currentState.history[currentState.history.length - 1] + 
	      ") are not the same!");
	return;
    }
    currentState.history.pop();
    currentState.future.push(currentState.id);
    currentState.id = currentState.history[currentState.history.length - 1];
    showContent();
}
function goBack ( ) { if ( currentState . history . length <= 1 ) { return ; } if ( ! sameId ( currentState . history [ currentState . history . length - 1 ] , currentState . id ) ) { alert ( "goBack: Current state id (" + currentState . id + ") and the last history id (" + currentState . history [ currentState . history . length - 1 ] + ") are not the same!" ) ; return ; } currentState . history . pop ( ) ; currentState . future . push ( currentState . id ) ; currentState . id = currentState . history [ currentState . history . length - 1 ] ; showContent ( ) ; }
Tries to go back, but not guaranteed if no more history
Tries to go back but not guaranteed if no more history
// Can't do anything since the only entry is myself // Sanity check // Add to the future