/* animation 1*/ (function() { 'use strict'; var event = window.mheContpract.libs['event'].user; var KEYCODES = { ENTER: 13, SPACE: 32 }; var PracticeSlide = function(section) { this.section = section; this.section.points_possible = 1; this.section.points_earned = 0; this.section.section_completed = false; this.section.jq.addClass('concept_review'); this.animation1 = this.section.jq.find('#anim1'); this.animation2 = this.section.jq.find('#anim2'); this.animation3 = this.section.jq.find('#anim3'); initLiveRegion.call(this); addButtons.call(this); initAnimation1.call(this); }; var initLiveRegion = function() { this.liveRegion = $('
'); this.section.jq.append(this.liveRegion); }; var initAnimation1 = function(){ this.animation2.show(); this.animation2.hide(); this.animation3.hide(); this.btnReset.show(); this.isPlayed = false; this.animation = this.section.jq.find('.animation'); this.animation.attr({ 'tabindex': 0, 'role': 'button', 'aria-label': 'string of numbers 1 6 1 6 3 9 2 5 1 1 1' }); this.animation.bind('click', animateAll1.bind(this)); this.animation.bind("keydown", function(e) { var code = e.which; if ( code === KEYCODES.ENTER || code === KEYCODES.SPACE ) { animateAll1.call(this); } }.bind(this)); this.animation1.find('.hidden_text').hide(); this.animation1.find('.hidden_text').bind('click', animateAll1.bind(this)); } var initAnimation2 = function(){ this.animation1.hide(); this.animation2.show(); $('.footer p').text('Select the list of words to see an example of clustering in action. Then select the “Continue” button.'); var self = this; this.isPlayed = false; this.animation = this.section.jq.find('.animation2'); this.animation.attr({ 'tabindex': 0, 'role': 'button', 'cursor': 'pointer', 'aria-label': '8 items list: bicycle, red, train, orange, boat, banana, blue, apple' }); this.animation.bind('click', animateAll2.bind(this)); this.animation.bind("keydown", function(e) { var code = e.which; if ( code === KEYCODES.ENTER || code === KEYCODES.SPACE ) { animateAll2.call(this); } }.bind(this)); this.btnReset.unbind('click', initAnimation2.bind(this)); this.btnReset.bind('click', initAnimation3.bind(this)); this.animation2.find('.hidden_text').hide(); this.animation2.find('.hidden_text').bind('click', animateAll2.bind(this)); } var initAnimation3 = function(){ this.animation2.hide(); this.animation3.show(); $('.footer p').text('Select the list of words to see an example of hierarchies in action. Then select the NEXT button and move to Practice 2.'); var self = this; this.isPlayed = false; this.animation = this.section.jq.find('.animation3'); this.animation.attr({ 'tabindex': 0, 'role': 'button', 'cursor': 'pointer', 'aria-label': '10 items list: amygdala, cerebellum, frontal lobe, hippocampus, hypothalamus, medulla, occipital lobe, parietal lobe, temporal lobe, thalamus' }); this.animation.bind('click', animateAll3.bind(this)); this.animation.bind("keydown", function(e) { var code = e.which; if ( code === KEYCODES.ENTER || code === KEYCODES.SPACE ) { animateAll3.call(this); } }.bind(this)); this.btnReset.hide(); this.animation3.find('.hidden_text').hide(); this.animation3.find('.hidden_text').bind('click', animateAll3.bind(this)); } var animateAll1 = function() { var self = this; this.btnReset.show(); this.animation1.find('.shape1a').toggleClass('shape1b', 1000); this.animation1.find('.txt1').toggleClass('text_anim1', 1000); this.animation1.find('.txt2').toggleClass('text_anim2', 1000); this.animation1.find('.txt3').toggleClass('text_anim3', 1000); this.animation1.find('.txt4').toggleClass('text_anim4', 1000); var hiddenText = this.section.jq.find('.hidden_text'); if ( this.isPlayed ) { hiddenText.hide(); this.liveRegion.text('string of numbers 1 6 1 6 3 9 2 5 1 1 1'); } else { setTimeout(function() { hiddenText.show(); self.liveRegion.text('numbers are rearranged in small chunks with corresponding labels: 1 - country code, 6 1 6 - area code, 3 9 2, 5 1 1 1 - individual telephone'); }, 1000); } this.isPlayed = !this.isPlayed; } var animateAll2 = function() { //this.btnReset.toggle(); var self = this; var hiddenText = this.animation2.find('.hidden_text'); var rect1 = this.animation2.find('.rect1'); if ( this.isPlayed ) { hiddenText.hide(); rect1.show(); for (var i = 1; i < 9; i++) { this.animation2.find('.txt' + i).removeClass('b_text_anim' + i, 0); } this.liveRegion.text('8 items list: bicycle, red, train, orange, boat, banana, blue, apple'); } else { rect1.hide() setTimeout(function() { hiddenText.show(); self.liveRegion.text('list are rearranged into sublists: 1 - bicycle, train and boat; 2 - red, orange and blue; 3 - banana and apple '); }, 1000); for (var i = 1; i < 9; i++) { this.animation2.find('.txt' + i).addClass('b_text_anim' + i, 1000); } } this.isPlayed = !this.isPlayed; } var animateAll3 = function() { //this.btnReset.toggle(); var self = this; var hiddenText = this.animation3.find('.hidden_text'); var rect1 = this.animation3.find('.rect6'); if ( this.isPlayed ) { hiddenText.hide(); rect1.show(); for (var i = 1; i < 11; i++) { this.animation3.find('.txt' + i).removeClass('c_text_anim' + i, 0); } this.liveRegion.text('10 items list: amygdala, cerebellum, frontal lobe, hippocampus, hypothalamus, medulla, occipital lobe, parietal lobe, temporal lobe, thalamus'); } else { rect1.hide() setTimeout(function() { hiddenText.show(); self.liveRegion.text('list are rearranged into hierarchies: main category - parts of the brain; first sub category - lower brain structures - includes cerebellum, medulla and thalamus; second sub category - cerebral cortex - includes frontal lobe, occipital lobe, parietal lobe and temporal lobe; third sub category - limbic system - includes amygdala, hippocampus and hypothalamus '); }, 500); for (var i = 1; i < 11; i++) { this.animation3.find('.txt' + i).addClass('c_text_anim' + i, 500); } } this.isPlayed = !this.isPlayed; finishSlide.call(this); } var addButtons = function() { this.btnReset = $(''); this.btnReset.bind('click', initAnimation2.bind(this)); this.btnReset.hide(); var btnContainer = $(''); btnContainer.append(this.btnReset); this.section.jq.append(btnContainer); }; var finishSlide = function() { this.section.points_earned = this.section.points_possible; this.section.section_completed = true; player.activity.grade_activity(); player.update_section_status(); }; PracticeSlide.prototype.showSlide = function() { //finishSlide.call(this); this.section.jq.focus(); }; window.mheContpract = window.mheContpract || {}; window.mheContpract['animation1'] = { initialize: function(section) { section.slide = new PracticeSlide(section); }, show: function(section) { section.slide.showSlide(); } }; })(); /* memory_test */ (function() { 'use strict'; var event = window.mheContpract.libs['event'].user; var KEYCODES = { ENTER: 13, SPACE: 32 }; var DIGIT_ARRAY = [ [6, 1, 5, 2, 9, 7, 3, 8, 4], [4, 8, 3, 7, 9, 2, 5, 1, 6], [8, 3, 9, 1, 7, 2, 4, 6, 5], [2, 6, 1, 4, 9, 3, 7, 5, 8], [3, 1, 4, 8, 2, 5, 9, 6, 7], [7, 2, 4, 5, 6, 9, 1, 3, 8], [5, 4, 8, 9, 2, 7, 1, 3, 6], [9, 5, 1, 8, 2, 3, 7, 4, 6], [1, 7, 6, 2, 9, 3, 8, 5, 4], [9, 7, 6, 1, 4, 2, 3, 5, 8], [2, 3, 5, 8, 9, 7, 6, 1, 4] ]; var MemoryTest = function(section) { this.section = section; this.section.points_possible = 1; this.section.points_earned = 0; this.section.section_completed = false; this.section.jq.addClass('concept_review'); var self = this; addButtons.call(this); this.number = this.section.jq[0].querySelector('.number'); this.input_container = this.section.jq[0].querySelector('.input_container'); $(this.input_container).hide(); this.feedback_container = this.section.jq[0].querySelector('.feedback_container'); $(this.feedback_container).hide(); this.correct_answer_container = this.section.jq[0].querySelector('.correct_answer_container'); $(this.correct_answer_container).hide(); this.inputField = this.section.jq[0].querySelector('input'); $(this.inputField).attr({ 'role': 'textbox', 'aria-label': 'type the numbers you heard in the exact order in which they appeared, when you have entered all the letters you can recall, select the Finished button' }); this.currentNumberSet = -1; this.currentNumber = -1; this.isGroup = false; initLiveRegion.call(this); }; var initLiveRegion = function() { this.liveRegion = $(''); this.section.jq.find('.numbers_test').append(this.liveRegion); }; var beginTest = function() { this.btnBegin.hide(); this.btnReset.hide(); showNumbers.call(this); } var showNumbers = function() { var self = this; $(this.input_container).hide(); $(this.correct_answer_container).hide(); $(this.feedback_container).hide(); this.btnContinue.hide(); this.liveRegion.text(''); self.currentNumber = -1; if ( !this.isGroup ) { self.currentNumberSet = Math.floor(Math.random() * 11); var isVisible = true; var timer = setTimeout(function tick() { if ( isVisible ) { self.currentNumber++; var text = DIGIT_ARRAY[self.currentNumberSet][self.currentNumber] $(self.number).html(text); self.liveRegion.text(text); $(self.number).css({"display": "block"}); if ( self.currentNumber < (DIGIT_ARRAY[self.currentNumberSet].length) ) { timer = setTimeout(tick, 1000); } else { $(self.number).css({"display": "none"}); showInput.call(self); } } else { $(self.number).css({"display": "none"}); timer = setTimeout(tick, 500); } isVisible = !isVisible; }, 500); } else { if ( self.currentNumberSet == 10 ) { self.currentNumberSet = Math.floor(Math.random() * 10); } else { self.currentNumberSet = self.currentNumberSet + 1 + Math.floor(Math.random() * (10 - self.currentNumberSet)); } var isVisible = true; var timer = setTimeout(function tick() { if ( isVisible ) { self.currentNumber++; var text = '' + DIGIT_ARRAY[self.currentNumberSet][self.currentNumber] + DIGIT_ARRAY[self.currentNumberSet][self.currentNumber + 1] + DIGIT_ARRAY[self.currentNumberSet][self.currentNumber + 2]; self.liveRegion.text(text); $(self.number).html(text); $(self.number).css({"display": "block"}); self.currentNumber++; self.currentNumber++; if ( self.currentNumber < (DIGIT_ARRAY[self.currentNumberSet].length) ) { timer = setTimeout(tick, 2000); } else { $(self.number).css({"display": "none"}); showInput.call(self); } } else { $(self.number).css({"display": "none"}); timer = setTimeout(tick, 1000); } isVisible = !isVisible; }, 500); } this.isGroup = !this.isGroup; } var showInput = function() { this.liveRegion.text(''); $(this.input_container).show(); this.inputField.disabled = false; this.inputField.value = ''; $(this.inputField).focus(); this.btnFinish.show(); } var showFeedback = function() { $(this.input_container).css('display','inline-block'); this.inputField.disabled = true; var liveText = 'your answer is' + this.inputField.value.split('').join(',') + '.'; $('.input_text').text('Your answer:'); var correctText = DIGIT_ARRAY[this.currentNumberSet].join(''); if ( !this.isGroup ) { correctText = correctText.slice(0, 3) + ' ' + correctText.slice(3); correctText = correctText.slice(0, 7) + ' ' + correctText.slice(7); liveText += 'correct answer is ' + correctText + '.'; } else { liveText += 'correct answer is ' + DIGIT_ARRAY[this.currentNumberSet].join(',') + '.'; } $('.correct_value').text(correctText); $('.correct_answer_container').show(); var correct = 0; for (var i = 0; i < DIGIT_ARRAY[this.currentNumberSet].length; i++) { if ( this.inputField.value.charAt(i) == DIGIT_ARRAY[this.currentNumberSet][i] ) { correct++; } } if ( correct == 1 ) { $(this.feedback_container).text('You recalled ' + correct + ' number in the correct position'); } else { $(this.feedback_container).text('You recalled ' + correct + ' numbers in the correct positions'); } $(this.feedback_container).show(); liveText += $(this.feedback_container).text() + '.'; if ( this.isGroup ) { liveText += 'press the continue button to proceed the test'; } else { liveText += 'press the try again button to repeat the memory test or the NEXT button to move to Quiz 1'; } this.liveRegion.text(liveText); this.btnFinish.hide(); if ( this.isGroup ) { this.btnContinue.show(); } else { finishSlide.call(this); this.btnReset.show(); } } var addButtons = function() { this.btnBegin = $(''); this.btnFinish = $(''); this.btnContinue = $(''); this.btnReset = $(''); this.btnBegin.bind("click", beginTest.bind(this)); this.btnFinish.bind("click", showFeedback.bind(this)); this.btnContinue.bind("click", beginTest.bind(this)); this.btnReset.bind("click", beginTest.bind(this)); var btnContainer = $(''); btnContainer.append(this.btnBegin, this.btnFinish, this.btnContinue, this.btnReset); this.section.jq.append(btnContainer); }; var finishSlide = function() { this.section.points_earned = this.section.points_possible; this.section.section_completed = true; player.activity.grade_activity(); player.update_section_status(); }; MemoryTest.prototype.showSlide = function() { //finishSlide.call(this); this.section.jq.focus(); }; window.mheContpract = window.mheContpract || {}; window.mheContpract['memory_test'] = { initialize: function(section) { section.slide = new MemoryTest(section); }, show: function(section) { section.slide.showSlide(); } }; })();