soiz1 commited on
Commit
d282a83
·
verified ·
1 Parent(s): 558245a

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +37 -5
index.html CHANGED
@@ -714,13 +714,45 @@
714
  let normalVideoWidth = videoContainer.clientWidth;
715
  let audioOnlyMode = false;
716
 
717
- document.addEventListener("DOMContentLoaded", function () {
718
- const previewVideo = document.getElementById("previewVideo");
 
 
719
 
720
- previewVideo.src = video.src;
721
- previewVideo.preload = "auto";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
722
 
723
- });
 
 
 
 
 
 
 
 
 
 
 
724
  // プログレスバーのイベントリスナーを更新
725
  progressContainer.addEventListener("mousemove", (e) => {
726
  if (!video.duration) return;
 
714
  let normalVideoWidth = videoContainer.clientWidth;
715
  let audioOnlyMode = false;
716
 
717
+ const previewVideo = document.createElement('video');
718
+ previewVideo.id = 'previewVideo';
719
+ previewVideo.className = 'thumbnail-preview';
720
+ document.body.appendChild(previewVideo);
721
 
722
+ // ホバー時の時間表示設定関数を追加
723
+ function setupHoverTime() {
724
+ progressContainer.addEventListener("mousemove", (e) => {
725
+ if (!video.duration) return;
726
+ const rect = progressContainer.getBoundingClientRect();
727
+ const pos = (e.clientX - rect.left) / rect.width;
728
+ const time = pos * video.duration;
729
+
730
+ // 時間表示
731
+ const minutes = Math.floor(time / 60);
732
+ const seconds = Math.floor(time % 60).toString().padStart(2, '0');
733
+ hoverTime.textContent = `${minutes}:${seconds}`;
734
+ hoverTime.style.display = 'block';
735
+ hoverTime.style.left = `${e.clientX - rect.left}px`;
736
+
737
+ // サムネイルプレビュー
738
+ previewVideo.currentTime = time;
739
+ previewVideo.style.display = "block";
740
+ previewVideo.style.left = `${e.clientX}px`;
741
+ previewVideo.style.bottom = `${rect.height + 10}px`;
742
+ });
743
 
744
+ progressContainer.addEventListener("mouseleave", () => {
745
+ hoverTime.style.display = "none";
746
+ previewVideo.style.display = "none";
747
+ });
748
+ }
749
+
750
+ // 初期設定
751
+ video.controls = false;
752
+ let isDragging = false;
753
+ let subtitlesEnabled = true;
754
+ let normalVideoWidth = videoContainer.clientWidth;
755
+ let audioOnlyMode = false;
756
  // プログレスバーのイベントリスナーを更新
757
  progressContainer.addEventListener("mousemove", (e) => {
758
  if (!video.duration) return;