var presentation = ["Argus Filch<\/word>","caretaker<\/word>","Hogwarts<\/word>","not an evil character<\/word>","ill-tempered<\/word>","unpopular<\/word>","student body<\/word>","tension<\/word>","exasperation<\/word>","teachers<\/word>","other staff<\/word>","His knowledge<\/word>","secrets<\/word>","short-cuts<\/word>","castle<\/word>","almost unparalleled<\/word>","except<\/word>","users<\/word>","Marauder's Map<\/word>","Voldemort<\/word>","Argus Filch<\/strong> is the caretaker<\/strong> of Hogwarts<\/strong>. While he is not an evil character<\/strong>, he is ill-tempered<\/strong>, which makes him unpopular<\/strong> with the student body<\/strong>, and occasionally causes tension<\/strong> or exasperation<\/strong> with teachers<\/strong> and other staff<\/strong>. His knowledge<\/strong> of the secrets<\/strong> and short-cuts<\/strong> of the castle<\/strong> is almost unparalleled<\/strong>, except<\/strong> perhaps by the users<\/strong> of the Marauder's Map<\/strong>, and Voldemort<\/strong> himself.<\/phrase>","tends to favor<\/word>","harsh punishments<\/word>","gleefully allies<\/word>","Umbridge<\/word>","prescribes<\/word>","punishments on students<\/word>","obsessive dislike<\/word>","mud<\/word>","animate toys<\/word>","all other things<\/word>","might interfere<\/word>","his desire<\/word>","immaculately clean<\/word>","Hogwarts<\/word>","He tends to favor<\/strong> harsh punishments<\/strong>, and gleefully allies<\/strong> himself with Umbridge<\/strong> when she prescribes<\/strong> such punishments on students<\/strong>. He has an obsessive dislike<\/strong> of mud<\/strong>, animate toys<\/strong>, and all other things<\/strong> that might interfere<\/strong> with his desire<\/strong> for an immaculately clean<\/strong> and orderly Hogwarts<\/strong>.<\/phrase>","constant antagonism<\/word>","Peeves the poltergeist<\/word>","tells<\/word>","Dumbledore<\/word>","Peeves should be thrown out<\/word>","Hogwarts<\/word>","wander Hogwarts corridors<\/word>","night<\/word>","in the hope<\/word>","catching a student<\/word>","out of bed<\/word>","He is also portrayed as having a constant antagonism<\/strong> towards Peeves the poltergeist<\/strong> and often tells<\/strong> Dumbledore<\/strong> that Peeves should be thrown out<\/strong> of Hogwarts<\/strong>. He also likes to wander Hogwarts corridors<\/strong> at night<\/strong>, presumably in the hope<\/strong> of catching a student<\/strong> out of bed<\/strong>.<\/phrase>","Squib<\/word>","Harry Potter and the Chamber of Secrets<\/word>","Harry accidentally discovers<\/word>","trying to teach himself<\/word>","basic magic<\/word>","Kwikspell correspondence course<\/word>","able to use<\/word>","wizarding devices<\/word>","innate magic<\/word>","Secrecy Sensor<\/word>","Harry Potter and the Half-Blood Prince<\/word>","hinted<\/word>","dislike of students<\/word>","stem from<\/word>","his disappointment<\/word>","jealousy<\/word>","not being able to do magic<\/word>","Harry Potter and the Deathly Hallows<\/word>","school starts preparing<\/word>","Battle of Hogwarts<\/word>","Filch is seen yelling<\/word>","students are out of bed<\/word>","later seen<\/word>","overseeing<\/word>","evacuation<\/word>","younger students<\/word>","Filch is revealed to be a Squib<\/strong> in Harry Potter and the Chamber of Secrets<\/strong> when Harry accidentally discovers<\/strong> that he is trying to teach himself<\/strong> basic magic<\/strong> from a Kwikspell correspondence course<\/strong>. Nonetheless, Filch is at least able to use<\/strong> wizarding devices<\/strong> that have their own innate magic<\/strong>, such as the Secrecy Sensor<\/strong> used in Harry Potter and the Half-Blood Prince<\/strong>. It is hinted<\/strong> that his dislike of students<\/strong> may stem from<\/strong> his disappointment<\/strong> and jealousy<\/strong> at not being able to do magic<\/strong>. In Harry Potter and the Deathly Hallows<\/strong>, the final book, when the school starts preparing<\/strong> itself for the Battle of Hogwarts<\/strong>, Filch is seen yelling<\/strong> that students are out of bed<\/strong>. He is later seen<\/strong> overseeing<\/strong> the evacuation<\/strong> of younger students<\/strong>.<\/phrase>","has a cat<\/word>","Mrs Norris<\/word>","particular<\/word>","possessive attachment<\/word>","She acts<\/word>","hallway monitor<\/word>","spy<\/word>","she observes students<\/word>","suspicious activity<\/word>","out of bed<\/word>","after curfew<\/word>","she finds Filch<\/word>","he arrives in seconds<\/word>","follow Hagrid<\/word>","under Filch's orders<\/word>","Chamber of Secrets<\/word>","incident<\/word>","Mrs Norris is temporarily petrified<\/word>","Basilisk<\/word>","causes Filch<\/word>","extreme distress<\/word>","Filch has a cat<\/strong> named Mrs Norris<\/strong> to whom he has a particular<\/strong> and possessive attachment<\/strong>. She acts<\/strong> as a hallway monitor<\/strong> or spy<\/strong> for Filch. If she observes students<\/strong> engaging in suspicious activity<\/strong> or out of bed<\/strong> after curfew<\/strong>, she finds Filch<\/strong> and he arrives in seconds<\/strong>. She has been known to follow Hagrid<\/strong> everywhere he goes in the school, apparently under Filch's orders<\/strong>. In the Chamber of Secrets<\/strong> incident<\/strong>, Mrs Norris is temporarily petrified<\/strong> by the Basilisk<\/strong>, which causes Filch<\/strong> extreme distress<\/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':3324, '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':3324, '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':3324, 'userId':0, 'playerAction':action, 'playerArea':area, 'details':details, 'timestamp': t } }) .done(function(results){ }) .fail(function( jqXHR, textStatus ) { alert( "Request failed: " + textStatus ); }); }