;(function(){
var CORRECT = "Correct!";
var INCORRECT = "Sorry.";
var ARIATEXT = "The text on the page was changed.";
function Practice(section){
var self = this;
this.section = section;
this.sectionNode = section.jq[0];
this.section.points_possible = 1;
this.section.points_earned = 0;
this.section.section_completed = false;
this.feedback = this.section.jq.find(".feedback_part");
this.buttons = this.section.jq.find(".practice button");
// hide feedback
this.feedback.hide();
//define events
this.buttons.bind('click', checkAnswer);
this.section.jq.find('button.contPract').bind('click', nextPage);
function nextPage(){
$(this).parent().next().addClass('showItem')
.siblings().removeClass('showItem');
var textInstr = 'Indicate your choice of classical or operant conditioning. Then select the “Continue” button to view the next example of conditioning.';
if($(this).parent().nextAll().length == 1){
textInstr = 'Select the NEXT button and move to Quiz 1.';
}
$('.footer p').text(textInstr);
self.section.instructionsHTML = textInstr;
$(this).closest(".itemPractice").next().find('button.contPract').attr('disabled', true);
}
function checkAnswer(){
var parNode = $(this).closest('.practice');
var corAnsw = $(this).closest(".itemPractice").attr("data-answer");
parNode.find('.answer-checker').text( ( $(this).attr("data-answer") == corAnsw ) ? CORRECT : INCORRECT );
parNode.find('.feedback_part').show();
parNode.find('.live_region').html("
" + ARIATEXT + "
");
parNode.find('button').unbind('click', checkAnswer).bind('blur', function(){
$(this).closest('.practice').find('button').attr('disabled', true);
});
parNode.parent().find('button.contPract').attr('disabled', false);
if(parNode.parent().nextAll().length == 0){
self.finishSlide();
}
}
}
Practice.prototype.finishSlide = function() {
this.section.points_earned = this.section.points_possible;
this.section.section_completed = true;
player.activity.grade_activity();
player.update_section_status();
};
window.mheContpract = window.mheContpract || {};
window.mheContpract['practice1'] = {
initialize: function(section) {
section.slide = new Practice(section);
},
show: function(section) {},
hide: function(section) {}
};
}());
// Page 10 custom dnd activity
(function() {
'use strict';
var FEEDBACK = {
INCORRECT: 'Sorry. Perhaps you should go back to review the activity.',
CORRECT: 'Press the Next button and move forward.'
};
var ARIATEXTS = {
INTRO_END: "You can change the location of the label only while this label is selected.",
DONE_DRAG: "You have completed the Table with all answers. Press Reset button to start a new try or press Check answer button to check this try.",
COMPLETE: "You have set all the labels correctly. Good job! "
};
var DIALOG_OPTIONS = {
correct: {
title: 'Correct!'
},
incorrect: {
title: 'Incorrect'
}
};
var INSTRUCTION = "Enter one of the following numbers to select the corresponding answer";
function Activity(section){
this.section = section;
this.sectionNode = section.jq[0];
this.section.points_possible = 1;
this.section.points_earned = 0;
this.section.section_completed = false;
var correct_fb = this.section.jq.find('.correct_feedback').text();
var incorrect_fb = this.section.jq.find('.incorrect_feedback').text();
this.feedback = {};
this.feedback.incorrect = incorrect_fb || FEEDBACK.INCORRECT;
this.feedback.correct = correct_fb || FEEDBACK.CORRECT;
this._init();
this._addButtons();
initLiveRegion.call(this);
}
Activity.prototype._init = function(){
this.slide = [];
var slides = this.section.jq.find(".dnd_slide");
var listener = this.updateButtons.bind(this);
var slide, $item;
for( var j, i = 0; i < slides.length; i++ ){
slides[i].jq = $( slides[i] );
slide = new DnDSlide(slides[i]);
this.slide.push(slide);
for(j = 0; j < slide.dragItemsNodes.length; j++){
$item = $( slide.dragItemsNodes[j] );
$item.focus( grabbedOn.bind(this) );
$item.blur( grabbedOff.bind(this) );
}
slide.addListener("drop", listener);
slide.addListener("update", listener);
}
};
Activity.prototype._addButtons = function(){
var instruction, btnContainer;
this.btnReset = $('');
this.btnCheck = $('');
this.btnCheck.bind('click', this.check.bind(this));
this.btnReset.bind('click', this.reset.bind(this));
btnContainer = $('');
instruction = $('