Spaces:
Running
Running
Update index.html
Browse files- index.html +48 -21
index.html
CHANGED
@@ -40,11 +40,12 @@
|
|
40 |
|
41 |
/* 字幕スタイル */
|
42 |
video::cue {
|
43 |
-
background-color: rgba(0, 0, 0, 0.7);
|
44 |
-
color: #c7dbed;
|
45 |
-
font-family: 'Courier New', monospace;
|
46 |
-
text-shadow: 1px 1px 2px #000;
|
47 |
-
outline:
|
|
|
48 |
}
|
49 |
|
50 |
/* カスタム動画コントロール */
|
@@ -263,24 +264,25 @@
|
|
263 |
background-color: rgba(0, 20, 40, 0.5);
|
264 |
border: 1px solid #0066ff;
|
265 |
}
|
266 |
-
/* 字幕スタイルを修正 */
|
267 |
-
video::cue {
|
268 |
-
background-color: rgba(0, 0, 0, 0.7) !important;
|
269 |
-
color: #c7dbed !important;
|
270 |
-
border-radius: 25% 10%;
|
271 |
-
font-family: 'Courier New', monospace !important;
|
272 |
-
text-shadow: 1px 1px 2px #000 !important;
|
273 |
-
outline: 3px solid #0b3e8f !important;
|
274 |
-
}
|
275 |
|
276 |
/* 字幕サイズ調整用のCSS変数 */
|
277 |
:root {
|
278 |
--subtitle-scale: 1;
|
|
|
279 |
}
|
280 |
|
281 |
video::cue {
|
282 |
font-size: calc(16px * var(--subtitle-scale)) !important;
|
283 |
line-height: 1.5 !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
}
|
285 |
</style>
|
286 |
</head>
|
@@ -381,11 +383,13 @@
|
|
381 |
const subtitleSizeInput = document.getElementById('subtitleSizeInput');
|
382 |
const subtitleTrack = document.getElementById('subtitleTrack');
|
383 |
const subtitleTrackElement = document.getElementById('subtitleTrackElement');
|
|
|
384 |
|
385 |
// 初期設定
|
386 |
video.controls = false;
|
387 |
let isDragging = false;
|
388 |
let subtitlesEnabled = true;
|
|
|
389 |
|
390 |
function updatePlaybackRate(value) {
|
391 |
const speed = parseFloat(value);
|
@@ -473,13 +477,26 @@
|
|
473 |
}
|
474 |
|
475 |
function goFullscreen() {
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
483 |
}
|
484 |
}
|
485 |
|
@@ -560,6 +577,12 @@
|
|
560 |
volumeSlider.addEventListener('input', handleVolumeChange);
|
561 |
fullscreenBtn.addEventListener('click', goFullscreen);
|
562 |
|
|
|
|
|
|
|
|
|
|
|
|
|
563 |
video.addEventListener('loadedmetadata', () => {
|
564 |
updatePlaybackRate(speedRange.value);
|
565 |
updateVolume(volumeRange.value);
|
@@ -567,10 +590,14 @@
|
|
567 |
video.loop = loopCheckbox.checked;
|
568 |
toggleSubtitles();
|
569 |
updateProgress();
|
|
|
|
|
570 |
});
|
571 |
|
572 |
// CSS変数を設定
|
573 |
document.documentElement.style.setProperty('--subtitle-scale', '1');
|
|
|
|
|
574 |
</script>
|
575 |
</body>
|
576 |
</html>
|
|
|
40 |
|
41 |
/* 字幕スタイル */
|
42 |
video::cue {
|
43 |
+
background-color: rgba(0, 0, 0, 0.7) !important;
|
44 |
+
color: #c7dbed !important;
|
45 |
+
font-family: 'Courier New', monospace !important;
|
46 |
+
text-shadow: 1px 1px 2px #000 !important;
|
47 |
+
outline: 3px solid #0b3e8f !important;
|
48 |
+
border-radius: 10px !important; /* 角を丸める */
|
49 |
}
|
50 |
|
51 |
/* カスタム動画コントロール */
|
|
|
264 |
background-color: rgba(0, 20, 40, 0.5);
|
265 |
border: 1px solid #0066ff;
|
266 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
267 |
|
268 |
/* 字幕サイズ調整用のCSS変数 */
|
269 |
:root {
|
270 |
--subtitle-scale: 1;
|
271 |
+
--subtitle-border-radius: 10px;
|
272 |
}
|
273 |
|
274 |
video::cue {
|
275 |
font-size: calc(16px * var(--subtitle-scale)) !important;
|
276 |
line-height: 1.5 !important;
|
277 |
+
border-radius: var(--subtitle-border-radius) !important;
|
278 |
+
}
|
279 |
+
|
280 |
+
/* 全画面時の字幕サイズ調整 */
|
281 |
+
.video-container:fullscreen video::cue,
|
282 |
+
.video-container:-webkit-full-screen video::cue,
|
283 |
+
.video-container:-moz-full-screen video::cue,
|
284 |
+
.video-container:-ms-fullscreen video::cue {
|
285 |
+
font-size: calc(16px * var(--subtitle-scale) * var(--fullscreen-scale, 1)) !important;
|
286 |
}
|
287 |
</style>
|
288 |
</head>
|
|
|
383 |
const subtitleSizeInput = document.getElementById('subtitleSizeInput');
|
384 |
const subtitleTrack = document.getElementById('subtitleTrack');
|
385 |
const subtitleTrackElement = document.getElementById('subtitleTrackElement');
|
386 |
+
const videoContainer = document.querySelector('.video-container');
|
387 |
|
388 |
// 初期設定
|
389 |
video.controls = false;
|
390 |
let isDragging = false;
|
391 |
let subtitlesEnabled = true;
|
392 |
+
let normalVideoWidth = videoContainer.clientWidth;
|
393 |
|
394 |
function updatePlaybackRate(value) {
|
395 |
const speed = parseFloat(value);
|
|
|
477 |
}
|
478 |
|
479 |
function goFullscreen() {
|
480 |
+
if (videoContainer.requestFullscreen) {
|
481 |
+
videoContainer.requestFullscreen();
|
482 |
+
} else if (videoContainer.webkitRequestFullscreen) {
|
483 |
+
videoContainer.webkitRequestFullscreen();
|
484 |
+
} else if (videoContainer.msRequestFullscreen) {
|
485 |
+
videoContainer.msRequestFullscreen();
|
486 |
+
}
|
487 |
+
}
|
488 |
+
|
489 |
+
// 全画面変更時の字幕サイズ調整
|
490 |
+
function updateSubtitleScaleForFullscreen() {
|
491 |
+
if (document.fullscreenElement || document.webkitFullscreenElement ||
|
492 |
+
document.mozFullScreenElement || document.msFullscreenElement) {
|
493 |
+
// 全画面モード
|
494 |
+
const fullscreenWidth = window.innerWidth;
|
495 |
+
const scaleFactor = fullscreenWidth / normalVideoWidth;
|
496 |
+
document.documentElement.style.setProperty('--fullscreen-scale', scaleFactor);
|
497 |
+
} else {
|
498 |
+
// 通常モード
|
499 |
+
document.documentElement.style.setProperty('--fullscreen-scale', 1);
|
500 |
}
|
501 |
}
|
502 |
|
|
|
577 |
volumeSlider.addEventListener('input', handleVolumeChange);
|
578 |
fullscreenBtn.addEventListener('click', goFullscreen);
|
579 |
|
580 |
+
// 全画面変更イベントを監視
|
581 |
+
document.addEventListener('fullscreenchange', updateSubtitleScaleForFullscreen);
|
582 |
+
document.addEventListener('webkitfullscreenchange', updateSubtitleScaleForFullscreen);
|
583 |
+
document.addEventListener('mozfullscreenchange', updateSubtitleScaleForFullscreen);
|
584 |
+
document.addEventListener('MSFullscreenChange', updateSubtitleScaleForFullscreen);
|
585 |
+
|
586 |
video.addEventListener('loadedmetadata', () => {
|
587 |
updatePlaybackRate(speedRange.value);
|
588 |
updateVolume(volumeRange.value);
|
|
|
590 |
video.loop = loopCheckbox.checked;
|
591 |
toggleSubtitles();
|
592 |
updateProgress();
|
593 |
+
// 通常時の動画幅を記録
|
594 |
+
normalVideoWidth = videoContainer.clientWidth;
|
595 |
});
|
596 |
|
597 |
// CSS変数を設定
|
598 |
document.documentElement.style.setProperty('--subtitle-scale', '1');
|
599 |
+
document.documentElement.style.setProperty('--subtitle-border-radius', '10px');
|
600 |
+
document.documentElement.style.setProperty('--fullscreen-scale', '1');
|
601 |
</script>
|
602 |
</body>
|
603 |
</html>
|