From 75e2f5b208fbadfa4502d081fbae62970c5f2767 Mon Sep 17 00:00:00 2001 From: lsamc <2322176165@qq.com> Date: Mon, 31 Aug 2026 01:21:04 -0400 Subject: [PATCH] Fix remembering normal playback speed --- ...0\247\206\351\242\221\347\253\231h5.user.js" | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git "a/\350\247\206\351\242\221\347\253\231h5.user.js" "b/\350\247\206\351\242\221\347\253\231h5.user.js" index a590080..56edf36 100644 --- "a/\350\247\206\351\242\221\347\253\231h5.user.js" +++ "b/\350\247\206\351\242\221\347\253\231h5.user.js" @@ -338,6 +338,15 @@ const adjustRate = n => { else if (n > 16) v.playbackRate = 16; else v.playbackRate = +n.toFixed(2); }; +const rememberPlayRate = rate => { + if (!rate) return; + localStorage.mvPlayRate = rate; + if (rate != 1) localStorage.mvLastPlayRate = rate; +}; +const getFastPlayRate = () => { + const rate = +localStorage.mvPlayRate; + return +localStorage.mvLastPlayRate || (rate != 1 && rate) || 1.3; +}; const adjustVolume = n => { n += v.volume; if (inRange(n, 0, 1)) v.volume = +n.toFixed(2); @@ -501,9 +510,9 @@ cacheMV.onChache = cacheMV.onChache.bind(cacheMV); const actList = new Map(); actList.set(90, _ => { //按键Z: 切换加速状态 if (v.playbackRate == 1 || v.playbackRate == 0) { - v.playbackRate = +localStorage.mvPlayRate || 1.3; + v.playbackRate = getFastPlayRate(); } else { - // localStorage.mvPlayRate = v.playbackRate; + localStorage.mvLastPlayRate = v.playbackRate; v.playbackRate = 1; } }) @@ -619,7 +628,7 @@ const app = { if (!cfg.isLive && GM_getValue('remberRate', true)) { v.playbackRate = +localStorage.mvPlayRate || 1; v.addEventListener('ratechange', ev => { - if (v.playbackRate && v.playbackRate != 1) localStorage.mvPlayRate = v.playbackRate; + rememberPlayRate(v.playbackRate); }); } this.setShell(); @@ -752,7 +761,7 @@ const app = { else { if (bRate) v.playbackRate = +localStorage.mvPlayRate || 1; v.addEventListener('ratechange', ev => { - if (bRate && v.playbackRate && v.playbackRate != 1) localStorage.mvPlayRate = v.playbackRate; + if (bRate) rememberPlayRate(v.playbackRate); }); }