File size: 127,200 Bytes
ddace5e a7d9ee6 900514d 1f8f8ed 900514d a7d9ee6 900514d a7d9ee6 900514d 1f8f8ed 900514d a7d9ee6 900514d a7d9ee6 5e1d87b a7d9ee6 c29e784 a7d9ee6 c29e784 a7d9ee6 c29e784 de07894 a7d9ee6 c29e784 a7d9ee6 c29e784 a7d9ee6 c29e784 a7d9ee6 c29e784 a7d9ee6 f1447dc a20ad42 a7d9ee6 a20ad42 a7d9ee6 a20ad42 a7d9ee6 a20ad42 a7d9ee6 a20ad42 a7d9ee6 a20ad42 a7d9ee6 a20ad42 a7d9ee6 a20ad42 a7d9ee6 a20ad42 a7d9ee6 a20ad42 a7d9ee6 3b1bc9f a7d9ee6 a20ad42 b1bff68 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 |
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<script src="https://soiz1-eruda3.hf.space/eruda.js"></script>
<script>
eruda.init();
</script>
<script>
function isAdmin() {
return document.cookie.includes("admin_access=true");
}
if (!isAdmin()) {
// Google Tag Manager
(function(w, d, s, l, i) {
w[l] = w[l] || [];
w[l].push({
'gtm.start': new Date().getTime(),
event: 'gtm.js'
});
var f = d.getElementsByTagName(s)[0],
j = d.createElement(s),
dl = l != 'dataLayer' ? '&l=' + l : '';
j.async = true;
j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', 'GTM-NDL2LKLQ');
// Google Analytics (gtag.js)
var gtagScript = document.createElement('script');
gtagScript.async = true;
gtagScript.src = "https://www.googletagmanager.com/gtag/js?id=G-2M35HBEEVH";
document.head.appendChild(gtagScript);
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'G-2M35HBEEVH');
} else {
console.log("管理者のため、Googleタグはスキップされました。");
}
</script>
<script src="https://unpkg.com/draggabilly@2/dist/draggabilly.pkgd.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
(function() {
const UPDATE_URL = '/update.txt';
const CHECK_INTERVAL_MS = 30000;
let initialVersion = null;
// CSSを挿入
const style = document.createElement('style');
style.textContent = `
#update-popup {
position: fixed;
top: 20px;
right: 20px;
background: #fff3cd;
color: #856304;
border: 1px solid #ffeeba;
border-radius: 8px;
padding: 20px 16px 16px 16px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
display: none;
z-index: 1000;
font-family: sans-serif;
width: 240px;
}
#update-popup-close {
position: absolute;
top: 6px;
right: 8px;
background: none;
border: none;
font-size: 16px;
font-weight: bold;
color: #856404;
cursor: pointer;
}
#update-popup-close:hover {
color: #000;
}
#update-popup button.reload {
margin-top: 10px;
padding: 6px 12px;
border: none;
background-color: #ffc107;
color: #000;
cursor: pointer;
border-radius: 4px;
width: 100%;
}
#update-popup button.reload:hover {
background-color: #e0a800;
}
`;
document.head.appendChild(style);
// ポップアップ要素を作成
const popup = document.createElement('div');
popup.id = 'update-popup';
popup.innerHTML = `
<button id="update-popup-close" aria-label="閉じる">×</button>
<p>ページが新しくなりました。<br>タブの再読み込みが必要です。</p>
<button class="reload">再読み込み</button>
`;
document.body.appendChild(popup);
// 閉じるボタン機能
document.getElementById('update-popup-close').addEventListener('click', () => {
popup.style.display = 'none';
});
// 再読み込みボタン機能
popup.querySelector('.reload').addEventListener('click', () => {
location.reload();
});
// バージョン取得関数
async function fetchVersion() {
try {
const res = await fetch(UPDATE_URL + '?t=' + Date.now());
if (res.ok) return await res.text();
} catch (err) {
console.warn('update.txt の取得に失敗:', err);
}
return null;
}
// 更新チェック関数
async function checkForUpdate() {
const latest = await fetchVersion();
if (initialVersion && latest && latest !== initialVersion) {
popup.style.display = 'block';
}
}
// 初期バージョン取得 → チェック開始
(async () => {
initialVersion = await fetchVersion();
if (initialVersion) {
setInterval(checkForUpdate, CHECK_INTERVAL_MS);
}
})();
})();
})
</script>
<link rel="icon" type="image/svg+xml" href='data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIgdmlld0JveD0iMCAwIDIwMCAyMDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgbGFuZz0iamEiPjxkZWZzPiA8bGluZWFyR3JhZGllbnQgaWQ9ImdyYWQxIiB4MT0iMCUiIHkxPSIwJSIgeDI9IjAlIiB5Mj0iMTAwJSI+IDxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiMzNDc0ZWIiIC8+IDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzM0YThlYiIgLz4gPC9saW5lYXJHcmFkaWVudD4gPC9kZWZzPiA8IS0tIOWQhOS6uuWbvuWkjeS9nOWumuS7tuWkjeaWsOWIl+OBjOaWsOWIl+OBq+OBhOOBq+OBvuOBq+OCi+OCieWbvuWkjeOBjOOCjOOCieOCk+ODq+ODvOODrOODs+ODg+OCiwotLT4gPHBvbHlnb24gcG9pbnRzPSI1MCw1MCA1MCwxNTAgMTUwLDEwMCIgZmlsbD0idXJsKCNncmFkMSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIgLz48L3N2Zz4=' />
<meta charset="UTF-8">
<script>
//青いスクロールバーを追加
document.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll("input[type='range']").forEach((slider) => {
const bubble = document.createElement("div");
bubble.style.position = "absolute";
bubble.style.background = "#333a";
bubble.style.color = "#fff";
bubble.style.padding = "4px 8px";
bubble.style.borderRadius = "4px";
bubble.style.fontSize = "12px";
bubble.style.pointerEvents = "none";
bubble.style.whiteSpace = "nowrap";
bubble.style.transform = "translate(-50%, -120%)";
bubble.style.transition = "opacity 0.1s";
bubble.style.opacity = "0";
bubble.style.zIndex = "1000";
document.body.appendChild(bubble);
let rect = null;
slider.addEventListener("mouseenter", () => {
rect = slider.getBoundingClientRect();
bubble.style.opacity = "1";
});
slider.addEventListener("mouseleave", () => {
bubble.style.opacity = "0";
});
slider.addEventListener("mousemove", (e) => {
if (!rect) rect = slider.getBoundingClientRect();
const min = parseFloat(slider.min || 0);
const max = parseFloat(slider.max || 100);
const step = parseFloat(slider.step || 1);
const relativeX = e.clientX - rect.left;
const percent = Math.min(Math.max(relativeX / rect.width, 0), 1);
let value = min + (max - min) * percent;
value = Math.round(value / step) * step;
value = Number(value.toFixed(4)); //小数点以下を丸める(0.140000000000003などの誤差)
// スライダーの値として表示
bubble.textContent = value;
// ツールチップの位置調整
const pageX = e.pageX;
const pageY = window.scrollY + rect.top;
bubble.style.left = `${pageX}px`;
bubble.style.top = `${pageY}px`;
});
window.addEventListener("scroll", () => {
rect = slider.getBoundingClientRect();
});
window.addEventListener("resize", () => {
rect = slider.getBoundingClientRect();
});
});
});
</script>
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIgdmlld0JveD0iMCAwIDIwMCAyMDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgbGFuZz0iamEiPjxkZWZzPiA8bGluZWFyR3JhZGllbnQgaWQ9ImdyYWQxIiB4MT0iMCUiIHkxPSIwJSIgeDI9IjAlIiB5Mj0iMTAwJSI+IDxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiMzNDc0ZWIiIC8+IDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzM0YThlYiIgLz4gPC9saW5lYXJHcmFkaWVudD4gPC9kZWZzPiA8IS0tIOWQhOS6uuWbvuWkjeS9nOWumuS7tuWkjeaWsOWIl+OBjOaWsOWIl+OBq+OBhOOBq+OBvuOBq+OCi+OCieWbvuWkjeOBjOOCjOOCieOCk+ODq+ODvOODrOODs+ODg+OCiwotLT4gPHBvbHlnb24gcG9pbnRzPSI1MCw1MCA1MCwxNTAgMTUwLDEwMCIgZmlsbD0idXJsKCNncmFkMSkiIHN0cm9rZT0iYmxhY2siIHN0cm9rZS13aWR0aD0iMiIgLz48L3N2Zz4=">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c&display=swap" rel="stylesheet">
<title>文化発表会動画プレイヤー</title>
<style>
/* テクノロジー風背景スタイル */
.tech-background {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -2;
background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
overflow: hidden;
}
.circuit-line {
position: absolute;
background: rgba(0, 255, 255, 0.1);
box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}
.grid-dot {
position: absolute;
width: 2px;
height: 2px;
background: rgba(0, 255, 255, 0.3);
border-radius: 50%;
}
.hexagon {
position: absolute;
width: 40px;
height: 23px;
background: rgba(0, 255, 255, 0.05);
border: 1px solid rgba(0, 255, 255, 0.1);
box-shadow: 0 0 5px rgba(0, 255, 255, 0.2);
}
.hexagon:before,
.hexagon:after {
content: "";
position: absolute;
width: 0;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
}
.hexagon:before {
bottom: 100%;
border-bottom: 11.5px solid rgba(0, 255, 255, 0.05);
}
.hexagon:after {
top: 100%;
width: 0;
border-top: 11.5px solid rgba(0, 255, 255, 0.05);
}
.pulse {
position: absolute;
width: 10px;
height: 10px;
background: rgba(0, 255, 255, 0.7);
border-radius: 50%;
box-shadow: 0 0 10px 5px rgba(0, 255, 255, 0.5);
animation: pulse 2s infinite;
}
@keyframes pulse {
0% {
transform: scale(0.8);
opacity: 0.7;
}
50% {
transform: scale(1.2);
opacity: 1;
}
100% {
transform: scale(0.8);
opacity: 0.7;
}
}
@keyframes float {
0% {
transform: translateY(0) rotate(0deg);
}
50% {
transform: translateY(-20px) rotate(5deg);
}
100% {
transform: translateY(0) rotate(0deg);
}
}
/* メインスタイル */
body {
font-family: "M PLUS Rounded 1c", 'Arial', sans-serif;
background-color: rgba(10, 25, 47, 0.8);
color: #e6f1ff;
margin: 0;
padding: 20px;
display: flex;
flex-direction: column;
align-items: center;
min-height: 100vh;
}
h1 {
color: #a2c2e8;
text-align: center;
margin-bottom: 30px;
border-bottom: 1px solid #64ffda;
padding-bottom: 10px;
width: 100%;
}
.container {
display: flex;
flex-direction: column;
width: 100%;
max-width: 1000px;
background-color: rgba(17, 34, 64, 0.3);
border-radius: 10px;
padding: 20px;
box-shadow: 0 0 20px rgba(100, 255, 218, 0.2);
backdrop-filter: blur(5px);
border: 1px solid rgba(100, 255, 218, 0.1);
}
.video-container {
position: relative;
width: 100%;
margin-bottom: 20px;
}
video {
width: 100%;
border-radius: 5px;
background-color: #000;
display: block;
cursor: pointer;
}
.video-controls {
background-color: rgba(17, 34, 64, 0.2);
padding: 10px;
border-radius: 0 0 5px 5px;
display: flex;
flex-direction: column;
gap: 10px;
transition: opacity 0.3s;
}
.progress-container {
width: 100%;
height: 10px;
background-color: #1e2a47;
border-radius: 5px;
cursor: pointer;
position: relative;
}
.progress-bar {
height: 100%;
background-color: #64ffda;
border-radius: 5px;
width: 0%;
position: relative;
}
.progress-time {
position: absolute;
top: -25px;
transform: translateX(-50%);
background-color: rgba(30, 42, 71, 0.9);
padding: 3px 6px;
border-radius: 3px;
font-size: 12px;
display: none;
white-space: nowrap;
}
/* プログレスバーのマーカー */
.progress-marker {
position: absolute;
bottom: 0px;
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 10px solid #ff5555;
transform: translateX(-50%);
z-index: 2;
}
.main-controls {
display: flex;
align-items: center;
gap: 15px;
}
.control-button {
background: none;
border: none;
color: #e6f1ff;
font-size: 18px;
cursor: pointer;
padding: 5px;
border-radius: 50%;
width: 36px;
height: 36px;
display: flex;
align-items: center;
justify-content: center;
transition: background-color 0.3s;
}
.control-button:hover {
background-color: rgba(100, 255, 218, 0.2);
}
.time-display {
font-size: 14px;
color: #ccd6f6;
white-space: nowrap;
}
.volume-control {
display: flex;
align-items: center;
gap: 5px;
margin-left: auto;
}
.volume-button {
background: none;
border: none;
color: #e6f1ff;
font-size: 18px;
cursor: pointer;
padding: 5px;
}
.volume-slider {
width: 80px;
height: 6px;
-webkit-appearance: none;
background: #1e2a47;
border-radius: 3px;
outline: none;
opacity: 0;
transition: opacity 0.3s, width 0.3s;
background-image: linear-gradient(#6aebfc, #6aebfc);
background-size: 100% 100%;
background-repeat: no-repeat;
}
.volume-control:hover .volume-slider {
opacity: 1;
width: 100px;
}
.volume-slider::-webkit-slider-thumb {
-webkit-appearance: none;
width: 12px;
height: 12px;
background: #6aebfc;
border-radius: 50%;
cursor: pointer;
}
.speed-control {
display: flex;
align-items: center;
gap: 5px;
}
.speed-slider {
width: 120px;
height: 6px;
-webkit-appearance: none;
background: #1e2a47;
border-radius: 3px;
outline: none;
background-image: linear-gradient(#64d1ff, #64d1ff);
background-size: 100% 100%;
background-repeat: no-repeat;
}
.speed-slider::-webkit-slider-thumb {
-webkit-appearance: none;
width: 12px;
height: 12px;
background: #5bb7de;
border-radius: 50%;
cursor: pointer;
}
.speed-value {
font-size: 14px;
min-width: 30px;
text-align: center;
}
.fullscreen-button {
margin-left: 10px;
}
.audio-controls {
display: flex;
flex-direction: column;
gap: 10px;
margin-bottom: 15px;
}
.audio-item {
display: flex;
align-items: center;
gap: 10px;
}
.audio-item label {
min-width: 50px;
color: #9ab3d9;
}
.audio-slider {
flex-grow: 1;
height: 8px;
-webkit-appearance: none;
background: #1e2a47;
border-radius: 5px;
outline: none;
background-image: linear-gradient(#64ffda, #64ffda);
background-size: 100% 100%;
background-repeat: no-repeat;
}
.audio-slider::-webkit-slider-thumb {
-webkit-appearance: none;
width: 18px;
height: 18px;
background: #64ffda;
border-radius: 50%;
cursor: pointer;
}
.settings {
background-color: rbga(30, 42, 71, 0.3);
padding: 15px;
border-radius: 5px;
margin-bottom: 20px;
}
.setting-item {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
}
.setting-item:last-child {
margin-bottom: 0;
}
.setting-item label {
color: #ccd6f6;
}
.global-volume-container,
.playback-speed-container {
display: flex;
align-items: center;
gap: 10px;
width: 100%;
}
.global-volume-slider,
.playback-speed-slider {
flex-grow: 1;
height: 8px;
-webkit-appearance: none;
background: #1e2a47;
border-radius: 5px;
outline: none;
background-image: linear-gradient(#64ffda, #64ffda);
background-size: 100% 100%;
background-repeat: no-repeat;
}
.global-volume-slider::-webkit-slider-thumb,
.playback-speed-slider::-webkit-slider-thumb {
-webkit-appearance: none;
width: 16px;
height: 16px;
background: #64ffda;
border-radius: 50%;
cursor: pointer;
}
.slider-value {
min-width: 40px;
text-align: right;
}
input[type="number"],
input[type="checkbox"],
select {
background-color: #112240;
border: 1px solid #64ffda;
color: #e6f1ff;
padding: 5px;
border-radius: 3px;
}
.tech-decoration {
width: 100%;
height: 2px;
background: linear-gradient(90deg, transparent, #64ffda, transparent);
margin: 20px 0;
}
/* 全画面時のスタイル */
.video-container:-webkit-full-screen {
width: 100%;
height: 100%;
background-color: black;
}
.video-container:-webkit-full-screen video {
width: 100%;
height: 100%;
}
.video-container:-webkit-full-screen .video-controls {
position: fixed;
bottom: 0;
left: 0;
right: 0;
width: 100%;
border-radius: 0;
}
/* ローディングアニメーション */
.loading-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.8);
display: flex;
justify-content: center;
align-items: center;
z-index: 9998;
transition: opacity 1s ease-out;
}
.spinner-box {
width: 300px;
height: 300px;
display: flex;
justify-content: center;
align-items: center;
background-color: transparent;
}
/* 軌道スタイル */
.leo {
position: absolute;
display: flex;
justify-content: center;
align-items: center;
border-radius: 50%;
}
.blue-orbit {
width: 165px;
height: 165px;
border: 1px solid #91daffa5;
animation: spin3D 3s linear .2s infinite;
}
.green-orbit {
width: 120px;
height: 120px;
border: 1px solid #91ffbfa5;
animation: spin3D 2s linear 0s infinite;
}
.red-orbit {
width: 90px;
height: 90px;
border: 1px solid #ffca91a5;
animation: spin3D 1s linear 0s infinite;
}
.white-orbit {
width: 60px;
height: 60px;
border: 2px solid #ffffff;
animation: spin3D 10s linear 0s infinite;
}
.w1 {
transform: rotate3D(1, 1, 1, 90deg);
}
.w2 {
transform: rotate3D(1, 2, .5, 90deg);
}
.w3 {
transform: rotate3D(.5, 1, 2, 90deg);
}
/* キーフレームアニメーション */
@keyframes spin3D {
from {
transform: rotate3d(.5, .5, .5, 360deg);
}
to {
transform: rotate3d(0, 0, 0, 0deg);
}
}
@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
.time-set-button {
background-color: #112240;
border: 1px solid #64ffda;
color: #e6f1ff;
padding: 5px 10px;
border-radius: 3px;
cursor: pointer;
font-size: 12px;
margin-left: 5px;
transition: background-color 0.3s;
}
.time-set-button:hover {
background-color: rgba(100, 255, 218, 0.2);
}
/* 合成ボタンスタイル */
.combine-button {
background-color: #97c2f0;
color: #0a192f;
border: none;
padding: 10px 20px;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
margin-top: 20px;
transition: all 0.3s;
font-weight: bold;
}
.combine-button:hover {
background-color: #52e0c4;
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(100, 255, 218, 0.4);
}
.combine-button:disabled {
background-color: #3a5a78;
cursor: not-allowed;
transform: none;
box-shadow: none;
}
/* 合成ステータスメッセージ */
.combine-status {
margin-top: 10px;
color: #97c2f0;
font-size: 14px;
height: 20px;
}
/* プレビューセクション */
.preview-section {
margin-top: 20px;
padding: 15px;
background-color: rgba(17, 34, 64, 0.7);
border-radius: 5px;
display: none;
}
.preview-section h3 {
margin-top: 0;
color: #97c2f0;
border-bottom: 1px solid #64ffda;
padding-bottom: 5px;
}
/* 無効状態のオーバーレイ */
.disabled-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(10, 25, 47, 0.7);
display: flex;
justify-content: center;
align-items: center;
z-index: 10;
border-radius: 5px;
}
.disabled-message {
background-color: rgba(30, 42, 71, 0.9);
padding: 20px;
border-radius: 5px;
text-align: center;
max-width: 80%;
}
.disabled-message p {
margin-bottom: 15px;
}
.loader {
width: 80px;
aspect-ratio: 1;
border: 10px solid #000;
box-sizing: border-box;
background:
radial-gradient(farthest-side, #fff 98%, #0000) 50%/20px 20px,
radial-gradient(farthest-side, #fff 98%, #0000) 50%/20px 20px,
radial-gradient(farthest-side, #fff 98%, #0000) 50%/20px 20px,
radial-gradient(farthest-side, #fff 98%, #0000) 50%/20px 20px,
radial-gradient(farthest-side, #fff 98%, #0000) 50%/80% 80%,
#000;
background-repeat: no-repeat;
filter: blur(4px) contrast(10);
animation: squarePulse 1s infinite alternate;
}
@keyframes squarePulse {
0% {
background-position:
50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 50%;
}
25% {
background-position:
50% 0, 50% 50%, 50% 50%, 50% 50%, 50% 50%, 50% 50%;
}
50% {
background-position:
50% 0, 50% 100%, 50% 50%, 50% 50%, 50% 50%, 50% 50%;
}
75% {
background-position:
50% 0, 50% 100%, 0 50%, 50% 50%, 50% 50%, 50% 50%;
}
100% {
background-position:
50% 0, 50% 100%, 0 50%, 100% 50%, 50% 50%, 50% 50%;
}
}
#buffering-indicator {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 10;
display: none;
}
.sync-status {
position: absolute;
bottom: 100px;
left: 10px;
width: 150px;
/* 固定幅 */
height: 30px;
/* 固定高さ */
background-color: rgba(0, 0, 0, 0.7);
color: #97c2f0;
padding: 5px 10px;
border-radius: 3px;
font-size: 12px;
z-index: 5;
display: flex;
align-items: center;
gap: 5px;
white-space: nowrap;
/* 文字の折り返しを防止 */
overflow: hidden;
/* 内容がはみ出す場合に隠す */
text-overflow: ellipsis;
/* はみ出したテキストに「…」を表示(任意) */
user-select: none;
/* テキストの選択を不可にする */
/* はみ出してもスクロールバーを出さない */
contain: strict;
/* レイアウトの影響を最小限にする */
}
.sync-status button {
background: none;
border: none;
color: #fff;
cursor: pointer;
font-size: 12px;
}
.lock-controls-btn {
position: fixed;
bottom: 20px;
right: 20px;
background-color: rgba(0, 0, 0, 0.7);
border: none;
color: #fff;
width: 36px;
height: 36px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
z-index: 100;
display: none;
}
.lock-controls-btn.locked {
color: #97c2f0;
}
.time-markers-container {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin: 15px 0;
padding: 15px;
background-color: rgba(17, 34, 64, 0.8);
border-radius: 5px;
}
.time-marker {
font-size: 80%;
padding: 6px 8px;
background-color: rgba(100, 255, 218, 0.05);
border: 1px solid #64ffda;
border-radius: 4px;
cursor: grab;
user-select: none;
transition: background-color 0.3s;
}
.time-marker:hover {
background-color: rgba(100, 255, 218, 0.1);
}
.time-marker.dragging {
opacity: 0.7;
cursor: grabbing;
}
.time-input-container {
display: flex;
align-items: center;
gap: 5px;
}
.time-input-container input {
width: 80px;
}
#hide-video:checked~.video-container video {
background-color: black;
opacity: 0;
}
</style>
</head>
<body>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-NDL2LKLQ" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<script>
// 動画パスを再設定
document.addEventListener('DOMContentLoaded', function() {
const urlParams = new URLSearchParams(window.location.search);
const isTMode = urlParams.has('mode') && urlParams.get('mode') === 't';
const videoSource = document.querySelector('#video source');
if (isTMode && videoSource) {
videoSource.src = '/t/v.mp4';
const video = document.getElementById('video');
video.load();
}
});
</script>
<!-- テクノロジー風背景 -->
<div class="tech-background" id="techBg">
</div>
<!-- ローディングオーバーレイ -->
<div class="loading-overlay" id="loadingOverlay">
<div class="spinner-box">
<div class="blue-orbit leo">
</div>
<div class="green-orbit leo">
</div>
<div class="red-orbit leo">
</div>
<div class="white-orbit w1 leo">
</div>
<div class="white-orbit w2 leo">
</div>
<div class="white-orbit w3 leo">
</div>
</div>
</div>
<h1 id="title-name">文化発表会音声動画プレイヤー</h1>
<div class="settings">
<h2>サービスワーカー設定</h2>
<div hidden>
<!--邪魔だから一時的に非表示-->
<div class="setting-item">
<label>
<input type="checkbox" id="sw-video" checked>動画ファイル (/v.mp4)</label>
</div>
<div class="setting-item">
<label>
<input type="checkbox" id="sw-t-video" checked>動画ファイル (/t/v.mp4)</label>
</div>
<br>
<div class="setting-item">
<label>
<input type="checkbox" id="sw-piano" checked>ピアノ音声 (/p.mp3)</label>
</div>
<div class="setting-item">
<label>
<input type="checkbox" id="sw-soprano" checked>ソプラノ音声 (/s.mp3)</label>
</div>
<div class="setting-item">
<label>
<input type="checkbox" id="sw-alto" checked>アルト音声 (/a.mp3)</label>
</div>
<div class="setting-item">
<label>
<input type="checkbox" id="sw-tenor" checked>テノール音声 (/t.mp3)</label>
</div>
<div class="setting-item">
<label>
<input type="checkbox" id="sw-combined" checked>全体音声 (/k.mp3)</label>
</div>
<br>
<div class="setting-item">
<label>
<input type="checkbox" id="sw-t-piano" checked>ピアノ音声 (/t/p.mp3)</label>
</div>
<div class="setting-item">
<label>
<input type="checkbox" id="sw-t-soprano" checked>ソプラノ音声 (/t/s.mp3)</label>
</div>
<div class="setting-item">
<label>
<input type="checkbox" id="sw-t-alto" checked>アルト音声 (/t/a.mp3)</label>
</div>
<div class="setting-item">
<label>
<input type="checkbox" id="sw-t-tenor" checked>テノール音声 (/t/t.mp3)</label>
</div>
<div class="setting-item">
<label>
<input type="checkbox" id="sw-t-combined" checked>全体音声 (/t/k.mp3)</label>
</div>
<br>
<div class="setting-item">
<label>
<input type="checkbox" id="sw-index" checked>インデックスファイル (/index.html)</label>
</div>
<div class="setting-item">
<label>
<input type="checkbox" id="sw-root" checked>ルートファイル (/)</label>
</div>
</div>
<a>下記のボタンを押すと、サービスワーカーを使用してページをオフラインで使用できるようにします。<br>
<b>これはテスト的な機能で、ページの更新などができなくなるバグが発生する可能性があります。<br>(更新機能は実装していますが安定して動作するとは限りません。)<br>
ページが更新されない場合、動画の更新ができなかったり既存のバグが残り続けたりする可能性があります。</b></a>
<br>
<button class="combine-button" id="sw-register-btn" disabled>登録を開始</button>
<div class="combine-status" id="sw-status">
</div>
<script>
window.addEventListener('load', async () => {
const statusElem = document.getElementById('sw-status');
const registerBtn = document.getElementById('sw-register-btn');
function updateStatus(message) {
console.log(message);
statusElem.textContent = message;
}
function updateError(message, error) {
const errorMsg = `${message}\nエラー詳細: ${error?.message || error}`;
console.error(errorMsg, error);
statusElem.textContent = errorMsg;
}
if (!('serviceWorker' in navigator)) {
updateError('このブラウザはService Workerに対応していません。');
return;
}
// 常にボタン有効にする
registerBtn.disabled = false;
try {
const reg = await navigator.serviceWorker.getRegistration();
if (reg) {
updateStatus('Service Workerは既に登録されています。更新を確認中...');
registerBtn.innerText = "更新を開始";
await reg.update();
reg.onupdatefound = () => {
const newSW = reg.installing;
if (newSW) {
newSW.onstatechange = () => {
if (newSW.state === 'installed' && navigator.serviceWorker.controller) {
updateStatus('更新があります。新しいService Workerがインストールされました。');
// ボタンは常に押せるので変更不要
}
};
}
};
} else {
updateStatus('Service Workerは未登録です。');
// ボタンは常に押せるので変更不要
}
} catch (err) {
updateError('Service Workerの確認中にエラーが発生しました。', err);
}
registerBtn.addEventListener('click', async () => {
registerBtn.disabled = true;
try {
updateStatus('既存のService Workerをアンレジスター中...');
const regs = await navigator.serviceWorker.getRegistrations();
for (const reg of regs) {
await reg.unregister();
}
updateStatus('新しいService Workerを登録中...');
await navigator.serviceWorker.register('/sw.js');
updateStatus('登録完了。ページをリロードしてキャッシュを有効化します。');
registerBtn.textContent = 'ページをリロード';
registerBtn.disabled = false;
registerBtn.onclick = () => location.reload();
} catch (err) {
updateError('Service Workerの登録に失敗しました。', err);
}
});
});
</script>
<style>
#app {
position: fixed;
top: 50%;
left: 50%;
width: 200px;
height: 265px;
background: rgba(0, 0, 0, 0.5);
color: #fff;
border-radius: 10px;
box-sizing: border-box;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.7);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 10px;
overflow: hidden;
z-index: 999999;
}
#header {
position: absolute;
top: 5px;
right: 5px;
cursor: pointer;
user-select: none;
font-size: 24px;
color: #fff;
z-index: 10;
width: 30px;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
}
svg {
overflow: visible;
}
#toggle {
cursor: pointer;
}
#bpmInput {
margin-top: 10px;
background: #222;
border: none;
color: #fff;
font-size: 16px;
text-align: center;
width: 80px;
padding: 4px;
border-radius: 4px;
}
#content {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
user-select: none;
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/CustomEase.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
const urlParams = new URLSearchParams(window.location.search);
// メトロノーム関連のグローバル変数
let metronomeState = {
isActive: false,
bpm: urlParams.get('mode') === 't' ? 66 : 92
};
// メトロノームのタイムライン
const tl = gsap.timeline({
repeat: -1,
paused: true
})
.to('#arm', {
duration: 1,
rotate: 90,
ease: 'power2.inOut',
yoyo: true,
repeat: 1,
transformOrigin: '100% 100%'
}, 0)
.add(() => {
swing(-1);
}, 0.5)
.add(() => {
swing(1);
}, 1.5);
// メトロノームの状態を設定する関数
function setMetronomeState(active, bpm) {
metronomeState.isActive = active;
metronomeState.bpm = bpm;
if (active) {
if (!tl.isActive()) {
gsap.to('#toggle path', {
attr: {
stroke: '#fff'
}
});
gsap.to('#toggle circle', {
duration: 0.3,
x: 15,
ease: 'power3.inOut'
});
tl.play();
}
} else {
if (tl.isActive()) {
gsap.to('#toggle path', {
attr: {
stroke: '#333'
}
});
gsap.to('#toggle circle', {
duration: 0.3,
x: 0,
ease: 'power3.inOut'
});
tl.pause();
}
}
}
// メトロノームのスイングアニメーション
function swing(dir) {
gsap.timeline()
.to('#tip', {
duration: 0.25,
rotate: 40 * dir,
transformOrigin: '50% 19%',
ease: 'power3'
})
.to('#tip', {
duration: 0.35,
rotate: 0,
ease: CustomEase.create('ez', 'M0,0 C0.06,0.002 0.148,0.026 0.186,0.17 0.211,0.274 0.27,1.074 0.552,1.086 0.635,1.089 0.736,0.991 0.81,0.976 0.894,0.957 0.938,1.012 1,1')
}, '-=0.1');
const snd = document.getElementById('snd');
const sound = snd.cloneNode();
sound.volume = 0.33;
sound.play().catch(e => console.error('メトロノーム音再生エラー:', e));
}
// メトロノームのトグル処理
document.querySelector('#toggle').onclick = () => {
setMetronomeState(!tl.isActive(), metronomeState.bpm);
};
// BPM変更処理
function setTempoFromBPM() {
const bpmInput = document.getElementById('bpmInput');
let bpm = parseInt(bpmInput.value);
if (isNaN(bpm)) bpm = 60;
bpm = Math.max(0, Math.min(bpm, 10000));
bpmInput.value = bpm;
metronomeState.bpm = bpm;
const tempoLevel = Math.round(gsap.utils.mapRange(0, 10000, 1, 10, bpm));
gsap.set('#lvl', {
attr: {
'stroke-dasharray': tempoLevel * 10 + ' ' + (100 - tempoLevel * 10)
}
});
const secondsPerBeat = 60 / bpm;
const durationPerHalf = secondsPerBeat;
const wasActive = tl.isActive();
tl.pause(0).clear(); // アニメーションを停止し、タイムラインを初期化
tl.to('#arm', {
duration: durationPerHalf,
rotate: 90,
ease: 'power2.inOut',
yoyo: true,
repeat: 1,
transformOrigin: '100% 100%'
}, 0)
.add(() => {
swing(-1);
}, durationPerHalf / 2)
.add(() => {
swing(1);
}, durationPerHalf * 1.5);
if (wasActive) {
tl.play(0); // 再スタートする場合、タイムラインを最初から再生
}
}
// BPM入力のイベントリスナー
document.getElementById('bpmInput').addEventListener('input', setTempoFromBPM);
// 初期化時にメトロノームを設定
setTempoFromBPM();
// 音声合成関数(完全版)
async function combineAudio() {
// 合成前にメトロノームの状態を保存
const wasMetronomeActive = tl.isActive();
if (wasMetronomeActive) {
setMetronomeState(false, metronomeState.bpm);
}
const combineButton = document.getElementById('combine-button');
const combineStatus = document.getElementById('combine-status');
const audioFiles = ['p', 'a', 't', 's', 'k'];
const basePath = new URLSearchParams(window.location.search).has('mode') ? '/t/' : '/';
// 現在の音量設定を保存
const currentVolumes = {};
audioFiles.forEach(file => {
const slider = document.querySelector(`.audio-slider[data-audio="${file}"]`);
currentVolumes[file] = parseFloat(slider.value);
});
combineButton.disabled = true;
combineStatus.textContent = "音声を合成中...";
try {
// 各音声ファイルをデコード
const audioBufferPromises = audioFiles.map(async file => {
if (currentVolumes[file] === 0) return null;
try {
const response = await fetch(`${basePath}${file}.mp3`);
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
const arrayBuffer = await response.arrayBuffer();
return await audioContext.decodeAudioData(arrayBuffer);
} catch (error) {
console.error(`音声ファイル読み込みエラー (${file}.mp3):`, error);
return null;
}
});
// すべての音声バッファを取得
const buffers = await Promise.all(audioBufferPromises);
const validBuffers = buffers.filter(Boolean);
if (validBuffers.length === 0) {
throw new Error("有効な音声ファイルが見つかりませんでした");
}
// 最長の音声バッファの長さを取得
const maxDuration = Math.max(...validBuffers.map(b => b.duration));
// 新しい音声バッファを作成
const combinedAudioBuffer = audioContext.createBuffer(
2, // ステレオ
audioContext.sampleRate * maxDuration,
audioContext.sampleRate
);
// 各音声バッファを結合
audioFiles.forEach((file, index) => {
if (!buffers[index] || currentVolumes[file] === 0) return;
const buffer = buffers[index];
const volume = currentVolumes[file];
// 各チャンネルに音声を加算
for (let channel = 0; channel < 2; channel++) {
const inputData = buffer.getChannelData(channel % buffer.numberOfChannels);
const outputData = combinedAudioBuffer.getChannelData(channel);
for (let i = 0; i < inputData.length; i++) {
outputData[i] += inputData[i] * volume;
}
}
});
// 音量を正規化 (クリッピング防止)
for (let channel = 0; channel < 2; channel++) {
const outputData = combinedAudioBuffer.getChannelData(channel);
let max = 0;
for (let i = 0; i < outputData.length; i++) {
if (Math.abs(outputData[i]) > max) {
max = Math.abs(outputData[i]);
}
}
if (max > 1) {
for (let i = 0; i < outputData.length; i++) {
outputData[i] /= max;
}
}
}
// AudioBufferをBlobに変換
const blob = bufferToWave(combinedAudioBuffer, audioContext);
const url = URL.createObjectURL(blob);
// 既存のaudio要素をクリーンアップ
if (window.combinedAudioElement) {
window.combinedAudioElement.pause();
URL.revokeObjectURL(window.combinedAudioElement.src);
}
// 新しいaudio要素を作成
window.combinedAudioElement = new Audio(url);
window.combinedAudioElement.preservesPitch = true;
window.combinedAudioElement.mozPreservesPitch = true;
window.combinedAudioElement.webkitPreservesPitch = true;
window.combinedAudioElement.playbackRate = currentPlaybackRate;
// 合成完了メッセージ
combineStatus.textContent = "音声の合成が完了しました";
isAudioCombined = true;
enablePlayerControls();
// メトロノームの状態を復元
if (wasMetronomeActive) {
setTimeout(() => {
setMetronomeState(true, metronomeState.bpm);
}, 500);
}
} catch (error) {
console.error('音声合成エラー:', error);
combineStatus.textContent = `音声の合成に失敗しました: ${error.message}`;
// エラー時もメトロノームの状態を復元
if (wasMetronomeActive) {
setMetronomeState(true, metronomeState.bpm);
}
} finally {
combineButton.disabled = false;
}
}
// AudioBufferをWAV Blobに変換
function bufferToWave(abuffer, audioContext) {
const numOfChan = abuffer.numberOfChannels;
const length = abuffer.length * numOfChan * 2 + 44;
const buffer = new ArrayBuffer(length);
const view = new DataView(buffer);
let pos = 0;
// WAVヘッダー書き込み
setUint32(0x46464952); // "RIFF"
setUint32(length - 8); // ファイル長 - 8
setUint32(0x45564157); // "WAVE"
setUint32(0x20746d66); // "fmt "チャンク
setUint32(16); // 長さ = 16
setUint16(1); // PCM (非圧縮)
setUint16(numOfChan);
setUint32(audioContext.sampleRate);
setUint32(audioContext.sampleRate * 2 * numOfChan);
setUint16(numOfChan * 2);
setUint16(16);
setUint32(0x61746164); // "data"チャンク
setUint32(length - pos - 4);
// インターリーブデータ書き込み
for (let i = 0; i < abuffer.length; i++) {
for (let channel = 0; channel < numOfChan; channel++) {
let sample = abuffer.getChannelData(channel)[i] * 0x7fff;
sample = Math.max(-32768, Math.min(32767, sample));
view.setInt16(pos, sample, true);
pos += 2;
}
}
function setUint16(data) {
view.setUint16(pos, data, true);
pos += 2;
}
function setUint32(data) {
view.setUint32(pos, data, true);
pos += 4;
}
return new Blob([buffer], {
type: 'audio/wav'
});
}
// ドラッグ可能化
const app = document.getElementById('app');
new Draggabilly(app, {
containment: 'body'
});
// 開閉ボタン
const header = document.getElementById('header');
const content = document.getElementById('content');
let isOpen = false;
// 初期コンパクト状態へアニメーション
gsap.set(app, {
width: 60,
height: 40,
padding: 0
});
content.style.display = 'none';
header.textContent = '▼';
header.addEventListener('click', () => {
if (isOpen) {
// 閉じる
gsap.to(app, {
duration: 0.4,
width: 60,
height: 40,
padding: 0,
ease: 'power3.inOut',
onComplete: () => {
content.style.display = 'none';
header.textContent = '▼';
}
});
} else {
// 開く
content.style.display = 'flex';
gsap.to(app, {
duration: 0.4,
width: 300,
height: 400,
padding: 10,
ease: 'power3.inOut',
onComplete: () => {
header.textContent = '▲';
}
});
}
isOpen = !isOpen;
});
});
</script>
</div>
<div class="container">
<div class="audio-controls">
<h2>音声コントロール</h2>
<span>各パートの音の大きさを設定できます、自分のパートの音量を1、それ以外のパートの音量を0.4くらいにすると他のパートのタイミングを確認しながら練習できます。<br>
※「ピアノ」と「全体」は他のパートと音がずれるため、組み合わせて使用しないでください。</span>
<div class="audio-item">
<label>ソプラノ</label>
<input type="range" class="audio-slider" data-audio="s" min="0" max="1" step="0.01" value="1">
<span class="slider-value volume-value">1.00</span>
</div>
<div class="audio-item">
<label>アルト </label>
<input type="range" class="audio-slider" data-audio="a" min="0" max="1" step="0.01" value="1">
<span class="slider-value volume-value">1.00</span>
</div>
<div class="audio-item">
<label>テノール</label>
<input type="range" class="audio-slider" data-audio="t" min="0" max="1" step="0.01" value="1">
<span class="slider-value volume-value">1.00</span>
</div>
<div class="audio-item">
<label>ピアノ </label>
<input type="range" class="audio-slider" data-audio="p" min="0" max="1" step="0.01" value="0">
<span class="slider-value volume-value">0.00</span>
</div>
<div class="audio-item">
<label>全体(非推奨)</label>
<input type="range" class="audio-slider" data-audio="k" min="0" max="1" step="0.01" value="0">
<span class="slider-value volume-value">0.00</span>
</div>
<!-- 合成ボタンとステータス -->
<button class="combine-button" id="combine-button">音声を合成</button>
<div class="combine-status" id="combine-status">
</div>
</div>
<div class="tech-decoration">
</div>
<!-- プレビューセクション -->
<div class="preview-section" id="preview-section" hidden>
<h3 hidden>プレビュー</h3>
<p hidden>合成された音声をプレビューできます。再生ボタンをクリックして確認してください。</p>
<button class="control-button" id="preview-button" hidden>▶</button>
<span id="preview-time" hidden>00:00 / 00:00</span>
</div>
<div class="video-container" id="video-container">
<!-- バッファリングインジケーター -->
<div id="buffering-indicator">
<div class="loader">
</div>
</div>
<!-- 同期ステータス -->
<div class="sync-status" id="sync-status">
<span id="sync-status-text">
</span>
<button id="sync-status-close">×</button>
</div>
<script>
new Draggabilly('#sync-status');
</script>
<!-- 無効状態のオーバーレイ -->
<div class="disabled-overlay" id="disabledOverlay">
<div class="disabled-message">
<p>音声の合成が完了していません</p>
<p>上の音声コントロールで各パートの音量を調整し、「合成」ボタンを押してください</p>
</div>
</div>
<video id="video" muted>
<source src="v.mp4" type="video/mp4" allowpictureinpicture>
</source>
</video>
<div id="app">
<div id="header">▼</div>
<div id="content">
<svg width="108" height="150" fill="none" stroke="#fff" stroke-width="4" stroke-linecap="round">
<path id="tip" d="M55,1c22,0,0,48,0,48S33,1,55,1z" fill="none" />
<path d="M21.3,117.5c0-17.4,14.1-31.5,31.5-31.5s31.5,14.1,31.5,31.5" stroke="#333" />
<path id="lvl" d="M21.3,117.5c0-17.4,14.1-31.5,31.5-31.5s31.5,14.1,31.5,31.5" />
<g id="arm">
<path d="M2,65 55,117" />
<circle cx="2" cy="65" r="2" />
</g>
<g id="toggle">
<path d="M45.5,145 60.5,145" stroke-width="20" stroke="#444" />
<circle cx="45.5" cy="145" r="8" stroke="none" fill="#000" />
</g>
</svg>
<input id="bpmInput" type="number" min="0" value="66" /> BPM
</div>
<audio id="snd" src="data:audio/mpeg;base64,SUQzBAAAAAAAIlRTU0UAAAAOAAADTGF2ZjYxLjEuMTAwAAAAAAAAAAAAAAD/+1QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABJbmZvAAAADwAAAAUAAASAAFVVVVVVVVVVVVVVVVVVVVVVVVWAgICAgICAgICAgICAgICAgICAgKqqqqqqqqqqqqqqqqqqqqqqqqqq1dXV1dXV1dXV1dXV1dXV1dXV1dX//////////////////////////wAAAABMYXZjNjEuMy4AAAAAAAAAAAAAAAAkAkAAAAAAAAAEgFJnjCP/+1RkAA/wDQCAAeAACAAADSAAAAEASAIADQAAIAAANIAAAAQD+c9Ur/f39/KLpNtVUpRoKhWoMy4UxKDYGAlmATReypqYqNWo+bVVKUZuovOVsYm4fiQntX6bb+vS6FVUoptu/tmZzvpdCqrM0iW1UxiThsDAPzC/K1BmhWAwOCkgrLbHh29sDrznj/qFIc6kdIe+OiLrGtwIkCn/9NMc8TLx48muiDgf2/RBODoZIFX9JUPc6f41SqLFvEPMuf7/+1RkTA/y3TsugYVlEgAADSAAAAENJQz0FGeACAAANIKAAARb1XDj0vAruHuBEgOH1tjT87z6h3U6xTqQghLKv46ncz8OhQaY2f7xm9PAiEICgUDAV0irYCAMBAAADwt5A73wJGAN/ijDg8BqgCONoHkwtMA3ED3PsQcPSAUAzJoVmZw0LhmF1ZKHgIm/RuyZuB+wFrBExSY0wbL/9buwGMYYXC2ZtLpX//1pmgNggOhBsWFyxOhfACv///i3uMz/+1RkN4ADhEjMbkpgAAAADSDAAAAOEPt9uPeAEAAANIMAAAAef19jsZigQCAUBgMCkABIwuN3LMqhG36c3GNxNIZDg1VL9VQbZP8cCxnN3tt0yr76xnGIDneOOSlM7gXlo9O41VQQhkXC/q+s59Lb+byPMel73vTO4mpa4ta2buHVkmsMn/znO9YtrGfjwb4eROGX8i22d2VUVDbcYTAIImcXTQlEE8LqR19UYqMXXuVcZb9xd9XU8ces0s3df3f/+1RkFQDx2x5jfzEABAAADSDgAAEHnHVxx6RmwAAANIAAAAQOAiaTAUBpMqhxt///7m+Bot83TS7MiyMMDaXyOT0eJuHofDzYXiwaHmlm2DHQRrKjGv9//I3tpEf9hgRHfEQ4gR1KEQdQepGsvt/JZWSqyXqniHQ1SSSwMAsGgVBFwlLwRPrWOicfLlyGus0DQNQ6dPA0JgaeIhKFRjyoLR534h8sDRUqC1MS//8qEnifewZ1n+So1zXK1P9MrP3/+1RkJoDx7QrZeYlgEAAADSAAAAEGROUOAIxHQAAANIAAAAQskwY5djO3+UKzpqz1KGOJM7br5SkFBSGXzBSCg0/2gyCQakxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqo="></audio>
</div>
<script>
window.addEventListener('DOMContentLoaded', () => {
const urlParams = new URLSearchParams(window.location.search);
document.getElementById('bpmInput').value = urlParams.get('mode') === 't' ? 66 : 92;
document.getElementById('title-name').textContent = urlParams.get('mode') === 't' ? "地球星歌" : "時の旅人";
});
</script>
<div class="video-controls">
<div class="progress-container" id="progress-container">
<div class="progress-bar" id="progress-bar">
</div>
<div class="progress-time" id="progress-time">00:00</div>
<div class="progress-marker" id="start-marker" style="left: 0%; display: none;">
</div>
<div class="progress-marker" id="end-marker" style="left: 100%; display: none;">
</div>
</div>
<div class="main-controls">
<button class="control-button" id="play-pause-btn" disabled>▶</button>
<button class="control-button" id="reset-btn" disabled title="最初から再生">↺</button>
<div class="time-display" id="time-display">00:00.00 / 00:00.00</div>
<div class="volume-control">
<button class="volume-button" id="volume-btn" disabled>🔊</button>
<input type="range" class="volume-slider" id="volume-slider" min="0" max="1" step="0.01" value="1" disabled>
</div>
<div class="speed-control">
<span class="speed-value" id="speed-value">1.00x</span>
<input type="range" class="speed-slider" id="speed-slider" min="0.01" max="5" step="0.01" value="1" disabled>
</div>
<button class="control-button" id="pip-btn" disabled title="ピクチャーインピクチャー">⇲</button>
<button class="control-button fullscreen-button" id="fullscreen-btn" disabled>⛶</button>
</div>
</div>
</div>
<div class="tech-decoration">
</div>
<div class="settings">
<div class="time-markers-container" id="time-markers-container">
<span>このボックスをドラッグして「再生開始秒数」や「再生終了秒数」の入力ボックスの上で離すと秒数を簡単に変更できます。各秒数は楽譜に合わせています。<br>
時の旅人はAからE、地球星歌は①から⑤で区切っていて、地球星歌はリピート記号があるので①と②は1番と2番があります。</span>
<!-- ここにタイムマーカーが動的に追加されます -->
</div>
<div class="setting-item">
<label for="start-time">再生開始秒数:</label>
<div class="time-input-container">
<input type="number" id="start-time" min="0" value="0" step="0.01" disabled>
<button class="time-set-button" id="set-start-time" disabled>現在の秒数に設定</button>
</div>
</div>
<div class="setting-item">
<label for="end-time">再生終了秒数:</label>
<div class="time-input-container">
<input type="number" id="end-time" min="0" value="0" step="0.01" disabled>
<button class="time-set-button" id="set-end-time" disabled>現在の秒数に設定</button>
<button class="time-set-button" id="reset-end-time" disabled>動画の長さに戻す</button>
</div>
</div>
<div class="setting-item">
<label for="loop">ループ再生:</label>
<input type="checkbox" id="loop" disabled>
</div>
<div class="setting-item">
<button class="combine-button" id="apply-time-btn" disabled>時間設定を適用</button>
</div>
<h2>設定</h2>
<!-- 設定セクションに消画モードを追加 -->
<div class="setting-item">
<label for="hide-video">消画モード:</label>
<input type="checkbox" id="hide-video">
</div>
<div class="setting-item">
<div class="global-volume-container">
<label>全体音量係数:</label>
<input type="range" class="global-volume-slider" id="global-volume" min="0" max="10" step="0.01" value="5" disabled>
<span class="slider-value" id="global-volume-value">0.5</span>
</div>
</div>
<div class="setting-item">
<div class="playback-speed-container">
<label>再生速度:</label>
<input type="range" class="playback-speed-slider" id="playback-speed" min="0.01" max="5" step="0.001" value="1" disabled>
<span class="slider-value" id="playback-speed-value">1.00x</span>
</div>
</div>
<div class="setting-item">
<label for="tempo">テンポ (BPM):</label>
<input type="number" id="tempo" min="40" max="200" value="92" step="0.1">
<span id="tempo-speed-value">1.00x</span>
</div>
<span>↑練習したいテンポを入力するとそのテンポに合わせて再生速度スライダーを変更できます。
<br>楽譜に記載された「♪=」の横のテンポ(時の旅人は約92、地球星歌は約66)を基準に計算します。</span>
</div>
</div>
<!-- 全画面時のロックボタン -->
<button class="lock-controls-btn" id="lock-controls-btn" title="コントロールバーを固定">🔒</button>
<script>
document.addEventListener('DOMContentLoaded', function() {
// 同期管理用の変数
let lastSyncTime = 0;
let isBuffering = false;
let syncDriftLog = [];
let syncCheckInterval;
let audioContext;
let controlsHideTimeout;
let isControlsLocked = false;
let controlsVisible = true;
let isCheckingSync = false;
let isInBackgroundTab = false;
try {
audioContext = new(window.AudioContext || window.webkitAudioContext)
();
} catch (e) {
console.error('Web Audio APIがサポートされていません:', e);
}
// テクノロジー風背景を生成
function createTechBackground() {
const bg = document.getElementById('techBg');
for (let i = 0; i < 200; i++) {
const line = document.createElement('div');
line.className = 'circuit-line';
const isHorizontal = Math.random() > 0.5;
if (isHorizontal) {
line.style.width = `${Math.random() * 300 + 100}px`;
line.style.height = '1px';
} else {
line.style.width = '1px';
line.style.height = `${Math.random() * 300 + 100}px`;
}
line.style.left = `${Math.random() * 100}%`;
line.style.top = `${Math.random() * 100}%`;
line.style.opacity = Math.random() * 0.5 + 0.1;
bg.appendChild(line);
}
for (let i = 0; i < 200; i++) {
const dot = document.createElement('div');
dot.className = 'grid-dot';
dot.style.left = `${Math.random() * 100}%`;
dot.style.top = `${Math.random() * 100}%`;
bg.appendChild(dot);
}
for (let i = 0; i < 15; i++) {
const hex = document.createElement('div');
hex.className = 'hexagon';
hex.style.left = `${Math.random() * 100}%`;
hex.style.top = `${Math.random() * 100}%`;
hex.style.transform = `rotate(${Math.random() * 360}deg)`;
hex.style.animation =
`float ${Math.random() * 10 + 5}s infinite ease-in-out`;
bg.appendChild(hex);
}
for (let i = 0; i < 8; i++) {
const pulse = document.createElement('div');
pulse.className = 'pulse';
pulse.style.left = `${Math.random() * 100}%`;
pulse.style.top = `${Math.random() * 100}%`;
pulse.style.animationDelay = `${Math.random() * 2}s`;
bg.appendChild(pulse);
}
}
createTechBackground();
const urlParams = new URLSearchParams(window.location.search);
const isTMode = urlParams.has('mode') && urlParams.get('mode') ===
't';
const basePath = isTMode ? '/t/' : '/';
// ローディング状態を管理
let loadingCount = 0;
let totalToLoad = 6; // 動画 + 5つの音声ファイル
let lastUpdateTime = 0;
const updateInterval = 1;
function checkLoadingComplete() {
loadingCount++;
if (loadingCount >= totalToLoad) {
setTimeout(function() {
const loadingOverlay = document.getElementById(
'loadingOverlay');
loadingOverlay.style.opacity = '0';
setTimeout(function() {
loadingOverlay.style.display = 'none';
}, 1000);
}, 500);
}
}
function handleError(error, message) {
console.error(message, error);
window.alert(`${message}\n\nエラー詳細: ${error.message}`);
}
// 要素を取得
const video = document.getElementById('video');
video.preservesPitch = true;
video.mozPreservesPitch = true; // Firefox用
video.webkitPreservesPitch = true; // 古いWebKit用
const videoContainer = document.getElementById('video-container');
const playPauseBtn = document.getElementById('play-pause-btn');
const timeDisplay = document.getElementById('time-display');
const progressContainer = document.getElementById(
'progress-container');
const progressBar = document.getElementById('progress-bar');
const progressTime = document.getElementById('progress-time');
const volumeBtn = document.getElementById('volume-btn');
const volumeSlider = document.getElementById('volume-slider');
const speedSlider = document.getElementById('speed-slider');
const speedValue = document.getElementById('speed-value');
const playbackSpeedSlider = document.getElementById(
'playback-speed');
const playbackSpeedValue = document.getElementById(
'playback-speed-value');
const fullscreenBtn = document.getElementById('fullscreen-btn');
const startTimeInput = document.getElementById('start-time');
const endTimeInput = document.getElementById('end-time');
const loopCheckbox = document.getElementById('loop');
const globalVolumeSlider = document.getElementById(
'global-volume');
const globalVolumeValue = document.getElementById(
'global-volume-value');
const audioSliders = document.querySelectorAll('.audio-slider');
const volumeValues = document.querySelectorAll('.volume-value');
const setStartTimeBtn = document.getElementById('set-start-time');
const setEndTimeBtn = document.getElementById('set-end-time');
const resetEndTimeBtn = document.getElementById('reset-end-time');
const disabledOverlay = document.getElementById(
'disabledOverlay');
const combineButton = document.getElementById('combine-button');
const combineStatus = document.getElementById('combine-status');
const previewSection = document.getElementById('preview-section');
const previewButton = document.getElementById('preview-button');
const previewTime = document.getElementById('preview-time');
const bufferingIndicator = document.getElementById(
'buffering-indicator');
const syncStatus = document.getElementById('sync-status');
const syncStatusText = document.getElementById(
'sync-status-text');
const syncStatusClose = document.getElementById(
'sync-status-close');
const lockControlsBtn = document.getElementById(
'lock-controls-btn');
const startMarker = document.getElementById('start-marker');
const endMarker = document.getElementById('end-marker');
const tempoInput = document.getElementById('tempo');
const tempoSpeedValue = document.getElementById(
'tempo-speed-value');
const videoControls = document.querySelector('.video-controls');
const applyTimeBtn = document.getElementById('apply-time-btn');
const pipBtn = document.getElementById('pip-btn');
const resetBtn = document.getElementById('reset-btn');
// 音声オブジェクトを作成
const audioElements = {};
const audioBuffers = {};
const audioFiles = ['p', 'a', 't', 's', 'k'];
let combinedAudioElement = null;
let isAudioCombined = false;
let currentVolumes = {
p: 0,
a: 1,
t: 1,
s: 1,
k: 0
};
// 初期化
let videoDuration = 0;
let isPlaying = false;
let lastVolume = 1;
let currentPlaybackRate = 1;
let isFullscreen = false;
async function enterPiP() {
if (!document.pictureInPictureElement && !video.paused) {
try {
await video.requestPictureInPicture();
} catch (err) {
console.warn('PiP開始失敗:', err);
}
}
}
async function exitPiP() {
if (document.pictureInPictureElement) {
try {
await document.exitPictureInPicture();
} catch (err) {
console.warn('PiP終了失敗:', err);
}
}
}
const hideVideoCheckbox = document.getElementById('hide-video');
hideVideoCheckbox.addEventListener('change', function() {
video.style.backgroundColor = this.checked ? 'black' : '';
video.style.opacity = this.checked ? '0' : '1';
});
// 動画のバッファリング状態を監視
video.addEventListener('waiting', function() {
isBuffering = true;
bufferingIndicator.style.display = 'block';
if (combinedAudioElement) {
combinedAudioElement.pause();
}
});
video.addEventListener('playing', function() {
isBuffering = false;
bufferingIndicator.style.display = 'none';
if (combinedAudioElement && isPlaying) {
syncAudioWithVideo();
}
});
video.addEventListener('suspend', function() {
console.log('動画の読み込みが一時停止しました');
});
video.addEventListener('stalled', function() {
console.log('動画の読み込みが停滞しました');
if (isPlaying) {
pauseMedia();
}
});
function updatePipButton() {
if (document.pictureInPictureElement) {
pipBtn.textContent = '↸';
pipBtn.title = 'ピクチャーインピクチャーを終了';
} else {
pipBtn.textContent = '⇲';
pipBtn.title = 'ピクチャーインピクチャーで再生';
}
}
pipBtn.addEventListener('click', async () => {
try {
if (document.pictureInPictureElement) {
await document.exitPictureInPicture();
} else {
await video.requestPictureInPicture();
}
updatePipButton();
} catch (err) {
console.error('PiP操作エラー:', err);
}
});
video.addEventListener('enterpictureinpicture', updatePipButton);
video.addEventListener('leavepictureinpicture', async () => {
updatePipButton();
if (isPlaying && !document.hidden) {
try {
await video.play();
} catch (err) {
console.error('PiP終了後の再生エラー:', err);
}
}
});
// リセットボタンクリック処理
resetBtn.addEventListener('click', () => {
const startTime = parseFloat(startTimeInput.value) || 0;
seekMedia(startTime);
if (isPlaying) {
playMedia();
}
});
// 初期化時にPiPボタンの状態を設定
updatePipButton();
function startSyncCheck() {
if (isCheckingSync) return;
isCheckingSync = true;
if (syncCheckInterval) clearInterval(syncCheckInterval);
syncCheckInterval = setInterval(checkSync, 1000);
}
function stopSyncCheck() {
isCheckingSync = false;
if (syncCheckInterval) clearInterval(syncCheckInterval);
}
function checkSync() {
if (!isAudioCombined || !isPlaying || isBuffering ||
isInBackgroundTab) return;
const videoTime = video.currentTime;
const audioTime = combinedAudioElement.currentTime;
const drift = videoTime - audioTime;
syncDriftLog.push(drift);
if (syncDriftLog.length > 5) syncDriftLog.shift();
const avgDrift = syncDriftLog.reduce((a, b) => a + b, 0) /
syncDriftLog.length;
syncStatusText.textContent = `同期ズレ: ${avgDrift.toFixed(3)}秒`;
if (Math.abs(avgDrift) > 0.1) {
console.log(`同期ズレを修正: ${avgDrift.toFixed(3)}秒`);
syncAudioWithVideo();
}
}
applyTimeBtn.addEventListener('click', function() {
// 現在再生中なら一時停止
const wasPlaying = isPlaying;
if (isPlaying) {
pauseMedia();
}
// 開始時間と終了時間を取得
const startTime = parseFloat(startTimeInput.value) || 0;
const endTime = parseFloat(endTimeInput.value) || video.duration;
// 現在位置が開始時間より前なら開始時間に移動
if (video.currentTime < startTime) {
video.currentTime = startTime;
if (combinedAudioElement) {
combinedAudioElement.currentTime = startTime;
}
}
// 現在位置が終了時間より後なら開始時間に移動
else if (video.currentTime > endTime) {
video.currentTime = startTime;
if (combinedAudioElement) {
combinedAudioElement.currentTime = startTime;
}
}
// 再生中だった場合は再開
if (wasPlaying) {
playMedia();
}
// マーカーを更新
updateProgressMarkers();
});
// 音声を動画に同期させる関数
function syncAudioWithVideo() {
if (!isAudioCombined || !isPlaying) return;
const currentTime = video.currentTime;
if (combinedAudioElement) {
combinedAudioElement.currentTime = currentTime;
if (isPlaying) {
combinedAudioElement.play().catch(e => console.error(
'音声再生エラー:', e));
}
}
// ズレ記録をリセット
syncDriftLog = [];
lastSyncTime = performance.now();
}
// 音声ファイルをロード
function loadAudioFiles() {
audioFiles.forEach(file => {
try {
const audio = new Audio(`${basePath}${file}.mp3`);
audio.preload = 'auto';
audio.loop = false;
audioElements[file] = audio;
audio.addEventListener('loadedmetadata', function() {
console.log(`${basePath}${file}.mp3 loaded`);
checkLoadingComplete();
});
audio.addEventListener('error', function() {
console.error(`音声ファイル読み込みエラー (${basePath}${file}.mp3):`,
audio.error);
checkLoadingComplete();
});
} catch (error) {
console.error(`音声ファイル初期化エラー (${basePath}${file}.mp3):`,
error);
checkLoadingComplete();
}
});
}
// 音声を結合する関数
async function combineAudio() {
if (combinedAudioElement) {
combinedAudioElement.pause();
combinedAudioElement.src = '';
URL.revokeObjectURL(combinedAudioElement.src);
}
combineButton.disabled = true;
combineStatus.textContent = "音声を合成中...";
try {
// 現在の音量設定を保存
audioFiles.forEach(file => {
currentVolumes[file] = parseFloat(document.querySelector(
`.audio-slider[data-audio="${file}"]`).value);
});
// 各音声ファイルをデコード
const audioBufferPromises = audioFiles.map(async file => {
const audio = audioElements[file];
if (!audio) return null;
// 音量が0の場合はスキップ
if (currentVolumes[file] === 0) return null;
const response = await fetch(`${basePath}${file}.mp3`);
const arrayBuffer = await response.arrayBuffer();
return await audioContext.decodeAudioData(arrayBuffer);
});
// すべての音声バッファを取得
const buffers = await Promise.all(audioBufferPromises);
audioFiles.forEach((file, index) => {
audioBuffers[file] = buffers[index];
});
// 最長の音声バッファの長さを取得
const maxDuration = Math.max(...buffers.filter(b => b).map(b =>
b.duration));
// 新しい音声バッファを作成
const combinedAudioBuffer = audioContext.createBuffer(
2, // ステレオ
audioContext.sampleRate * maxDuration,
audioContext.sampleRate
);
// 各音声バッファを結合
for (let file of audioFiles) {
if (!audioBuffers[file] || currentVolumes[file] === 0)
continue;
const buffer = audioBuffers[file];
const volume = currentVolumes[file];
// 各チャンネルに音声を加算
for (let channel = 0; channel < 2; channel++) {
const inputData = buffer.getChannelData(channel % buffer.numberOfChannels);
const outputData = combinedAudioBuffer.getChannelData(
channel);
for (let i = 0; i < inputData.length; i++) {
outputData[i] += inputData[i] * volume;
}
}
}
// 音量を正規化 (クリッピング防止)
for (let channel = 0; channel < 2; channel++) {
const outputData = combinedAudioBuffer.getChannelData(channel);
let max = 0;
for (let i = 0; i < outputData.length; i++) {
if (Math.abs(outputData[i]) > max) {
max = Math.abs(outputData[i]);
}
}
if (max > 1) {
for (let i = 0; i < outputData.length; i++) {
outputData[i] /= max;
}
}
}
// AudioBufferをBlobに変換
const blob = bufferToWave(combinedAudioBuffer);
const url = URL.createObjectURL(blob);
// 新しいaudio要素を作成
combinedAudioElement = new Audio(url);
combinedAudioElement.preservesPitch = true;
combinedAudioElement.mozPreservesPitch = true;
combinedAudioElement.webkitPreservesPitch = true;
combinedAudioElement.playbackRate = currentPlaybackRate;
isAudioCombined = true;
combineStatus.textContent = "音声の合成が完了しました";
enablePlayerControls();
combineButton.disabled = false;
document.addEventListener('visibilitychange', async () => {
if (document.hidden) {
isInBackgroundTab = true;
// 動画のみ停止
if (!document.pictureInPictureElement) {
video.pause();
}
// 音声とメトロノームは継続
if (combinedAudioElement && !combinedAudioElement.paused) {
await combinedAudioElement.play();
}
if (tl.isActive()) {
tl.play();
}
} else {
isInBackgroundTab = false;
if (combinedAudioElement && !combinedAudioElement.paused) {
video.currentTime = combinedAudioElement.currentTime;
if (isPlaying) {
await video.play();
}
}
}
});
// 動画終了時に自動的にPiPを閉じる(次回再開のため)
video.addEventListener('ended', exitPiP);
// 合成後に音量と再生速度を適用
applyVolume();
applyPlaybackRate();
} catch (error) {
console.error('音声合成エラー:', error);
combineStatus.textContent = "音声の合成に失敗しました";
combineButton.disabled = false;
}
}
function bufferToWave(abuffer) {
const numOfChan = abuffer.numberOfChannels,
length = abuffer.length * numOfChan * 2 + 44,
buffer = new ArrayBuffer(length),
view = new DataView(buffer),
channels = [],
sampleRate = abuffer.sampleRate;
// posをletで宣言(constから変更)
let pos = 0;
// write WAV header
setUint32(0x46464952); // "RIFF"
setUint32(length - 8); // file length - 8
setUint32(0x45564157); // "WAVE"
setUint32(0x20746d66); // "fmt " chunk
setUint32(16); // length = 16
setUint16(1); // PCM (uncompressed)
setUint16(numOfChan);
setUint32(sampleRate);
setUint32(sampleRate * 2 * numOfChan);
setUint16(numOfChan * 2);
setUint16(16);
setUint32(0x61746164); // "data" - chunk
setUint32(length - pos - 4);
// write interleaved data
for (let i = 0; i < abuffer.length; i++) {
for (let channel = 0; channel < numOfChan; channel++) {
let sample = abuffer.getChannelData(channel)[i] * 0x7fff;
if (sample < -32768) sample = -32768;
if (sample > 32767) sample = 32767;
view.setInt16(pos, sample, true);
pos += 2;
}
}
function setUint16(data) {
view.setUint16(pos, data, true);
pos += 2;
}
function setUint32(data) {
view.setUint32(pos, data, true);
pos += 4;
}
return new Blob([buffer], {
type: 'audio/wav'
});
}
function applyVolume() {
if (!isAudioCombined) return;
// ベース音量 (0-1)
const baseVolume = parseFloat(volumeSlider.value);
// グローバル音量係数 (0-10)
const globalVolume = parseFloat(globalVolumeSlider.value) / 10; // 0-1に変換
// 最終音量 (0-1)
const finalVolume = Math.max(0, Math.min(1, baseVolume *
globalVolume));
// 動画と音声の音量を設定
video.volume = finalVolume;
if (combinedAudioElement) {
combinedAudioElement.volume = finalVolume;
}
// 音量アイコンを更新
updateVolumeIcon();
}
function applyPlaybackRate() {
if (!isAudioCombined) return;
const speed = parseFloat(playbackSpeedSlider.value);
currentPlaybackRate = speed;
video.playbackRate = speed;
if (combinedAudioElement) {
combinedAudioElement.playbackRate = speed;
}
speedValue.textContent = speed.toFixed(2) + 'x';
playbackSpeedValue.textContent = speed.toFixed(2) + 'x';
speedSlider.value = speed;
}
// プレイヤーコントロールを有効化
function enablePlayerControls() {
disabledOverlay.style.display = 'none';
playPauseBtn.disabled = false;
volumeBtn.disabled = false;
volumeSlider.disabled = false;
speedSlider.disabled = false;
fullscreenBtn.disabled = false;
startTimeInput.disabled = false;
endTimeInput.disabled = false;
resetEndTimeBtn.disabled = false;
loopCheckbox.disabled = false;
globalVolumeSlider.disabled = false;
setStartTimeBtn.disabled = false;
setEndTimeBtn.disabled = false;
playbackSpeedSlider.disabled = false;
applyTimeBtn.disabled = false;
resetBtn.disabled = false; // 追加
pipBtn.disabled = false; // 追加
}
// プレビュー再生
function togglePreview() {
if (!isAudioCombined || !combinedAudioElement) return;
if (previewButton.textContent === '▶') {
// 再生
combinedAudioElement.currentTime = 0;
combinedAudioElement.play()
.then(() => {
previewButton.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#1f1f1f"><path d="M520-200v-560h240v560H520Zm-320 0v-560h240v560H200Zm400-80h80v-400h-80v400Zm-320 0h80v-400h-80v400Zm0-400v400-400Zm320 0v400-400Z"/></svg>';
// プレビューの時間表示を更新
const updatePreviewTime = () => {
if (!combinedAudioElement || !isAudioCombined) return;
const currentTime = combinedAudioElement.currentTime;
const duration = combinedAudioElement.duration;
if (currentTime >= duration) {
previewButton.textContent = '▶';
previewTime.textContent =
`00:00 / ${formatTime(duration)}`;
return;
}
previewTime.textContent =
`${formatTime(currentTime)} / ${formatTime(duration)}`;
requestAnimationFrame(updatePreviewTime);
};
updatePreviewTime();
})
.catch(e => console.error('プレビュー再生エラー:', e));
} else {
// 一時停止
combinedAudioElement.pause();
previewButton.textContent = '▶';
}
}
// 時間をフォーマットするヘルパー関数
function formatTime(seconds) {
const mins = Math.floor(seconds / 60);
const secs = Math.floor(seconds % 60);
return `${String(mins).padStart(2, '0')}:${String(secs).padStart(2, '0')}`;
}
// 動画のメタデータが読み込まれたら
video.addEventListener('loadedmetadata', function() {
try {
videoDuration = video.duration;
endTimeInput.value = videoDuration.toFixed(2);
endTimeInput.max = videoDuration;
startTimeInput.max = videoDuration - 0.1;
updateTimeDisplay();
checkLoadingComplete();
} catch (error) {
handleError(error, '動画メタデータ読み込み中にエラーが発生しました');
}
});
// 動画エラー処理
video.addEventListener('error', function() {
handleError(video.error, '動画読み込み中にエラーが発生しました');
});
// 再生ボタンクリック
playPauseBtn.addEventListener('click', function() {
const endTime = parseFloat(endTimeInput.value) ||
videoDuration;
if (video.currentTime >= endTime) {
const startTime = parseFloat(startTimeInput.value) || 0;
seekMedia(startTime);
}
togglePlayPause();
});
// 時間表示を更新
function updateTimeDisplay() {
const now = performance.now();
if (now - lastUpdateTime < updateInterval && !isFullscreen)
return;
lastUpdateTime = now;
try {
const currentTime = video.currentTime;
const duration = video.duration || videoDuration;
const currentMinutes = Math.floor(currentTime / 60);
const currentSeconds = Math.floor(currentTime % 60);
const currentMilliseconds = Math.floor((currentTime % 1) * 100);
const durationMinutes = Math.floor(duration / 60);
const durationSeconds = Math.floor(duration % 60);
const durationMilliseconds = Math.floor((duration % 1) * 100);
timeDisplay.textContent =
`${String(currentMinutes).padStart(2, '0')}:${String(currentSeconds).padStart(2, '0')}.${String(currentMilliseconds).padStart(2, '0')} / ` +
`${String(durationMinutes).padStart(2, '0')}:${String(durationSeconds).padStart(2, '0')}.${String(durationMilliseconds).padStart(2, '0')}`;
const progressPercent = (currentTime / duration) * 100;
progressBar.style.width = `${progressPercent}%`;
} catch (error) {
console.error('時間表示更新エラー:', error);
}
}
// 再生/一時停止をトグル
function togglePlayPause() {
if (isPlaying) {
pauseMedia();
} else {
playMedia();
}
}
function playMedia() {
try {
const duration = video.duration || videoDuration;
const startTime = parseFloat(startTimeInput.value) || 0;
const endTime = parseFloat(endTimeInput.value) || duration;
if (video.currentTime >= endTime) {
video.currentTime = startTime;
}
const playPromise = video.play();
if (playPromise !== undefined) {
playPromise.then(() => {
isPlaying = true;
playPauseBtn.textContent = '⏸';
// 音声を同期して再生
if (isAudioCombined) {
combinedAudioElement.currentTime = video.currentTime;
combinedAudioElement.play().catch(e => console.error(
'音声再生エラー:', e));
}
startSyncCheck();
video.playbackRate = currentPlaybackRate;
}).catch(error => {
console.error('動画再生エラー:', error);
isPlaying = false;
playPauseBtn.textContent = '▶';
});
}
} catch (error) {
console.error('メディア再生エラー:', error);
isPlaying = false;
playPauseBtn.textContent = '▶';
}
}
function pauseMedia() {
try {
video.pause();
isPlaying = false;
playPauseBtn.textContent = '▶';
stopSyncCheck();
if (combinedAudioElement) {
combinedAudioElement.pause();
}
} catch (error) {
console.error('メディア一時停止エラー:', error);
}
}
// 時間更新時の処理
video.addEventListener('timeupdate', function() {
updateTimeDisplay();
});
// プログレスバークリックでシーク
progressContainer.addEventListener('click', function(e) {
if (!video.duration) return;
const rect = this.getBoundingClientRect();
const pos = (e.clientX - rect.left) / rect.width;
const seekTime = pos * video.duration;
seekMedia(seekTime);
});
// 指定した時間にシーク (改良版)
function seekMedia(time) {
try {
const duration = video.duration || videoDuration;
const startTime = parseFloat(startTimeInput.value) || 0;
const endTime = parseFloat(endTimeInput.value) || duration;
const seekTime = Math.max(startTime, Math.min(time, endTime));
video.currentTime = seekTime;
if (combinedAudioElement) {
combinedAudioElement.currentTime = seekTime;
if (isPlaying) {
combinedAudioElement.play().catch(e => console.error(
'音声再生エラー:', e));
}
}
} catch (error) {
console.error('メディアシークエラー:', error);
}
}
// プログレスバー上でマウス移動時に時間を表示
progressContainer.addEventListener('mousemove', function(e) {
if (!video.duration) return;
const rect = this.getBoundingClientRect();
const pos = (e.clientX - rect.left) / rect.width;
const hoverTime = pos * video.duration;
const minutes = Math.floor(hoverTime / 60);
const seconds = Math.floor(hoverTime % 60);
const milliseconds = Math.floor((hoverTime % 1) * 100);
progressTime.textContent =
`${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}.${String(milliseconds).padStart(2, '0')}`;
progressTime.style.display = 'block';
progressTime.style.left = `${pos * 100}%`;
});
progressContainer.addEventListener('mouseleave', function() {
progressTime.style.display = 'none';
});
// 動画クリックで再生/一時停止
video.addEventListener('click', function() {
togglePlayPause();
});
volumeSlider.addEventListener('input', function() {
if (!isAudioCombined) return;
lastVolume = parseFloat(this.value);
applyVolume();
});
volumeBtn.addEventListener('click', function() {
if (!isAudioCombined) return;
if (video.volume > 0) {
lastVolume = parseFloat(volumeSlider.value);
volumeSlider.value = 0;
} else {
volumeSlider.value = lastVolume;
}
applyVolume();
});
// 音量アイコンを更新
function updateVolumeIcon() {
if (video.volume === 0) {
volumeBtn.textContent = '🔇';
} else if (video.volume < 3) {
volumeBtn.textContent = '🔈';
} else {
volumeBtn.textContent = '🔊';
}
}
// 再生速度スライダー (動画プレイヤー)
speedSlider.addEventListener('input', function() {
if (!isAudioCombined) return;
const speed = parseFloat(this.value);
speedValue.textContent = speed.toFixed(2) + 'x';
playbackSpeedSlider.value = speed;
playbackSpeedValue.textContent = speed.toFixed(2) + 'x';
updatePlaybackRate(speed);
});
// 再生速度スライダー (設定メニュー)
playbackSpeedSlider.addEventListener('input', function() {
if (!isAudioCombined) return;
const speed = parseFloat(this.value);
playbackSpeedValue.textContent = speed.toFixed(2) + 'x';
speedSlider.value = speed;
speedValue.textContent = speed.toFixed(2) + 'x';
updatePlaybackRate(speed);
});
// テンポ入力による再生速度更新
tempoInput.addEventListener('input', function() {
const tempo = parseFloat(this.value);
const baseTempo = isTMode ? 66 : 92;
const speed = tempo / baseTempo;
const clampedSpeed = Math.max(0.001, Math.min(5.0, speed));
playbackSpeedSlider.value = clampedSpeed;
playbackSpeedValue.textContent = clampedSpeed.toFixed(2) +
'x';
speedSlider.value = clampedSpeed;
speedValue.textContent = clampedSpeed.toFixed(2) + 'x';
tempoSpeedValue.textContent = clampedSpeed.toFixed(2) + 'x';
updatePlaybackRate(clampedSpeed);
});
function updatePlaybackRate(speed) {
if (!isAudioCombined) return;
currentPlaybackRate = speed;
video.playbackRate = speed;
// ピッチ保持を再設定
video.preservesPitch = true;
video.mozPreservesPitch = true;
video.webkitPreservesPitch = true;
if (combinedAudioElement) {
combinedAudioElement.playbackRate = speed;
// 合成音声のピッチ保持を設定
combinedAudioElement.preservesPitch = true;
combinedAudioElement.mozPreservesPitch = true;
combinedAudioElement.webkitPreservesPitch = true;
}
}
// 全画面ボタン
fullscreenBtn.addEventListener('click', function() {
if (!isFullscreen) {
if (videoContainer.requestFullscreen) {
videoContainer.requestFullscreen();
} else if (videoContainer.webkitRequestFullscreen) {
videoContainer.webkitRequestFullscreen();
} else if (videoContainer.msRequestFullscreen) {
videoContainer.msRequestFullscreen();
}
} else {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
}
});
// 全画面変更イベント
document.addEventListener('fullscreenchange',
handleFullscreenChange);
document.addEventListener('webkitfullscreenchange',
handleFullscreenChange);
document.addEventListener('msfullscreenchange',
handleFullscreenChange);
function handleFullscreenChange() {
isFullscreen = !!(document.fullscreenElement || document.webkitFullscreenElement ||
document.msFullscreenElement);
fullscreenBtn.textContent = isFullscreen ? '⛶' : '⛶';
video.controls = false;
// 全画面時にロックボタンを表示
lockControlsBtn.style.display = isFullscreen ? 'flex' : 'none';
// 全画面時にコントロールバー自動非表示機能を有効化
if (isFullscreen) {
resetControlsHideTimer();
document.addEventListener('mousemove',
handleFullscreenMouseMove);
} else {
document.removeEventListener('mousemove',
handleFullscreenMouseMove);
clearTimeout(controlsHideTimeout);
showControls();
}
}
// 全画面時のマウス移動処理
function handleFullscreenMouseMove() {
if (!isControlsLocked) {
showControls();
resetControlsHideTimer();
}
}
// コントロールバーを表示
function showControls() {
if (!controlsVisible) {
videoControls.style.opacity = '1';
controlsVisible = true;
}
}
// コントロールバーを非表示
function hideControls() {
if (!isControlsLocked && controlsVisible) {
videoControls.style.opacity = '0';
controlsVisible = false;
}
}
// コントロールバー非表示タイマーをリセット
function resetControlsHideTimer() {
clearTimeout(controlsHideTimeout);
if (!isControlsLocked) {
controlsHideTimeout = setTimeout(hideControls, 1500); // 1.5秒後に非表示
}
}
// ロックボタンのクリック処理
lockControlsBtn.addEventListener('click', function() {
isControlsLocked = !isControlsLocked;
this.classList.toggle('locked', isControlsLocked);
if (isControlsLocked) {
showControls();
clearTimeout(controlsHideTimeout);
} else {
resetControlsHideTimer();
}
});
// キーボードイベント (ESCで全画面終了)
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape' && isFullscreen) {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
}
});
// ボリュームスライダーのイベント
audioSliders.forEach((slider, index) => {
slider.addEventListener('input', function() {
const value = parseFloat(this.value);
volumeValues[index].textContent = value.toFixed(2);
const percent = value * 100;
this.style.backgroundSize = `${percent}% 100%`;
});
});
globalVolumeSlider.addEventListener('input', function() {
const value = parseFloat(this.value);
globalVolumeValue.textContent = value.toFixed(1);
const percent = (value - this.min) / (this.max - this.min) *
100;
this.style.backgroundSize = `${percent}% 100%`;
applyVolume();
});
// ループ設定変更時
loopCheckbox.addEventListener('change', function() {
// 合成音声ではループは動画に依存する
});
// 現在の秒数を開始時間に設定
setStartTimeBtn.addEventListener('click', function() {
startTimeInput.value = video.currentTime.toFixed(2);
updateProgressMarkers();
});
// 現在の秒数を終了時間に設定
setEndTimeBtn.addEventListener('click', function() {
endTimeInput.value = video.currentTime.toFixed(2);
updateProgressMarkers();
});
// 終了時間を動画の長さにリセット
resetEndTimeBtn.addEventListener('click', function() {
endTimeInput.value = video.duration.toFixed(2);
updateProgressMarkers();
});
// プログレスバーのマーカーを更新
function updateProgressMarkers() {
const duration = video.duration || 0;
const startTime = parseFloat(startTimeInput.value) || 0;
const endTime = parseFloat(endTimeInput.value) || duration;
if (duration > 0) {
if (startTime > 0) {
startMarker.style.left = `${(startTime / duration) * 100}%`;
startMarker.style.display = 'block';
} else {
startMarker.style.display = 'none';
}
if (endTime < duration) {
endMarker.style.left = `${(endTime / duration) * 100}%`;
endMarker.style.display = 'block';
} else {
endMarker.style.display = 'none';
}
}
}
// 開始/終了時間変更時にマーカーを更新
startTimeInput.addEventListener('input', updateProgressMarkers);
endTimeInput.addEventListener('input', updateProgressMarkers);
// 合成ボタンクリック
combineButton.addEventListener('click', combineAudio);
// プレビューボタンクリック
previewButton.addEventListener('click', togglePreview);
// 同期ステータスを閉じる
syncStatusClose.addEventListener('click', function() {
syncStatus.style.display = 'none';
});
// 初期化
loadAudioFiles();
updateVolumeIcon();
volumeSlider.value = video.volume;
video.controls = false;
// スライダーの背景を初期化
function initSliderBackgrounds() {
const sliders = [
volumeSlider,
speedSlider,
globalVolumeSlider,
playbackSpeedSlider,
...audioSliders
];
sliders.forEach(slider => {
if (slider) {
slider.style.backgroundImage =
'linear-gradient(#64ffda, #64ffda)';
slider.style.backgroundRepeat = 'no-repeat';
if (slider === globalVolumeSlider) {
const percent = (slider.value - slider.min) / (slider.max -
slider.min) * 100;
slider.style.backgroundSize = `${percent}% 100%`;
globalVolumeValue.textContent = slider.value;
} else {
slider.style.backgroundSize =
`${slider.value * 100}% 100%`;
}
}
});
}
initSliderBackgrounds();
startSyncCheck(); // 同期チェックを開始
// 初期テンポ設定
tempoInput.value = isTMode ? 66 : 92;
tempoInput.dispatchEvent(new Event('input'));
});
// タイムマーカー関連のコードを修正
document.addEventListener('DOMContentLoaded', function() {
// まず必要なDOM要素を取得
const startMarker = document.getElementById('start-marker');
const endMarker = document.getElementById('end-marker');
const video = document.getElementById('video');
const startTimeInput = document.getElementById('start-time');
const endTimeInput = document.getElementById('end-time');
// URLパラメータをチェック
const urlParams = new URLSearchParams(window.location.search);
const isTMode = urlParams.has('mode') && urlParams.get('mode') ===
't';
// タイムマーカーデータ
const timeMarkers = isTMode ? [{
label: '①[1番]',
time: 15.2
}, {
label: '②[1番]',
time: 43.8
}, {
label: '①[2番]',
time: 79.0
}, {
label: '②[2番]',
time: 108.0
}, {
label: '③',
time: 137.25
}, {
label: '④',
time: 162.55
}, {
label: '⑤',
time: 191.65
}] : [{
label: 'A',
time: 8.35
}, {
label: 'B',
time: 72.1
}, {
label: 'C',
time: 98.67
}, {
label: 'D',
time: 155.83
}, {
label: 'E',
time: 192.55
}];
// タイムマーカーを表示
const timeMarkersContainer = document.getElementById(
'time-markers-container');
timeMarkers.forEach(marker => {
const markerElement = document.createElement('div');
markerElement.className = 'time-marker';
markerElement.innerHTML =
`<b>${marker.label}</b>(${marker.time}秒)`;
markerElement.dataset.time = marker.time;
// ドラッグ開始
markerElement.addEventListener('dragstart', function(e) {
e.dataTransfer.setData('text/plain', marker.time);
this.classList.add('dragging');
});
// ドラッグ終了
markerElement.addEventListener('dragend', function() {
this.classList.remove('dragging');
});
// ドラッグ可能に設定
markerElement.draggable = true;
// クリックで開始時間に設定
markerElement.addEventListener('click', function() {
startTimeInput.value = marker.time;
updateProgressMarkers();
});
timeMarkersContainer.appendChild(markerElement);
});
// ドロップターゲットの設定
[startTimeInput, endTimeInput].forEach(input => {
// ドラッグオーバー
input.addEventListener('dragover', function(e) {
e.preventDefault();
this.style.backgroundColor = 'rgba(100, 255, 218, 0.2)';
});
// ドラッグリーブ
input.addEventListener('dragleave', function() {
this.style.backgroundColor = '';
});
// ドロップ
input.addEventListener('drop', function(e) {
e.preventDefault();
this.style.backgroundColor = '';
const time = parseFloat(e.dataTransfer.getData(
'text/plain'));
if (!isNaN(time)) {
this.value = time;
updateProgressMarkers();
}
});
});
// 入力ボックスの変更時にマーカーを更新
startTimeInput.addEventListener('input', updateProgressMarkers);
endTimeInput.addEventListener('input', updateProgressMarkers);
// updateProgressMarkers関数
function updateProgressMarkers() {
const duration = video.duration || 0;
const startTime = parseFloat(startTimeInput.value) || 0;
const endTime = parseFloat(endTimeInput.value) || duration;
if (duration > 0) {
if (startMarker) startMarker.style.left =
`${(startTime / duration) * 100}%`;
if (endMarker) endMarker.style.left =
`${(endTime / duration) * 100}%`;
if (startMarker) startMarker.style.display = 'block';
if (endMarker) endMarker.style.display = 'block';
}
}
});
</script>
</body>
</html> |