var presentation = ["Force-sensitive Dathomirian Zabrak<\/word>","apprentice Dark Lord of the Sith Darth Maul<\/word>","he was taken at a young age by the Dark Lord of the Sith Darth Sidious<\/word>","Darth Maul grew strong in the dark side of the Force, becoming an expert lightsaber duelist and assassin who yearned to reveal the Sith's continued survival to the Jedi Order<\/word>","Maul was defeated and maimed by Jinn's apprentice, who left the Sith Lord for dead<\/word>","Maul was a Force-sensitive Dathomirian Zabrak<\/strong> male and dark side warrior who served as the apprentice Dark Lord of the Sith Darth Maul<\/strong> during the final years of the Galactic Republic and reigned as a crime lord during the rule of the Galactic Empire. The son of Mother Talzin of the Nightsisters, he was taken at a young age by the Dark Lord of the Sith Darth Sidious<\/strong>, who anointed him his first Sith apprentice. Through his training, Darth Maul grew strong in the dark side of the Force, becoming an expert lightsaber duelist and assassin who yearned to reveal the Sith's continued survival to the Jedi Order<\/strong>. During the crisis on Naboo in 32 BBY, Maul confronted Jedi Master Qui-Gon Jinn and Padawan Obi-Wan Kenobi. Although he succeeded in killing the former, Maul was defeated and maimed by Jinn's apprentice, who left the Sith Lord for dead<\/strong>. As a result of Maul's defeat and apparent death, Sidious replaced him with Count Dooku, Jinn's Jedi mentor who adopted the Sith persona of Darth Tyranus.<\/phrase>","Maul survived and reconstructed himself as a cyborg, although the experience of his defeat also drove him insane<\/word>","found Maul and restabilized his mind with the help of Mother Talzin<\/word>","Maul embarked on a personal quest for revenge against Kenobi<\/word>","The Dark Lord confronted Maul in person; after killing Opress, Sidious denounced his former apprentice as a Sith no longer due to the Rule of Two.<\/word>","Fueled by his hatred for Kenobi, Maul survived and reconstructed himself as a cyborg, although the experience of his defeat also drove him insane<\/strong>. He was presumed dead for over a decade until his brother, Savage Opress, found Maul and restabilized his mind with the help of Mother Talzin<\/strong>. By that time, the Clone Wars raged across the galaxy, with the Jedi-led clone forces of the Republic battling the droid armies of the Confederacy of Independent Systems as intended by Maul's former Sith Master. Believing he had been cheated out of his place in galactic history, Maul embarked on a personal quest for revenge against Kenobi<\/strong>, whom he blamed for his fate. He also used the galactic conflict as an opportunity to form his own criminal empire, the Shadow Collective, through various alliances, which included the Pyke Syndicate, the Black Sun, the Hutt Clan, and the Mandalorian Death Watch. Their combined resources enabled Maul to overthrow the New Mandalorians and install a puppet government on Mandalore. However, as his power and influence increased, Maul became a threat to Sidious' own plans for the future. The Dark Lord confronted Maul in person; after killing Opress, Sidious denounced his former apprentice as a Sith no longer due to the Rule of Two.<\/strong> Despite Maul's efforts to avenge his brother, he was defeated and overpowered by Sidious' command of the Force.<\/phrase>","overthrown by former Padawan Ahsoka Tano and an army of clone troopers<\/word>","dealt Maul a lethal blow, ending Maul's decade-spanning quest for vengeance<\/word>","meant the Sith would be destroyed.<\/word>","In the waning days of the Clone Wars, Maul escaped from Sidious and ultimately returned to Mandalore where he was overthrown by former Padawan Ahsoka Tano and an army of clone troopers<\/strong>. However, Maul survived the war and continued to build his own empire as a crime lord and the secret leader of Crimson Dawn. He was later stranded on the planet Malachor, where he hoped to destroy the Sith by unlocking the superweapon at the heart of the Sith temple. Maul's plan was thwarted by two Jedi, Kanan Jarrus and Ezra Bridger, the latter of whom Maul hoped to corrupt as his own apprentice. After escaping Malachor, Maul continued to try to tempt Bridger to the dark side before ultimately learning that Kenobi was still alive in spite of Order 66 and the Great Jedi Purge. Seeking hope and purpose, Maul sought Kenobi on Tatooine, the same planet where he had first revealed himself to Kenobi. In 2 BBY, Maul engaged Kenobi in a brief lightsaber duel for the last time. Kenobi cut Maul's lightsaber in half and dealt Maul a lethal blow, ending Maul's decade-spanning quest for vengeance<\/strong>. He died moments later with the knowledge that Kenobi was protecting Luke Skywalker, who Kenobi believed was the Chosen One, taking comfort in the fact that it meant the Sith would be destroyed.<\/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':1324, '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':1324, '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':1324, 'userId':0, 'playerAction':action, 'playerArea':area, 'details':details, 'timestamp': t } }) .done(function(results){ }) .fail(function( jqXHR, textStatus ) { alert( "Request failed: " + textStatus ); }); }