var presentation = ["The Vampire Diaries<\/word>","later killed<\/word>","control her blood lust<\/word>","ex-boyfriend<\/word>","former fianc\u00e9<\/word>","Matt Donovan<\/word>","main character<\/word>","older sister<\/word>","Vicki Donovan<\/word>","vampire<\/word>","Elena Gilbert<\/word>","Caroline Forbes<\/word>","Rebekah Mikaelson<\/word>","Penny Ares<\/word>","Matt Donovan<\/strong> is a main character<\/strong> on The Vampire Diaries<\/strong>. He had an older sister<\/strong> Vicki Donovan<\/strong>, who was turned into a vampire<\/strong>, and was later killed<\/strong> because she was unable to control her blood lust<\/strong>. Matt is also the ex-boyfriend<\/strong> of Elena Gilbert<\/strong>, Caroline Forbes<\/strong> and Rebekah Mikaelson<\/strong> and former fianc\u00e9<\/strong> of Penny Ares<\/strong>.<\/phrase>","Mystic Falls<\/word>","Elena broke up with Matt<\/word>","struggles with his sister<\/word>","tragically dies<\/word>","breaks up with him<\/word>","to protect him<\/word>","good friendship<\/word>","poor choices<\/word>","Caroline Forbes<\/word>","young woman<\/word>","her transition<\/word>","vampire<\/word>","He was born and raised in the town of Mystic Falls<\/strong>. After the death of Elena's parents, Elena broke up with Matt<\/strong> because she lost interest in him. Despite the way they broke up, Matt still cares about Elena deeply and they've managed to maintain a good friendship<\/strong>. At the beginning of the series, Matt struggles with his sister<\/strong>, Vicki, because she made many poor choices<\/strong>, but then she tragically dies<\/strong>. Later on he begins dating Caroline Forbes<\/strong>, and encourages her to become a more caring, kind and selfless young woman<\/strong>. However, Caroline soon breaks up with him<\/strong> after her transition<\/strong> into a vampire<\/strong> -- in order to protect him<\/strong>.<\/phrase>","distance himself from his friends<\/word>","help his friends defeat their enemies<\/word>","see his sister's ghost<\/word>","brief relationship<\/word>","Mystic Falls<\/word>","supernatural creatures<\/word>","protect<\/word>","their hometown<\/word>","Medium<\/word>","Rebekah Mikaelson<\/word>","Europe<\/word>","end<\/word>","Season Four<\/word>","Upon learning about the existence of supernatural creatures<\/strong>, he begins to distance himself from his friends<\/strong>. Eventually he starts to help his friends defeat their enemies<\/strong> and protect<\/strong> their hometown<\/strong>, and he fixes his friendship with Caroline. Later he becomes a Medium<\/strong> for a short while like Jeremy Gilbert, although he could only see his sister's ghost<\/strong>. He began a brief relationship<\/strong> with Rebekah Mikaelson<\/strong>, and went to Europe<\/strong> with her at the end<\/strong> of Season Four<\/strong>, but they ended things before she left Mystic Falls<\/strong>.<\/phrase>","destruction of The Other Side<\/word>","Season Five<\/word>","Traveler<\/word>","Nadia Petrova<\/word>","Katherine<\/word>","his friends<\/word>","In Season Five<\/strong>, he was possessed by a Traveler<\/strong> for a brief time, and was also involved with Nadia Petrova<\/strong>, Katherine<\/strong>'s daughter. After Nadia's death, Matt helps his friends<\/strong> deal with the destruction of The Other Side<\/strong>.<\/phrase>","deputy in Mystic Falls Police Department<\/word>","vampire hunter<\/word>","Later on, he decided to become a deputy in Mystic Falls Police Department<\/strong>, and a vampire hunter<\/strong>.<\/phrase>","coma-like slumber<\/word>","sheriff of Mystic Falls<\/word>","Mystic Falls<\/word>","Elena Gilbert<\/word>","Kai Parker<\/word>","Bonnie Bennett<\/word>","When Elena Gilbert<\/strong> falls into a magical, coma-like slumber<\/strong> after Kai Parker<\/strong> links her to Bonnie Bennett<\/strong>, Matt eventually becomes the sheriff of Mystic Falls<\/strong>. During this time, Matt kicks out all vampires Mystic Falls<\/strong>.<\/phrase>","falls in love<\/word>","revenge<\/word>","try and save Bonnie from being a bloodthirsty Supernatural Huntress<\/word>","decides to leave Mystic Falls<\/word>","start a normal life<\/word>","Penny Ares<\/word>","vampire<\/word>","He later falls in love<\/strong> with his police partner, Penny Ares<\/strong>. After Penny's death, Matt is determined to get revenge<\/strong> on the vampire<\/strong> who made Matt impulsively, but accidentally kill Penny. However, after a series of events that forces Matt to try and save Bonnie from being a bloodthirsty Supernatural Huntress<\/strong>, Matt is done fighting the war between humans and vampires. Matt decides to leave Mystic Falls<\/strong> and start a normal life<\/strong> outside the world of vampires.<\/phrase>","look for his estranged father<\/word>","nothing of the supernatural creatures<\/word>","Mystic Falls<\/word>","stopping them from helping Katherine destroy Mystic Falls<\/word>","sheriff<\/word>","mayor<\/word>","After Matt left town, he went to look for his estranged father<\/strong>, Peter, and told him nothing of the supernatural creatures<\/strong> he dealt with for the last seven years of his life in Mystic Falls<\/strong>. He later returned to Mystic Falls<\/strong> and reunited with the spirits of his mother and sister, stopping them from helping Katherine destroy Mystic Falls<\/strong>. He took back the position of sheriff<\/strong> and became well-respected, and one day he became mayor<\/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':1847, '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':1847, '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':1847, 'userId':0, 'playerAction':action, 'playerArea':area, 'details':details, 'timestamp': t } }) .done(function(results){ }) .fail(function( jqXHR, textStatus ) { alert( "Request failed: " + textStatus ); }); }