can you move this block to the dual captions block header - Follow Up Deployment
Browse files- index.html +47 -42
index.html
CHANGED
|
@@ -79,8 +79,8 @@
|
|
| 79 |
<div id="captionSection" class="hidden">
|
| 80 |
<div class="bg-white rounded-lg shadow-md p-4 mb-8">
|
| 81 |
<div class="flex items-center justify-between mb-4">
|
| 82 |
-
<h3 class="text-lg font-semibold text-gray-800">Dual Captions</h3>
|
| 83 |
<div class="flex items-center space-x-4">
|
|
|
|
| 84 |
<span id="originalLanguage" class="px-2 py-1 bg-gray-100 rounded text-sm"></span>
|
| 85 |
<select id="languageSelect" class="px-2 py-1 border border-gray-300 rounded text-sm">
|
| 86 |
<option value="en">English</option>
|
|
@@ -95,27 +95,37 @@
|
|
| 95 |
<option value="ar">Arabic</option>
|
| 96 |
</select>
|
| 97 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
</div>
|
| 99 |
<div id="mergedCaptions" class="caption-container h-96 overflow-y-auto p-1 bg-gray-50 rounded border border-gray-200">
|
| 100 |
<!-- Merged captions will be inserted here -->
|
| 101 |
</div>
|
| 102 |
</div>
|
| 103 |
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
<
|
| 111 |
-
<i class="fas fa-highlighter mr-2"></i> Highlight Current Line
|
| 112 |
-
</button>
|
| 113 |
-
<button id="fontSizePlusBtn" class="bg-gray-200 hover:bg-gray-300 text-gray-800 px-4 py-2 rounded">
|
| 114 |
-
<i class="fas fa-text-height mr-2"></i> Increase Font Size
|
| 115 |
-
</button>
|
| 116 |
-
<button id="fontSizeMinusBtn" class="bg-gray-200 hover:bg-gray-300 text-gray-800 px-4 py-2 rounded">
|
| 117 |
-
<i class="fas fa-text-height mr-2"></i> Decrease Font Size
|
| 118 |
-
</button>
|
| 119 |
</div>
|
| 120 |
</div>
|
| 121 |
</div>
|
|
@@ -140,15 +150,6 @@
|
|
| 140 |
</button>
|
| 141 |
</div>
|
| 142 |
</div>
|
| 143 |
-
|
| 144 |
-
<div id="errorMessage" class="hidden bg-red-100 border-l-4 border-red-500 text-red-700 p-4 mb-8 rounded">
|
| 145 |
-
<div class="flex items-center">
|
| 146 |
-
<i class="fas fa-exclamation-circle mr-3"></i>
|
| 147 |
-
<div>
|
| 148 |
-
<p id="errorText"></p>
|
| 149 |
-
</div>
|
| 150 |
-
</div>
|
| 151 |
-
</div>
|
| 152 |
</main>
|
| 153 |
|
| 154 |
<footer class="bg-gray-800 text-white py-8">
|
|
@@ -193,9 +194,11 @@
|
|
| 193 |
const highlightCurrentBtn = document.getElementById('highlightCurrentBtn');
|
| 194 |
const fontSizePlusBtn = document.getElementById('fontSizePlusBtn');
|
| 195 |
const fontSizeMinusBtn = document.getElementById('fontSizeMinusBtn');
|
|
|
|
| 196 |
|
| 197 |
let currentFontSize = 14;
|
| 198 |
let highlightEnabled = false;
|
|
|
|
| 199 |
let player;
|
| 200 |
let captions = [];
|
| 201 |
let translatedCaptionData = {};
|
|
@@ -397,25 +400,27 @@
|
|
| 397 |
|
| 398 |
// Toggle caption syncing with video
|
| 399 |
function toggleSyncCaptions() {
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 404 |
|
| 405 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 406 |
}
|
| 407 |
|
| 408 |
// Toggle highlighting of current caption
|
| 409 |
function toggleHighlightCurrent() {
|
| 410 |
highlightEnabled = !highlightEnabled;
|
|
|
|
|
|
|
|
|
|
| 411 |
|
| 412 |
-
if (highlightEnabled) {
|
| 413 |
-
highlightCurrentBtn.classList.add('bg-green-700');
|
| 414 |
-
highlightCurrentBtn.classList.remove('bg-green-600');
|
| 415 |
-
} else {
|
| 416 |
-
highlightCurrentBtn.classList.remove('bg-green-700');
|
| 417 |
-
highlightCurrentBtn.classList.add('bg-green-600');
|
| 418 |
-
|
| 419 |
// Remove all highlights
|
| 420 |
document.querySelectorAll('.highlight').forEach(el => {
|
| 421 |
el.classList.remove('highlight');
|
|
@@ -425,16 +430,16 @@
|
|
| 425 |
|
| 426 |
// Increase font size for captions
|
| 427 |
function increaseFontSize() {
|
| 428 |
-
currentFontSize
|
|
|
|
| 429 |
updateCaptionFontSize();
|
| 430 |
}
|
| 431 |
|
| 432 |
// Decrease font size for captions
|
| 433 |
function decreaseFontSize() {
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
|
| 437 |
-
}
|
| 438 |
}
|
| 439 |
|
| 440 |
// Update font size for caption containers
|
|
|
|
| 79 |
<div id="captionSection" class="hidden">
|
| 80 |
<div class="bg-white rounded-lg shadow-md p-4 mb-8">
|
| 81 |
<div class="flex items-center justify-between mb-4">
|
|
|
|
| 82 |
<div class="flex items-center space-x-4">
|
| 83 |
+
<h3 class="text-lg font-semibold text-gray-800">Dual Captions</h3>
|
| 84 |
<span id="originalLanguage" class="px-2 py-1 bg-gray-100 rounded text-sm"></span>
|
| 85 |
<select id="languageSelect" class="px-2 py-1 border border-gray-300 rounded text-sm">
|
| 86 |
<option value="en">English</option>
|
|
|
|
| 95 |
<option value="ar">Arabic</option>
|
| 96 |
</select>
|
| 97 |
</div>
|
| 98 |
+
<div class="flex space-x-2">
|
| 99 |
+
<button id="syncCaptionsBtn" class="p-2 rounded-full hover:bg-blue-100 text-blue-600" title="Toggle Sync">
|
| 100 |
+
<i class="fas fa-sync-alt"></i>
|
| 101 |
+
</button>
|
| 102 |
+
<button id="highlightCurrentBtn" class="p-2 rounded-full hover:bg-green-100 text-gray-600" title="Toggle Highlight">
|
| 103 |
+
<i class="fas fa-highlighter"></i>
|
| 104 |
+
</button>
|
| 105 |
+
<div class="flex items-center space-x-2">
|
| 106 |
+
<span class="text-sm text-gray-500">Font Size:</span>
|
| 107 |
+
<button id="fontSizeMinusBtn" class="p-1 rounded-full hover:bg-gray-200 text-gray-700" title="Decrease">
|
| 108 |
+
<i class="fas fa-minus"></i>
|
| 109 |
+
</button>
|
| 110 |
+
<span id="fontSizeDisplay" class="text-sm w-6 text-center">14</span>
|
| 111 |
+
<button id="fontSizePlusBtn" class="p-1 rounded-full hover:bg-gray-200 text-gray-700" title="Increase">
|
| 112 |
+
<i class="fas fa-plus"></i>
|
| 113 |
+
</button>
|
| 114 |
+
</div>
|
| 115 |
+
</div>
|
| 116 |
</div>
|
| 117 |
<div id="mergedCaptions" class="caption-container h-96 overflow-y-auto p-1 bg-gray-50 rounded border border-gray-200">
|
| 118 |
<!-- Merged captions will be inserted here -->
|
| 119 |
</div>
|
| 120 |
</div>
|
| 121 |
|
| 122 |
+
</div>
|
| 123 |
+
|
| 124 |
+
<div id="errorMessage" class="hidden bg-red-100 border-l-4 border-red-500 text-red-700 p-4 mb-8 rounded">
|
| 125 |
+
<div class="flex items-center">
|
| 126 |
+
<i class="fas fa-exclamation-circle mr-3"></i>
|
| 127 |
+
<div>
|
| 128 |
+
<p id="errorText"></p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
</div>
|
| 130 |
</div>
|
| 131 |
</div>
|
|
|
|
| 150 |
</button>
|
| 151 |
</div>
|
| 152 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
</main>
|
| 154 |
|
| 155 |
<footer class="bg-gray-800 text-white py-8">
|
|
|
|
| 194 |
const highlightCurrentBtn = document.getElementById('highlightCurrentBtn');
|
| 195 |
const fontSizePlusBtn = document.getElementById('fontSizePlusBtn');
|
| 196 |
const fontSizeMinusBtn = document.getElementById('fontSizeMinusBtn');
|
| 197 |
+
const fontSizeDisplay = document.getElementById('fontSizeDisplay');
|
| 198 |
|
| 199 |
let currentFontSize = 14;
|
| 200 |
let highlightEnabled = false;
|
| 201 |
+
let syncEnabled = false;
|
| 202 |
let player;
|
| 203 |
let captions = [];
|
| 204 |
let translatedCaptionData = {};
|
|
|
|
| 400 |
|
| 401 |
// Toggle caption syncing with video
|
| 402 |
function toggleSyncCaptions() {
|
| 403 |
+
syncEnabled = !syncEnabled;
|
| 404 |
+
syncCaptionsBtn.classList.toggle('text-blue-600', !syncEnabled);
|
| 405 |
+
syncCaptionsBtn.classList.toggle('text-white', syncEnabled);
|
| 406 |
+
syncCaptionsBtn.classList.toggle('bg-blue-600', syncEnabled);
|
| 407 |
|
| 408 |
+
if (syncEnabled) {
|
| 409 |
+
// In a real implementation, start syncing
|
| 410 |
+
alert("Caption syncing would be implemented with YouTube Player API in a real application");
|
| 411 |
+
} else {
|
| 412 |
+
// Stop syncing
|
| 413 |
+
}
|
| 414 |
}
|
| 415 |
|
| 416 |
// Toggle highlighting of current caption
|
| 417 |
function toggleHighlightCurrent() {
|
| 418 |
highlightEnabled = !highlightEnabled;
|
| 419 |
+
highlightCurrentBtn.classList.toggle('text-gray-600', !highlightEnabled);
|
| 420 |
+
highlightCurrentBtn.classList.toggle('text-white', highlightEnabled);
|
| 421 |
+
highlightCurrentBtn.classList.toggle('bg-green-600', highlightEnabled);
|
| 422 |
|
| 423 |
+
if (!highlightEnabled) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 424 |
// Remove all highlights
|
| 425 |
document.querySelectorAll('.highlight').forEach(el => {
|
| 426 |
el.classList.remove('highlight');
|
|
|
|
| 430 |
|
| 431 |
// Increase font size for captions
|
| 432 |
function increaseFontSize() {
|
| 433 |
+
currentFontSize = Math.min(24, currentFontSize + 1);
|
| 434 |
+
fontSizeDisplay.textContent = currentFontSize;
|
| 435 |
updateCaptionFontSize();
|
| 436 |
}
|
| 437 |
|
| 438 |
// Decrease font size for captions
|
| 439 |
function decreaseFontSize() {
|
| 440 |
+
currentFontSize = Math.max(12, currentFontSize - 1);
|
| 441 |
+
fontSizeDisplay.textContent = currentFontSize;
|
| 442 |
+
updateCaptionFontSize();
|
|
|
|
| 443 |
}
|
| 444 |
|
| 445 |
// Update font size for caption containers
|