soiz1 commited on
Commit
dc70a48
·
1 Parent(s): 7734c09

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +105 -100
index.html CHANGED
@@ -2235,108 +2235,113 @@
2235
  tempoInput.value = isTMode ? 66 : 92;
2236
  tempoInput.dispatchEvent(new Event('input'));
2237
  });
2238
- document.addEventListener('DOMContentLoaded', function() {
2239
- // URLパラメータをチェック
2240
- const urlParams = new URLSearchParams(window.location.search);
2241
- const isTMode = urlParams.has('mode') && urlParams.get('mode') === 't';
2242
-
2243
- // タイムマーカーデータ
2244
- const timeMarkers = isTMode ? [
2245
- { label: '①[1番]', time: 15.2 },
2246
- { label: '②[1番]', time: 43.8 },
2247
- { label: '①[2番]', time: 79.0 },
2248
- { label: '②[2番]', time: 108.0 },
2249
- { label: '', time: 137.25 },
2250
- { label: '④', time: 162.55 },
2251
- { label: '⑤', time: 191.65 }
2252
- ] : [
2253
- { label: 'A', time: 8.35 },
2254
- { label: 'B', time: 72.1 },
2255
- { label: 'C', time: 98.67 },
2256
- { label: 'D', time: 155.83 },
2257
- { label: 'E', time: 192.55 }
2258
- ];
2259
-
2260
- // タイムマーカーを表示
2261
- const timeMarkersContainer = document.getElementById('time-markers-container');
2262
-
2263
- timeMarkers.forEach(marker => {
2264
- const markerElement = document.createElement('div');
2265
- markerElement.className = 'time-marker';
2266
- markerElement.innerHTML = `<b>${marker.label}</b>(${marker.time}秒)`;
2267
- markerElement.dataset.time = marker.time;
2268
-
2269
- // ドラッグ開始
2270
- markerElement.addEventListener('dragstart', function(e) {
2271
- e.dataTransfer.setData('text/plain', marker.time);
2272
- this.classList.add('dragging');
2273
- });
2274
-
2275
- // ドラッグ終了
2276
- markerElement.addEventListener('dragend', function() {
2277
- this.classList.remove('dragging');
2278
- });
2279
-
2280
- // ドラッグ可能に設定
2281
- markerElement.draggable = true;
2282
-
2283
- // クリックで開始時間に設定
2284
- markerElement.addEventListener('click', function() {
2285
- document.getElementById('start-time').value = marker.time;
2286
- updateProgressMarkers();
2287
- });
2288
-
2289
- timeMarkersContainer.appendChild(markerElement);
2290
- });
2291
-
2292
- // ドロップターゲットの設定
2293
- const startTimeInput = document.getElementById('start-time');
2294
- const endTimeInput = document.getElementById('end-time');
2295
-
2296
- [startTimeInput, endTimeInput].forEach(input => {
2297
- // ドラッグオーバー
2298
- input.addEventListener('dragover', function(e) {
2299
- e.preventDefault();
2300
- this.style.backgroundColor = 'rgba(100, 255, 218, 0.2)';
2301
- });
2302
-
2303
- // ドラッグリーブ
2304
- input.addEventListener('dragleave', function() {
2305
- this.style.backgroundColor = '';
2306
- });
2307
-
2308
- // ドロップ
2309
- input.addEventListener('drop', function(e) {
2310
- e.preventDefault();
2311
- this.style.backgroundColor = '';
2312
-
2313
- const time = parseFloat(e.dataTransfer.getData('text/plain'));
2314
- if (!isNaN(time)) {
2315
- this.value = time;
2316
- updateProgressMarkers();
2317
- }
2318
- });
2319
- });
2320
-
2321
- // 入力ボックスの変更時にマーカーを更新
2322
- startTimeInput.addEventListener('input', updateProgressMarkers);
2323
- endTimeInput.addEventListener('input', updateProgressMarkers);
2324
-
2325
- // 既存のupdateProgressMarkers関数を再利用
2326
- function updateProgressMarkers() {
2327
- const duration = video.duration || videoDuration;
2328
- const startTime = parseFloat(startTimeInput.value) || 0;
2329
- const endTime = parseFloat(endTimeInput.value) || duration;
2330
-
2331
- if (duration > 0) {
2332
- startMarker.style.left = `${(startTime / duration) * 100}%`;
2333
- endMarker.style.left = `${(endTime / duration) * 100}%`;
2334
-
2335
- startMarker.style.display = 'block';
2336
- endMarker.style.display = 'block';
2337
- }
2338
  }
2339
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2340
 
2341
  </script>
2342
  </body>
 
2235
  tempoInput.value = isTMode ? 66 : 92;
2236
  tempoInput.dispatchEvent(new Event('input'));
2237
  });
