1try{ 2// adding try catch for read_aloud.js so if something break in read_aloud.js it will not break other js files 3var elem = document.getElementById('read_aloud-js'); 4var read_aloud_audio_file_path = elem.getAttribute('read_aloud_audio_file_path'); 5var valid_legacy_url = elem.getAttribute('valid_legacy_url'); 6var pause_button_svg = elem.getAttribute('pause_button_svg'); 7var play_button_svg = elem.getAttribute('play_button_svg'); 8window.audio_file = new Audio(); 9 10window.audio_file.addEventListener('loadedmetadata', function() { 11 12 var duration = window.audio_file.duration; 13 14 if (duration) { 15 $('#max-time_'+valid_legacy_url).html(formatTime(duration)); 16 } 17}); 18 19function read_aloud_audio_play(audio_path,legacy_url){ 20 var read_aloud_audio = window.audio_file 21 // decoding url for handling url in hindi or other languages 22 const parsedUrl2 = new URL(audio_path); 23 24 decoded_audio_path = parsedUrl2.href 25 if(read_aloud_audio.src == decoded_audio_path){ 26 if(read_aloud_audio.paused){ 27 read_aloud_audio.play(); 28 $('.audio-playbtn_'+ legacy_url).html(pause_button_svg); 29 } 30 else{ 31 read_aloud_audio.pause(); 32 $('.audio-playbtn_'+ legacy_url).html(play_button_svg); 33 } 34 }else{ 35 read_aloud_audio.pause() 36 window.audio_file =new Audio(audio_path); 37 read_aloud_audio = window.audio_file 38 read_aloud_audio.addEventListener('loadedmetadata', function() { 39 var duration = read_aloud_audio.duration; 40 if (duration) { 41 $('#max-time_'+legacy_url).html(formatTime(duration)); 42 } 43 }); 44 read_aloud_audio.play(); 45 $('.speed-options').removeClass('active'); 46 $('.reset-speed-class').addClass('active'); 47 $('.seek-slider-class').val(0); 48 $('.seek-slider-class').css('background-size',0+ '%'); 49 $('.play-icon').html(play_button_svg); 50 $('.audio-playbtn_'+ legacy_url).html(pause_button_svg); 51 52 } 53 read_aloud_audio.addEventListener('loadedmetadata', function() { 54 var duration = read_aloud_audio.duration; 55 if (duration) { 56 $('#max-time_'+legacy_url).html(formatTime(duration)); 57 } 58 }); 59 read_aloud_audio.addEventListener('ended', function() { 60 $("#playbtn_"+legacy_url).html(play_button_svg); 61 62 // Reset the time and progress bar 63 $('#seek-slider_'+legacy_url).val(0); 64 $('#current-time_'+legacy_url).html("00:00") 65 $('#seek-slider_'+legacy_url).css('background-size',0+ '%'); 66 }); 67 68 $('#seek-slider_'+legacy_url).on('input', function() { 69 var progress = $(this).val(); 70 var duration = read_aloud_audio.duration; 71 var currentTime = (progress / 100) * duration; 72 read_aloud_audio.currentTime = currentTime; 73 }); 74 75 read_aloud_audio.addEventListener('timeupdate', function() { 76 var currentTime = read_aloud_audio.currentTime; 77 var duration = read_aloud_audio.duration; 78 var progress = (currentTime / duration) * 100; 79 $('#seek-slider_'+legacy_url).css('background-size',progress+ '%'); 80 $('#seek-slider_'+legacy_url).val(progress); 81 $('#current-time_'+legacy_url).html(formatTime(currentTime)) 82 83 }); 84 85 $('.audio-player-speed_'+legacy_url).on('click', '.speed-options-legacy_url_'+ legacy_url, function() { 86 var speed = $(this).data('speed'); 87 88 read_aloud_audio.playbackRate = speed; 89 $('.speed-options-legacy_url_'+ legacy_url).removeClass('active'); 90 $(this).addClass('active'); 91 }); 92 93} 94 95function read_aloud_audio_speed(legacy_url,speed){ 96 window.audio_file.playbackRate = speed; 97 $('.speed-options-legacy_url_'+ legacy_url).removeClass('active'); 98 event.target.classList.add('active'); 99} 100 101 102 103 function formatTime(time) { 104 var minutes = Math.floor(time / 60); 105 var seconds = Math.floor(time % 60); 106 return minutes.toString().padStart(2, '0') + ':' + seconds.toString().padStart(2, '0'); 107 } 108 109 function set_other_div_top_value(){ 110 try{ 111 var element = $('.shareables'); 112 var topValue = parseInt(element.css('top')) 113 var newTopValue = topValue + 88; 114 element.css('top', newTopValue + 'px'); 115 } 116 catch(err){ 117 118 } 119 } 120}catch(err){ 121 console.log('handle error ',err) 122}
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.