var presentation = ["President of the United States<\/word>","Martin Van Buren<\/word>","Abraham Van Buren<\/word>","First Lady<\/word>","White House hostess<\/word>","Sarah Angelica Van Buren<\/word>","post<\/word>","Hannah Van Buren<\/word>","Sarah Angelica Van Buren<\/strong> (February 13, 1818 \u2013 December 29, 1877), was the daughter-in-law of the eighth President of the United States<\/strong> Martin Van Buren<\/strong>. She was married to the President's son, Abraham Van Buren<\/strong>. She assumed the post<\/strong> of First Lady<\/strong> because the president's wife, Hannah Van Buren<\/strong>, had died and he never remarried. She is the youngest woman ever to act as the White House hostess<\/strong>.<\/phrase>","Wedgefield, South Carolina<\/word>","Rebecca<\/word>","Sarah Angelica Singleton<\/word>","Richard Singleton<\/word>","Sarah Angelica Singleton<\/strong> was born in Wedgefield, South Carolina<\/strong>, on February 13, 1818. She was the fourth of six children born to Richard Singleton<\/strong> and his wife, Rebecca<\/strong> Travis Coles.<\/phrase>","Columbia Female Academy<\/word>","South Carolina<\/word>","Madame Grelaud's French School<\/word>","Philadelphia<\/word>","Angelica was educated at the Columbia Female Academy<\/strong> in South Carolina<\/strong> and Madame Grelaud's French School<\/strong> in Philadelphia<\/strong> for 5 years. She was a popular student at Madame Grelaud's and the school gave her the opportunity to meet a more diverse group of people.<\/phrase>","Washington, DC,<\/word>","First Lady<\/word>","Dolley Madison<\/word>","Rebecca<\/word>","Martin Van Buren<\/word>","Abraham Van Buren<\/word>","play<\/word>","Wedgefield<\/word>","President Van Buren<\/word>","Old South<\/word>","In 1838, Angelica visited Washington, DC,<\/strong> with her sister. Former First Lady<\/strong> Dolley Madison<\/strong>, a cousin of Angelica's mother Rebecca<\/strong> Travis Coles, decided to play<\/strong> matchmaker and introduced the Singleton girls to President Martin Van Buren<\/strong>'s bachelor sons. Eight months later, Angelica Singleton married Abraham Van Buren<\/strong> on November 27, 1838, on his 31st birthday in Wedgefield<\/strong>. The marriage strengthened President Van Buren<\/strong>'s ties to the Old South<\/strong>.<\/phrase>","hostess<\/word>","White House<\/word>","Following the wedding, Van Buren assumed the duties of hostess<\/strong> at the White House<\/strong> with great success.<\/phrase>","U.S. Minister the U.K.<\/word>","dais<\/word>","French Ambassador<\/word>","trip<\/word>","England<\/word>","Sally Coles Stevenson<\/word>","Andrew Stevenson<\/word>","Washington<\/word>","White House<\/word>","Blue Room<\/word>","greet<\/word>","In the spring of 1839, the couple took an extended trip<\/strong> through England<\/strong> (where her aunt, Sally Coles Stevenson<\/strong>, and uncle, Andrew Stevenson<\/strong>, was U.S. Minister the U.K.<\/strong>) and other European countries. The trip<\/strong> was a massive success and when Van Buren returned to Washington<\/strong>, she hoped to bring some European style to the White House<\/strong>. Angelica and other honored female guests began standing on a dais<\/strong> in the Blue Room<\/strong> to greet<\/strong> guests at the beginning of White House<\/strong> functions. Although the French Ambassador<\/strong> enjoyed the reception, Americans did not. The dais<\/strong> was soon removed.<\/phrase>","Rebecca<\/word>","Martin Van Buren II<\/word>","Travis Coles Van Buren<\/word>","White House<\/word>","Singleton Van Buren<\/word>","In March 1840, Angelica gave birth to the couple's first child, a daughter named Rebecca<\/strong>. Rebecca<\/strong> died a few months later. After leaving the White House<\/strong>, the couple had four sons; the survivors were: Singleton Van Buren<\/strong>, Martin Van Buren II<\/strong>, and Travis Coles Van Buren<\/strong>.<\/phrase>","Martin Van Buren<\/word>","Lindenwald<\/word>","Kinderhook, New York<\/word>","Melrose House<\/word>","South Carolina<\/word>","New York City<\/word>","After Martin Van Buren<\/strong> was defeated for re-election in 1840, Angelica and her husband lived at the Van Buren home of Lindenwald<\/strong>, in Kinderhook, New York<\/strong>, wintering at her family home, Melrose House<\/strong>, in South Carolina<\/strong>. From 1848 until her death, she lived in New York City<\/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':1314, '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':1314, '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':1314, 'userId':0, 'playerAction':action, 'playerArea':area, 'details':details, 'timestamp': t } }) .done(function(results){ }) .fail(function( jqXHR, textStatus ) { alert( "Request failed: " + textStatus ); }); }