//####################################################
//practice1
;(function () {
'use strict';
var currentStep,
ariaContainer;
function slideInitHandler(section) {
// console.log('slideInitHandler');
section.points_possible = 1;
section.points_earned = 0;
section.section_completed = false;
var _elem = section.jq;
_elem.addClass('practice1');
ariaContainer = $('
')
.addClass('hidden_element')
.attr('aria-live', 'polite');
_elem.append(ariaContainer);
}
function completeTask(section) {
section.points_earned = 1;
section.section_completed = true;
player.activity.grade_activity();
player.update_section_status();
document.querySelector('.navigation_button.next_button').focus();
}
function slideShowHandler(section) {
// console.log('slideShowHandler', section);
currentStep = 0;
initStep(section)
}
function initStep(section) {
var _elem = section.jq.focus()
var $steps = _elem.find('.step').hide()
var $step = $steps.eq(currentStep).show()
var $initial = $step.find('.step__initial').show()
var $parts = $step.find('[class~=step__part]')
.each(function (i, item) {
item.removeClass('step__part--shown')
item.removeClass('step__part--active')
})
.hide()
var $btns = $step.find('.step__btn').show()
_elem.find('[data-part=general]').hide()
var descriptions = $step.find('.step__description-item')
.toArray()
.map(function (item) {
return item.textContent
})
if ($initial.find('.step__description-item').length) {
ariaContainer
.empty()
.append($initial.find('.step__description-item').clone())
}
$btns
.unbind('click')
.bind('click', function (e) {
$(e.target).focus()
var $id = $(this).attr('data-view')
$initial.hide()
ariaContainer.empty().append(descriptions[$id])
$parts.each(function (i, item) {
if ($(item).attr('data-part') == $id) {
item.addClass('step__part--shown')
item.addClass('step__part--active')
$(item).fadeIn(100).show()
$(item).find('.step__description-item').show()
} else {
// $(item).hide()
$(item).find('.step__description-item').hide()
item.removeClass('step__part--active')
}
})
if (_elem.find('[class~=step__part][class~=step__part--shown]').length == $parts.length) {
var $dg = _elem.find('[data-part=general]').show()
ariaContainer.append($dg.clone())
completeTask(section)
}
})
}
function slideHideHandler(section) {
//console.log('slideHideHandler', section)
//add navigation
}
window.mheContpract = window.mheContpract || {};
window.mheContpract['practice1'] = {
initialize: slideInitHandler,
show: slideShowHandler,
hide: slideHideHandler
};
})();
//####################################################
//practice2
;(function () {
'use strict';
function slideInitHandler(section) {
// console.log('slideInitHandler');
section.points_possible = 1;
section.points_earned = 0;
section.section_completed = false;
var _elem = section.jq
_elem.addClass('practice2')
}
function completeTask(section) {
section.points_earned = 1;
section.section_completed = true;
player.activity.grade_activity();
player.update_section_status();
document.querySelector('.navigation_button.next_button').focus();
}
function slideShowHandler(section) {
// console.log('slideShowHandler', section);
//init step0 ---------------
var _elem = section.jq.focus()
var ariaContainer = $('
')
.addClass('hidden_element')
.attr('aria-live', 'polite')
var $steps = _elem.find('.step').hide()
var $step = _elem.find('.step0').show()
var $btn0 = _elem.find('.show-one-trial').show()
var $btn1 = _elem.find('.show-results').hide()
var $interImg = $step.find('svg').eq(0)
var $light = $interImg.find('[class~=practice2__light]').hide()
var $sound = $interImg.find('[class~=practice2__sound]').hide()
var $electro = $interImg.find('[class~=practice2__electricity]').hide()
var $grate = $interImg.find('[class~=practice2__grate]')
$grate[0].classList.remove('active')
$btn0.unbind('click').bind('click', function () {
$btn0.fadeOut()
$light.show()
$sound.show()
$('.footer')
.html(
$step.find('.step-end-instruction').contents().clone()
)
setTimeout(function () {
$grate[0].classList.add('active')
$btn1.fadeIn().unbind('click').bind('click', function () {
//init step1 ---------------
$grate[0].classList.remove('active')
$step.fadeOut()
$step = _elem.find('.step1').fadeIn()
$('.footer')
.html(
$step.find('.step-end-instruction').contents().clone()
)
completeTask(section)
})
}, 1000)
// var rapeMouse = function () {
// setTimeout(function () {
// $grate[0].classList.add('active')
// setTimeout(function () {
// $btn1.hide()
// $light.hide()
// $sound.hide()
// $grate[0].classList.remove('active')
// setTimeout(function () {
// $light.show()
// setTimeout(function () {
// $sound.show()
// }, Math.random() * 1000)
// rapeMouse()
// }, Math.random() * 2000)
// }, Math.random() * 2000)
// }, 1000)
// }
// rapeMouse()
})
//========================================
}
function slideHideHandler(section) {
//console.log('slideHideHandler', section)
//add navigation
}
window.mheContpract = window.mheContpract || {};
window.mheContpract['practice2'] = {
initialize: slideInitHandler,
show: slideShowHandler,
hide: slideHideHandler
};
})();
//####################################################
//practice3
;(function () {
'use strict';
function slideInitHandler(section) {
// console.log('slideInitHandler');
section.points_possible = 1;
section.points_earned = 0;
section.section_completed = false;
var _elem = section.jq
_elem.addClass('practice3')
}
function completeTask(section) {
section.points_earned = 1;
section.section_completed = true;
player.activity.grade_activity();
player.update_section_status();
document.querySelector('.navigation_button.next_button').focus();
}
function slideShowHandler(section) {
// console.log('slideShowHandler', section);
//init step0 ---------------
var _elem = section.jq.focus()
var ariaContainer = $('
')
.addClass('hidden_element')
.attr('aria-live', 'polite')
var $steps = _elem.find('.step').hide()
var $step = _elem.find('.step0').show()
var $btn0 = _elem.find('.show-trial-sequence').show()
var $btn1 = _elem.find('.show-results').hide()
$btn0.unbind('click').bind('click', function () {
$btn0.fadeOut()
$step.fadeOut()
//init step1 ---------------
$step = _elem.find('.step1').fadeIn()
$('.footer')
.html(
$step.find('.step-end-instruction').contents().clone()
)
$btn1.fadeIn()
.unbind('click')
.bind('click', function () {
//init step2 ---------------
$step.fadeOut()
$step = _elem.find('.step2').delay(400).fadeIn()
$('.footer')
.html(
$step.find('.step-end-instruction').contents().clone()
)
completeTask(section)
})
})
//========================================
}
function slideHideHandler(section) {
//console.log('slideHideHandler', section)
//add navigation
}
window.mheContpract = window.mheContpract || {};
window.mheContpract['practice3'] = {
initialize: slideInitHandler,
show: slideShowHandler,
hide: slideHideHandler
};
})();