var presentation = ["imposingly<\/word>","valley<\/word>","steeply<\/word>","abruptly<\/word>","heath<\/word>","wayfarer<\/word>","Mayenfeld<\/word>","well-wooded stretches<\/word>","Alps<\/word>","pungent herbage<\/word>","soft perfume<\/word>","The little old town of Mayenfeld<\/strong> is charmingly situated. From it, a footpath leads through green, well-wooded stretches<\/strong> to the foot of the heights which look down imposingly<\/strong> upon the valley<\/strong>. Where the footpath begins to go steeply<\/strong> and abruptly<\/strong> up the Alps<\/strong>, the heath<\/strong>, with its short grass and pungent herbage<\/strong>, at once sends out its soft perfume<\/strong> to meet the wayfarer<\/strong>.<\/phrase>","scarcely<\/word>","distinguish<\/word>","toiled<\/word>","vigorous maiden<\/word>","narrow path<\/word>","glow<\/word>","sun-browned skin<\/word>","Small wonder<\/word>","bitter frost<\/word>","hob-nailed boots<\/word>","One bright sunny morning in June, a tall, vigorous maiden<\/strong> of the mountain region climbed up the narrow path<\/strong>, leading a little girl by the hand. The youngster's cheeks were in such a glow<\/strong> that it showed even through her sun-browned skin<\/strong>. Small wonder<\/strong> though! for in spite of the heat, the little one, who was scarcely<\/strong> five years old, was bundled up as if she had to brave a bitter frost<\/strong>. Her shape was difficult to distinguish<\/strong>, for she wore two dresses, if not three, and around her shoulders a large red cotton shawl. With her feet encased in heavy hob-nailed boots<\/strong>, this hot and shapeless little person toiled<\/strong> up the mountain.<\/phrase>","a hamlet<\/word>","Alm<\/word>","Im D\u00f6rfli<\/word>","loiter<\/word>","scattered<\/word>","instantly<\/word>","promptly<\/word>","Little Village<\/word>","Deta<\/word>","The pair had been climbing for about an hour when they reached a hamlet<\/strong> half-way up the great mountain named the Alm<\/strong>. This hamlet was called \"Im D\u00f6rfli<\/strong>'' or \"The Little Village<\/strong>.\" It was the elder girl's hometown, and therefore she was greeted from nearly every house; people called to her from windows and doors, and very often from the road. But, answering questions and calls as she went by, the girl did not loiter<\/strong> on her way and only stood still when she reached the end of the hamlet. There a few cottages lay scattered<\/strong> about, from the furthest of which a voice called out to her through an open door: \"Deta<\/strong>, please wait one moment! I am coming with you, if you are going further up.\"\nWhen the girl stood still to wait, the child instantly<\/strong> let go her hand and promptly<\/strong> sat down on the ground.<\/phrase>","stout<\/word>","wandered<\/word>","Heidi<\/word>","Deta<\/word>","encourage<\/word>","small companion<\/word>","pleasant-looking woman<\/word>","old acquaintances<\/word>","\"Are you tired, Heidi<\/strong>?\" Deta<\/strong> asked the child.\n\"No, but hot,\" she replied.\n\"We shall be up in an hour, if you take big steps and climb with all your little might!\" Thus the elder girl tried to encourage<\/strong> her small companion<\/strong>.\nA stout<\/strong>, pleasant-looking woman<\/strong> stepped out of the house and joined the two. The child had risen and wandered<\/strong> behind the old acquaintances<\/strong>, who immediately started gossiping about their friends in the neighborhood and the people of the hamlet generally.<\/phrase>","assured<\/word>","Alm<\/word>","grandfather<\/word>","hinder<\/word>","Deta<\/word>","\"Where are you taking the child, Deta<\/strong>?\" asked the newcomer. \"Is she the child your sister left?\"\n\"Yes,\" Deta<\/strong> assured<\/strong> her; \"I am taking her up to the Alm<\/strong>-Uncle and there I want her to remain.\"\n\"You can't really mean to take her there Deta<\/strong>. You must have lost your senses, to go to him. I am sure the old man will show you the door and won't even listen to what you say.\"\n\"Why not? As he's her grandfather<\/strong>, it is high time he should do something for the child. I have taken care of her until this summer and now a good place has been offered to me. The child shall not hinder<\/strong> me from accepting it, I tell you that!\"<\/phrase>","mortals<\/word>","prospects<\/word>","splendid<\/word>","persuaded<\/word>","Frankfurt<\/word>","\"It would not be so hard, if he were like other mortals<\/strong>. But you know him yourself. How could he look after a child, especially such a little one? She'll never get along with him, I am sure of that!-But tell me of your prospects<\/strong>.\"\n\"I am going to a splendid<\/strong> house in Frankfurt<\/strong>. Last summer some people went off to the baths and I took care of their rooms. As they got to like me, they wanted to take me along, but I could not leave. They have come back now and have persuaded<\/strong> me to go with them.\"<\/phrase>","shudder<\/word>","heathen<\/word>","uncanny beard<\/word>","twisted stick<\/word>","Barbara<\/word>","\"I am glad I am not the child!\" exclaimed Barbara<\/strong> with a shudder<\/strong>. \"Nobody knows anything about the old man's life up there. He doesn't speak to a living soul, and from one year's end to the other he keeps away from church. People get out of his way when he appears once in a twelve-month down here among us. We all fear him and he is really just like a heathen<\/strong> or an old Indian, with those thick grey eyebrows and that huge uncanny beard<\/strong>. When he wanders along the road with his twisted stick<\/strong> we are all afraid to meet him alone.\"<\/phrase>","stubbornly<\/word>","responsible<\/word>","conscience<\/word>","fierce<\/word>","hold my tongue<\/word>","make me pay for it<\/word>","Deta<\/word>","\"That is not my fault,\" said Deta<\/strong> stubbornly<\/strong>. \"He won't do her any harm; and if he should, he is responsible<\/strong>, not I.\"\n\"I wish I knew what weighs on the old man's conscience<\/strong>. Why are his eyes so fierce<\/strong> and why does he live up there all alone? Nobody ever sees him and we hear many strange things about him. Didn't your sister tell you anything, Deta<\/strong>?\"\n\"Of course she did, but I shall hold my tongue<\/strong>. He would make me pay for it<\/strong> if I didn't.\"<\/phrase>"]; var currentPosition = 0; var totalPositions = 0; var timePerWord = 1500; var timePerPhraseWord = 120 var readAheadPlayerTimer; var autoPlay = true; var setMinimized = false; var wordSpeedOptions = {'Slower':2000,'Moderate':1200,'Fast':800}; var phraseSpeedOptions = {'Slower':280,'Moderate':200,'Fast':80}; var defaultWordSpeedOption = 'Moderate'; var defaultPhraseSpeedOption = 'Moderate'; var logToLTI = false; $(window).load(function(){ totalPositions = presentation.length; if (totalPositions > 0){ $('body').prepend('
'); $('body').prepend('
'); $('#read_ahead_player').prepend('
'); initializeReadAheadControls(); initializeReadAheadSlider(); initializeReadAheadSpeedOptions(); currentReadAheadControls(); resumeReadAheadPlayback(); } }); $(document).keyup(function(e){ switch(e.which) { case 37: pauseReadAheadPresentation(); priorReadAheadPresentationItem(); break; case 39: pauseReadAheadPresentation(); nextReadAheadPresentationItem(); break; default: break; } }); function initializeReadAheadControls(){ var s = ''; s += ''; s += ''; s += ''; s += '
'; s += ''; s += ''; s += ''; s += ''; s += ''; s += ''; s += ''; s += ''; s += ''; s += '
'; $('#read_ahead_player').append(s); } function initializeReadAheadSlider(){ var s = ''; s += '
'; s += '
'; s += '
'; $('#read_ahead_controls').prepend(s); updateReadAheadSliderPosition(); } function initializeReadAheadSpeedOptions(){ var s = '
'; s += '
'; s += ' Word Speed
'; s += '
'; optionCount = 0; for (index in wordSpeedOptions) { optionCount++; } optionWidth = 100 / optionCount; for (index in wordSpeedOptions) { var option = wordSpeedOptions[index]; if (index == defaultWordSpeedOption) { s += ''; updateReadAheadWordSpeed(option); } else { s += ''; } } s += '
'; s += '
'; s += '
'; s += ' Phrase Speed
'; s += '
'; optionCount = 0; for (index in phraseSpeedOptions) { optionCount++; } optionWidth = 100 / optionCount; for (index in phraseSpeedOptions) { var option = phraseSpeedOptions[index]; if (index == defaultWordSpeedOption) { s += ''; updateReadAheadPhraseSpeed(option); } else { s += ''; } } s += '
'; s += '
'; s += '
'; $('#read_ahead_controls').append(s); } function updateReadAheadWordSpeed(microseconds,sender) { microseconds = microseconds != undefined && microseconds > 0 ? microseconds : 0; if (microseconds > 0) { timePerWord = microseconds; } if (sender!=undefined) { $('#slider_control_word_speed').find('a').removeClass('current_speed'); $(sender).addClass('current_speed'); } logReadAheadPlayerAction('updateReadAheadWordSpeed','Presentation',microseconds); } function updateReadAheadPhraseSpeed(microseconds,sender) { microseconds = microseconds != undefined && microseconds > 0 ? microseconds : 0; if (microseconds > 0 ) { timePerPhraseWord = microseconds; } if (sender!=undefined) { $('#slider_control_phrase_speed').find('a').removeClass('current_speed'); $(sender).addClass('current_speed'); } logReadAheadPlayerAction('updateReadAheadPhraseSpeed','Presentation',microseconds); } function updateReadAheadSliderPosition(){ var currentSliderBarWidth = 100 - (100 / totalPositions * (currentPosition + 1)); $('#readAheadSliderBar').css('width',currentSliderBarWidth+'%'); } function currentReadAheadControls(){ $('#read_ahead_player_pause_play').show(); if (currentPosition < totalPositions - 1) { $('#read_ahead_player_next_word').removeClass('disabled'); } else { $('#read_ahead_player_next_word').addClass('disabled'); } if (currentPosition > 0) { $('#read_ahead_player_previous_word').removeClass('disabled'); } else { $('#read_ahead_player_previous_word').addClass('disabled'); } } function restartReadAheadPresentation(){ currentPosition = 0; logReadAheadPlayerAction('restartReadAheadPresentation','Presentation',''); resumeReadAheadPlayback(); } function resumeReadAheadPlayback(){ $('.fa-repeat').removeClass('fa-repeat').addClass('fa-play'); $('#read_ahead_player_pause_play').each(function(){ $(this).find('.fa-play').removeClass('fa-play').addClass('fa-pause'); $(this).off('click'); $(this).attr('onclick','pauseReadAheadPresentation()'); }); logReadAheadPlayerAction('resumeReadAheadPlayback','Presentation',''); playReadAheadPresentation(); } function pauseReadAheadPresentation(){ $('#read_ahead_player_pause_play').each(function(){ $(this).find('.fa-pause').removeClass('fa-pause').addClass('fa-play'); $(this).off('click'); $(this).attr('onclick','resumeReadAheadPlayback()'); }); logReadAheadPlayerAction('pauseReadAheadPresentation','Presentation',''); read_ahead_pause(); } function endReadAheadPresentation(){ $('.fa-play').removeClass('fa-play').addClass('fa-repeat'); $('.fa-pause').removeClass('fa-pause').addClass('fa-repeat'); $('#read_ahead_player_pause_play').each(function(){ $(this).off('click'); $(this).attr('onclick','restartReadAheadPresentation()'); }); logReadAheadPlayerAction('endReadAheadPresentation','Presentation',''); logLTIEndPresentation(); } function playReadAheadPresentation(){ autoPlay=true; currentPosition--; logReadAheadPlayerAction('playReadAheadPresentation','Presentation',''); nextReadAheadPresentationItem(); } function startReadAheadStepper(timeDisplayWord){ clearInterval(readAheadPlayerTimer); readAheadPlayerTimer = setTimeout(function() { read_ahead_step(); },timeDisplayWord); } function stopReadAheadStepper(){ clearInterval(readAheadPlayerTimer); } function read_ahead_step(){ if (autoPlay) { nextReadAheadPresentationItem(); } } function read_ahead_pause(){ autoPlay=false; stopReadAheadStepper(); } function showReadAheadPresentationItem(index){ currentPosition = index; currentPresentationItem = presentation[currentPosition] != undefined ? presentation[currentPosition].trim() : ""; if (currentPresentationItem != "") { currentItemWordCount = presentation[currentPosition].replace("\n","").split(" ").length; if (currentPresentationItem.startsWith("")){ startReadAheadStepper(currentItemWordCount*timePerWord); $('#read_ahead_player_field').html('
'+currentPresentationItem+'
'); logReadAheadPlayerAction('showReadAheadPresentationItem','Word',currentPresentationItem); } else { startReadAheadStepper(currentItemWordCount*timePerPhraseWord); $('#read_ahead_player_field').html('
'+currentPresentationItem.replace("\n","
")+'
'); logReadAheadPlayerAction('showReadAheadPresentationItem','Phrase',''); } } else { if (currentPosition < totalPositions) { nextReadAheadPresentationItem(); } else { endReadAheadPresentation(); read_ahead_minimize(); } } currentReadAheadControls(); updateReadAheadSliderPosition(); saveReadAheadPosition(); } function priorReadAheadPresentationItem(){ stopReadAheadStepper(); logReadAheadPlayerAction('priorReadAheadPresentationItem','Controls',''); showReadAheadPresentationItem(currentPosition-1); } function nextReadAheadPresentationItem(){ stopReadAheadStepper(); logReadAheadPlayerAction('nextReadAheadPresentationItem','Controls',''); showReadAheadPresentationItem(currentPosition+1); } function read_ahead_playAgain(){ currentWordIndex = 0; logReadAheadPlayerAction('read_ahead_playAgain','Controls',''); playReadAheadPresentation(); } function read_ahead_minimize(){ setMinimized = true; logReadAheadPlayerAction('read_ahead_minimize','Controls',''); read_ahead_switch_min_max(); } function read_ahead_maximize(){ setMinimized = false; logReadAheadPlayerAction('read_ahead_maximize','Controls',''); read_ahead_switch_min_max(); } function read_ahead_switch_min_max(forceSwitch){ forceSwitch = forceSwitch != undefined ? forceSwitch : false; if (forceSwitch) { setMinimized = !setMinimized; } if (setMinimized) { $('#read_ahead_player_back').fadeOut(); $('#read_ahead_player').addClass('minimize'); $('.player-icons .fa-stack').removeClass('fa-lg').addClass('fa-sm'); $('.player-icons .fa-minus').removeClass('fa-minus').addClass('fa-expand'); logReadAheadPlayerAction('read_ahead_switch_min_max','Min',''); //$('#read_ahead_player_max_min').each(function(){ // $(this).off('click'); // $(this).attr('onclick','read_ahead_maximize()'); //}); } else { $('#read_ahead_player_back').fadeIn(); $('#read_ahead_player').removeClass('minimize'); $('.player-icons .fa-stack').removeClass('fa-sm').addClass('fa-lg'); $('.player-icons .fa-expand').removeClass('fa-expand').addClass('fa-minus'); logReadAheadPlayerAction('read_ahead_switch_min_max','Max',''); //$('#read_ahead_player_max_min').each(function(){ // $(this).off('click'); // $(this).attr('onclick','read_ahead_minimize()'); //}); } } function saveReadAheadPosition(){ $.ajax({ type:'POST', url:'/ajax/save_user_presentation_position.php', data: { 'id':2271, 'position': currentPosition } }) .done(function(results){ }) .fail(function( jqXHR, textStatus ) { alert( "Request failed: " + textStatus ); }); } function logLTIEndPresentation(action) { if (!logToLTI) { return; } $.ajax({ type:'POST', url:'/lti/presentationEnded.php', data: { 'documentId':2271, 'userId':0, } }) } function logReadAheadPlayerAction(action,area,details){ var d = new Date(); var t = d.getTime(); action = action != undefined ? action.trim() : 'UNKNOWN'; area = area != undefined ? area.trim() : ''; details = details != undefined ? details : ''; // If we are about to show a new word, increase the number of keywords // reinforced so we can log that for the Dashboard page. if (area == 'Word') { window.keywordCount++; } $.ajax({ type:'POST', url:'/logging/logPlayerAction.php', data: { 'documentId':2271, 'userId':0, 'playerAction':action, 'playerArea':area, 'details':details, 'timestamp': t } }) .done(function(results){ }) .fail(function( jqXHR, textStatus ) { alert( "Request failed: " + textStatus ); }); }