var presentation = ["diva-in-training<\/word>","refuses<\/word>","sing back-up<\/word>","flair for fashion<\/word>","develops a crush<\/word>","unaware<\/word>","he is gay<\/word>","hurt<\/word>","rejects her<\/word>","supportive<\/word>","confides his sexuality<\/word>","Mercedes Jones<\/word>","Kurt<\/word>","close friends<\/word>","Mercedes Jones<\/strong> is a diva-in-training<\/strong> who refuses<\/strong> to sing back-up<\/strong> with a flair for fashion<\/strong>. Early in season one, Mercedes develops a crush<\/strong> on Kurt<\/strong>, unaware<\/strong> that he is gay<\/strong>. She is hurt<\/strong> when he rejects her<\/strong>, but supportive<\/strong> when he confides his sexuality<\/strong>. After this, the two become especially close friends<\/strong>.<\/phrase>","Dismayed<\/word>","never receiving solo songs<\/word>","Mercedes and Kurt join<\/word>","briefly dates Puck<\/word>","breaks up with him<\/word>","quits the Cheerios<\/word>","afraid<\/word>","turning into someone she does not want to be<\/word>","becomes friends<\/word>","pregnant ex-cheerleader<\/word>","advice<\/word>","her stint on the Cheerios<\/word>","Quinn is unhappy<\/word>","Puck's house<\/word>","invites Quinn to move in with her family<\/word>","Quinn gives birth<\/word>","asks that<\/word>","Mercedes be present<\/word>","delivery of her child<\/word>","cheerleading squad<\/word>","Cheerios<\/word>","Quinn<\/word>","stay<\/word>","Dismayed<\/strong> at never receiving solo songs<\/strong>, Mercedes and Kurt join<\/strong> the cheerleading squad<\/strong>, the Cheerios<\/strong>, as vocalists. She briefly dates Puck<\/strong>, but ultimately breaks up with him<\/strong> and quits the Cheerios<\/strong>, afraid<\/strong> of turning into someone she does not want to be<\/strong>. She becomes friends<\/strong> with Quinn<\/strong> when the pregnant ex-cheerleader<\/strong> gives her advice<\/strong> during her stint on the Cheerios<\/strong>, and when Quinn is unhappy<\/strong> having to stay<\/strong> at Puck's house<\/strong>, invites Quinn to move in with her family<\/strong>. When Quinn gives birth<\/strong>, she asks that<\/strong> Mercedes be present<\/strong> for the delivery of her child<\/strong>.<\/phrase>","junior prom<\/word>","Mercedes and Sam<\/word>","dating secretly<\/word>","moves away<\/word>","Mercedes has a new boyfriend<\/word>","third season<\/word>","Mercedes quits the glee club<\/word>","joins the new<\/word>","rival<\/word>","McKinley show choir<\/word>","recruiting<\/word>","join her<\/word>","Troubletones lose Sectionals<\/word>","Shelby quits<\/word>","return to New Directions<\/word>","Shane<\/word>","Troubletones<\/word>","Shelby Corcoran<\/word>","Santana<\/word>","Brittany<\/word>","New Directions<\/word>","After junior prom<\/strong>, Mercedes and Sam<\/strong> begin dating secretly<\/strong>, but he moves away<\/strong> during the summer. Mercedes has a new boyfriend<\/strong>, Shane<\/strong>, by the beginning of the third season<\/strong>. In the third episode, Mercedes quits the glee club<\/strong> and joins the new<\/strong>, rival<\/strong> McKinley show choir<\/strong>, the Troubletones<\/strong>, run by Shelby Corcoran<\/strong>, later recruiting<\/strong> Santana<\/strong> and Brittany<\/strong> to join her<\/strong>. When the Troubletones lose Sectionals<\/strong> to New Directions<\/strong> and Shelby quits<\/strong>, they return to New Directions<\/strong>.<\/phrase>","Sam returns to McKinley<\/word>","attempts to rekindle his romance with Mercedes<\/word>","breaks up with Shane<\/word>","refuses to date Sam<\/word>","unsure of her true feelings<\/word>","Sam continues to support her<\/word>","YouTube video<\/word>","posts<\/word>","Mercedes singing<\/word>","offered a job<\/word>","backup singer<\/word>","after she graduates<\/word>","fourth season<\/word>","Mercedes has moved there<\/word>","returns<\/word>","help with the school musical<\/word>","Mr. Schuester's wedding<\/word>","gives up on doing an album<\/word>","her producer pressures<\/word>","showing more skin<\/word>","CD cover art<\/word>","Los Angeles<\/word>","UCLA<\/word>","Thanksgiving<\/word>","Sam returns to McKinley<\/strong> and attempts to rekindle his romance with Mercedes<\/strong>. She still has feelings for him, and eventually breaks up with Shane<\/strong>, though she refuses to date Sam<\/strong> while she is unsure of her true feelings<\/strong>. Sam continues to support her<\/strong>, and a YouTube video<\/strong> he posts<\/strong> of Mercedes singing<\/strong> results in her being offered a job<\/strong> as a backup singer<\/strong> in Los Angeles<\/strong> after she graduates<\/strong>. In the fourth season<\/strong>, Mercedes has moved there<\/strong> and is taking classes at UCLA<\/strong> as well as being a backup singer<\/strong>, though she returns<\/strong> to help with the school musical<\/strong>, for Thanksgiving<\/strong>, and for Mr. Schuester's wedding<\/strong>. Eventually she gives up on doing an album<\/strong> after her producer pressures<\/strong> her into showing more skin<\/strong> on her CD cover art<\/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':2430, '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':2430, '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':2430, 'userId':0, 'playerAction':action, 'playerArea':area, 'details':details, 'timestamp': t } }) .done(function(results){ }) .fail(function( jqXHR, textStatus ) { alert( "Request failed: " + textStatus ); }); }