var presentation = ["A Bug's Life<\/word>","Pixar Animation Studios<\/word>","Walt Disney Pictures<\/word>","second film produced by Pixar<\/word>","save his colony<\/word>","computer-animated comedy film<\/word>","film<\/word>","misfit ant<\/word>","Flik<\/word>","tough warriors<\/word>","hungry grasshoppers<\/word>","inept circus troupe<\/word>","A Bug's Life<\/strong> is a 1998 American computer-animated comedy film<\/strong> produced by Pixar Animation Studios<\/strong> for Walt Disney Pictures<\/strong>. It was the second film produced by Pixar<\/strong>. The film<\/strong> follows a misfit ant<\/strong>, Flik<\/strong>, who is looking for tough warriors<\/strong> to save his colony<\/strong> from hungry grasshoppers<\/strong>, only to recruit a group of insects that turn out to be an inept circus troupe<\/strong>.<\/phrase>","Ant Island<\/word>","colony of ants<\/word>","retiring Queen<\/word>","forced to give food to a gang of marauding grasshoppers<\/word>","inadvertently knocks the offering into a stream<\/word>","Hopper demands twice as much food<\/word>","seek help from other stronger bugs<\/word>","opportunity to remove him<\/word>","send him off<\/word>","her daughter<\/word>","Princess Atta<\/word>","Hopper<\/word>","Flik<\/word>","individualist and inventor<\/word>","latest invention<\/word>","grain harvesting device<\/word>","other ants<\/word>","Ant Island<\/strong> is a colony of ants<\/strong> led by the retiring Queen<\/strong> and her daughter<\/strong>, Princess Atta<\/strong>. Every season, they are forced to give food to a gang of marauding grasshoppers<\/strong> led by Hopper<\/strong>. One day, when Flik<\/strong>, an individualist and inventor<\/strong>, inadvertently knocks the offering into a stream<\/strong> with his latest invention<\/strong>, a grain harvesting device<\/strong>, Hopper demands twice as much food<\/strong> as compensation. When Flik<\/strong> suggests in earnest that they seek help from other stronger bugs<\/strong>, the other ants<\/strong> see it as an opportunity to remove him<\/strong> and send him off<\/strong>.<\/phrase>","heap of trash under a trailer<\/word>","dismissed by their greedy ringmaster<\/word>","P.T. Flea<\/word>","mistake Flik for a talent agent<\/word>","accept his offer<\/word>","travel with him back to Ant Island<\/word>","discover their mutual misunderstandings<\/word>","Circus Bugs attempt to leave<\/word>","pursued by a nearby bird<\/word>","they rescue Dot<\/word>","Atta's younger sister<\/word>","gaining the ants' respect<\/word>","Flik's request<\/word>","continue the ruse of being warriors<\/word>","Hopper fears birds<\/word>","inspires Flik to create a false bird<\/word>","scare away the grasshoppers<\/word>","greatly the ants outnumber them<\/word>","suspects that they will eventually rebel against them<\/word>","bug city<\/word>","Flik<\/word>","Circus Bugs<\/word>","warrior bugs<\/word>","welcome ceremony<\/word>","their arrival<\/word>","Hopper<\/word>","At the \"bug city<\/strong>\", which is a heap of trash under a trailer<\/strong>, Flik<\/strong> mistakes a troupe of Circus Bugs<\/strong> (who were recently dismissed by their greedy ringmaster<\/strong>, P.T. Flea<\/strong>) for the warrior bugs<\/strong> he seeks. The bugs, in turn, mistake Flik for a talent agent<\/strong>, and accept his offer<\/strong> to travel with him back to Ant Island<\/strong>. During a welcome ceremony<\/strong> upon their arrival<\/strong>, the Circus Bugs<\/strong> and Flik<\/strong> both discover their mutual misunderstandings<\/strong>. The Circus Bugs attempt to leave<\/strong>, but are pursued by a nearby bird<\/strong>; while fleeing, they rescue Dot<\/strong>, Atta's younger sister<\/strong> from the bird, gaining the ants' respect<\/strong> in the process. At Flik's request<\/strong>, they continue the ruse of being warriors<\/strong>, so the troupe can continue to enjoy the hospitality of the ants. Hearing that Hopper fears birds<\/strong> inspires Flik to create a false bird<\/strong> to scare away the grasshoppers<\/strong>. Meanwhile, Hopper<\/strong> reminds his gang how greatly the ants outnumber them<\/strong> and suspects that they will eventually rebel against them<\/strong>.<\/phrase>","P.T. Flea arrives, searching for his troupe<\/word>","inadvertently reveals their secret<\/word>","Flik's deception<\/word>","ants exile him<\/word>","attempt to gather food for a new offering to the grasshoppers<\/word>","takes over the island<\/word>","demands the ants' winter food supply<\/word>","planning to execute the Queen<\/word>","Dot persuades Flik and the Circus Bugs<\/word>","Ant Island<\/word>","fake bird<\/word>","Hopper<\/word>","discover<\/word>","mediocre offering<\/word>","return<\/word>","The ants finish constructing the fake bird<\/strong>, but during a celebration, P.T. Flea arrives, searching for his troupe<\/strong>, and inadvertently reveals their secret<\/strong>. Outraged by Flik's deception<\/strong>, the ants exile him<\/strong>, and desperately attempt to gather food for a new offering to the grasshoppers<\/strong>. However, when Hopper<\/strong> returns to discover<\/strong> the mediocre offering<\/strong>, he takes over the island<\/strong>, and demands the ants' winter food supply<\/strong>, planning to execute the Queen<\/strong> afterwards. Overhearing the plan, Dot persuades Flik and the Circus Bugs<\/strong> to return<\/strong> to Ant Island<\/strong>.<\/phrase>","Circus Bugs distract the grasshoppers<\/word>","rescue the Queen<\/word>","Flik deploys the bird<\/word>","fools the grasshoppers<\/word>","P.T. Flea<\/word>","burns it<\/word>","exposing it as a decoy<\/word>","Hopper has Flik beaten<\/word>","ants are humble<\/word>","lowly life forms<\/word>","live to serve the grasshoppers<\/word>","Flik responds that Hopper actually fears the colony<\/word>","inspiring the ants and the Circus Bugs to fight back against the grasshoppers<\/word>","attempt to force Hopper out of Ant Island<\/word>","using P.T. Flea's circus cannon<\/word>","Hopper frees himself from the cannon<\/word>","abducts Flik<\/word>","Circus Bugs fail to catch them<\/word>","Atta rescues Flik<\/word>","Hopper pursues them<\/word>","Flik lures him to the nest of the bird<\/word>","captured<\/word>","fed to its chicks<\/word>","Circus Bugs<\/word>","Hopper<\/word>","After the Circus Bugs distract the grasshoppers<\/strong> long enough to rescue the Queen<\/strong>, Flik deploys the bird<\/strong>; it initially fools the grasshoppers<\/strong>, but P.T. Flea<\/strong>, who also mistakes it for a real bird, burns it<\/strong>, exposing it as a decoy<\/strong>. Hopper has Flik beaten<\/strong> in retaliation, saying that the ants are humble<\/strong> and lowly life forms<\/strong> who live to serve the grasshoppers<\/strong>. However, Flik responds that Hopper actually fears the colony<\/strong>, because he has always known what they are capable of, inspiring the ants and the Circus Bugs to fight back against the grasshoppers<\/strong>. The ants attempt to force Hopper out of Ant Island<\/strong> using P.T. Flea's circus cannon<\/strong>, but it suddenly begins to rain. In the ensuing chaos, Hopper frees himself from the cannon<\/strong>, and abducts Flik<\/strong>. After the Circus Bugs fail to catch them<\/strong>, Atta rescues Flik<\/strong>. As Hopper pursues them<\/strong>, Flik lures him to the nest of the bird<\/strong> he, Dot, and the Circus Bugs<\/strong> encountered earlier. Thinking that the bird is another decoy, Hopper<\/strong> taunts it before realizing that it is real, and is captured<\/strong> and fed to its chicks<\/strong>.<\/phrase>","Flik has improved his inventions<\/word>","Ant Island<\/word>","he and Atta become a couple<\/word>","Hopper's younger brother<\/word>","P.T. Flea<\/word>","new members of his troupe<\/word>","ants congratulate Flik as a hero<\/word>","Molt<\/word>","With their enemies gone, Flik has improved his inventions<\/strong> along with the quality of life for Ant Island<\/strong>, he and Atta become a couple<\/strong>, and they give Hopper's younger brother<\/strong> Molt<\/strong>, and a few ants to P.T. Flea<\/strong> as new members of his troupe<\/strong>. Atta and Dot respectively become the new queen and princess. The ants congratulate Flik as a hero<\/strong>, and bid a fond farewell to the circus troupe.<\/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':2208, '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':2208, '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':2208, 'userId':0, 'playerAction':action, 'playerArea':area, 'details':details, 'timestamp': t } }) .done(function(results){ }) .fail(function( jqXHR, textStatus ) { alert( "Request failed: " + textStatus ); }); }