All the functions called within _checkStep are nearly identical. There is a good opportunity there for refactoring.
Example
// A certain attribute exists at the url endpoint
// Display the returned attribute
function _checkIfAttributeExists(response){
if (debug) console.log(response);
response = $.parseJSON(response);
if (response.timeout) _checkStep();
if ( response.attribute_exists ){
$('#step'+currentStep.stepNumber+' .feedback .responseDisplay').html(response.attribute_to_display);
$('#step'+currentStep.stepNumber+' .step_text').css('display','none');
$('#step'+currentStep.stepNumber+' .feedback').css('display','block');
$('#next').addClass('animated pulse');
}
}
All of the similar functions have the same style. They check for a certain response response.attribute_exists then display the feedback portion of the step.
Description
All the functions called within _checkStep are nearly identical. There is a good opportunity there for refactoring.
Example
All of the similar functions have the same style. They check for a certain response
response.attribute_exists
then display the feedback portion of the step.Files
js/instructions.js
Tips