/** * Created by Mitina on 29.04.2016. */ (function() { 'use strict'; var event = window.mheContpract.libs['event'].user; var ReviewSlide = function(section) { this.section = section; this.section.points_possible = 1; this.section.points_earned = 0; this.section.section_completed = false; section.jq.addClass('review_1'); this.container = section.jq[0].querySelector('.text'); this.response = section.jq[0].querySelector('.response'); this.tone = section.jq[0].querySelector('.tone'); this.response.style.display = 'none'; // Add aria description addAriaElement.call(this); addAnswerBtns.call(this); this.countTries = 0; }; var addAriaElement = function() { var ariaLabel = this.section.title + '.'; this.ariaReader = $('
'); this.section.jq.prepend(this.ariaReader); }; var preventTab = function(e) { e = e || window.event; if ( !e.shiftKey && e.keyCode === 9 ) { // !Shift + Tab key e.preventDefault(); document.querySelector('.navigation_button.next_button').focus(); } }; var addAnswerBtns = function() { var self = this; var $button = $(''); $button.bind('click', function(){ // tone play self.countTries++; self.tone.play(); if ( self.countTries === 3 ) { self.response.style.display = ''; if(!self.section.section_completed) { finishSlide.call(self); } } }); this.container.appendChild($button[0]); }; var finishSlide = function() { this.section.points_earned = this.section.points_possible; this.section.section_completed = true; player.activity.grade_activity(); player.update_section_status(); }; ReviewSlide.prototype.showSlide = function() { this.ariaReader.focus(); }; window.mheContpract = window.mheContpract || {}; window.mheContpract['review_1'] = { initialize: function(section) { section.slide = new ReviewSlide(section); }, show: function(section) { section.slide.showSlide(); } }; })(); (function() { 'use strict'; var event = window.mheContpract.libs['event'].user; var STEP_TEXT = "Air flows out of the air pump into the woman's eye. The graph was changed."; var ReviewSlide = function(section) { this.section = section; this.section.points_possible = 1; this.section.points_earned = 0; this.section.section_completed = false; section.jq.addClass('review_2'); this.container = section.jq[0].querySelector('.text'); this.response = section.jq[0].querySelector('.response'); this.tone = section.jq[0].querySelector('.tone'); this.liveRegion = section.jq[0].querySelector( ".live_region" ); this.response.style.display = 'none'; var nameMC = this.section.jq.find('.movieclip').data('name'); this.mc = window.mheContpract.movieclips[nameMC]; this.dataArray = [1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2]; // Add aria description addAriaElement.call(this); addAnswerBtns.call(this); this.countTries = 0; }; var addAriaElement = function() { var ariaLabel = this.section.title + '.'; this.ariaReader = $(''); this.section.jq.prepend(this.ariaReader); }; var preventTab = function(e) { e = e || window.event; if ( !e.shiftKey && e.keyCode === 9 ) { // !Shift + Tab key e.preventDefault(); document.querySelector('.navigation_button.next_button').focus(); } }; var addAnswerBtns = function() { this.isPlaying = false; var self = this; var $button = $(''); $button.bind('click', function(){ if( self.isPlaying ) return; self.isPlaying = true; self.liveRegion.innerHTML = "" + STEP_TEXT + "
"; self.tone.play(); var step = self.dataArray[self.countTries]; self.mc.root.onStop = function() {}; self.mc.root.gotoAndStop(self.mc.root.labels['step' + step]); self.mc.root.play(); // It is bad to use Id of sprite, but no another way now, can't use IN self.mc.root.onStop = function() { self.mc.root['graph'].play(); if ( self.countTries === 20 ) { self.response.style.display = ''; finishSlide.call(self); $button.attr('disabled', 'disabled'); } else { $button.attr('disabled', ''); } self.isPlaying = false; }; // tone play self.countTries++; }); this.container.appendChild($button[0]); }; var finishSlide = function() { this.section.points_earned = this.section.points_possible; this.section.section_completed = true; player.activity.grade_activity(); player.update_section_status(); }; ReviewSlide.prototype.showSlide = function() { this.ariaReader.focus(); }; window.mheContpract = window.mheContpract || {}; window.mheContpract['review_2'] = { initialize: function(section) { section.slide = new ReviewSlide(section); }, show: function(section) { section.slide.showSlide(); } }; })();