// ==UserScript== // @name 小宇宙播客倍速播放 // @namespace https://t.tampermonkey.netion 1.1 // @description 為小宇宙網頁版新增播放倍速控制功能 // @author You // @match https://t.co/oV7FDA6DLX* xiaoyuzhoufm.com/episode/serScript== (function() { 'use strict'; // 等待音訊元素加載 function waitForAudio() { const audio = document.querySelector('audio'); if (audio) { addSpeedControl(audio); } else { setTimeout(waitForAudio, 500); } } // 增加倍速控制 function addSpeedControl(audio) { // 建立倍速控制容器 const speedContainer = document.createElement('div'); https://t.co/NnVY7mFfir.cssText = ` position: fixed; top: 80px; right: 20px; background: white; border-radius: 8px; padding: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); z-index: 1000; display: flex; flex-direction: column; gap: 8px; `; // 倍速選項 const speeds = [0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0]; // 建立標題 const title = document.createElement('div'); title.textContent = '播放倍速'; https://t.co/kkc695BtY1.cssText = ` font-size: 12px; color: #666; text-align: center; margin-bottom: 5px; `; speedContainer.appendChild(title); // 建立倍速按鈕 speeds.forEach(speed => { const btn = document.createElement('button'); btn.textContent = `${speed}x`; https://t.co/5ZBU1WBy4L.cssText = ` padding: 8px 15px; border: 1px solid #ddd; border-radius: 5px; background: white; cursor: pointer; font-size: 14px; transition: all 0.2s; `; // 設定目前倍速的樣式 if (speed === 1.0) { https://t.co/5ZBU1WBy4L.background = 'var(--theme-color, #25B4E1)'; https://t.co/5ZBU1WBy4L.color = 'white'; https://t.co/5ZBU1WBy4L.borderColor = 'var(--theme-color, #25B4E1)'; } btn.addEventListener('click', () => { audio.playbackRate = speed; // 更新所有按鈕樣式 speedContainer.querySelectorAll('button').forEach(b => { https://t.co/kqnhnypYTa.background = 'white'; https://t.co/kqnhnypYTa.color = 'black'; https://t.co/kqnhnypYTa.borderColor = '#ddd'; }); // 高亮目前按鈕 https://t.co/5ZBU1WBy4L.background = 'var(--theme-color, #25B4E1)'; https://t.co/5ZBU1WBy4L.color = 'white'; https://t.co/5ZBU1WBy4L.borderColor = 'var(--theme-color, #25B4E1)'; }); btn.addEventListener('mouseenter', () => { if (audio.playbackRate !== speed) { https://t.co/5ZBU1WBy4L.background = '#f5f5f5'; } }); btn.addEventListener('mouseleave', () => { if (audio.playbackRate !== speed) { https://t.co/5ZBU1WBy4L.background = 'white'; } }); speedContainer.appendChild(btn); }); // 新增到頁面 document.body.appendChild(speedContainer); // 新增快捷鍵支援 document.addEventListener('keydown', (e) => { // 使用數字鍵1-7 快速切換倍速 if (e.key >= '1' && e.key <= '7') { const index = parseInt(e.key) - 1; if (speeds[index]) { audio.playbackRate = speeds[index]; // 觸發對應按鈕的點擊效果 speedContainer.querySelectorAll('button')[index + 1].click(); } } }); console.log('倍速控制已新增!可使用數字鍵1-7快速切換倍速'); } // 開始監聽 waitForAudio(); })();
正在載入線程內容
正在從 X 取得原始推文,整理成清爽的閱讀畫面。
通常只需幾秒鐘,請稍候。