diff --git a/client.js b/client.js
index b2a9f10..27aaa06 100644
--- a/client.js
+++ b/client.js
@@ -1077,6 +1077,435 @@ try {
}
// 3. Screen-Reader & Turkish Q Optimized Shortcuts & Player Bar (v1.4.1)
+ // YakTube NLnet WCAG 2.2 AAA & Privacy Suite Modules
+
+// ============================================================================
+// 1. WCAG 2.2 AAA Focus Trap & Modal Management
+// ============================================================================
+var lastActiveElementBeforeModal = null;
+
+function trapFocusInModal(modalEl) {
+ if (!modalEl) return;
+ var focusableElements = modalEl.querySelectorAll(
+ 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
+ );
+ if (!focusableElements.length) return;
+ var firstFocusable = focusableElements[0];
+ var lastFocusable = focusableElements[focusableElements.length - 1];
+
+ function handleKeydown(e) {
+ if (e.key !== 'Tab') return;
+ if (e.shiftKey) {
+ if (document.activeElement === firstFocusable) {
+ e.preventDefault();
+ lastFocusable.focus();
+ }
+ } else {
+ if (document.activeElement === lastFocusable) {
+ e.preventDefault();
+ firstFocusable.focus();
+ }
+ }
+ }
+
+ modalEl.removeEventListener('keydown', modalEl._trapHandler);
+ modalEl._trapHandler = handleKeydown;
+ modalEl.addEventListener('keydown', handleKeydown);
+ setTimeout(function () {
+ firstFocusable.focus();
+ }, 50);
+}
+
+function recordFocusBeforeModal() {
+ lastActiveElementBeforeModal = document.activeElement;
+}
+
+function restoreFocusAfterModal() {
+ if (lastActiveElementBeforeModal && typeof lastActiveElementBeforeModal.focus === 'function') {
+ try {
+ lastActiveElementBeforeModal.focus();
+ } catch (e) {}
+ }
+}
+
+// ============================================================================
+// 2. Audio-Only & Screen Blank Mode (NLnet Privacy & Bandwidth Shield)
+// ============================================================================
+var isAudioOnlyMode = false;
+var wakeLockSentinel = null;
+
+async function requestScreenWakeLock() {
+ try {
+ if ('wakeLock' in navigator) {
+ wakeLockSentinel = await navigator.wakeLock.request('screen');
+ wakeLockSentinel.addEventListener('release', function () {
+ wakeLockSentinel = null;
+ });
+ }
+ } catch (err) {
+ console.warn('[YakTube] WakeLock error:', err);
+ }
+}
+
+function releaseScreenWakeLock() {
+ if (wakeLockSentinel) {
+ wakeLockSentinel.release().catch(function () {});
+ wakeLockSentinel = null;
+ }
+}
+
+function toggleAudioOnlyMode() {
+ var video = getVideoElement();
+ if (!video) {
+ announce('Aktif video bulunamadı.');
+ return;
+ }
+
+ isAudioOnlyMode = !isAudioOnlyMode;
+ document.body.classList.toggle('yaktube-audio-only-active', isAudioOnlyMode);
+
+ var overlay = document.getElementById('yaktube-audio-blank-overlay');
+ var audioBtn = document.getElementById('yaktube-bar-audio-btn');
+
+ if (isAudioOnlyMode) {
+ if (!overlay) {
+ overlay = document.createElement('div');
+ overlay.id = 'yaktube-audio-blank-overlay';
+ overlay.className = 'yaktube-audio-blank-overlay';
+ overlay.setAttribute('role', 'region');
+ overlay.setAttribute('aria-label', 'Yalnızca Ses ve Ekran Karartma Modu');
+ overlay.innerHTML =
+ '
' +
+ '
📻
' +
+ '
Yalnızca Ses Modu Aktif
' +
+ '
Ekran pil ve veri tasarrufu için karartıldı. Arka planda çalma desteklenir.
' +
+ '
' +
+ '' +
+ '' +
+ '
' +
+ '
';
+
+ var exitBtn = overlay.querySelector('#yaktube-exit-audio-btn');
+ if (exitBtn) {
+ exitBtn.addEventListener('click', toggleAudioOnlyMode);
+ }
+ var togglePlayBtn = overlay.querySelector('#yaktube-toggle-play-audio-btn');
+ if (togglePlayBtn) {
+ togglePlayBtn.addEventListener('click', function () {
+ var v = getVideoElement();
+ if (v) {
+ if (v.paused) v.play(); else v.pause();
+ }
+ });
+ }
+ document.body.appendChild(overlay);
+ }
+ overlay.style.display = 'flex';
+ requestScreenWakeLock();
+ if (audioBtn) {
+ audioBtn.classList.add('active');
+ audioBtn.setAttribute('aria-pressed', 'true');
+ }
+ announce('Yalnızca ses modu açıldı. Ekran karartıldı, pil ve veri tasarrufu aktif. Çıkmak için Alt+O tuşuna basın.');
+ showQuickToast('📻 Yalnızca Ses Modu Açık');
+ } else {
+ if (overlay) overlay.style.display = 'none';
+ releaseScreenWakeLock();
+ if (audioBtn) {
+ audioBtn.classList.remove('active');
+ audioBtn.setAttribute('aria-pressed', 'false');
+ }
+ announce('Yalnızca ses modu kapatıldı. Görüntü normale döndü.');
+ showQuickToast('🎬 Normal Görüntü Modu');
+ }
+}
+
+// ============================================================================
+// 3. Accessible Live Transcript Reader (NLnet WCAG 2.2 AAA Milestone)
+// ============================================================================
+var liveTranscriptCues = [];
+var isTranscriptPanelOpen = false;
+
+function extractVideoCaptions() {
+ var video = getVideoElement();
+ if (!video || !video.textTracks || !video.textTracks.length) return [];
+
+ var cuesList = [];
+ for (var i = 0; i < video.textTracks.length; i++) {
+ var track = video.textTracks[i];
+ if (track.cues && track.cues.length) {
+ for (var j = 0; j < track.cues.length; j++) {
+ var cue = track.cues[j];
+ cuesList.push({
+ startTime: cue.startTime,
+ endTime: cue.endTime,
+ text: (cue.text || '').replace(/<[^>]*>/g, '').trim()
+ });
+ }
+ break;
+ }
+ }
+ return cuesList;
+}
+
+function openTranscriptPanel() {
+ var existing = document.getElementById('yaktube-transcript-panel');
+ if (existing) {
+ existing.remove();
+ isTranscriptPanelOpen = false;
+ restoreFocusAfterModal();
+ announce('Transkript paneli kapatıldı.');
+ return;
+ }
+
+ recordFocusBeforeModal();
+ isTranscriptPanelOpen = true;
+
+ var cues = extractVideoCaptions();
+ var video = getVideoElement();
+ var curTime = video ? video.currentTime : 0;
+
+ var panel = document.createElement('div');
+ panel.id = 'yaktube-transcript-panel';
+ panel.className = 'yaktube-transcript-panel';
+ panel.setAttribute('role', 'region');
+ panel.setAttribute('aria-label', 'Video Transkript ve Canlı Metin İnceleyici');
+
+ var listHtml = '';
+ if (cues && cues.length) {
+ liveTranscriptCues = cues;
+ cues.forEach(function (c, idx) {
+ var isActive = curTime >= c.startTime && curTime <= c.endTime;
+ listHtml +=
+ '' +
+ '
📄 Bu video için otomatik altyazı veya transkript henüz hazır değil.
' +
+ '
Video oynatıcısındaki Altyazı (CC) butonunu açarak dili seçebilirsiniz.
' +
+ '
';
+ }
+
+ panel.innerHTML =
+ '' +
+ '' +
+ '
' +
+ '
🔗 Temiz ve Federe Paylaşım
' +
+ '' +
+ '' +
+ '
Tüm reklam ve izleyici parametrelerinden arındırılmış temiz YakTube bağlantısı:
' +
+ '
' +
+ '
' +
+ '' +
+ '' +
+ '
' +
+ '
' +
+ '' +
+ '' +
+ '
' +
+ '
' +
+ '
' +
+ '
';
+
+ var closeBtn = modal.querySelector('#yaktube-share-close');
+ if (closeBtn) {
+ closeBtn.addEventListener('click', function () {
+ modal.remove();
+ restoreFocusAfterModal();
+ });
+ }
+
+ var chk = modal.querySelector('#yaktube-share-timestamp-chk');
+ var inp = modal.querySelector('#yaktube-share-url-inp');
+ var mastodonLink = modal.querySelector('#yaktube-mastodon-share');
+ var waLink = modal.querySelector('#yaktube-whatsapp-share');
+
+ function updateShareLinks() {
+ var finalUrl = chk.checked ? timestampUrl : cleanUrl;
+ inp.value = finalUrl;
+ var shareText = encodeURIComponent(videoTitle + ' - YakTube: ' + finalUrl);
+ if (mastodonLink) mastodonLink.href = 'https://mastodonshare.com/?text=' + shareText;
+ if (waLink) waLink.href = 'https://api.whatsapp.com/send?text=' + shareText;
+ }
+ chk.addEventListener('change', updateShareLinks);
+ updateShareLinks();
+
+ modal.querySelector('#yaktube-copy-share-btn').addEventListener('click', function () {
+ inp.select();
+ navigator.clipboard.writeText(inp.value).then(function () {
+ announce('Temiz paylaşım bağlantısı panoya kopyalandı.');
+ showQuickToast('📋 Bağlantı Kopyalandı!');
+ }).catch(function () {
+ document.execCommand('copy');
+ announce('Temiz paylaşım bağlantısı kopyalandı.');
+ });
+ });
+
+ document.body.appendChild(modal);
+ trapFocusInModal(modal);
+ announce('Paylaşım penceresi açıldı. Kapatmak için Escape tuşuna basın.');
+}
+
+// ============================================================================
+// 5. F6 Landmark Cycle Navigation (WCAG 2.2 AAA Quick Switch)
+// ============================================================================
+var landmarkIndex = 0;
+function cycleLandmarks(reverse) {
+ var landmarks = [
+ { name: 'Başlık ve Ana Arama', selector: 'header, my-header, #yaktube-search-input' },
+ { name: 'Kategori Çipleri', selector: '#yaktube-home-categories, .yaktube-categories-bar' },
+ { name: 'Video Oynatıcı Alanı', selector: '#videojs-wrapper, .video-js, #video-wrapper' },
+ { name: 'Video Araç Çubuğu', selector: '#yaktube-player-action-bar' },
+ { name: 'Video Açıklaması ve Bilgiler', selector: 'my-video-watch-description, .video-info, .video-bottom' },
+ { name: 'Yorumlar ve Tartışmalar', selector: 'my-video-comments, .comments' },
+ { name: 'Önerilen Videolar', selector: 'my-video-watch-related, .related-videos, #yaktube-ondemand-container' }
+ ];
+
+ var validLandmarks = landmarks.map(function (item) {
+ return { name: item.name, el: document.querySelector(item.selector) };
+ }).filter(function (item) {
+ return !!item.el && item.el.offsetParent !== null;
+ });
+
+ if (!validLandmarks.length) {
+ announce('Sayfada gezinilebilir alan bulunamadı.');
+ return;
+ }
+
+ if (reverse) {
+ landmarkIndex = (landmarkIndex - 1 + validLandmarks.length) % validLandmarks.length;
+ } else {
+ landmarkIndex = (landmarkIndex + 1) % validLandmarks.length;
+ }
+
+ var target = validLandmarks[landmarkIndex];
+ if (target && target.el) {
+ target.el.setAttribute('tabindex', '-1');
+ target.el.scrollIntoView({ behavior: 'smooth', block: 'center' });
+ target.el.focus();
+ announce('Bölgeye atlandı: ' + target.name);
+ showQuickToast('🎯 ' + target.name);
+ }
+}
+
+
function toggleShortcutsModal() {
var modal = document.getElementById('yaktube-shortcuts-dialog');
if (modal) {
@@ -2367,6 +2796,9 @@ try {
'