static/js-parsons/ui-extension/parsons-site-ui.js
function(newAction) {
    // ignore init and feedback actions
    if (newAction.type === "init" || newAction.type === "feedback") { return; }
    var action = parson.whatWeDidPreviously();
    // if we have been here before (action not undefined) and more than one line in solution...
    if (action && action.output && newAction.output.split('-').length > 1 && action.output.split('-').length > 1 && action.stepsToLast > 2) {
      var html = "<div class='currentState'><p>Your current code is identical to one you had " +
                 "previously. You might want to stop going in circles and think carefully about " +
                 "the feedback shown here.</p>" +
                 "<div class='sortable-code' id='currFeedback'></div>";
      html += "</div><div class='prevAction'><p>Last time you went on to move the line " +
              "highlighted with a blue right margin. Think carefully about the feedback for " +
              "this code and your current code.</p>" +
              "<div class='sortable-code' id='prevFeedback'></div>";
      html += "</div>";

      // .. set the content of the tab ...
      RevisitFeedback.html(html)
                     .label("Hint")
                     .available(true); // .. and make the "feedback" available
      // create the parsons feedback
      createParsonFeedbackForElement("currFeedback", newAction.output);
      createParsonFeedbackForElement("prevFeedback", action.output);
      // .. and higlight modified lines
      RevisitFeedback.highlightLine("currFeedbackcodeline" + action.target)
                     .highlightLine("prevFeedbackcodeline" + action.target);
    } else if (previousFeedbackState) {
      RevisitFeedback.available(false);
      setLastFeedback();
    } else {
      RevisitFeedback.available(false); // make the feedback unavailable
    }
  }
function(newAction) {
    // ignore init and feedback actions
    if (newAction.type === "init" || newAction.type === "feedback") { return; }
    var action = parson.whatWeDidPreviously();
    // if we have been here before (action not undefined) and more than one line in solution...
    if (action && action.output && newAction.output.split('-').length > 1 && action.output.split('-').length > 1 && action.stepsToLast > 2) {
      var html = "<div class='currentState'><p>Your current code is identical to one you had " +
                 "previously. You might want to stop going in circles and think carefully about " +
                 "the feedback shown here.</p>" +
                 "<div class='sortable-code' id='currFeedback'></div>";
      html += "</div><div class='prevAction'><p>Last time you went on to move the line " +
              "highlighted with a blue right margin. Think carefully about the feedback for " +
              "this code and your current code.</p>" +
              "<div class='sortable-code' id='prevFeedback'></div>";
      html += "</div>";

      // .. set the content of the tab ...
      RevisitFeedback.html(html)
                     .label("Hint")
                     .available(true); // .. and make the "feedback" available
      // create the parsons feedback
      createParsonFeedbackForElement("currFeedback", newAction.output);
      createParsonFeedbackForElement("prevFeedback", action.output);
      // .. and higlight modified lines
      RevisitFeedback.highlightLine("currFeedbackcodeline" + action.target)
                     .highlightLine("prevFeedbackcodeline" + action.target);
    } else if (previousFeedbackState) {
      RevisitFeedback.available(false);
      setLastFeedback();
    } else {
      RevisitFeedback.available(false); // make the feedback unavailable
    }
  }
function ( newAction ) { // ignore init and feedback actions if ( newAction . type === "init" || newAction . type === "feedback" ) { return ; } var action = parson . whatWeDidPreviously ( ) ; // if we have been here before (action not undefined) and more than one line in solution... if ( action && action . output && newAction . output . split ( '-' ) . length > 1 && action . output . split ( '-' ) . length > 1 && action . stepsToLast > 2 ) { var html = "<div class='currentState'><p>Your current code is identical to one you had " + "previously. You might want to stop going in circles and think carefully about " + "the feedback shown here.</p>" + "<div class='sortable-code' id='currFeedback'></div>" ; html += "</div><div class='prevAction'><p>Last time you went on to move the line " + "highlighted with a blue right margin. Think carefully about the feedback for " + "this code and your current code.</p>" + "<div class='sortable-code' id='prevFeedback'></div>" ; html += "</div>" ; // .. set the content of the tab ... RevisitFeedback . html ( html ) . label ( "Hint" ) . available ( true ) ; // .. and make the "feedback" available // create the parsons feedback createParsonFeedbackForElement ( "currFeedback" , newAction . output ) ; createParsonFeedbackForElement ( "prevFeedback" , action . output ) ; // .. and higlight modified lines RevisitFeedback . highlightLine ( "currFeedbackcodeline" + action . target ) . highlightLine ( "prevFeedbackcodeline" + action . target ) ; } else if ( previousFeedbackState ) { RevisitFeedback . available ( false ) ; setLastFeedback ( ) ; } else { RevisitFeedback . available ( false ) ; // make the feedback unavailable } }
callback function called when user action is done on codelines
callback function called when user action is done on codelines