static/kelmu.js
function(event, action) {
        var data = window.kelmu.data[id];
        var stepsLeft = Math.max(+(action.parameter || 1), 1);
        var stepsToRun = 0;

        var proceed = function() {
          this('skip', stepsToRun);
        };

        while (stepsLeft > 0) {

          var subSteps = (data.definitions['step' + data.stepNumber] || [null]).length - 1;
          var currentSub = data.subStepNumber;
          var canIncrease = subSteps - currentSub;

          if (canIncrease < stepsLeft) {

            data.stepNumber += 1;
            data.subStepNumber = 0;
            stepsToRun += 1;
            stepsLeft -= canIncrease + 1;

          } else if (canIncrease > 0) {

            if (stepsToRun > 0) {
              $.each(window.kelmu.callbacks[id], proceed);
              stepsToRun = 0;
              clearAnnotations();
              originalStep(event);
            }

            stepsLeft -= canIncrease;
            data.subStepNumber = data.subStepNumber + canIncrease;
          } else {
            data.stepNumber += 1;
            stepsToRun += 1;
            stepsLeft -= 1;
          }

        }

        if (stepsToRun > 0) {
          $.each(window.kelmu.callbacks[id], proceed);
          stepsToRun = 0;
          clearAnnotations();
          originalStep(event);

          if (!window.kelmu.data[id].animationReadyAvailable) {
            setTimeout(function() {
              createAnnotations();
              if (window.kelmu.data[id].actions.updateEditor) {
                window.kelmu.data[id].actions.updateEditor();
              }
            }, window.kelmu.data[id].settings.animationLength);
          }

        } else {
          createAnnotations();
        }

        window.kelmu.data[id].undoStack.splice(window.kelmu.data[id].undoStackPointer + 1, window.kelmu.data[id].undoStack.length);
        window.kelmu.data[id].undoStack.push([window.kelmu.data[id].stepNumber, window.kelmu.data[id].subStepNumber]);
        window.kelmu.data[id].undoStackPointer += 1;

      }
function(event, action) {
        var data = window.kelmu.data[id];
        var stepsLeft = Math.max(+(action.parameter || 1), 1);
        var stepsToRun = 0;

        var proceed = function() {
          this('skip', stepsToRun);
        };

        while (stepsLeft > 0) {

          var subSteps = (data.definitions['step' + data.stepNumber] || [null]).length - 1;
          var currentSub = data.subStepNumber;
          var canIncrease = subSteps - currentSub;

          if (canIncrease < stepsLeft) {

            data.stepNumber += 1;
            data.subStepNumber = 0;
            stepsToRun += 1;
            stepsLeft -= canIncrease + 1;

          } else if (canIncrease > 0) {

            if (stepsToRun > 0) {
              $.each(window.kelmu.callbacks[id], proceed);
              stepsToRun = 0;
              clearAnnotations();
              originalStep(event);
            }

            stepsLeft -= canIncrease;
            data.subStepNumber = data.subStepNumber + canIncrease;
          } else {
            data.stepNumber += 1;
            stepsToRun += 1;
            stepsLeft -= 1;
          }

        }

        if (stepsToRun > 0) {
          $.each(window.kelmu.callbacks[id], proceed);
          stepsToRun = 0;
          clearAnnotations();
          originalStep(event);

          if (!window.kelmu.data[id].animationReadyAvailable) {
            setTimeout(function() {
              createAnnotations();
              if (window.kelmu.data[id].actions.updateEditor) {
                window.kelmu.data[id].actions.updateEditor();
              }
            }, window.kelmu.data[id].settings.animationLength);
          }

        } else {
          createAnnotations();
        }

        window.kelmu.data[id].undoStack.splice(window.kelmu.data[id].undoStackPointer + 1, window.kelmu.data[id].undoStack.length);
        window.kelmu.data[id].undoStack.push([window.kelmu.data[id].stepNumber, window.kelmu.data[id].subStepNumber]);
        window.kelmu.data[id].undoStackPointer += 1;

      }
function ( event , action ) { var data = window . kelmu . data [ id ] ; var stepsLeft = Math . max ( + ( action . parameter || 1 ) , 1 ) ; var stepsToRun = 0 ; var proceed = function ( ) { this ( 'skip' , stepsToRun ) ; } ; while ( stepsLeft > 0 ) { var subSteps = ( data . definitions [ 'step' + data . stepNumber ] || [ null ] ) . length - 1 ; var currentSub = data . subStepNumber ; var canIncrease = subSteps - currentSub ; if ( canIncrease < stepsLeft ) { data . stepNumber += 1 ; data . subStepNumber = 0 ; stepsToRun += 1 ; stepsLeft -= canIncrease + 1 ; } else if ( canIncrease > 0 ) { if ( stepsToRun > 0 ) { $ . each ( window . kelmu . callbacks [ id ] , proceed ) ; stepsToRun = 0 ; clearAnnotations ( ) ; originalStep ( event ) ; } stepsLeft -= canIncrease ; data . subStepNumber = data . subStepNumber + canIncrease ; } else { data . stepNumber += 1 ; stepsToRun += 1 ; stepsLeft -= 1 ; } } if ( stepsToRun > 0 ) { $ . each ( window . kelmu . callbacks [ id ] , proceed ) ; stepsToRun = 0 ; clearAnnotations ( ) ; originalStep ( event ) ; if ( ! window . kelmu . data [ id ] . animationReadyAvailable ) { setTimeout ( function ( ) { createAnnotations ( ) ; if ( window . kelmu . data [ id ] . actions . updateEditor ) { window . kelmu . data [ id ] . actions . updateEditor ( ) ; } } , window . kelmu . data [ id ] . settings . animationLength ) ; } } else { createAnnotations ( ) ; } window . kelmu . data [ id ] . undoStack . splice ( window . kelmu . data [ id ] . undoStackPointer + 1 , window . kelmu . data [ id ] . undoStack . length ) ; window . kelmu . data [ id ] . undoStack . push ( [ window . kelmu . data [ id ] . stepNumber , window . kelmu . data [ id ] . subStepNumber ] ) ; window . kelmu . data [ id ] . undoStackPointer += 1 ; }
Functionality for the `skip` action.
Functionality for the skip action .