1// videoToggle.ts 2(() => { 3 const config = { 4 rootSelector: '.js-video', 5 videoSelector: '.fn-video-media', 6 buttonSelector: '.js-video-toggle', 7 buttonTextSelector: '.fn-video-toggle__text', 8 classIsPlay: 'is-play', 9 textPlay: 'åçãã', 10 textPause: '忢ãã', 11 }; 12 const roots = document.querySelectorAll(config.rootSelector); 13 if (!roots.length) 14 return; 15 roots.forEach((root) => { 16 const videos = root.querySelectorAll(config.videoSelector); 17 const btn = root.querySelector(config.buttonSelector); 18 const btnText = root.querySelector(config.buttonTextSelector); 19 if (!videos.length || !btn || !btnText) 20 return; 21 // 表示ããã¦ãã video ãåå¾ 22 const getActiveVideo = () => { 23 return Array.from(videos).find((video) => { 24 return window.getComputedStyle(video).display !== 'none'; 25 }); 26 }; 27 btn.addEventListener('click', () => { 28 const video = getActiveVideo(); 29 if (!video) 30 return; 31 if (video.paused) { 32 // åçãã 33 video.play(); 34 btnText.textContent = config.textPause; 35 btn.classList.remove(config.classIsPlay); 36 } 37 else { 38 // 忢ãã 39 video.pause(); 40 btnText.textContent = config.textPlay; 41 btn.classList.add(config.classIsPlay); 42 } 43 }); 44 }); 45})(); 46export {};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.