var presentation = ["based on the Alice books by Lewis Carroll<\/word>","Alice in Wonderland is a 1951 American animated musical fantasy-adventure film produced by Walt Disney Productions and based on the Alice books by Lewis Carroll<\/strong>.<\/phrase>","bored<\/word>","her sister's history lesson<\/word>","her want of adventure<\/word>","late for a significant date<\/word>","talking knob<\/word>","advises her to shrink<\/word>","drinking from a bottle<\/word>","floats out through the keyhole<\/word>","sea of her own tears<\/word>","eating a biscuit marked Eat Me<\/word>","grow very large<\/word>","encounters numerous characters<\/word>","recount the tale<\/word>","The Walrus and the Carpenter<\/word>","height<\/word>","Alice becomes bored<\/strong> with her sister's history lesson<\/strong> on the Norman conquest of England and expresses her want of adventure<\/strong>, leading her to a riverbank. There, Alice spots a passing White Rabbit in a waistcoat, exclaiming that he is late for a significant date<\/strong>. She gives chase, following him into a large hole. She sees him leave through a tiny door, whose talking knob<\/strong> advises her to shrink<\/strong> to an appropriate height<\/strong> by drinking from a bottle<\/strong> marked Drink Me. She does so and floats out through the keyhole<\/strong> into a sea of her own tears<\/strong>, which she had cried after eating a biscuit marked Eat Me<\/strong>, which caused her to grow very large<\/strong>. As she continues to follow the Rabbit, she encounters numerous characters<\/strong>, including Tweedledum and Tweedledee, who recount the tale<\/strong> of The Walrus and the Carpenter<\/strong>.<\/phrase>","tracks the Rabbit to his house<\/word>","mistakes her for his housemaid Mary Ann<\/word>","sends her to retrieve his gloves<\/word>","eats another cookie marked<\/word>","grows large again<\/word>","Rabbit asks the Dodo to help expel her<\/word>","Dodo decides to burn the house down<\/word>","Alice escapes<\/word>","causes her to shrink<\/word>","Alice meets a garden of talking flowers<\/word>","welcome her with a song<\/word>","make disparaging comments about her appearance<\/word>","order her to leave<\/word>","becomes enraged at Alice<\/word>","Caterpillar turns into a butterfly<\/word>","returns to her original height<\/word>","three<\/word>","size<\/word>","alter<\/word>","Alice tracks the Rabbit to his house<\/strong>; he mistakes her for his housemaid Mary Ann<\/strong> and sends her to retrieve his gloves<\/strong>. While searching for the gloves in the Rabbit's house, Alice finds and eats another cookie marked<\/strong> \"Eat Me\" and grows large again<\/strong>, getting stuck in the house. Thinking her a monster, the Rabbit asks the Dodo to help expel her<\/strong>. When the Dodo decides to burn the house down<\/strong>, Alice escapes<\/strong> by eating a carrot from the Rabbit's garden, which causes her to shrink<\/strong> to three<\/strong> inches tall. Continuing to follow the Rabbit, Alice meets a garden of talking flowers<\/strong> who initially welcome her with a song<\/strong>, but then make disparaging comments about her appearance<\/strong> and order her to leave<\/strong>. Alice then encounters a Caterpillar, who becomes enraged at Alice<\/strong> after she laments her small size<\/strong> after which the Caterpillar turns into a butterfly<\/strong> and flies away. Before leaving, the Caterpillar advises Alice to eat a piece of a mushroom to alter<\/strong> her size<\/strong>. She does so and returns to her original height<\/strong>, continuing her chase of the Rabbit.<\/phrase>","visit the Mad Hatter or the March Hare<\/word>","learn the Rabbit's location<\/word>","celebrating their unbirthdays<\/word>","ask Alice to explain her predicament<\/word>","becomes frustrated<\/word>","Rabbit appears<\/word>","Hatter and Hare sing The Unbirthday Song<\/word>","Alice decides to return home<\/word>","surroundings completely change<\/word>","gets lost<\/word>","two<\/word>","food<\/word>","In the woods, Alice meets the Cheshire Cat, who advises her to visit the Mad Hatter or the March Hare<\/strong> to learn the Rabbit's location<\/strong>. She encounters both, along with the Dormouse, at the Hare's house having a mad tea party and celebrating their unbirthdays<\/strong>. The Hatter and the Hare ask Alice to explain her predicament<\/strong>, to which Alice tries but becomes frustrated<\/strong> by their interruptions and absurd logic. As she prepares to leave, the Rabbit appears<\/strong>, continuing to exclaim that he is late; the Hatter examines the Rabbit's pocket watch and says it is two<\/strong> days slow, and attempts to fix it by filling it with food<\/strong> and tea and ends up destroying it after declaring it mad. The Rabbit laments that his watch was an unbirthday present, and the Hatter and Hare sing The Unbirthday Song<\/strong> to him before throwing him back into the woods. Fed up with the nonsense, Alice decides to return home<\/strong>, but her surroundings completely change<\/strong>, and she gets lost<\/strong>. Fearing she is lost forever, she sits on a rock sobbing.<\/phrase>","Cheshire Cat reappears and advises Alice to ask the Queen of Hearts for directions home<\/word>","shortcut to the King and tyrannical Queen's castle<\/word>","Queen orders the beheading of a trio of playing card<\/word>","forces Alice to play against her in a croquet match<\/word>","live flamingos<\/word>","card guards<\/word>","hedgehogs are used as equipment<\/word>","rig the game in favor of the Queen<\/word>","Cat appears again<\/word>","plays a trick on the Queen<\/word>","causing her to fall over<\/word>","Cat disappears in time<\/word>","look like Alice was the prankster<\/word>","before the Queen can order her execution<\/word>","King suggests a trial<\/word>","ones<\/word>","The Cheshire Cat reappears and advises Alice to ask the Queen of Hearts for directions home<\/strong>, showing her a shortcut to the King and tyrannical Queen's castle<\/strong>. The Queen orders the beheading of a trio of playing card<\/strong> gardeners who mistakenly planted white roses instead of red ones<\/strong> (but paint them to make them look red), and forces Alice to play against her in a croquet match<\/strong>, in which live flamingos<\/strong>, card guards<\/strong>, and hedgehogs are used as equipment<\/strong>. The equipment rig the game in favor of the Queen<\/strong>. The Cat appears again<\/strong> and plays a trick on the Queen<\/strong>, causing her to fall over<\/strong>. The Cat disappears in time<\/strong> to make it look like Alice was the prankster<\/strong>, but before the Queen can order her execution<\/strong>, the King suggests a trial<\/strong>.<\/phrase>","Alice's trial<\/word>","stand as witnesses<\/word>","celebrating the Queen's unbirthday<\/word>","headpiece as a present<\/word>","turns into the Cat<\/word>","Queen orders Alice's execution<\/word>","Alice eats a piece of the Caterpillar's mushroom<\/word>","grows large again<\/word>","King and Queen order her to leave the courthouse<\/word>","refuses<\/word>","insults the Queen<\/word>","returns to her normal size<\/word>","Queen orders her execution<\/word>","card guards<\/word>","Alice reaches the small door she encountered<\/word>","doorknob shows her<\/word>","she is actually already outside<\/word>","asleep<\/word>","Alice yells at herself to wake up<\/word>","she does thanks to her sister<\/word>","return home for tea<\/word>","At Alice's trial<\/strong>, the Mad Hatter, March Hare, and Dormouse are called to the stand as witnesses<\/strong>, briefly celebrating the Queen's unbirthday<\/strong> and giving her a headpiece as a present<\/strong>, which turns into the Cat<\/strong>. Chaos ensues when the Dormouse, frightened when Alice points out the Cat, runs around the courtroom. As the Queen orders Alice's execution<\/strong>, Alice eats a piece of the Caterpillar's mushroom<\/strong> she saved and grows large again<\/strong>. The King and Queen order her to leave the courthouse<\/strong>, but she refuses<\/strong> and insults the Queen<\/strong>. As she does so, she returns to her normal size<\/strong>, and the Queen orders her execution<\/strong>. Alice flees, and the Queen, King, card guards<\/strong>, and other characters give chase. When Alice reaches the small door she encountered<\/strong>, the doorknob shows her<\/strong> that she is actually already outside<\/strong>, asleep<\/strong>. Alice yells at herself to wake up<\/strong>; she does thanks to her sister<\/strong>, and they return home for tea<\/strong>.<\/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':2254, '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':2254, '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':2254, 'userId':0, 'playerAction':action, 'playerArea':area, 'details':details, 'timestamp': t } }) .done(function(results){ }) .fail(function( jqXHR, textStatus ) { alert( "Request failed: " + textStatus ); }); }