var presentation = ["loyal sky bison<\/word>","strong bond<\/word>","Air Nomad civilization<\/word>","fly in spite of his heavy weight<\/word>","airbending<\/word>","means of transportation<\/word>","Appa was Avatar Aang's loyal sky bison<\/strong>, who shared a strong bond<\/strong> with him and Momo as they were all some of the few remaining traces of the Air Nomad civilization<\/strong>. Appa was most noted for his ability to fly in spite of his heavy weight<\/strong>, a feat achieved through airbending<\/strong>, which made him the primary means of transportation<\/strong> utilized by Team Avatar.<\/phrase>","young calf<\/word>","future companions<\/word>","two became best friends<\/word>","When Appa was still a young calf<\/strong> who lived around the Eastern Air Temple, young airbenders were allowed to meet their future companions<\/strong>, who would bond with them for life. The herd's mother willingly directed her calves to meet the young monks. Aang came forward and offered an apple to Appa, and the two became best friends<\/strong> almost immediately afterward.<\/phrase>","Air Nomad Genocide<\/word>","Monk Gyatso<\/word>","run away<\/word>","leaving the air temples<\/word>","Just before the Air Nomad Genocide<\/strong>, Aang heard that the monks were going to separate him from Monk Gyatso<\/strong> and subsequently decided to run away<\/strong>, using Appa as his mode of departure. Appa did not know where he was going, only that he was leaving the air temples<\/strong>.<\/phrase>","vicious storm<\/word>","Aang lost consciousness<\/word>","Avatar State<\/word>","Appa in an iceberg<\/word>","hibernation<\/word>","one hundred years<\/word>","Aang flew Appa over the ocean, at which point they were caught in a vicious storm<\/strong> which pushed the two underwater by stirring up the wind and the waves until Aang lost consciousness<\/strong>. Faced with a life-or-death situation, the young Avatar entered the Avatar State<\/strong> and froze himself with Appa in an iceberg<\/strong>, the latter was stuck in hibernation<\/strong> along with Aang for one hundred years<\/strong>.<\/phrase>","main form of transportation<\/word>","master all four elements<\/word>","tried to steal food<\/word>","beloved friend<\/word>","The pair were discovered by Katara and Sokka. After this, Appa became the group's main form of transportation<\/strong> in their quest to help Aang master all four elements<\/strong> throughout the world. He appeared in most of Sokka and Princess Yue's dates, tried to steal food<\/strong> with Momo in the Foggy Swamp, and became a beloved friend<\/strong> for all members of Team Avatar.<\/phrase>","became lost for a short<\/word>","kidnapped by a group of sandbenders<\/word>","trapped in an underground Spirit library<\/word>","Appa became lost for a short<\/strong> while when the group was traveling through the Earth Kingdom, having been kidnapped by a group of sandbenders<\/strong> in the middle of the vast Si Wong Desert, while Aang, Katara, Sokka, and Momo were trapped in an underground Spirit library<\/strong>.<\/phrase>","sold to beetle-headed merchants<\/word>","Fire Nation circus<\/word>","sadistic<\/word>","sympathetic boy<\/word>","Kyoshi Warriors<\/word>","healed his various wounds<\/word>","thwarted<\/word>","It was later revealed that Appa was eventually sold to beetle-headed merchants<\/strong>, who in turn sold him to a Fire Nation circus<\/strong> where a sadistic<\/strong> trainer attempted to make him part of the show. Encouraged by a sympathetic boy<\/strong>, he later escaped and hurried back to the Si Wong Desert where he last saw Aang. Understanding that his friends weren't there anymore, Appa journeyed throughout the Earth Kingdom until he encountered the Kyoshi Warriors<\/strong>, who healed his various wounds<\/strong>, physical as well as emotional, that he had sustained on his travels. They wanted to escort him back to Aang, but they were soon thwarted<\/strong> in their attempt when Azula and her allies attacked. He was forced to flee, ushered away by Suki while the warriors tried to delay the three Fire Nation girls.<\/phrase>","Guru Pathik<\/word>","tell Appa of Aang's location<\/word>","hands of Zuko<\/word>","set the bison free<\/word>","On his journey, Appa encountered Guru Pathik<\/strong> at the Eastern Air Temple, where the Guru was able to tell Appa of Aang's location<\/strong> by reading his energy. Consequently, he flew to Ba Sing Se, where he was captured by Long Feng and kept in a secret location under Lake Laogai until his rescue at the hands of Zuko<\/strong>, who was initially planning on utilizing him to capture the Avatar until he talked with his uncle Iroh, deciding to do the right thing and set the bison free<\/strong>.<\/phrase>","victory at the Jasmine Dragon<\/word>","tsungi horn music<\/word>","Earth King Kuei<\/word>","Harmony Restoration Movement<\/word>","After the Hundred Year War's end, Appa was seen in Ba Sing Se with the gang as they celebrated their victory at the Jasmine Dragon<\/strong>, seemingly enjoying Iroh's tsungi horn music<\/strong> from the doorway of the tea shop. After this, the team decided to take a ride on Appa before Earth King Kuei<\/strong>'s celebration in announcement of the Harmony Restoration Movement<\/strong> to the kingdom.<\/phrase>","A year later, when the movement was being carried out, Appa helped Team Avatar transport Fire Nation colonials back to their nation.<\/phrase>","Harmony Restoration Movement<\/word>","transported Team Avatar to Hira'a<\/word>","attacked by a wolf spirit<\/word>","Mother of Faces.<\/word>","One year following the failure of the Harmony Restoration Movement<\/strong>, Appa once again embarked on a mission and transported Team Avatar to Hira'a<\/strong> in search of Zuko's mother, Ursa. However, he was visibly upset that Azula would be accompanying the team on the trip. On their way there, the party was attacked by a wolf spirit<\/strong>, so Appa aided in the battle against the beast. Once the team learned about Ikem's flight up Forgetful Valley, he stayed behind and later flew back to Hira'a along with the remaining members of Team Avatar and the Mother of Faces.<\/strong><\/phrase>","last of the flying bison<\/word>","Air Nomad Genocide<\/word>","new herd<\/word>","colonies of healthy bison<\/word>","Though Appa was believed to be the last of the flying bison<\/strong> following the Air Nomad Genocide<\/strong>, Aang discovered a new herd<\/strong> during his adventures after the Hundred Year War, with colonies of healthy bison<\/strong> coming to reside at the air temples.<\/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':3218, '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':3218, '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':3218, 'userId':0, 'playerAction':action, 'playerArea':area, 'details':details, 'timestamp': t } }) .done(function(results){ }) .fail(function( jqXHR, textStatus ) { alert( "Request failed: " + textStatus ); }); }