//joelHarmelingBio // start $( document ).ready(function() { var hidePlay_joelHarmelingBio = function(){ $('.play_joelHarmelingBio').hide(); }; var showPlay_joelHarmelingBio = function(){ $('.play_joelHarmelingBio').show(); }; var hidePause_joelHarmelingBio = function(){ $('.pause_joelHarmelingBio').hide(); }; var showPause_joelHarmelingBio = function(){ $('.pause_joelHarmelingBio').show(); }; var hideResume_joelHarmelingBio = function(){ $('.resume_joelHarmelingBio').hide(); }; var showResume_joelHarmelingBio = function(){ $('.resume_joelHarmelingBio').show(); }; hidePause_joelHarmelingBio(); hideResume_joelHarmelingBio(); // Get the 'speak' button var play_joelHarmelingBio = document.getElementsByClassName("play_joelHarmelingBio")[0]; // Get the 'speak' button var pause_joelHarmelingBio = document.getElementsByClassName("pause_joelHarmelingBio")[0]; // Get the 'speak' button var resume_joelHarmelingBio = document.getElementsByClassName("resume_joelHarmelingBio")[0]; // Create a new instance of SpeechSynthesisUtterance. var msg = new SpeechSynthesisUtterance(); // Get the text to be spoken. var joelHarmelingBio = $('div.joelHarmelingBio').text(); //var joelHarmelingBio = "Hello World" var restartSpeech = function () { speechSynthesisInstance.cancel(); window.speechSynthesis.speak(msg); }; var speak_joelHarmelingBio = function () { // Set the text. msg.text = joelHarmelingBio; // Set the attributes. // msg.volume = globalChatterboxVolume; msg.rate = 1; msg.pitch = 1; msg.lang = 1; // msg.voice = "Samantha"; // Queue this utterance. window.speechSynthesis.cancel(); window.speechSynthesis.speak(msg); msg.onend = function(){ hideResume_joelHarmelingBio(); hidePause_joelHarmelingBio(); showPlay_joelHarmelingBio(); }; }; play_joelHarmelingBio.addEventListener('click', function(e) { if (joelHarmelingBio.length > 0) { speak_joelHarmelingBio(joelHarmelingBio.value); } }); pause_joelHarmelingBio.addEventListener('click', function(e) { speechSynthesis.pause(); }); resume_joelHarmelingBio.addEventListener('click', function(e) { speechSynthesis.resume(); }); // Toggle Play Pause and Resume Button $( ".play_joelHarmelingBio" ).click(function() { if($('.play_joelHarmelingBio:visible').length) hidePlay_joelHarmelingBio(); showPause_joelHarmelingBio(); }); $( ".resume_joelHarmelingBio" ).click(function() { if($('.resume_joelHarmelingBio:visible').length) showPause_joelHarmelingBio(); hideResume_joelHarmelingBio(); }); $( ".pause_joelHarmelingBio" ).click(function() { hidePause_joelHarmelingBio(); showResume_joelHarmelingBio(); }); }); //joelHarmelingBio // end