Spaces:
Running
Running
Update index.html
Browse files- index.html +36 -9
index.html
CHANGED
|
@@ -825,7 +825,7 @@ function updateSubtitleScaleForFullscreen() {
|
|
| 825 |
document.documentElement.style.setProperty('--fullscreen-scale', 1);
|
| 826 |
}
|
| 827 |
}
|
| 828 |
-
|
| 829 |
let previewTimeout;
|
| 830 |
|
| 831 |
progressContainer.addEventListener('mousemove', (e) => {
|
|
@@ -833,8 +833,23 @@ function updateSubtitleScaleForFullscreen() {
|
|
| 833 |
|
| 834 |
clearTimeout(previewTimeout);
|
| 835 |
|
| 836 |
-
|
| 837 |
-
const
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 838 |
const previewTime = (clickX / progressRect.width) * video.duration;
|
| 839 |
|
| 840 |
// 時間表示を更新
|
|
@@ -842,8 +857,9 @@ function updateSubtitleScaleForFullscreen() {
|
|
| 842 |
const previewSeconds = Math.floor(previewTime % 60).toString().padStart(2, '0');
|
| 843 |
frameTime.textContent = `${previewMinutes}:${previewSeconds}`;
|
| 844 |
|
| 845 |
-
//
|
| 846 |
-
framePreview.style.left = `${
|
|
|
|
| 847 |
framePreview.style.display = 'block';
|
| 848 |
|
| 849 |
// キャッシュがあればそれを使う
|
|
@@ -1081,10 +1097,10 @@ function updateSubtitleScaleForFullscreen() {
|
|
| 1081 |
fullscreenBtn.addEventListener('click', goFullscreen);
|
| 1082 |
|
| 1083 |
// 全画面変更イベントを監視
|
| 1084 |
-
|
| 1085 |
-
|
| 1086 |
-
|
| 1087 |
-
|
| 1088 |
|
| 1089 |
// 右クリックメニューイベント
|
| 1090 |
videoContainer.addEventListener('contextmenu', showContextMenu);
|
|
@@ -1148,6 +1164,17 @@ function updateSubtitleScaleForFullscreen() {
|
|
| 1148 |
case 'arrowleft': video.currentTime -= 5; break;
|
| 1149 |
}
|
| 1150 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1151 |
|
| 1152 |
// CSS変数を設定
|
| 1153 |
document.documentElement.style.setProperty('--subtitle-scale', '1');
|
|
|
|
| 825 |
document.documentElement.style.setProperty('--fullscreen-scale', 1);
|
| 826 |
}
|
| 827 |
}
|
| 828 |
+
function setupFramePreview() {
|
| 829 |
let previewTimeout;
|
| 830 |
|
| 831 |
progressContainer.addEventListener('mousemove', (e) => {
|
|
|
|
| 833 |
|
| 834 |
clearTimeout(previewTimeout);
|
| 835 |
|
| 836 |
+
// 全画面モードかどうかを判定
|
| 837 |
+
const isFullscreen = document.fullscreenElement ||
|
| 838 |
+
document.webkitFullscreenElement ||
|
| 839 |
+
document.msFullscreenElement;
|
| 840 |
+
|
| 841 |
+
// 座標計算を全画面モードに対応
|
| 842 |
+
let clientX;
|
| 843 |
+
if (isFullscreen) {
|
| 844 |
+
const progressRect = progressContainer.getBoundingClientRect();
|
| 845 |
+
clientX = e.clientX;
|
| 846 |
+
const clickX = Math.max(0, Math.min(clientX - progressRect.left, progressRect.width));
|
| 847 |
+
} else {
|
| 848 |
+
const progressRect = progressContainer.getBoundingClientRect();
|
| 849 |
+
clientX = e.clientX;
|
| 850 |
+
const clickX = Math.max(0, Math.min(e.clientX - progressRect.left, progressRect.width));
|
| 851 |
+
}
|
| 852 |
+
|
| 853 |
const previewTime = (clickX / progressRect.width) * video.duration;
|
| 854 |
|
| 855 |
// 時間表示を更新
|
|
|
|
| 857 |
const previewSeconds = Math.floor(previewTime % 60).toString().padStart(2, '0');
|
| 858 |
frameTime.textContent = `${previewMinutes}:${previewSeconds}`;
|
| 859 |
|
| 860 |
+
// プレビュー位置を更新(全画面モードに合わせて調整)
|
| 861 |
+
framePreview.style.left = `${clientX - 80}px`; // 中央寄せ
|
| 862 |
+
framePreview.style.bottom = isFullscreen ? '100px' : '30px'; // 全画面時は少し上に
|
| 863 |
framePreview.style.display = 'block';
|
| 864 |
|
| 865 |
// キャッシュがあればそれを使う
|
|
|
|
| 1097 |
fullscreenBtn.addEventListener('click', goFullscreen);
|
| 1098 |
|
| 1099 |
// 全画面変更イベントを監視
|
| 1100 |
+
document.addEventListener('fullscreenchange', handleFullscreenChange);
|
| 1101 |
+
document.addEventListener('webkitfullscreenchange', handleFullscreenChange);
|
| 1102 |
+
document.addEventListener('mozfullscreenchange', handleFullscreenChange);
|
| 1103 |
+
document.addEventListener('MSFullscreenChange', handleFullscreenChange);
|
| 1104 |
|
| 1105 |
// 右クリックメニューイベント
|
| 1106 |
videoContainer.addEventListener('contextmenu', showContextMenu);
|
|
|
|
| 1164 |
case 'arrowleft': video.currentTime -= 5; break;
|
| 1165 |
}
|
| 1166 |
});
|
| 1167 |
+
|
| 1168 |
+
function handleFullscreenChange() {
|
| 1169 |
+
updateSubtitleScaleForFullscreen();
|
| 1170 |
+
setupFullscreenContextMenu();
|
| 1171 |
+
|
| 1172 |
+
// 全画面モード時にプログレスバーのサイズが変わる可能性があるので再計算
|
| 1173 |
+
normalVideoWidth = videoContainer.clientWidth;
|
| 1174 |
+
|
| 1175 |
+
// フレームプレビューを再設定
|
| 1176 |
+
setupFramePreview();
|
| 1177 |
+
}
|
| 1178 |
|
| 1179 |
// CSS変数を設定
|
| 1180 |
document.documentElement.style.setProperty('--subtitle-scale', '1');
|