1document.addEventListener("DOMContentLoaded", function() { 2 var ttsPlayer = document.querySelector(".ai-tts-player"); 3 var startTime = 0; 4 5 if (ttsPlayer) { 6 7 ttsPlayer.addEventListener('play', function() { 8 startTime = this.currentTime; 9 }); 10 11 ttsPlayer.addEventListener('pause', function() { 12 if (this.ended) { 13 return; 14 } 15 sendPlayTime(); 16 }); 17 18 ttsPlayer.addEventListener('ended', function() { 19 sendPlayTime(); 20 }); 21 22 function sendPlayTime() { 23 var endTime = ttsPlayer.currentTime; 24 var playTime = endTime - startTime; 25 26 if (playTime > 0) { // Ensure valid play time 27 jQuery.post(aiTTS.ajax_url, { 28 action: 'increment_play_count', 29 post_id: jQuery(ttsPlayer).data('post-id'), 30 play_time: playTime, 31 security: aiTTS.nonce 32 }); 33 } 34 35 } 36 } 37});
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.