2238
+ // タイムマーカー関連のコードを修正
2239
+ document.addEventListener('DOMContentLoaded', function() {
2240
+ // まず必要なDOM要素を取得
2241
+ const startMarker = document.getElementById('start-marker');
2242
+ const endMarker = document.getElementById('end-marker');
2243
+ const video = document.getElementById('video');
2244
+ const startTimeInput = document.getElementById('start-time');
2245
+ const endTimeInput = document.getElementById('end-time');
2246
+
2247
+ // URLパラメータをチェック
2248
+ const urlParams = new URLSearchParams(window.location.search);
2249
+ const isTMode = urlParams.has('mode') && urlParams.get('mode') === 't';
2250
+
2251
+ // タイムマーカーデータ
2252
+ const timeMarkers = isTMode ? [
2253
+ { label: '①[1番]', time: 15.2 },
2254
+ { label: '②[1番]', time: 43.8 },
2255
+ { label: '①[2番]', time: 79.0 },
2256
+ { label: '②[2番]', time: 108.0 },
2257
+ { label: '', time: 137.25 },
2258
+ { label: '④', time: 162.55 },
2259
+ { label: '⑤', time: 191.65 }
2260
+ ] : [
2261
+ { label: 'A', time: 8.35 },
2262
+ { label: 'B', time: 72.1 },
2263
+ { label: 'C', time: 98.67 },
2264
+ { label: 'D', time: 155.83 },
2265
+ { label: 'E', time: 192.55 }
2266
+ ];
2267
+
2268
+ // タイムマーカーを表示
2269
+ const timeMarkersContainer = document.getElementById('time-markers-container');
2270
+
2271
+ timeMarkers.forEach(marker => {
2272
+ const markerElement = document.createElement('div');
2273
+ markerElement.className = 'time-marker';
2274
+ markerElement.innerHTML = `<b>${marker.label}</b>(${marker.time}秒)`;
2275
+ markerElement.dataset.time = marker.time;
2276
+
2277
+ // ドラッグ開始
2278
+ markerElement.addEventListener('dragstart', function(e) {
2279
+ e.dataTransfer.setData('text/plain', marker.time);
2280
+ this.classList.add('dragging');
2281
+ });
2282
+
2283
+ // ドラッグ終了
2284
+ markerElement.addEventListener('dragend', function() {
2285
+ this.classList.remove('dragging');
2286
+ });
2287
+
2288
+ // ドラッグ可能に設定
2289
+ markerElement.draggable = true;
2290
+
2291
+ // クリックで開始時間に設定
2292
+ markerElement.addEventListener('click', function() {
2293
+ startTimeInput.value = marker.time;
2294
+ updateProgressMarkers();
2295
+ });
2296
+
2297
+ timeMarkersContainer.appendChild(markerElement);
2298
+ });
2299
+
2300
+ // ドロップターゲットの設定
2301
+ [startTimeInput, endTimeInput].forEach(input => {
2302
+ // ドラッグオーバー
2303
+ input.addEventListener('dragover', function(e) {
2304
+ e.preventDefault();
2305
+ this.style.backgroundColor = 'rgba(100, 255, 218, 0.2)';
2306
+ });
2307
+
2308
+ // ドラッグリーブ
2309
+ input.addEventListener('dragleave', function() {
2310
+ this.style.backgroundColor = '';
2311
+ });
2312
+
2313
+ // ドロップ
2314
+ input.addEventListener('drop', function(e) {
2315
+ e.preventDefault();
2316
+ this.style.backgroundColor = '';
2317
+
2318
+ const time = parseFloat(e.dataTransfer.getData('text/plain'));
2319
+ if (!isNaN(time)) {
2320
+ this.value = time;
2321
+ updateProgressMarkers();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2322
  }
2323
  });
2324
+ });
2325
+
2326
+ // 入力ボックスの変更時にマーカーを更新
2327
+ startTimeInput.addEventListener('input', updateProgressMarkers);
2328
+ endTimeInput.addEventListener('input', updateProgressMarkers);
2329
+
2330
+ // updateProgressMarkers関数
2331
+ function updateProgressMarkers() {
2332
+ const duration = video.duration || 0;
2333
+ const startTime = parseFloat(startTimeInput.value) || 0;
2334
+ const endTime = parseFloat(endTimeInput.value) || duration;
2335
+
2336
+ if (duration > 0) {
2337
+ if(startMarker) startMarker.style.left = `${(startTime / duration) * 100}%`;
2338
+ if(endMarker) endMarker.style.left = `${(endTime / duration) * 100}%`;
2339
+
2340
+ if(startMarker) startMarker.style.display = 'block';
2341
+ if(endMarker) endMarker.style.display = 'block';
2342
+ }
2343
+ }
2344
+ });
2345
 
2346
  </script>
2347
  </body>