1/** Run jQuery scripts */ 2( function ( $ ) { 3 4 "use strict"; 5 6 /** Document Ready. */ 7 $( document ).ready( function () { 8 9 window.speechSynthesis.cancel(); 10 11 var refreshIntervalId = ""; 12 13 14 /************************************* 15 * button position content js. 16 **************************************/ 17 $(document).on('click', '.wp_button_text_to_speech-buttons', function (e) { 18 e.preventDefault(); 19 var currentDoom = $(this); 20 var text_to_speech_content = currentDoom.attr('data-content'); 21 22 window.speechSynthesis.getVoices(); 23 var refreshIntervalId = ""; 24 25 window.speechSynthesis.cancel(); 26 const text_to_speech_val = new SpeechSynthesisUtterance( text_to_speech_content ); 27 text_to_speech_val.voice = window.speechSynthesis.getVoices().find(voice => voice.voiceURI === qcld_tts_ajax.text_to_speech_voice ); 28 text_to_speech_val.pitch = qcld_tts_ajax.text_to_speech_pitch; 29 text_to_speech_val.rate = qcld_tts_ajax.text_to_speech_rate; 30 text_to_speech_val.volume = qcld_tts_ajax.text_to_speech_volume; 31 32 if( currentDoom.hasClass("qcld_floating_text_to_speech_loud") ){ 33 currentDoom.remove("qcld_floating_text_to_speech_loud"); 34 window.speechSynthesis.pause(); 35 } else { 36 currentDoom.addClass("qcld_floating_text_to_speech_loud"); 37 window.speechSynthesis.speak(text_to_speech_val); 38 } 39 var synth = window.speechSynthesis; 40 41 refreshIntervalId = setInterval(function(){ 42 displayHello(synth, currentDoom) 43 }, 500); 44 45 46 }); 47 48 49 /************************************* 50 * button shortcode content js. 51 **************************************/ 52 $(document).on('click', '.wp_button_text_to_speech-button', function (e) { 53 e.preventDefault(); 54 var currentDoom = $(this); 55 var text_to_speech_content = currentDoom.attr('data-content'); 56 var text_to_text = currentDoom.attr('btn-text'); 57 var text_to_stop = currentDoom.attr('btn-stop'); 58 59 window.speechSynthesis.getVoices(); 60 var refreshIntervalId = ""; 61 62 window.speechSynthesis.cancel(); 63 const text_to_speech_val = new SpeechSynthesisUtterance( text_to_speech_content ); 64 text_to_speech_val.voice = window.speechSynthesis.getVoices().find(voice => voice.voiceURI === qcld_tts_ajax.text_to_speech_voice ); 65 text_to_speech_val.pitch = qcld_tts_ajax.text_to_speech_pitch; 66 text_to_speech_val.rate = qcld_tts_ajax.text_to_speech_rate; 67 text_to_speech_val.volume = qcld_tts_ajax.text_to_speech_volume; 68 69 if( currentDoom.hasClass("qcld_floating_text_to_speech_loud") ){ 70 currentDoom.remove("qcld_floating_text_to_speech_loud"); 71 currentDoom.find('span').text(text_to_text); 72 window.speechSynthesis.pause(); 73 } else { 74 currentDoom.addClass("qcld_floating_text_to_speech_loud"); 75 currentDoom.find('span').text(text_to_stop); 76 window.speechSynthesis.speak(text_to_speech_val); 77 } 78 var synth = window.speechSynthesis; 79 80 refreshIntervalId = setInterval(function(){ 81 displayHello(synth, currentDoom) 82 }, 500); 83 84 85 }); 86 87 88 /************************************* 89 * button voice_to_speech_voice_box js. 90 **************************************/ 91 $(document).on('click', '.qcld_playbutton', function (e) { 92 e.preventDefault(); 93 var currentDoom = $(this); 94 var text_to_speech_content = (jQuery("#qcld_text_to_speech_content").val()) ? jQuery("#qcld_text_to_speech_content").val() : jQuery("#qcld_text_to_speech_content").attr("placeholder"); 95 96 window.speechSynthesis.getVoices(); 97 var refreshIntervalId = ""; 98 99 window.speechSynthesis.cancel(); 100 const text_to_speech_val = new SpeechSynthesisUtterance( text_to_speech_content ); 101 text_to_speech_val.voice = window.speechSynthesis.getVoices().find(voice => voice.voiceURI === qcld_tts_ajax.text_to_speech_voice ); 102 text_to_speech_val.pitch = qcld_tts_ajax.text_to_speech_pitch; 103 text_to_speech_val.rate = qcld_tts_ajax.text_to_speech_rate; 104 text_to_speech_val.volume = qcld_tts_ajax.text_to_speech_volume; 105 106 if( currentDoom.hasClass("qcld_floating_text_to_speech_loud") ){ 107 currentDoom.remove("qcld_floating_text_to_speech_loud"); 108 window.speechSynthesis.pause(); 109 } else { 110 currentDoom.addClass("qcld_floating_text_to_speech_loud"); 111 window.speechSynthesis.speak(text_to_speech_val); 112 } 113 var synth = window.speechSynthesis; 114 115 refreshIntervalId = setInterval(function(){ 116 displayHello(synth, currentDoom) 117 }, 500); 118 119 120 }); 121 122 123 function displayHello(synth, currentDoom) { 124 if (!synth.speaking) { 125 var qcld_floating_text_to_buttons = currentDoom; 126 currentDoom.removeClass("qcld_floating_text_to_speech_loud"); 127 clearInterval(refreshIntervalId); 128 } 129 } 130 131 132 133 });
134 135} ( jQuery ) );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.