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 var refreshIntervalIdfloating = ""; 13 14 /************************************* 15 * floating button controlling js. 16 **************************************/ 17 $(document).on('click', '.qcld_floating_text_to_speech_button', 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 refreshIntervalIdfloating = ""; 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 currentDoom.removeClass("qcld_bounce"); 35 currentDoom.text( qcld_tts_ajax.floating_btn_text ); 36 window.speechSynthesis.pause(); 37 } else { 38 currentDoom.addClass("qcld_floating_text_to_speech_loud"); 39 currentDoom.addClass("qcld_bounce"); 40 currentDoom.text( qcld_tts_ajax.floating_btn_text_stop ); 41 window.speechSynthesis.speak(text_to_speech_val); 42 } 43 var synth = window.speechSynthesis; 44 45 refreshIntervalIdfloating = setInterval(function(){ 46 floating_display_hello(synth, currentDoom) 47 }, 500); 48 49 50 }); 51 52 53 54 function floating_display_hello( synth, currentDoom ) { 55 if (!synth.speaking) { 56 var qcld_floating_text_to_buttons = currentDoom; 57 currentDoom.removeClass("qcld_floating_text_to_speech_loud"); 58 currentDoom.text( qcld_tts_ajax.floating_btn_text ); 59 clearInterval(refreshIntervalIdfloating); 60 } 61 } 62 63 64 /************************************* 65 * button position content js. 66 **************************************/ 67 $(document).on('click', '.wp_button_text_to_speech-buttons', function (e) { 68 e.preventDefault(); 69 var currentDoom = $(this); 70 var text_to_speech_content = currentDoom.attr('data-content'); 71 72 window.speechSynthesis.getVoices(); 73 var refreshIntervalId = ""; 74 75 window.speechSynthesis.cancel(); 76 const text_to_speech_val = new SpeechSynthesisUtterance( text_to_speech_content ); 77 text_to_speech_val.voice = window.speechSynthesis.getVoices().find(voice => voice.voiceURI === qcld_tts_ajax.text_to_speech_voice ); 78 text_to_speech_val.pitch = qcld_tts_ajax.text_to_speech_pitch; 79 text_to_speech_val.rate = qcld_tts_ajax.text_to_speech_rate; 80 text_to_speech_val.volume = qcld_tts_ajax.text_to_speech_volume; 81 82 if( currentDoom.hasClass("qcld_floating_text_to_speech_loud") ){ 83 currentDoom.remove("qcld_floating_text_to_speech_loud"); 84 window.speechSynthesis.pause(); 85 } else { 86 currentDoom.addClass("qcld_floating_text_to_speech_loud"); 87 window.speechSynthesis.speak(text_to_speech_val); 88 } 89 var synth = window.speechSynthesis; 90 91 refreshIntervalId = setInterval(function(){ 92 displayHello(synth, currentDoom) 93 }, 500); 94 95 96 }); 97 98 99 /************************************* 100 * button shortcode content js. 101 **************************************/ 102 $(document).on('click', '.wp_button_text_to_speech-button', function (e) { 103 e.preventDefault(); 104 var currentDoom = $(this); 105 var text_to_speech_content = currentDoom.attr('data-content'); 106 var text_to_text = currentDoom.attr('btn-text'); 107 var text_to_stop = currentDoom.attr('btn-stop'); 108 109 window.speechSynthesis.getVoices(); 110 var refreshIntervalId = ""; 111 112 window.speechSynthesis.cancel(); 113 const text_to_speech_val = new SpeechSynthesisUtterance( text_to_speech_content ); 114 text_to_speech_val.voice = window.speechSynthesis.getVoices().find(voice => voice.voiceURI === qcld_tts_ajax.text_to_speech_voice ); 115 text_to_speech_val.pitch = qcld_tts_ajax.text_to_speech_pitch; 116 text_to_speech_val.rate = qcld_tts_ajax.text_to_speech_rate; 117 text_to_speech_val.volume = qcld_tts_ajax.text_to_speech_volume; 118 119 if( currentDoom.hasClass("qcld_floating_text_to_speech_loud") ){ 120 currentDoom.remove("qcld_floating_text_to_speech_loud"); 121 currentDoom.find('span').text(text_to_text); 122 window.speechSynthesis.pause(); 123 } else { 124 currentDoom.addClass("qcld_floating_text_to_speech_loud"); 125 currentDoom.find('span').text(text_to_stop); 126 window.speechSynthesis.speak(text_to_speech_val); 127 } 128 var synth = window.speechSynthesis; 129 130 refreshIntervalId = setInterval(function(){ 131 displayHello(synth, currentDoom) 132 }, 500); 133 134 135 }); 136 137 138 /************************************* 139 * button voice_to_speech_voice_box js. 140 **************************************/ 141 $(document).on('click', '.qcld_playbutton', function (e) { 142 e.preventDefault(); 143 var currentDoom = $(this); 144 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"); 145 146 window.speechSynthesis.getVoices(); 147 var refreshIntervalId = ""; 148 149 window.speechSynthesis.cancel(); 150 const text_to_speech_val = new SpeechSynthesisUtterance( text_to_speech_content ); 151 text_to_speech_val.voice = window.speechSynthesis.getVoices().find(voice => voice.voiceURI === qcld_tts_ajax.text_to_speech_voice ); 152 text_to_speech_val.pitch = qcld_tts_ajax.text_to_speech_pitch; 153 text_to_speech_val.rate = qcld_tts_ajax.text_to_speech_rate; 154 text_to_speech_val.volume = qcld_tts_ajax.text_to_speech_volume; 155 156 if( currentDoom.hasClass("qcld_floating_text_to_speech_loud") ){ 157 currentDoom.remove("qcld_floating_text_to_speech_loud"); 158 window.speechSynthesis.pause(); 159 } else { 160 currentDoom.addClass("qcld_floating_text_to_speech_loud"); 161 window.speechSynthesis.speak(text_to_speech_val); 162 } 163 var synth = window.speechSynthesis; 164 165 refreshIntervalId = setInterval(function(){ 166 displayHello(synth, currentDoom) 167 }, 500); 168 169 170 }); 171 172 173 function displayHello(synth, currentDoom) { 174 if (!synth.speaking) { 175 var qcld_floating_text_to_buttons = currentDoom; 176 currentDoom.removeClass("qcld_floating_text_to_speech_loud"); 177 clearInterval(refreshIntervalId); 178 } 179 } 180 181 182 183 });
184 185} ( 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.