mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
1 line
1.0 KiB
JavaScript
1 line
1.0 KiB
JavaScript
(()=>{return(i,t)=>{function e(i){const t=/((\d)*:)?(\d)*:(\d)*/g;const e=i.text();const n=e.match(t);if(!n){return}const r=n[0].split(":");const o=(()=>{if(r.length===3){const[i,t,e]=r.map(i=>parseInt(i));return i*60*60+t*60+e}else if(r.length===2){const[i,t]=r.map(i=>parseInt(i));return i*60+t}else{logError(`解析历史时间发生错误: historyTime=${JSON.stringify(r)}`);return NaN}})();const s=i.parent();const l=document.querySelector("video");if(o<l.duration){l.currentTime=o;l.play();s.find(".bilibili-player-video-toast-item-jump").remove();const t=$(`<div class="bilibili-player-video-toast-item-jump">从头开始</div>`);t.appendTo(s).on("click",()=>l.currentTime=0);i.html(`<span>已跳转到上次历史记录</span><span>${n[0]}</span>`)}else{s.find(".bilibili-player-video-toast-item-close").get(0).click()}}function n(){SpinQuery.condition(()=>$(".bilibili-player-video-toast-item-text"),i=>i.text().indexOf("上次看到")!==-1,i=>e(i.filter((i,t)=>t.innerText.indexOf("上次看到")!==-1)))}Observer.childList("#bofqi",n)}})(); |