Add extensive diagnostic logging to ClientScript

This commit is contained in:
2026-09-17 16:25:01 +02:00
parent 5b14fe9657
commit 0a437a5588
+10 -1
View File
@@ -99,18 +99,27 @@ namespace JellyfinPlugin.Api
function checkPlayback() { function checkPlayback() {
const video = document.querySelector('video'); const video = document.querySelector('video');
if (video && video !== currentVideoElement) { if (video && video !== currentVideoElement) {
console.log('Black Bar Remover: Found new video element');
currentVideoElement = video; currentVideoElement = video;
const match = window.location.href.match(/[?&](id|itemId)=([^&#]+)/i); const match = window.location.href.match(/[?&](id|itemId)=([^&#]+)/i);
const itemId = match ? match[2] : null; const itemId = match ? match[2] : null;
console.log('Black Bar Remover: Parsed itemId from URL:', itemId, 'URL was:', window.location.href);
if (itemId) { if (itemId) {
console.log('Black Bar Remover: Fetching crop data for item', itemId);
fetch('/BlackBarRemover/CropById?itemId=' + itemId) fetch('/BlackBarRemover/CropById?itemId=' + itemId)
.then(r => r.text()) .then(r => r.text())
.then(crop => { .then(crop => {
console.log('Black Bar Remover: Received crop data:', crop);
if (crop) applyCrop(crop); if (crop) applyCrop(crop);
}); })
.catch(e => console.error('Black Bar Remover: API fetch error:', e));
} else {
console.log('Black Bar Remover: Could not find itemId in URL to fetch crop data.');
} }
} else if (!video && currentVideoElement) { } else if (!video && currentVideoElement) {
console.log('Black Bar Remover: Video element removed');
currentVideoElement = null; currentVideoElement = null;
} }
} }