var presentation = ["Vincent Crabbe<\/word>","Gregory Goyle<\/word>","Slytherin students<\/word>","both of their fathers<\/word>","Crabbe Sr<\/word>","Goyle Sr<\/word>","Death Eaters<\/word>","their size<\/word>","strength<\/word>","Draco Malfoy's minions<\/word>","serve<\/word>","Malfoy's bidding<\/word>","intimidate<\/word>","fellow students<\/word>","entirely lacking<\/word>","introspection<\/word>","curiosity<\/word>","Crabbe is shown<\/word>","significantly smarter than Goyle<\/word>","unable<\/word>","make up their own minds<\/word>","Vincent Crabbe<\/strong> and Gregory Goyle<\/strong> are Slytherin students<\/strong> in Harry's year; both of their fathers<\/strong>, Crabbe Sr<\/strong> and Goyle Sr<\/strong>, are Death Eaters<\/strong>. Due to their size<\/strong> and strength<\/strong>, the pair act as Draco Malfoy's minions<\/strong> and serve<\/strong> to do Malfoy's bidding<\/strong>, especially to intimidate<\/strong> fellow students<\/strong>. Both are entirely lacking<\/strong> in introspection<\/strong> or curiosity<\/strong>, though Crabbe is shown<\/strong> to be significantly smarter than Goyle<\/strong>. They seem unable<\/strong> to make up their own minds<\/strong> or to see things their own way.<\/phrase>","Crabbe and Goyle<\/word>","first appearance<\/word>","Slytherin Quidditch Beaters<\/word>","opening match<\/word>","against Gryffindor<\/word>","Harry catches the Snitch<\/word>","Crabbe vents his frustration<\/word>","purposely hitting a Bludger<\/word>","Harry's back<\/word>","knocking him off<\/word>","his broom<\/word>","receives<\/word>","light punishment<\/word>","writing lines<\/word>","do not return<\/word>","the team<\/word>","following year<\/word>","regularly serve<\/word>","Malfoy's lookouts<\/word>","forays<\/word>","Room of Requirement<\/word>","Malfoy leaves the school<\/word>","following<\/word>","death of Dumbledore<\/word>","end of the term<\/word>","state of loneliness<\/word>","Crabbe and Goyle<\/strong> make their first appearance<\/strong> as new Slytherin Quidditch Beaters<\/strong> in the opening match<\/strong> against Gryffindor<\/strong> in their fifth year; after Harry catches the Snitch<\/strong>, Crabbe vents his frustration<\/strong> by purposely hitting a Bludger<\/strong> into Harry's back<\/strong> and knocking him off<\/strong> his broom<\/strong>, for which he receives<\/strong> the light punishment<\/strong> of writing lines<\/strong>. They do not return<\/strong> to the team<\/strong> the following year<\/strong>, as they regularly serve<\/strong> as Malfoy's lookouts<\/strong> during his forays<\/strong> into the Room of Requirement<\/strong>. After Malfoy leaves the school<\/strong> following<\/strong> the death of Dumbledore<\/strong> just before the end of the term<\/strong>, Crabbe and Goyle<\/strong> are left in a state of loneliness<\/strong>.<\/phrase>","three of them<\/word>","reunited<\/word>","Harry Potter and the Deathly Hallows<\/word>","speak for the first time<\/word>","Crabbe's voice<\/word>","described<\/word>","oddly soft<\/word>","huge frame<\/word>","Goyle's voice is described<\/word>","grunt<\/word>","Crabbe has sided<\/word>","Death Eaters<\/word>","more conviction<\/word>","either Goyle or Malfoy<\/word>","increasingly independent of Malfoy<\/word>","well aware<\/word>","Malfoy family<\/word>","falling out of favor with Voldemort<\/word>","surprisingly powerful wizards<\/word>","The three of them<\/strong> are reunited<\/strong> in Harry Potter and the Deathly Hallows<\/strong>. Both of them speak for the first time<\/strong>, Crabbe's voice<\/strong> being described<\/strong> as oddly soft<\/strong> for someone with his huge frame<\/strong> and Goyle's voice is described<\/strong> as simply a grunt<\/strong>. Crabbe has sided<\/strong> with the Death Eaters<\/strong> with more conviction<\/strong> than either Goyle or Malfoy<\/strong>, and becomes increasingly independent of Malfoy<\/strong>, well aware<\/strong> of the Malfoy family<\/strong> falling out of favor with Voldemort<\/strong>. The pair have developed into surprisingly powerful wizards<\/strong>.<\/phrase>","Crabbe and Goyle<\/word>","excelled<\/word>","inflicting<\/word>","Cruciatus Curse<\/word>","received detentions<\/word>","Amycus Carrow's direction<\/word>","according<\/word>","Neville Longbottom<\/word>","first time<\/word>","they were the best in anything<\/word>","fight<\/word>","Horcrux diadem<\/word>","Ron Weasley<\/word>","Hermione Granger<\/word>","Room of Requirement<\/word>","Crabbe defies<\/word>","Malfoy's order<\/word>","not kill Harry<\/word>","casually throws around<\/word>","Avada Kedavra curse<\/word>","summons magical fire<\/word>","turns the room<\/word>","blazing inferno<\/word>","quickly rages beyond his control<\/word>","leads to his death<\/word>","destruction of the Horcrux<\/word>","Goyle is knocked unconscious<\/word>","ensuing fight<\/word>","rescued<\/word>","Crabbe and Goyle<\/strong> are mentioned as having excelled<\/strong> in inflicting<\/strong> the Cruciatus Curse<\/strong> on other pupils who had received detentions<\/strong> under Amycus Carrow's direction<\/strong>-- according<\/strong> to Neville Longbottom<\/strong>, it was \"the first time<\/strong> they were the best in anything<\/strong>\". During the fight<\/strong> for the Horcrux diadem<\/strong> with Harry, Ron Weasley<\/strong> and Hermione Granger<\/strong> in the Room of Requirement<\/strong>, Crabbe defies<\/strong> Malfoy's order<\/strong> to not kill Harry<\/strong> and casually throws around<\/strong> the Avada Kedavra curse<\/strong>. Finally, he summons magical fire<\/strong> and turns the room<\/strong> into a blazing inferno<\/strong>, but it quickly rages beyond his control<\/strong> and leads to his death<\/strong> and the destruction of the Horcrux<\/strong>. Goyle is knocked unconscious<\/strong> during the ensuing fight<\/strong>, but is rescued<\/strong>, along with Draco, by Harry, Ron and Hermione.<\/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':3300, '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':3300, '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':3300, 'userId':0, 'playerAction':action, 'playerArea':area, 'details':details, 'timestamp': t } }) .done(function(results){ }) .fail(function( jqXHR, textStatus ) { alert( "Request failed: " + textStatus ); }); }