From 8bc648a6bd99d6d5af7fd71a7370bfcabdad2b06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enes=20Yak=C4=B1=C5=9Ft=C4=B1r?= Date: Sat, 29 Aug 2026 23:01:08 +0300 Subject: [PATCH] fix(modal): guarantee unconditional voice modal opening and instant user feedback v1.2.4 --- client.js | 74 ++++++++++++++++++++++++++++++++++------------------ package.json | 2 +- 2 files changed, 49 insertions(+), 27 deletions(-) diff --git a/client.js b/client.js index 8ed6933..a62e2ea 100644 --- a/client.js +++ b/client.js @@ -1402,7 +1402,8 @@ // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- - // 8. YOUTUBE-IDENTICAL SEARCH BAR & VOICE MODAL ENGINE (v1.2.3 - Universal) + // -------------------------------------------------------------------------- + // 8. YOUTUBE-IDENTICAL SEARCH BAR & BULLETPROOF VOICE MODAL (v1.2.4) // -------------------------------------------------------------------------- var activeVoiceRecognition = null; var isVoiceListeningActive = false; @@ -1421,21 +1422,21 @@ modal.style.display = 'none'; modal.innerHTML = - '
' + - '
' + - '

Sesle arama yapın

' + - '' + + '
' + + '
' + + '

Sesle arama yapın

' + + '' + '
' + - '
' + - '
Dinleniyor...
' + - '
' + - '
' + - '' + - '
' + + '
' + '
' + - '
Aramak istediğiniz sanatçıyı, şarkıyı veya konuyu söyleyin.
' + + '
Aramak istediğiniz sanatçıyı, şarkıyı veya konuyu söyleyin.
' + '
' + '
'; @@ -1443,7 +1444,9 @@ var closeBtn = modal.querySelector('#yaktube-voice-modal-close'); if (closeBtn) { - closeBtn.addEventListener('click', function () { + closeBtn.addEventListener('click', function (e) { + e.preventDefault(); + e.stopPropagation(); closeYouTubeVoiceModal(); }); } @@ -1456,7 +1459,9 @@ var pulseBtn = modal.querySelector('#yaktube-voice-mic-pulse-btn'); if (pulseBtn) { - pulseBtn.addEventListener('click', function () { + pulseBtn.addEventListener('click', function (e) { + e.preventDefault(); + e.stopPropagation(); if (isVoiceListeningActive) { stopVoiceRecognition(); } else { @@ -1469,19 +1474,30 @@ } function openYouTubeVoiceModal(targetInput) { - var SpeechRec = window.SpeechRecognition || window.webkitSpeechRecognition; - if (!SpeechRec) { - announce( - 'Tarayıcınız sesli arama özelliğini desteklemiyor. Lütfen Chrome, Edge veya güncel bir mobil tarayıcı kullanın.' - ); - return; - } + modalTargetInput = + targetInput || + document.querySelector('my-search-typeahead input, my-header input[type="search"], input[type="search"]'); var modal = createYouTubeVoiceModal(); modal.style.display = 'flex'; + + var statusText = modal.querySelector('#yaktube-voice-status-text'); + var transcriptPreview = modal.querySelector('#yaktube-voice-transcript-preview'); + if (statusText) statusText.textContent = 'Dinleniyor...'; + if (transcriptPreview) transcriptPreview.textContent = ''; + announce('Sesli arama penceresi açıldı. Dinleniyor, lütfen aramak istediğiniz videoyu söyleyin.', true); - modalTargetInput = targetInput; + var SpeechRec = window.SpeechRecognition || window.webkitSpeechRecognition; + if (!SpeechRec) { + if (statusText) statusText.textContent = 'Tarayıcıda Ses Tanıma Desteklenmiyor'; + var hint = modal.querySelector('.yaktube-voice-hint-text'); + if (hint) hint.textContent = 'Lütfen sesli arama için Google Chrome veya Microsoft Edge kullanın.'; + stopVoiceRecognition(); + announce('Tarayıcınız sesli arama özelliğini desteklemiyor. Lütfen Chrome veya Edge kullanın.'); + return; + } + startVoiceRecognition(); var closeBtn = modal.querySelector('#yaktube-voice-modal-close'); @@ -1492,7 +1508,7 @@ var modal = document.getElementById('yaktube-voice-modal'); if (modal) modal.style.display = 'none'; stopVoiceRecognition(); - announce('Sesli arama kapatıldı.'); + announce('Sesli arama penceresi kapatıldı.'); } function startVoiceRecognition() { @@ -1513,7 +1529,10 @@ if (statusText) statusText.textContent = 'Dinleniyor...'; if (transcriptPreview) transcriptPreview.textContent = ''; - if (micBtn) micBtn.classList.remove('yaktube-idle-mic'); + if (micBtn) { + micBtn.style.background = '#cc0000'; + micBtn.style.boxShadow = '0 4px 20px rgba(204,0,0,0.5)'; + } if (ripple) ripple.style.display = 'block'; try { @@ -1561,7 +1580,7 @@ statusText.textContent = 'Ses Algılanamadı'; announce('Ses algılanamadı, tekrar denemek için mikrofona dokunun.'); } else { - statusText.textContent = 'Bir sorun oluştu'; + statusText.textContent = 'Tekrar Deneyin'; } } stopVoiceRecognition(); @@ -1595,7 +1614,10 @@ var ripple = modal.querySelector('#yaktube-voice-ripple'); var statusText = modal.querySelector('#yaktube-voice-status-text'); - if (micBtn) micBtn.classList.add('yaktube-idle-mic'); + if (micBtn) { + micBtn.style.background = '#333'; + micBtn.style.boxShadow = 'none'; + } if (ripple) ripple.style.display = 'none'; if (statusText && statusText.textContent === 'Dinleniyor...') { statusText.textContent = 'Mikrofona dokunup konuşun'; diff --git a/package.json b/package.json index 8ef292d..6a529c2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "peertube-plugin-yaktube-ondemand", - "version": "1.2.3", + "version": "1.2.4", "description": "Accessible On-Demand YouTube Import, Live Streams, Smart Recommendations and A11y Engine for PeerTube", "main": "main.js", "clientScripts": [