diff --git a/bilibili-evolved.offline.user.js b/bilibili-evolved.offline.user.js index 35a0cb7ce..6e0df3e02 100644 --- a/bilibili-evolved.offline.user.js +++ b/bilibili-evolved.offline.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name Bilibili Evolved (Offline) -// @version 257.35 +// @version 257.93 // @description Bilibili Evolved 的离线版, 所有功能都已内置于脚本中. // @author Grant Howard, Coulomb-G // @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G) @@ -942,10 +942,10 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/toast.min.js"] = (()=>{return(t,e)=>{class s{constructor(t="",e="",s="default"){this.type=s;this.message=t;this.title=e;this.duration=3e3;this.element=$(this.cardHtml)[0];document.querySelector(".toast-card-container").insertAdjacentElement("beforeend",this.element)}show(){this.element.classList.add("visible");this.element.querySelector(".toast-card-dismiss").addEventListener("click",()=>this.dismiss());if(this.duration){setTimeout(()=>this.dismiss(),this.duration)}}dismiss(){if(this.element.classList.contains("visible")){this.element.addEventListener("transitionend",()=>this.element.remove());this.element.classList.remove("visible")}}get cardHtml(){return`\n
\n
\n

${this.title}

\n
\n \n
\n
\n
${this.message}
\n
\n `}static get container(){return document.querySelector(".toast-card-container")}static createToastContainer(){if(!document.querySelector(".toast-card-container")){document.body.insertAdjacentHTML("beforeend",`
`)}}static internalShow(t,e,i,n){const a=new s(t,e,n);a.duration=i;a.show();return a}static show(t,e,s){return this.internalShow(t,e,s,"default")}static info(t,e,s){return this.internalShow(t,e,s,"info")}static success(t,e,s){return this.internalShow(t,e,s,"success")}static error(t,e,s){return this.internalShow(t,e,s,"error")}}e.applyStyle("toastStyle");s.createToastContainer();return{export:s}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/touch-navbar.min.js"] = (()=>{return(e,r)=>{SpinQuery.count(()=>document.querySelectorAll("ul.fr>li.nav-item:not(.profile-info)"),6,e=>{e.forEach(e=>{e.style.cursor="pointer";const r=e.querySelector("a.t");r.removeAttribute("href")})})}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/touch-player.min.css"] = `.touch-video-box-wrapper{display:flex;align-items:center;justify-content:center;width:100%;height:100%;position:absolute;top:0;left:0;z-index:14;pointer-events:none}.touch-video-box{border-radius:0;display:flex;align-items:center;justify-content:center;width:100%;height:100%;background:rgba(0,0,0,.85);position:relative;max-width:520px;max-height:240px;border:4px solid transparent;transform-origin:center}.bilibili-player-video-control-top,.touch-video-box.animation{transition:.2s}@supports (backdrop-filter:blur(60px)) or (-webkit-backdrop-filter:blur(60px)){.touch-video-box{background:rgba(0,0,0,.618);-webkit-backdrop-filter:blur(60px);backdrop-filter:blur(60px)}}.touch-video-info{color:#fff;font-size:2rem;text-align:center;display:flex;align-items:center;justify-content:center;flex-direction:column;height:100%;width:100%}.touch-row{flex-grow:1;display:flex;align-items:center;justify-content:center;width:100%}.touch-info{display:block;color:var(--theme-color)}.touch-result{display:block;font-size:1.5rem;line-height:150%}.touch-speed{display:block;background:rgba(0,0,0,.1);padding:.5em}.touch-progress{position:absolute;bottom:0;left:0;background:var(--theme-color);width:100%;transform-origin:left;transform:scaleX(0);height:4px;transition:.2s}.touch-row-item{flex:1 0 0;display:flex;align-items:center;justify-content:center}.touch-row-item-wide{flex:1.5 0 0;display:flex;align-items:center;justify-content:center}.videoshot{background-color:transparent;background-image:none;transform-origin:center;transform:scale(.9)}.adjust-closed{transform:rotateX(90deg) rotateY(90deg) scale(.5)}.adjust-opened{transform:rotateX(0) rotateY(0) scale(1)}.disable-original-hover .bilibili-player-video-control-bottom,.disable-original-hover .bilibili-player-video-control-mask{opacity:0!important;visibility:hidden!important}.disable-original-hover .bilibili-player-video-control-wrap,.disable-original-hover.touch-video-control-show .bilibili-player-video-control-bottom,.disable-original-hover.touch-video-control-show .bilibili-player-video-control-mask{opacity:1!important;visibility:visible!important}.bilibili-player-video-control-top,.disable-original-hover .bilibili-player-video-control-top{left:0!important;right:0!important;bottom:0!important}.bilibili-player-video-control-top{bottom:0!important}.disable-original-hover.touch-video-control-show .bilibili-player-video-control-top{left:0!important;right:0!important;bottom:38px!important}div.bilibili-player-video-control{height:38px!important;align-items:center!important}.bilibili-player-video-btn{flex-grow:1!important;height:100%!important;display:flex!important;align-items:center!important;justify-content:center!important}.bilibili-player-video-inputbar,.bilibili-player-video-progress{flex-grow:30!important}.bilibili-player-video-quality-menu{display:flex!important;align-items:center!important;justify-content:center!important}.bilibili-player-iconfont-color,.bilibili-player-iconfont-danmaku,.bilibili-player-iconfont-danmaku-off,.bilibili-player-iconfont-fullscreen,.bilibili-player-iconfont-pause,.bilibili-player-iconfont-repeat,.bilibili-player-iconfont-setting,.bilibili-player-iconfont-start,.bilibili-player-iconfont-volume,.bilibili-player-iconfont-volume-max,.bilibili-player-iconfont-volume-min,.bilibili-player-iconfont-web-fullscreen,.bilibili-player-iconfont-widescreen{font-size:2.5rem!important}.bilibili-player-iconfont-next{font-size:2rem!important}.bilibili-player-video-btn-setting-panel,.bilibili-player-video-danmaku-setting-wrap,.bilibili-player.mode-fullscreen .bilibili-player-video-sendbar,.bpui-selectmenu-list{left:unset!important;bottom:38px!important}.bilibili-player-video-volumebar-wrp{left:unset!important}.bilibili-player-video-control-wrap{padding:0!important}.bilibili-player-video-control-bottom{padding:0!important;align-items:center!important}.bilibili-player-iconfont-next,.bilibili-player-iconfont-setting,.bilibili-player-video-btn-volume.video-state-volume-max .bilibili-player-iconfont-volume-max,.bilibili-player-video-btn-volume.video-state-volume-min .bilibili-player-iconfont-volume-min,.bilibili-player-video-btn-volume:not(.video-state-volume-max):not(.video-state-volume-min) .bilibili-player-iconfont-volume,.bilibili-player-video-control-bottom-left{display:flex!important;align-items:center!important}.bilibili-player-video-btn-danmaku{flex-grow:0!important;display:flex!important;align-items:center!important;height:100%!important;margin:0!important;padding:0!important}.bilibili-player.mode-webfullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control-bottom-right{flex-grow:1!important}.bilibili-player.mode-fullscreen .bilibili-player-video-sendbar{bottom:0!important}.bilibili-player .bilibili-player-area .bilibili-player-video-control .bilibili-player-video-btn.bilibili-player-video-btn-fullscreen{margin-right:0!important;padding-right:8px!important}.bilibili-player .bilibili-player-area .bilibili-player-video-control .bilibili-player-video-btn.bilibili-player-video-btn-start{padding-left:8px!important;flex-grow:1.2!important;margin-right:0!important;margin-left:0!important}.bilibili-player .bilibili-player-area .bilibili-player-video-control .bilibili-player-video-btn{padding:0 3px!important}.bilibili-player .bilibili-player-area .bilibili-player-video-control-bottom,.bilibili-player .bilibili-player-area .bilibili-player-video-control-bottom-right,.bilibili-player-video-control-bottom-left{height:100%!important;margin:0!important}.bilibili-player-video-btn-setting-panel-hover-bridge{display:none!important}.disable-original-hover .bilibili-player-video-control-wrap:hover .bilibili-player-video-control-top .bilibili-player-video-progress-slider,.disable-original-hover.bilibili-player-area.video-control-show .bilibili-player-video-control-top .bilibili-player-video-progress-slider{height:2px!important}.disable-original-hover.bilibili-player-area .bilibili-player-video-control .bilibili-player-video-progress-detail.show{bottom:1px!important}#bofqi *{-webkit-tap-highlight-color:transparent!important}@media screen and (min-width:750px){.bilibili-player.mode-fullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control-bottom-center .bilibili-player-video-sendbar .bilibili-player-video-inputbar,.bilibili-player.mode-webfullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control-bottom-center .bilibili-player-video-sendbar .bilibili-player-video-inputbar{background:#fff1!important}.bilibili-player.mode-fullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control,.bilibili-player.mode-webfullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control{height:100%!important;margin:0!important}.bilibili-player.mode-fullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control-bottom,.bilibili-player.mode-webfullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control-bottom{margin:0!important}.bilibili-player.mode-fullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control-bottom-left,.bilibili-player.mode-webfullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control-bottom-left{height:100%!important}.bilibili-player-video-btn.bilibili-player-video-btn-start{flex-grow:.5!important}.player .bilibili-player.mode-fullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control-top,.player .bilibili-player.mode-webfullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control-top{left:0!important;right:0!important}.player .bilibili-player.mode-fullscreen .disable-original-hover.bilibili-player-video-control-wrap .bilibili-player-video-control-top,.player .bilibili-player.mode-webfullscreen .disable-original-hover.bilibili-player-video-control-wrap .bilibili-player-video-control-top{left:0!important;right:0!important;bottom:0!important}.player .bilibili-player.mode-fullscreen .disable-original-hover.touch-video-control-show .bilibili-player-video-control-top,.player .bilibili-player.mode-webfullscreen .disable-original-hover.touch-video-control-show .bilibili-player-video-control-top{left:0!important;right:0!important;bottom:54px!important}.mode-fullscreen .bilibili-player-area.mouse-hover:not(.disable-original-hover) .bilibili-player-video-control-top,.mode-fullscreen .bilibili-player-area.video-control-show:not(.disable-original-hover) .bilibili-player-video-control-top,.mode-webfullscreen .bilibili-player-area.mouse-hover:not(.disable-original-hover) .bilibili-player-video-control-top,.mode-webfullscreen .bilibili-player-area.video-control-show:not(.disable-original-hover) .bilibili-player-video-control-top{left:0!important;right:0!important;bottom:48px!important}}`; -offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/touch-player.min.js"] = (()=>{return(t,i)=>{const e=t=>{let i=0;let e=0;while(t&&!isNaN(t.offsetLeft)&&!isNaN(t.offsetTop)){i+=t.offsetLeft-t.scrollLeft;e+=t.offsetTop-t.scrollTop;t=t.offsetParent}return{x:i,y:e}};const o=t=>{t=Math.abs(t);const i=Math.floor(t/3600);const e=Math.floor((t-i*3600)/60);const o=t-i*3600-e*60;let s=fixed(o)+"秒";if(e>0){s=e+"分"+s}if(i>0){s=i+"时"+s}return s};const s=t=>{t=Math.abs(t);const i=Math.floor(t/3600);const e=Math.floor((t-i*3600)/60);const o=t-i*3600-e*60;let s=(o<10?"0":"")+fixed(o);s=(e<10?"0":"")+e+":"+s;s=(i<10?"0":"")+i+":"+s;return s};class n{constructor(t){this.action=new l(t);this.onTouchStart=null;this.onTouchEnd=null;this.direction=null;t.addEventListener("touchstart",t=>{this.xDown=t.touches[0].clientX;this.yDown=t.touches[0].clientY;if(this.onTouchStart){this.onTouchStart(t)}});t.addEventListener("touchmove",i=>{if(!this.xDown||!this.yDown){return}const o=i.touches[0].clientX;const s=i.touches[0].clientY;const n=e(t);const l={x:(i.touches[0].pageX-n.x)/t.clientWidth,y:(i.touches[0].pageY-n.y)/t.clientHeight,width:t.clientWidth,height:t.clientHeight};const a=this.xDown-o;const c=this.yDown-s;if(!this.direction){let t="";if(Math.abs(a)>Math.abs(c)){t="horizontal"}else{t="vertical"}this.direction=t;i.preventDefault()}else{if(this.direction==="vertical"){this.action.startAction(this.direction,c,l)}else if(this.direction==="horizontal"){this.action.startAction(this.direction,-a,l)}i.preventDefault()}});t.addEventListener("touchend",t=>{this.xDown=null;this.yDown=null;this.direction=null;if(this.onTouchEnd){this.onTouchEnd(t)}})}}class l{constructor(t){this.lowSpeedForward=null;this.lowSpeedBackward=null;this.mediumSpeedForward=null;this.mediumSpeedBackward=null;this.highSpeedForward=null;this.highSpeedBackward=null;this.lowVolumeUp=null;this.lowVolumeDown=null;this.mediumVolumeUp=null;this.mediumVolumeDown=null;this.highVolumeUp=null;this.highVolumeDown=null;this.speedCancel=null;this.volumeCancel=null;this.minSwipeDistance=20;this.onActionStart=null;this.onActionEnd=null;this.element=t;this.touchStart=false;this.startPosition=null;this.lastAction=null;t.addEventListener("touchstart",t=>{this.touchStart=true});t.addEventListener("touchend",t=>{this.startPosition=null;this.onActionEnd&&this.onActionEnd(this.lastAction);this.lastAction=null})}startAction(t,i,e){if(this.touchStart){this.onActionStart&&this.onActionStart(t);this.startPosition=e;this.touchStart=false}if(t==="vertical"){if(Math.abs(i)=1/3&&this.startPosition.x<=2/3){t=1;o=this.mediumVolumeUp;s=this.mediumVolumeDown}else{t=2;o=this.highVolumeUp;s=this.highVolumeDown}if(i>0){const s=Math.round(t*100*(i-this.minSwipeDistance)/(1.5*e.height));o&&o(s);this.lastAction={type:"volume",volume:s}}else{const o=Math.round(t*100*(i+this.minSwipeDistance)/(1.5*e.height));s&&s(o);this.lastAction={type:"volume",volume:o}}}}else if(t==="horizontal"){if(e.y<1/3&&(e.x<.1||e.x>.9)||Math.abs(i)=1/3&&this.startPosition.y<=2/3){t=.2;e=this.mediumSpeedForward;o=this.mediumSpeedBackward}else{t=1;e=this.highSpeedForward;o=this.highSpeedBackward}if(i>0){const o=(i-this.minSwipeDistance)*t;e&&e(o);this.lastAction={type:"playback",seconds:o}}else{const e=(i+this.minSwipeDistance)*t;o&&o(e);this.lastAction={type:"playback",seconds:e}}}}}}class a{constructor(){this.aid=unsafeWindow.aid;this.cid=unsafeWindow.cid;this.cidData=null;this.supportWebp=a.supportWebp}getVideoshot(t,i){if(!this.cidData){downloadText(`https://api.bilibili.com/x/player/videoshot?aid=${this.aid}&cid=${this.cid}&index=1`).then(e=>{this.cidData=JSON.parse(e).data;this.getVideoshot(t,i)})}else{const e=this.cidData;const o=e.index;let s=0;for(let i=0;i=o[i]&&tt.replace(".jpg",".jpg@.webp"))}const l=parseInt(e.pv_x_len)||10;const a=parseInt(e.pv_y_len)||10;const c=parseInt(e.pv_x_size)||160;const r=parseInt(e.pv_y_size)||90;const d=-(s%100%l)*c;const h=-Math.floor(s%100/a)*r;i({width:c,height:r,backgroundImage:`url(${n[Math.floor(s/100)]})`,backgroundPosition:`${d}px ${h}px`})}}static get supportWebp(){try{const t=document.createElement("canvas");if(t.getContext&&t.getContext("2d"))try{return t.toDataURL("image/webp").indexOf("data:image/webp")===0}catch(t){return false}else return false}catch(t){return false}}}function c(t){t.unbind("click")}function r(i){if($(".touch-video-box").length!==0){return}$(".bilibili-player-video-subtitle").before(`\n
\n
\n
\n
\n
\n
`);const e=$("video");const l=e.prop("duration");const c=new n(i.get(0));const r=document.getElementsByClassName("touch-video-info")[0];const d=document.getElementsByClassName("touch-video-box")[0];let h=Math.round(e.prop("volume")*100);const u=t=>{t/=100;if(t<0){t=0}else if(t>1){t=1}e.prop("volume",t);const i=JSON.parse(localStorage.bilibili_player_settings);i.video_status.volume=t;localStorage.bilibili_player_settings=JSON.stringify(i);$(".bilibili-player-video-volume-num").text(Math.round(t*100));$(".bui-thumb").css("transform",`translateY(-${48*t}px)`);$(".bui-track-vertical .bui-bar").css("transform",`scaleY(${t})`);if(t===0){$(".bilibili-player-video-btn-volume").addClass("video-state-volume-min");$(".bilibili-player-video-btn-volume").removeClass("video-state-volume-max");e.prop("muted",true)}else if(t===1){$(".bilibili-player-video-btn-volume").removeClass("video-state-volume-min");$(".bilibili-player-video-btn-volume").addClass("video-state-volume-max");e.prop("muted",false)}else{$(".bilibili-player-video-btn-volume").removeClass("video-state-volume-min");$(".bilibili-player-video-btn-volume").removeClass("video-state-volume-max");e.prop("muted",false)}};if(t.touchVideoPlayerAnimation){d.classList.add("animation")}c.action.onActionStart=(t=>{d.classList.add("adjust-opened");r.innerHTML="";h=Math.round(e.prop("volume")*100)});const p=new a;const m=t=>{return i=>{const n=e.prop("currentTime");const a=fixed(100*n/l);let c=n+i;let d=fixed(100*c/l);let h=i;if(c>l){c=l;d=100;h=l-n}else if(c<0){c=0;d=0;h=n}const u=`${s(n)} (${a}%)
👇
${s(c)} (${d}%)`;const m=`\n
\n
\n ${t}速\n
\n
\n 进度: ${i>0?"+":"-"}${o(h)}\n
\n
\n
\n
\n
\n
\n
\n ${u}\n
\n
\n `;r.innerHTML=m;p.getVideoshot(c,t=>$(".videoshot").css(t));$(".touch-progress").css("transform",`scaleX(${d/100})`)}};c.action.lowSpeedBackward=m("低");c.action.lowSpeedForward=m("低");c.action.mediumSpeedBackward=m("中");c.action.mediumSpeedForward=m("中");c.action.highSpeedBackward=m("高");c.action.highSpeedForward=m("高");const v=t=>{return i=>{let e=h+i;let o=Math.abs(i);if(e>100){e=100;o=100-h}else if(e<0){e=0;o=h}const s=`${h} 👉 ${e}`;u(e);const n=`\n
\n
\n ${t}速\n
\n
\n 音量: ${i>0?"+":"-"}${o}\n
\n
\n
\n
\n ${s}\n
\n
\n `;r.innerHTML=n;$(".touch-progress").css("transform",`scaleX(${e/100})`)}};c.action.lowVolumeUp=v("低");c.action.lowVolumeDown=v("低");c.action.mediumVolumeUp=v("中");c.action.mediumVolumeDown=v("中");c.action.highVolumeUp=v("高");c.action.highVolumeDown=v("高");c.action.speedCancel=(()=>{r.innerHTML=`松开手指,取消进退`;$(".touch-progress").css("transform","scaleX(0)")});c.action.volumeCancel=(()=>{r.innerHTML=`松开手指,取消调整`;$(".touch-progress").css("transform","scaleX(0)");u(h)});if(!unsafeWindow.TOUCH_PLAYER_DEBUG){c.action.onActionEnd=(t=>{r.innerHTML="";if(t){if(t.type==="playback"){let i=e.prop("currentTime");i+=t.seconds;if(i<0){i=0}else if(i>l){i=l}e.prop("currentTime",i)}}d.classList.remove("adjust-opened")})}}function d(t){if(!t.hasClass("disable-original-hover")){t.addClass("disable-original-hover");const i=unsafeWindow.$(".bilibili-player-video");const e="touch-video-control-show";const o=i.data("events").click[0].handler;const s=new DoubleClickEvent(t=>o(t),()=>t.toggleClass(e));i.unbind("click");s.bind(i[0])}}const h=()=>{SpinQuery.any(()=>$(".bilibili-player-iconfont,.bilibili-player-video-quality-menu"),c);SpinQuery.condition(()=>$(".bilibili-player-video"),t=>t.length>0&&$("video").length>0&&$("video").prop("duration"),r);if(t.touchVideoPlayerDoubleTapControl){new SpinQuery(()=>$(".bilibili-player-area"),t=>t.length>0&&unsafeWindow.$&&unsafeWindow.$(".bilibili-player-video").data("events"),d).start()}};if(Observer.videoChange){Observer.videoChange(h)}else{Observer.childList("#bofqi",()=>h())}i.applyStyle("touchPlayerStyle")}})(); +offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/touch-player.min.js"] = (()=>{return(t,i)=>{const e=t=>{let i=0;let e=0;while(t&&!isNaN(t.offsetLeft)&&!isNaN(t.offsetTop)){i+=t.offsetLeft-t.scrollLeft;e+=t.offsetTop-t.scrollTop;t=t.offsetParent}return{x:i,y:e}};const s=t=>{t=Math.abs(t);const i=Math.floor(t/3600);const e=Math.floor((t-i*3600)/60);const s=t-i*3600-e*60;let o=fixed(s)+"秒";if(e>0){o=e+"分"+o}if(i>0){o=i+"时"+o}return o};const o=t=>{t=Math.abs(t);const i=Math.floor(t/3600);const e=Math.floor((t-i*3600)/60);const s=t-i*3600-e*60;let o=(s<10?"0":"")+fixed(s);o=(e<10?"0":"")+e+":"+o;o=(i<10?"0":"")+i+":"+o;return o};class n{constructor(t){this.action=new l(t);this.onTouchStart=null;this.onTouchEnd=null;this.direction=null;t.addEventListener("touchstart",t=>{this.xDown=t.touches[0].clientX;this.yDown=t.touches[0].clientY;if(this.onTouchStart){this.onTouchStart(t)}});t.addEventListener("touchmove",i=>{if(!this.xDown||!this.yDown){return}const s=i.touches[0].clientX;const o=i.touches[0].clientY;const n=e(t);const l={x:(i.touches[0].pageX-n.x)/t.clientWidth,y:(i.touches[0].pageY-n.y)/t.clientHeight,width:t.clientWidth,height:t.clientHeight};const a=this.xDown-s;const c=this.yDown-o;if(!this.direction){let t="";if(Math.abs(a)>Math.abs(c)){t="horizontal"}else{t="vertical"}this.direction=t;i.preventDefault()}else{if(this.direction==="vertical"){this.action.startAction(this.direction,c,l)}else if(this.direction==="horizontal"){this.action.startAction(this.direction,-a,l)}i.preventDefault()}});t.addEventListener("touchend",t=>{this.xDown=null;this.yDown=null;this.direction=null;if(this.onTouchEnd){this.onTouchEnd(t)}})}}class l{constructor(t){this.lowSpeedForward=null;this.lowSpeedBackward=null;this.mediumSpeedForward=null;this.mediumSpeedBackward=null;this.highSpeedForward=null;this.highSpeedBackward=null;this.lowVolumeUp=null;this.lowVolumeDown=null;this.mediumVolumeUp=null;this.mediumVolumeDown=null;this.highVolumeUp=null;this.highVolumeDown=null;this.speedCancel=null;this.volumeCancel=null;this.minSwipeDistance=20;this.onActionStart=null;this.onActionEnd=null;this.element=t;this.touchStart=false;this.startPosition=null;this.lastAction=null;t.addEventListener("touchstart",t=>{this.touchStart=true});t.addEventListener("touchend",t=>{this.startPosition=null;this.onActionEnd&&this.onActionEnd(this.lastAction);this.lastAction=null})}startAction(t,i,e){if(this.touchStart){this.onActionStart&&this.onActionStart(t);this.startPosition=e;this.touchStart=false}if(t==="vertical"){if(Math.abs(i)=1/3&&this.startPosition.x<=2/3){t=1;s=this.mediumVolumeUp;o=this.mediumVolumeDown}else{t=2;s=this.highVolumeUp;o=this.highVolumeDown}if(i>0){const o=Math.round(t*100*(i-this.minSwipeDistance)/(1.5*e.height));s&&s(o);this.lastAction={type:"volume",volume:o}}else{const s=Math.round(t*100*(i+this.minSwipeDistance)/(1.5*e.height));o&&o(s);this.lastAction={type:"volume",volume:s}}}}else if(t==="horizontal"){if(e.y<1/3&&(e.x<.1||e.x>.9)||Math.abs(i)=1/3&&this.startPosition.y<=2/3){t=.2;e=this.mediumSpeedForward;s=this.mediumSpeedBackward}else{t=1;e=this.highSpeedForward;s=this.highSpeedBackward}if(i>0){const s=(i-this.minSwipeDistance)*t;e&&e(s);this.lastAction={type:"playback",seconds:s}}else{const e=(i+this.minSwipeDistance)*t;s&&s(e);this.lastAction={type:"playback",seconds:e}}}}}}class a{constructor(){this.aid=unsafeWindow.aid;this.cid=unsafeWindow.cid;this.cidData=null;this.supportWebp=a.supportWebp}getVideoshot(t,i){if(!(this.aid&&this.cid)){return}if(!this.cidData){Ajax.getText(`https://api.bilibili.com/x/player/videoshot?aid=${this.aid}&cid=${this.cid}&index=1`).then(e=>{this.cidData=JSON.parse(e).data;this.getVideoshot(t,i)})}else{const e=this.cidData;const s=e.index;let o=0;for(let i=0;i=s[i]&&tt.replace(".jpg",".jpg@.webp"))}const l=parseInt(e.pv_x_len)||10;const a=parseInt(e.pv_y_len)||10;const c=parseInt(e.pv_x_size)||160;const r=parseInt(e.pv_y_size)||90;const d=-(o%100%l)*c;const h=-Math.floor(o%100/a)*r;i({width:c,height:r,backgroundImage:`url(${n[Math.floor(o/100)]})`,backgroundPosition:`${d}px ${h}px`})}}static get supportWebp(){try{const t=document.createElement("canvas");if(t.getContext&&t.getContext("2d"))try{return t.toDataURL("image/webp").indexOf("data:image/webp")===0}catch(t){return false}else return false}catch(t){return false}}}function c(t){t.unbind("click")}function r(i){if($(".touch-video-box").length!==0){return}$(".bilibili-player-video-subtitle").before(`\n
\n
\n
\n
\n
\n
`);const e=$("video");const l=e.prop("duration");const c=new n(i.get(0));const r=document.getElementsByClassName("touch-video-info")[0];const d=document.getElementsByClassName("touch-video-box")[0];let h=Math.round(e.prop("volume")*100);const u=t=>{t/=100;if(t<0){t=0}else if(t>1){t=1}e.prop("volume",t);const i=JSON.parse(localStorage.bilibili_player_settings);i.video_status.volume=t;localStorage.bilibili_player_settings=JSON.stringify(i);$(".bilibili-player-video-volume-num").text(Math.round(t*100));$(".bui-thumb").css("transform",`translateY(-${48*t}px)`);$(".bui-track-vertical .bui-bar").css("transform",`scaleY(${t})`);if(t===0){$(".bilibili-player-video-btn-volume").addClass("video-state-volume-min");$(".bilibili-player-video-btn-volume").removeClass("video-state-volume-max");e.prop("muted",true)}else if(t===1){$(".bilibili-player-video-btn-volume").removeClass("video-state-volume-min");$(".bilibili-player-video-btn-volume").addClass("video-state-volume-max");e.prop("muted",false)}else{$(".bilibili-player-video-btn-volume").removeClass("video-state-volume-min");$(".bilibili-player-video-btn-volume").removeClass("video-state-volume-max");e.prop("muted",false)}};if(t.touchVideoPlayerAnimation){d.classList.add("animation")}c.action.onActionStart=(t=>{d.classList.add("adjust-opened");r.innerHTML="";h=Math.round(e.prop("volume")*100)});const p=new a;const m=t=>{return i=>{const n=e.prop("currentTime");const a=fixed(100*n/l);let c=n+i;let d=fixed(100*c/l);let h=i;if(c>l){c=l;d=100;h=l-n}else if(c<0){c=0;d=0;h=n}const u=`${o(n)} (${a}%)
👇
${o(c)} (${d}%)`;const m=`\n
\n
\n ${t}速\n
\n
\n 进度: ${i>0?"+":"-"}${s(h)}\n
\n
\n
\n
\n
\n
\n
\n ${u}\n
\n
\n `;r.innerHTML=m;p.getVideoshot(c,t=>$(".videoshot").css(t));$(".touch-progress").css("transform",`scaleX(${d/100})`)}};c.action.lowSpeedBackward=m("低");c.action.lowSpeedForward=m("低");c.action.mediumSpeedBackward=m("中");c.action.mediumSpeedForward=m("中");c.action.highSpeedBackward=m("高");c.action.highSpeedForward=m("高");const v=t=>{return i=>{let e=h+i;let s=Math.abs(i);if(e>100){e=100;s=100-h}else if(e<0){e=0;s=h}const o=`${h} 👉 ${e}`;u(e);const n=`\n
\n
\n ${t}速\n
\n
\n 音量: ${i>0?"+":"-"}${s}\n
\n
\n
\n
\n ${o}\n
\n
\n `;r.innerHTML=n;$(".touch-progress").css("transform",`scaleX(${e/100})`)}};c.action.lowVolumeUp=v("低");c.action.lowVolumeDown=v("低");c.action.mediumVolumeUp=v("中");c.action.mediumVolumeDown=v("中");c.action.highVolumeUp=v("高");c.action.highVolumeDown=v("高");c.action.speedCancel=(()=>{r.innerHTML=`松开手指,取消进退`;$(".touch-progress").css("transform","scaleX(0)")});c.action.volumeCancel=(()=>{r.innerHTML=`松开手指,取消调整`;$(".touch-progress").css("transform","scaleX(0)");u(h)});if(!unsafeWindow.TOUCH_PLAYER_DEBUG){c.action.onActionEnd=(t=>{r.innerHTML="";if(t){if(t.type==="playback"){let i=e.prop("currentTime");i+=t.seconds;if(i<0){i=0}else if(i>l){i=l}e.prop("currentTime",i)}}d.classList.remove("adjust-opened")})}}function d(t){if(!t.hasClass("disable-original-hover")){t.addClass("disable-original-hover");const i=unsafeWindow.$(".bilibili-player-video");const e="touch-video-control-show";const s=i.data("events").click[0].handler;const o=new DoubleClickEvent(t=>s(t),()=>t.toggleClass(e));i.unbind("click");o.bind(i[0])}}const h=()=>{SpinQuery.any(()=>$(".bilibili-player-iconfont,.bilibili-player-video-quality-menu"),c);SpinQuery.condition(()=>$(".bilibili-player-video"),t=>t.length>0&&$("video").length>0&&$("video").prop("duration"),r);if(t.touchVideoPlayerDoubleTapControl){new SpinQuery(()=>$(".bilibili-player-area"),t=>t.length>0&&unsafeWindow.$&&unsafeWindow.$(".bilibili-player-video").data("events"),d).start()}};if(Observer.videoChange){Observer.videoChange(h)}else{Observer.childList("#bofqi",()=>h())}i.applyStyle("touchPlayerStyle")}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/tweets.min.css"] = `.nav-search-submit{display:block!important;color:var(--foreground-color-d)!important;transform:translateX(-125px);-webkit-tap-highlight-color:transparent}.nav-search-submit:hover{color:var(--foreground-color)!important}#nav_searchform{transition:.3s ease-out;box-shadow:none;width:0!important;padding:0!important}.preserve-rank>a{opacity:0!important;pointer-events:none}.showSearch .preserve-rank>a{opacity:.382!important;pointer-events:initial}.showSearch #nav_searchform{box-shadow:0 2px 10px 1px #0002;width:250px!important}.showSearch .nav-search-submit,.showSearch .nav-search-submit:hover{color:#888!important;transform:none}@media only screen and (max-width:1291px){.showSearch #nav_searchform{width:140px!important}}`; -offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/video-info.min.js"] = (()=>{return(t,i)=>{class e{constructor(t){this.aid=t}async fetchInfo(){const t=JSON.parse(await downloadText(`https://api.bilibili.com/x/web-interface/view?aid=${this.aid}`));if(t.code!==0){throw new Error(t.message)}const i=t.data;this.cid=i.cid;this.pageCount=i.videos;this.coverUrl=i.pic;this.tagId=i.tid;this.tagName=i.tname;this.title=i.title;this.description=i.desc;this.up={uid:i.owner.mid,name:i.owner.name,faceUrl:i.owner.face};this.pages=i.pages.map(t=>{return{cid:t.cid,title:t.part,pageNumber:t.page}});return this}async fetchDanmaku(){this.danmaku=new s(this.cid);return this.danmaku.fetchInfo()}}class a{constructor(t,i){this.text=t;this.p=i}}class s{constructor(t){this.cid=t}async fetchInfo(){const t=await downloadText(`https://api.bilibili.com/x/v1/dm/list.so?oid=${this.cid}`);this.rawXML=t;const i=(new DOMParser).parseFromString(t,"application/xml").documentElement;this.xml=i;this.danmakus=[].map.call(i.querySelectorAll("d[p]"),t=>{return new a(t.innerHTML,t.getAttribute("p"))})}}class n{constructor(t){this.ep=t;this.videos=[]}async fetchInfo(){const t=await downloadText(`https://www.bilibili.com/bangumi/play/ep${this.ep}/`);const i=JSON.parse(t.match(/window\.__INITIAL_STATE__=(.*);\(function\(\){/)[1]);this.title=i.mediaInfo.title;this.cover=i.mediaInfo.cover;this.squareCover=i.mediaInfo.square_cover;this.aid=i.epInfo.aid;this.cid=i.epInfo.cid;this.videos=i.epList.map(async t=>{return{title:t.index_title,aid:t.aid,cid:t.cid,info:await new e(t.aid).fetchInfo()}});return this}}return{export:{VideoInfo:e,BangumiInfo:n,Danmaku:a,DanmakuInfo:s}}}})(); -offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/view-cover.min.js"] = (()=>{return(e,t)=>{const{VideoInfo:i}=t.import("video-info");const{getFriendlyTitle:n}=t.import("title");class o{constructor(e){this.url=e;if($(".image-viewer").length===0){this.createContainer()}this.viewer=$(".image-viewer-container");this.downloadImage()}createContainer(){$("body").append((t.data.imageViewerDom||t.data.imageViewerHtml).text);$(".image-viewer-container .close").on("click",()=>this.hide());t.applyStyle("imageViewerStyle")}downloadImage(){const e=new XMLHttpRequest;e.open("GET",this.url.replace("http:","https:"),true);e.responseType="blob";e.onload=(()=>{const t=n();const i=URL.createObjectURL(e.response);if(this.imageData){URL.revokeObjectURL(this.imageData)}this.imageData=i;this.viewer.find(".download").attr("href",i).attr("download",t+this.url.substring(this.url.lastIndexOf(".")));this.viewer.find(".copy-link").on("click",()=>GM_setClipboard(this.url));this.viewer.find(".new-tab").attr("href",this.url);this.viewer.find(".image").prop("src",i)});e.send()}show(){this.viewer.addClass("opened")}hide(){this.viewer.removeClass("opened")}}return(()=>{if($("meta[itemprop='image'],meta[property='og:image']").length>0){return{widget:{content:`\n \n \n 查看封面\n `,condition:async()=>{const e=await SpinQuery.select(()=>(unsafeWindow||window).aid);return Boolean(e)},success:async()=>{async function e(){const e=(unsafeWindow||window).aid;const t=new i(e);await t.fetchInfo();return t.coverUrl}let t=new o(await e());$("#view-cover").on("click",()=>{t.show()});const n=async()=>{t=new o(await e())};if(Observer.videoChange){Observer.videoChange(n)}else{Observer.childList("#bofqi",n)}}}}}else{return{widget:{content:`\n \n \n 查看封面\n `,condition:async()=>{const e=await SpinQuery.select(()=>document.querySelector(".header-info-ctnr .room-cover"));return Boolean(e)},success:async()=>{const e=$(".header-info-ctnr .room-cover");const t=e.attr("href").match(/space\.bilibili\.com\/([\d]+)/);if(t&&t[1]){const e=t[1];const i=`https://api.live.bilibili.com/room/v1/Room/getRoomInfoOld?mid=${e}`;const n=await downloadText(i);const s=JSON.parse(n).data.cover;const a=new o(s);$("#view-cover").on("click",()=>{a.show()})}}}}}})()}})(); +offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/video-info.min.js"] = (()=>{return(t,i)=>{class e{constructor(t){this.aid=t}async fetchInfo(){const t=JSON.parse(await Ajax.getText(`https://api.bilibili.com/x/web-interface/view?aid=${this.aid}`));if(t.code!==0){throw new Error(t.message)}const i=t.data;this.cid=i.cid;this.pageCount=i.videos;this.coverUrl=i.pic;this.tagId=i.tid;this.tagName=i.tname;this.title=i.title;this.description=i.desc;this.up={uid:i.owner.mid,name:i.owner.name,faceUrl:i.owner.face};this.pages=i.pages.map(t=>{return{cid:t.cid,title:t.part,pageNumber:t.page}});return this}async fetchDanmaku(){this.danmaku=new s(this.cid);return this.danmaku.fetchInfo()}}class a{constructor(t,i){this.text=t;this.p=i}}class s{constructor(t){this.cid=t}async fetchInfo(){const t=await Ajax.getText(`https://api.bilibili.com/x/v1/dm/list.so?oid=${this.cid}`);this.rawXML=t;const i=(new DOMParser).parseFromString(t,"application/xml").documentElement;this.xml=i;this.danmakus=[].map.call(i.querySelectorAll("d[p]"),t=>{return new a(t.innerHTML,t.getAttribute("p"))})}}class n{constructor(t){this.ep=t;this.videos=[]}async fetchInfo(){const t=await Ajax.getText(`https://www.bilibili.com/bangumi/play/ep${this.ep}/`);const i=JSON.parse(t.match(/window\.__INITIAL_STATE__=(.*);\(function\(\){/)[1]);this.title=i.mediaInfo.title;this.cover=i.mediaInfo.cover;this.squareCover=i.mediaInfo.square_cover;this.aid=i.epInfo.aid;this.cid=i.epInfo.cid;this.videos=i.epList.map(async t=>{return{title:t.index_title,aid:t.aid,cid:t.cid,info:await new e(t.aid).fetchInfo()}});return this}}return{export:{VideoInfo:e,BangumiInfo:n,Danmaku:a,DanmakuInfo:s}}}})(); +offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/view-cover.min.js"] = (()=>{return(e,t)=>{const{VideoInfo:i}=t.import("video-info");const{getFriendlyTitle:n}=t.import("title");class o{constructor(e){this.url=e;if($(".image-viewer").length===0){this.createContainer()}this.viewer=$(".image-viewer-container");this.downloadImage()}createContainer(){$("body").append((t.data.imageViewerDom||t.data.imageViewerHtml).text);$(".image-viewer-container .close").on("click",()=>this.hide());t.applyStyle("imageViewerStyle")}downloadImage(){const e=new XMLHttpRequest;e.open("GET",this.url.replace("http:","https:"),true);e.responseType="blob";e.onload=(()=>{const t=n();const i=URL.createObjectURL(e.response);if(this.imageData){URL.revokeObjectURL(this.imageData)}this.imageData=i;this.viewer.find(".download").attr("href",i).attr("download",t+this.url.substring(this.url.lastIndexOf(".")));this.viewer.find(".copy-link").on("click",()=>GM_setClipboard(this.url));this.viewer.find(".new-tab").attr("href",this.url);this.viewer.find(".image").prop("src",i)});e.send()}show(){this.viewer.addClass("opened")}hide(){this.viewer.removeClass("opened")}}return(()=>{if($("meta[itemprop='image'],meta[property='og:image']").length>0){return{widget:{content:`\n \n \n 查看封面\n `,condition:async()=>{const e=await SpinQuery.select(()=>(unsafeWindow||window).aid);return Boolean(e)},success:async()=>{async function e(){const e=(unsafeWindow||window).aid;const t=new i(e);await t.fetchInfo();return t.coverUrl}let t=new o(await e());$("#view-cover").on("click",()=>{t.show()});const n=async()=>{t=new o(await e())};if(Observer.videoChange){Observer.videoChange(n)}else{Observer.childList("#bofqi",n)}}}}}else{return{widget:{content:`\n \n \n 查看封面\n `,condition:async()=>{const e=await SpinQuery.select(()=>document.querySelector(".header-info-ctnr .room-cover"));return Boolean(e)},success:async()=>{const e=$(".header-info-ctnr .room-cover");const t=e.attr("href").match(/space\.bilibili\.com\/([\d]+)/);if(t&&t[1]){const e=t[1];const i=`https://api.live.bilibili.com/room/v1/Room/getRoomInfoOld?mid=${e}`;const n=await Ajax.getText(i);const s=JSON.parse(n).data.cover;const a=new o(s);$("#view-cover").on("click",()=>{a.show()})}}}}}})()}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/watchlater.min.js"] = (()=>{return(e,t)=>{const r=e=>{const t=e.match(/(av[\d]+)\/p([\d]+)/);if(t){return`https://www.bilibili.com/video/${t[1]}/?p=${t[2]}`}else{return"javascript:;"}};const a=e=>{const t=e.map(e=>{const t=e.getAttribute("href");if(!t){return"javascript:;"}if(t.match(/.*watchlater.*|javascript:;/g)){return r(t)}if(t.indexOf("video/av")!==-1){return t}});e.forEach((e,r)=>$(e).attr("href",t[r]).attr("target","_blank"))};const i=(...e)=>{for(const t of e){SpinQuery.select(()=>document.querySelectorAll(t),e=>a([...e]))}};SpinQuery.any(()=>$(".watch-later-list"),()=>{(Observer.childListSubtree||Observer.subtree)("#viewlater-app",()=>{SpinQuery.condition(()=>document.URL.match(/(av[\d]+)\/p([\d]+)/),e=>e&&document.URL.indexOf("watchlater")!==-1,()=>{const e=r(document.URL);if(e!==null){window.location.replace(e)}});SpinQuery.any(()=>$("#viewlater-app .s-btn[href='#/']"),e=>e.remove());i(".av-pic",".av-about>a")})});SpinQuery.any(()=>$("li.nav-item[report-id*=watchlater]"),()=>{(Observer.childListSubtree||Observer.subtree)("li.nav-item[report-id*=watchlater]",()=>{i(".av-item>a",".av-about>a","div.watch-later-m>ul>div>li>a");SpinQuery.any(()=>$(".read-more.mr"),e=>e.remove());SpinQuery.any(()=>$(".read-more-grp>.read-more"),e=>e.css({float:"none",width:"auto"}))})})}})(); class ResourceType diff --git a/bilibili-evolved.preview-offline.user.js b/bilibili-evolved.preview-offline.user.js index 2b14784af..eb76f5e47 100644 --- a/bilibili-evolved.preview-offline.user.js +++ b/bilibili-evolved.preview-offline.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name Bilibili Evolved (Preview Offline) -// @version 257.35 +// @version 257.93 // @description Bilibili Evolved 的预览离线版, 可以抢先体验新功能, 并且所有功能都已内置于脚本中. // @author Grant Howard, Coulomb-G // @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G) @@ -942,10 +942,10 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/toast.min.js"] = (()=>{return(t,e)=>{class s{constructor(t="",e="",s="default"){this.type=s;this.message=t;this.title=e;this.duration=3e3;this.element=$(this.cardHtml)[0];document.querySelector(".toast-card-container").insertAdjacentElement("beforeend",this.element)}show(){this.element.classList.add("visible");this.element.querySelector(".toast-card-dismiss").addEventListener("click",()=>this.dismiss());if(this.duration){setTimeout(()=>this.dismiss(),this.duration)}}dismiss(){if(this.element.classList.contains("visible")){this.element.addEventListener("transitionend",()=>this.element.remove());this.element.classList.remove("visible")}}get cardHtml(){return`\n
\n
\n

${this.title}

\n
\n \n
\n
\n
${this.message}
\n
\n `}static get container(){return document.querySelector(".toast-card-container")}static createToastContainer(){if(!document.querySelector(".toast-card-container")){document.body.insertAdjacentHTML("beforeend",`
`)}}static internalShow(t,e,i,n){const a=new s(t,e,n);a.duration=i;a.show();return a}static show(t,e,s){return this.internalShow(t,e,s,"default")}static info(t,e,s){return this.internalShow(t,e,s,"info")}static success(t,e,s){return this.internalShow(t,e,s,"success")}static error(t,e,s){return this.internalShow(t,e,s,"error")}}e.applyStyle("toastStyle");s.createToastContainer();return{export:s}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/touch-navbar.min.js"] = (()=>{return(e,r)=>{SpinQuery.count(()=>document.querySelectorAll("ul.fr>li.nav-item:not(.profile-info)"),6,e=>{e.forEach(e=>{e.style.cursor="pointer";const r=e.querySelector("a.t");r.removeAttribute("href")})})}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/touch-player.min.css"] = `.touch-video-box-wrapper{display:flex;align-items:center;justify-content:center;width:100%;height:100%;position:absolute;top:0;left:0;z-index:14;pointer-events:none}.touch-video-box{border-radius:0;display:flex;align-items:center;justify-content:center;width:100%;height:100%;background:rgba(0,0,0,.85);position:relative;max-width:520px;max-height:240px;border:4px solid transparent;transform-origin:center}.bilibili-player-video-control-top,.touch-video-box.animation{transition:.2s}@supports (backdrop-filter:blur(60px)) or (-webkit-backdrop-filter:blur(60px)){.touch-video-box{background:rgba(0,0,0,.618);-webkit-backdrop-filter:blur(60px);backdrop-filter:blur(60px)}}.touch-video-info{color:#fff;font-size:2rem;text-align:center;display:flex;align-items:center;justify-content:center;flex-direction:column;height:100%;width:100%}.touch-row{flex-grow:1;display:flex;align-items:center;justify-content:center;width:100%}.touch-info{display:block;color:var(--theme-color)}.touch-result{display:block;font-size:1.5rem;line-height:150%}.touch-speed{display:block;background:rgba(0,0,0,.1);padding:.5em}.touch-progress{position:absolute;bottom:0;left:0;background:var(--theme-color);width:100%;transform-origin:left;transform:scaleX(0);height:4px;transition:.2s}.touch-row-item{flex:1 0 0;display:flex;align-items:center;justify-content:center}.touch-row-item-wide{flex:1.5 0 0;display:flex;align-items:center;justify-content:center}.videoshot{background-color:transparent;background-image:none;transform-origin:center;transform:scale(.9)}.adjust-closed{transform:rotateX(90deg) rotateY(90deg) scale(.5)}.adjust-opened{transform:rotateX(0) rotateY(0) scale(1)}.disable-original-hover .bilibili-player-video-control-bottom,.disable-original-hover .bilibili-player-video-control-mask{opacity:0!important;visibility:hidden!important}.disable-original-hover .bilibili-player-video-control-wrap,.disable-original-hover.touch-video-control-show .bilibili-player-video-control-bottom,.disable-original-hover.touch-video-control-show .bilibili-player-video-control-mask{opacity:1!important;visibility:visible!important}.bilibili-player-video-control-top,.disable-original-hover .bilibili-player-video-control-top{left:0!important;right:0!important;bottom:0!important}.bilibili-player-video-control-top{bottom:0!important}.disable-original-hover.touch-video-control-show .bilibili-player-video-control-top{left:0!important;right:0!important;bottom:38px!important}div.bilibili-player-video-control{height:38px!important;align-items:center!important}.bilibili-player-video-btn{flex-grow:1!important;height:100%!important;display:flex!important;align-items:center!important;justify-content:center!important}.bilibili-player-video-inputbar,.bilibili-player-video-progress{flex-grow:30!important}.bilibili-player-video-quality-menu{display:flex!important;align-items:center!important;justify-content:center!important}.bilibili-player-iconfont-color,.bilibili-player-iconfont-danmaku,.bilibili-player-iconfont-danmaku-off,.bilibili-player-iconfont-fullscreen,.bilibili-player-iconfont-pause,.bilibili-player-iconfont-repeat,.bilibili-player-iconfont-setting,.bilibili-player-iconfont-start,.bilibili-player-iconfont-volume,.bilibili-player-iconfont-volume-max,.bilibili-player-iconfont-volume-min,.bilibili-player-iconfont-web-fullscreen,.bilibili-player-iconfont-widescreen{font-size:2.5rem!important}.bilibili-player-iconfont-next{font-size:2rem!important}.bilibili-player-video-btn-setting-panel,.bilibili-player-video-danmaku-setting-wrap,.bilibili-player.mode-fullscreen .bilibili-player-video-sendbar,.bpui-selectmenu-list{left:unset!important;bottom:38px!important}.bilibili-player-video-volumebar-wrp{left:unset!important}.bilibili-player-video-control-wrap{padding:0!important}.bilibili-player-video-control-bottom{padding:0!important;align-items:center!important}.bilibili-player-iconfont-next,.bilibili-player-iconfont-setting,.bilibili-player-video-btn-volume.video-state-volume-max .bilibili-player-iconfont-volume-max,.bilibili-player-video-btn-volume.video-state-volume-min .bilibili-player-iconfont-volume-min,.bilibili-player-video-btn-volume:not(.video-state-volume-max):not(.video-state-volume-min) .bilibili-player-iconfont-volume,.bilibili-player-video-control-bottom-left{display:flex!important;align-items:center!important}.bilibili-player-video-btn-danmaku{flex-grow:0!important;display:flex!important;align-items:center!important;height:100%!important;margin:0!important;padding:0!important}.bilibili-player.mode-webfullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control-bottom-right{flex-grow:1!important}.bilibili-player.mode-fullscreen .bilibili-player-video-sendbar{bottom:0!important}.bilibili-player .bilibili-player-area .bilibili-player-video-control .bilibili-player-video-btn.bilibili-player-video-btn-fullscreen{margin-right:0!important;padding-right:8px!important}.bilibili-player .bilibili-player-area .bilibili-player-video-control .bilibili-player-video-btn.bilibili-player-video-btn-start{padding-left:8px!important;flex-grow:1.2!important;margin-right:0!important;margin-left:0!important}.bilibili-player .bilibili-player-area .bilibili-player-video-control .bilibili-player-video-btn{padding:0 3px!important}.bilibili-player .bilibili-player-area .bilibili-player-video-control-bottom,.bilibili-player .bilibili-player-area .bilibili-player-video-control-bottom-right,.bilibili-player-video-control-bottom-left{height:100%!important;margin:0!important}.bilibili-player-video-btn-setting-panel-hover-bridge{display:none!important}.disable-original-hover .bilibili-player-video-control-wrap:hover .bilibili-player-video-control-top .bilibili-player-video-progress-slider,.disable-original-hover.bilibili-player-area.video-control-show .bilibili-player-video-control-top .bilibili-player-video-progress-slider{height:2px!important}.disable-original-hover.bilibili-player-area .bilibili-player-video-control .bilibili-player-video-progress-detail.show{bottom:1px!important}#bofqi *{-webkit-tap-highlight-color:transparent!important}@media screen and (min-width:750px){.bilibili-player.mode-fullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control-bottom-center .bilibili-player-video-sendbar .bilibili-player-video-inputbar,.bilibili-player.mode-webfullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control-bottom-center .bilibili-player-video-sendbar .bilibili-player-video-inputbar{background:#fff1!important}.bilibili-player.mode-fullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control,.bilibili-player.mode-webfullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control{height:100%!important;margin:0!important}.bilibili-player.mode-fullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control-bottom,.bilibili-player.mode-webfullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control-bottom{margin:0!important}.bilibili-player.mode-fullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control-bottom-left,.bilibili-player.mode-webfullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control-bottom-left{height:100%!important}.bilibili-player-video-btn.bilibili-player-video-btn-start{flex-grow:.5!important}.player .bilibili-player.mode-fullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control-top,.player .bilibili-player.mode-webfullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control-top{left:0!important;right:0!important}.player .bilibili-player.mode-fullscreen .disable-original-hover.bilibili-player-video-control-wrap .bilibili-player-video-control-top,.player .bilibili-player.mode-webfullscreen .disable-original-hover.bilibili-player-video-control-wrap .bilibili-player-video-control-top{left:0!important;right:0!important;bottom:0!important}.player .bilibili-player.mode-fullscreen .disable-original-hover.touch-video-control-show .bilibili-player-video-control-top,.player .bilibili-player.mode-webfullscreen .disable-original-hover.touch-video-control-show .bilibili-player-video-control-top{left:0!important;right:0!important;bottom:54px!important}.mode-fullscreen .bilibili-player-area.mouse-hover:not(.disable-original-hover) .bilibili-player-video-control-top,.mode-fullscreen .bilibili-player-area.video-control-show:not(.disable-original-hover) .bilibili-player-video-control-top,.mode-webfullscreen .bilibili-player-area.mouse-hover:not(.disable-original-hover) .bilibili-player-video-control-top,.mode-webfullscreen .bilibili-player-area.video-control-show:not(.disable-original-hover) .bilibili-player-video-control-top{left:0!important;right:0!important;bottom:48px!important}}`; -offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/touch-player.min.js"] = (()=>{return(t,i)=>{const e=t=>{let i=0;let e=0;while(t&&!isNaN(t.offsetLeft)&&!isNaN(t.offsetTop)){i+=t.offsetLeft-t.scrollLeft;e+=t.offsetTop-t.scrollTop;t=t.offsetParent}return{x:i,y:e}};const o=t=>{t=Math.abs(t);const i=Math.floor(t/3600);const e=Math.floor((t-i*3600)/60);const o=t-i*3600-e*60;let s=fixed(o)+"秒";if(e>0){s=e+"分"+s}if(i>0){s=i+"时"+s}return s};const s=t=>{t=Math.abs(t);const i=Math.floor(t/3600);const e=Math.floor((t-i*3600)/60);const o=t-i*3600-e*60;let s=(o<10?"0":"")+fixed(o);s=(e<10?"0":"")+e+":"+s;s=(i<10?"0":"")+i+":"+s;return s};class n{constructor(t){this.action=new l(t);this.onTouchStart=null;this.onTouchEnd=null;this.direction=null;t.addEventListener("touchstart",t=>{this.xDown=t.touches[0].clientX;this.yDown=t.touches[0].clientY;if(this.onTouchStart){this.onTouchStart(t)}});t.addEventListener("touchmove",i=>{if(!this.xDown||!this.yDown){return}const o=i.touches[0].clientX;const s=i.touches[0].clientY;const n=e(t);const l={x:(i.touches[0].pageX-n.x)/t.clientWidth,y:(i.touches[0].pageY-n.y)/t.clientHeight,width:t.clientWidth,height:t.clientHeight};const a=this.xDown-o;const c=this.yDown-s;if(!this.direction){let t="";if(Math.abs(a)>Math.abs(c)){t="horizontal"}else{t="vertical"}this.direction=t;i.preventDefault()}else{if(this.direction==="vertical"){this.action.startAction(this.direction,c,l)}else if(this.direction==="horizontal"){this.action.startAction(this.direction,-a,l)}i.preventDefault()}});t.addEventListener("touchend",t=>{this.xDown=null;this.yDown=null;this.direction=null;if(this.onTouchEnd){this.onTouchEnd(t)}})}}class l{constructor(t){this.lowSpeedForward=null;this.lowSpeedBackward=null;this.mediumSpeedForward=null;this.mediumSpeedBackward=null;this.highSpeedForward=null;this.highSpeedBackward=null;this.lowVolumeUp=null;this.lowVolumeDown=null;this.mediumVolumeUp=null;this.mediumVolumeDown=null;this.highVolumeUp=null;this.highVolumeDown=null;this.speedCancel=null;this.volumeCancel=null;this.minSwipeDistance=20;this.onActionStart=null;this.onActionEnd=null;this.element=t;this.touchStart=false;this.startPosition=null;this.lastAction=null;t.addEventListener("touchstart",t=>{this.touchStart=true});t.addEventListener("touchend",t=>{this.startPosition=null;this.onActionEnd&&this.onActionEnd(this.lastAction);this.lastAction=null})}startAction(t,i,e){if(this.touchStart){this.onActionStart&&this.onActionStart(t);this.startPosition=e;this.touchStart=false}if(t==="vertical"){if(Math.abs(i)=1/3&&this.startPosition.x<=2/3){t=1;o=this.mediumVolumeUp;s=this.mediumVolumeDown}else{t=2;o=this.highVolumeUp;s=this.highVolumeDown}if(i>0){const s=Math.round(t*100*(i-this.minSwipeDistance)/(1.5*e.height));o&&o(s);this.lastAction={type:"volume",volume:s}}else{const o=Math.round(t*100*(i+this.minSwipeDistance)/(1.5*e.height));s&&s(o);this.lastAction={type:"volume",volume:o}}}}else if(t==="horizontal"){if(e.y<1/3&&(e.x<.1||e.x>.9)||Math.abs(i)=1/3&&this.startPosition.y<=2/3){t=.2;e=this.mediumSpeedForward;o=this.mediumSpeedBackward}else{t=1;e=this.highSpeedForward;o=this.highSpeedBackward}if(i>0){const o=(i-this.minSwipeDistance)*t;e&&e(o);this.lastAction={type:"playback",seconds:o}}else{const e=(i+this.minSwipeDistance)*t;o&&o(e);this.lastAction={type:"playback",seconds:e}}}}}}class a{constructor(){this.aid=unsafeWindow.aid;this.cid=unsafeWindow.cid;this.cidData=null;this.supportWebp=a.supportWebp}getVideoshot(t,i){if(!this.cidData){downloadText(`https://api.bilibili.com/x/player/videoshot?aid=${this.aid}&cid=${this.cid}&index=1`).then(e=>{this.cidData=JSON.parse(e).data;this.getVideoshot(t,i)})}else{const e=this.cidData;const o=e.index;let s=0;for(let i=0;i=o[i]&&tt.replace(".jpg",".jpg@.webp"))}const l=parseInt(e.pv_x_len)||10;const a=parseInt(e.pv_y_len)||10;const c=parseInt(e.pv_x_size)||160;const r=parseInt(e.pv_y_size)||90;const d=-(s%100%l)*c;const h=-Math.floor(s%100/a)*r;i({width:c,height:r,backgroundImage:`url(${n[Math.floor(s/100)]})`,backgroundPosition:`${d}px ${h}px`})}}static get supportWebp(){try{const t=document.createElement("canvas");if(t.getContext&&t.getContext("2d"))try{return t.toDataURL("image/webp").indexOf("data:image/webp")===0}catch(t){return false}else return false}catch(t){return false}}}function c(t){t.unbind("click")}function r(i){if($(".touch-video-box").length!==0){return}$(".bilibili-player-video-subtitle").before(`\n
\n
\n
\n
\n
\n
`);const e=$("video");const l=e.prop("duration");const c=new n(i.get(0));const r=document.getElementsByClassName("touch-video-info")[0];const d=document.getElementsByClassName("touch-video-box")[0];let h=Math.round(e.prop("volume")*100);const u=t=>{t/=100;if(t<0){t=0}else if(t>1){t=1}e.prop("volume",t);const i=JSON.parse(localStorage.bilibili_player_settings);i.video_status.volume=t;localStorage.bilibili_player_settings=JSON.stringify(i);$(".bilibili-player-video-volume-num").text(Math.round(t*100));$(".bui-thumb").css("transform",`translateY(-${48*t}px)`);$(".bui-track-vertical .bui-bar").css("transform",`scaleY(${t})`);if(t===0){$(".bilibili-player-video-btn-volume").addClass("video-state-volume-min");$(".bilibili-player-video-btn-volume").removeClass("video-state-volume-max");e.prop("muted",true)}else if(t===1){$(".bilibili-player-video-btn-volume").removeClass("video-state-volume-min");$(".bilibili-player-video-btn-volume").addClass("video-state-volume-max");e.prop("muted",false)}else{$(".bilibili-player-video-btn-volume").removeClass("video-state-volume-min");$(".bilibili-player-video-btn-volume").removeClass("video-state-volume-max");e.prop("muted",false)}};if(t.touchVideoPlayerAnimation){d.classList.add("animation")}c.action.onActionStart=(t=>{d.classList.add("adjust-opened");r.innerHTML="";h=Math.round(e.prop("volume")*100)});const p=new a;const m=t=>{return i=>{const n=e.prop("currentTime");const a=fixed(100*n/l);let c=n+i;let d=fixed(100*c/l);let h=i;if(c>l){c=l;d=100;h=l-n}else if(c<0){c=0;d=0;h=n}const u=`${s(n)} (${a}%)
👇
${s(c)} (${d}%)`;const m=`\n
\n
\n ${t}速\n
\n
\n 进度: ${i>0?"+":"-"}${o(h)}\n
\n
\n
\n
\n
\n
\n
\n ${u}\n
\n
\n `;r.innerHTML=m;p.getVideoshot(c,t=>$(".videoshot").css(t));$(".touch-progress").css("transform",`scaleX(${d/100})`)}};c.action.lowSpeedBackward=m("低");c.action.lowSpeedForward=m("低");c.action.mediumSpeedBackward=m("中");c.action.mediumSpeedForward=m("中");c.action.highSpeedBackward=m("高");c.action.highSpeedForward=m("高");const v=t=>{return i=>{let e=h+i;let o=Math.abs(i);if(e>100){e=100;o=100-h}else if(e<0){e=0;o=h}const s=`${h} 👉 ${e}`;u(e);const n=`\n
\n
\n ${t}速\n
\n
\n 音量: ${i>0?"+":"-"}${o}\n
\n
\n
\n
\n ${s}\n
\n
\n `;r.innerHTML=n;$(".touch-progress").css("transform",`scaleX(${e/100})`)}};c.action.lowVolumeUp=v("低");c.action.lowVolumeDown=v("低");c.action.mediumVolumeUp=v("中");c.action.mediumVolumeDown=v("中");c.action.highVolumeUp=v("高");c.action.highVolumeDown=v("高");c.action.speedCancel=(()=>{r.innerHTML=`松开手指,取消进退`;$(".touch-progress").css("transform","scaleX(0)")});c.action.volumeCancel=(()=>{r.innerHTML=`松开手指,取消调整`;$(".touch-progress").css("transform","scaleX(0)");u(h)});if(!unsafeWindow.TOUCH_PLAYER_DEBUG){c.action.onActionEnd=(t=>{r.innerHTML="";if(t){if(t.type==="playback"){let i=e.prop("currentTime");i+=t.seconds;if(i<0){i=0}else if(i>l){i=l}e.prop("currentTime",i)}}d.classList.remove("adjust-opened")})}}function d(t){if(!t.hasClass("disable-original-hover")){t.addClass("disable-original-hover");const i=unsafeWindow.$(".bilibili-player-video");const e="touch-video-control-show";const o=i.data("events").click[0].handler;const s=new DoubleClickEvent(t=>o(t),()=>t.toggleClass(e));i.unbind("click");s.bind(i[0])}}const h=()=>{SpinQuery.any(()=>$(".bilibili-player-iconfont,.bilibili-player-video-quality-menu"),c);SpinQuery.condition(()=>$(".bilibili-player-video"),t=>t.length>0&&$("video").length>0&&$("video").prop("duration"),r);if(t.touchVideoPlayerDoubleTapControl){new SpinQuery(()=>$(".bilibili-player-area"),t=>t.length>0&&unsafeWindow.$&&unsafeWindow.$(".bilibili-player-video").data("events"),d).start()}};if(Observer.videoChange){Observer.videoChange(h)}else{Observer.childList("#bofqi",()=>h())}i.applyStyle("touchPlayerStyle")}})(); +offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/touch-player.min.js"] = (()=>{return(t,i)=>{const e=t=>{let i=0;let e=0;while(t&&!isNaN(t.offsetLeft)&&!isNaN(t.offsetTop)){i+=t.offsetLeft-t.scrollLeft;e+=t.offsetTop-t.scrollTop;t=t.offsetParent}return{x:i,y:e}};const s=t=>{t=Math.abs(t);const i=Math.floor(t/3600);const e=Math.floor((t-i*3600)/60);const s=t-i*3600-e*60;let o=fixed(s)+"秒";if(e>0){o=e+"分"+o}if(i>0){o=i+"时"+o}return o};const o=t=>{t=Math.abs(t);const i=Math.floor(t/3600);const e=Math.floor((t-i*3600)/60);const s=t-i*3600-e*60;let o=(s<10?"0":"")+fixed(s);o=(e<10?"0":"")+e+":"+o;o=(i<10?"0":"")+i+":"+o;return o};class n{constructor(t){this.action=new l(t);this.onTouchStart=null;this.onTouchEnd=null;this.direction=null;t.addEventListener("touchstart",t=>{this.xDown=t.touches[0].clientX;this.yDown=t.touches[0].clientY;if(this.onTouchStart){this.onTouchStart(t)}});t.addEventListener("touchmove",i=>{if(!this.xDown||!this.yDown){return}const s=i.touches[0].clientX;const o=i.touches[0].clientY;const n=e(t);const l={x:(i.touches[0].pageX-n.x)/t.clientWidth,y:(i.touches[0].pageY-n.y)/t.clientHeight,width:t.clientWidth,height:t.clientHeight};const a=this.xDown-s;const c=this.yDown-o;if(!this.direction){let t="";if(Math.abs(a)>Math.abs(c)){t="horizontal"}else{t="vertical"}this.direction=t;i.preventDefault()}else{if(this.direction==="vertical"){this.action.startAction(this.direction,c,l)}else if(this.direction==="horizontal"){this.action.startAction(this.direction,-a,l)}i.preventDefault()}});t.addEventListener("touchend",t=>{this.xDown=null;this.yDown=null;this.direction=null;if(this.onTouchEnd){this.onTouchEnd(t)}})}}class l{constructor(t){this.lowSpeedForward=null;this.lowSpeedBackward=null;this.mediumSpeedForward=null;this.mediumSpeedBackward=null;this.highSpeedForward=null;this.highSpeedBackward=null;this.lowVolumeUp=null;this.lowVolumeDown=null;this.mediumVolumeUp=null;this.mediumVolumeDown=null;this.highVolumeUp=null;this.highVolumeDown=null;this.speedCancel=null;this.volumeCancel=null;this.minSwipeDistance=20;this.onActionStart=null;this.onActionEnd=null;this.element=t;this.touchStart=false;this.startPosition=null;this.lastAction=null;t.addEventListener("touchstart",t=>{this.touchStart=true});t.addEventListener("touchend",t=>{this.startPosition=null;this.onActionEnd&&this.onActionEnd(this.lastAction);this.lastAction=null})}startAction(t,i,e){if(this.touchStart){this.onActionStart&&this.onActionStart(t);this.startPosition=e;this.touchStart=false}if(t==="vertical"){if(Math.abs(i)=1/3&&this.startPosition.x<=2/3){t=1;s=this.mediumVolumeUp;o=this.mediumVolumeDown}else{t=2;s=this.highVolumeUp;o=this.highVolumeDown}if(i>0){const o=Math.round(t*100*(i-this.minSwipeDistance)/(1.5*e.height));s&&s(o);this.lastAction={type:"volume",volume:o}}else{const s=Math.round(t*100*(i+this.minSwipeDistance)/(1.5*e.height));o&&o(s);this.lastAction={type:"volume",volume:s}}}}else if(t==="horizontal"){if(e.y<1/3&&(e.x<.1||e.x>.9)||Math.abs(i)=1/3&&this.startPosition.y<=2/3){t=.2;e=this.mediumSpeedForward;s=this.mediumSpeedBackward}else{t=1;e=this.highSpeedForward;s=this.highSpeedBackward}if(i>0){const s=(i-this.minSwipeDistance)*t;e&&e(s);this.lastAction={type:"playback",seconds:s}}else{const e=(i+this.minSwipeDistance)*t;s&&s(e);this.lastAction={type:"playback",seconds:e}}}}}}class a{constructor(){this.aid=unsafeWindow.aid;this.cid=unsafeWindow.cid;this.cidData=null;this.supportWebp=a.supportWebp}getVideoshot(t,i){if(!(this.aid&&this.cid)){return}if(!this.cidData){Ajax.getText(`https://api.bilibili.com/x/player/videoshot?aid=${this.aid}&cid=${this.cid}&index=1`).then(e=>{this.cidData=JSON.parse(e).data;this.getVideoshot(t,i)})}else{const e=this.cidData;const s=e.index;let o=0;for(let i=0;i=s[i]&&tt.replace(".jpg",".jpg@.webp"))}const l=parseInt(e.pv_x_len)||10;const a=parseInt(e.pv_y_len)||10;const c=parseInt(e.pv_x_size)||160;const r=parseInt(e.pv_y_size)||90;const d=-(o%100%l)*c;const h=-Math.floor(o%100/a)*r;i({width:c,height:r,backgroundImage:`url(${n[Math.floor(o/100)]})`,backgroundPosition:`${d}px ${h}px`})}}static get supportWebp(){try{const t=document.createElement("canvas");if(t.getContext&&t.getContext("2d"))try{return t.toDataURL("image/webp").indexOf("data:image/webp")===0}catch(t){return false}else return false}catch(t){return false}}}function c(t){t.unbind("click")}function r(i){if($(".touch-video-box").length!==0){return}$(".bilibili-player-video-subtitle").before(`\n
\n
\n
\n
\n
\n
`);const e=$("video");const l=e.prop("duration");const c=new n(i.get(0));const r=document.getElementsByClassName("touch-video-info")[0];const d=document.getElementsByClassName("touch-video-box")[0];let h=Math.round(e.prop("volume")*100);const u=t=>{t/=100;if(t<0){t=0}else if(t>1){t=1}e.prop("volume",t);const i=JSON.parse(localStorage.bilibili_player_settings);i.video_status.volume=t;localStorage.bilibili_player_settings=JSON.stringify(i);$(".bilibili-player-video-volume-num").text(Math.round(t*100));$(".bui-thumb").css("transform",`translateY(-${48*t}px)`);$(".bui-track-vertical .bui-bar").css("transform",`scaleY(${t})`);if(t===0){$(".bilibili-player-video-btn-volume").addClass("video-state-volume-min");$(".bilibili-player-video-btn-volume").removeClass("video-state-volume-max");e.prop("muted",true)}else if(t===1){$(".bilibili-player-video-btn-volume").removeClass("video-state-volume-min");$(".bilibili-player-video-btn-volume").addClass("video-state-volume-max");e.prop("muted",false)}else{$(".bilibili-player-video-btn-volume").removeClass("video-state-volume-min");$(".bilibili-player-video-btn-volume").removeClass("video-state-volume-max");e.prop("muted",false)}};if(t.touchVideoPlayerAnimation){d.classList.add("animation")}c.action.onActionStart=(t=>{d.classList.add("adjust-opened");r.innerHTML="";h=Math.round(e.prop("volume")*100)});const p=new a;const m=t=>{return i=>{const n=e.prop("currentTime");const a=fixed(100*n/l);let c=n+i;let d=fixed(100*c/l);let h=i;if(c>l){c=l;d=100;h=l-n}else if(c<0){c=0;d=0;h=n}const u=`${o(n)} (${a}%)
👇
${o(c)} (${d}%)`;const m=`\n
\n
\n ${t}速\n
\n
\n 进度: ${i>0?"+":"-"}${s(h)}\n
\n
\n
\n
\n
\n
\n
\n ${u}\n
\n
\n `;r.innerHTML=m;p.getVideoshot(c,t=>$(".videoshot").css(t));$(".touch-progress").css("transform",`scaleX(${d/100})`)}};c.action.lowSpeedBackward=m("低");c.action.lowSpeedForward=m("低");c.action.mediumSpeedBackward=m("中");c.action.mediumSpeedForward=m("中");c.action.highSpeedBackward=m("高");c.action.highSpeedForward=m("高");const v=t=>{return i=>{let e=h+i;let s=Math.abs(i);if(e>100){e=100;s=100-h}else if(e<0){e=0;s=h}const o=`${h} 👉 ${e}`;u(e);const n=`\n
\n
\n ${t}速\n
\n
\n 音量: ${i>0?"+":"-"}${s}\n
\n
\n
\n
\n ${o}\n
\n
\n `;r.innerHTML=n;$(".touch-progress").css("transform",`scaleX(${e/100})`)}};c.action.lowVolumeUp=v("低");c.action.lowVolumeDown=v("低");c.action.mediumVolumeUp=v("中");c.action.mediumVolumeDown=v("中");c.action.highVolumeUp=v("高");c.action.highVolumeDown=v("高");c.action.speedCancel=(()=>{r.innerHTML=`松开手指,取消进退`;$(".touch-progress").css("transform","scaleX(0)")});c.action.volumeCancel=(()=>{r.innerHTML=`松开手指,取消调整`;$(".touch-progress").css("transform","scaleX(0)");u(h)});if(!unsafeWindow.TOUCH_PLAYER_DEBUG){c.action.onActionEnd=(t=>{r.innerHTML="";if(t){if(t.type==="playback"){let i=e.prop("currentTime");i+=t.seconds;if(i<0){i=0}else if(i>l){i=l}e.prop("currentTime",i)}}d.classList.remove("adjust-opened")})}}function d(t){if(!t.hasClass("disable-original-hover")){t.addClass("disable-original-hover");const i=unsafeWindow.$(".bilibili-player-video");const e="touch-video-control-show";const s=i.data("events").click[0].handler;const o=new DoubleClickEvent(t=>s(t),()=>t.toggleClass(e));i.unbind("click");o.bind(i[0])}}const h=()=>{SpinQuery.any(()=>$(".bilibili-player-iconfont,.bilibili-player-video-quality-menu"),c);SpinQuery.condition(()=>$(".bilibili-player-video"),t=>t.length>0&&$("video").length>0&&$("video").prop("duration"),r);if(t.touchVideoPlayerDoubleTapControl){new SpinQuery(()=>$(".bilibili-player-area"),t=>t.length>0&&unsafeWindow.$&&unsafeWindow.$(".bilibili-player-video").data("events"),d).start()}};if(Observer.videoChange){Observer.videoChange(h)}else{Observer.childList("#bofqi",()=>h())}i.applyStyle("touchPlayerStyle")}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/tweets.min.css"] = `.nav-search-submit{display:block!important;color:var(--foreground-color-d)!important;transform:translateX(-125px);-webkit-tap-highlight-color:transparent}.nav-search-submit:hover{color:var(--foreground-color)!important}#nav_searchform{transition:.3s ease-out;box-shadow:none;width:0!important;padding:0!important}.preserve-rank>a{opacity:0!important;pointer-events:none}.showSearch .preserve-rank>a{opacity:.382!important;pointer-events:initial}.showSearch #nav_searchform{box-shadow:0 2px 10px 1px #0002;width:250px!important}.showSearch .nav-search-submit,.showSearch .nav-search-submit:hover{color:#888!important;transform:none}@media only screen and (max-width:1291px){.showSearch #nav_searchform{width:140px!important}}`; -offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/video-info.min.js"] = (()=>{return(t,i)=>{class e{constructor(t){this.aid=t}async fetchInfo(){const t=JSON.parse(await downloadText(`https://api.bilibili.com/x/web-interface/view?aid=${this.aid}`));if(t.code!==0){throw new Error(t.message)}const i=t.data;this.cid=i.cid;this.pageCount=i.videos;this.coverUrl=i.pic;this.tagId=i.tid;this.tagName=i.tname;this.title=i.title;this.description=i.desc;this.up={uid:i.owner.mid,name:i.owner.name,faceUrl:i.owner.face};this.pages=i.pages.map(t=>{return{cid:t.cid,title:t.part,pageNumber:t.page}});return this}async fetchDanmaku(){this.danmaku=new s(this.cid);return this.danmaku.fetchInfo()}}class a{constructor(t,i){this.text=t;this.p=i}}class s{constructor(t){this.cid=t}async fetchInfo(){const t=await downloadText(`https://api.bilibili.com/x/v1/dm/list.so?oid=${this.cid}`);this.rawXML=t;const i=(new DOMParser).parseFromString(t,"application/xml").documentElement;this.xml=i;this.danmakus=[].map.call(i.querySelectorAll("d[p]"),t=>{return new a(t.innerHTML,t.getAttribute("p"))})}}class n{constructor(t){this.ep=t;this.videos=[]}async fetchInfo(){const t=await downloadText(`https://www.bilibili.com/bangumi/play/ep${this.ep}/`);const i=JSON.parse(t.match(/window\.__INITIAL_STATE__=(.*);\(function\(\){/)[1]);this.title=i.mediaInfo.title;this.cover=i.mediaInfo.cover;this.squareCover=i.mediaInfo.square_cover;this.aid=i.epInfo.aid;this.cid=i.epInfo.cid;this.videos=i.epList.map(async t=>{return{title:t.index_title,aid:t.aid,cid:t.cid,info:await new e(t.aid).fetchInfo()}});return this}}return{export:{VideoInfo:e,BangumiInfo:n,Danmaku:a,DanmakuInfo:s}}}})(); -offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/view-cover.min.js"] = (()=>{return(e,t)=>{const{VideoInfo:i}=t.import("video-info");const{getFriendlyTitle:n}=t.import("title");class o{constructor(e){this.url=e;if($(".image-viewer").length===0){this.createContainer()}this.viewer=$(".image-viewer-container");this.downloadImage()}createContainer(){$("body").append((t.data.imageViewerDom||t.data.imageViewerHtml).text);$(".image-viewer-container .close").on("click",()=>this.hide());t.applyStyle("imageViewerStyle")}downloadImage(){const e=new XMLHttpRequest;e.open("GET",this.url.replace("http:","https:"),true);e.responseType="blob";e.onload=(()=>{const t=n();const i=URL.createObjectURL(e.response);if(this.imageData){URL.revokeObjectURL(this.imageData)}this.imageData=i;this.viewer.find(".download").attr("href",i).attr("download",t+this.url.substring(this.url.lastIndexOf(".")));this.viewer.find(".copy-link").on("click",()=>GM_setClipboard(this.url));this.viewer.find(".new-tab").attr("href",this.url);this.viewer.find(".image").prop("src",i)});e.send()}show(){this.viewer.addClass("opened")}hide(){this.viewer.removeClass("opened")}}return(()=>{if($("meta[itemprop='image'],meta[property='og:image']").length>0){return{widget:{content:`\n \n \n 查看封面\n `,condition:async()=>{const e=await SpinQuery.select(()=>(unsafeWindow||window).aid);return Boolean(e)},success:async()=>{async function e(){const e=(unsafeWindow||window).aid;const t=new i(e);await t.fetchInfo();return t.coverUrl}let t=new o(await e());$("#view-cover").on("click",()=>{t.show()});const n=async()=>{t=new o(await e())};if(Observer.videoChange){Observer.videoChange(n)}else{Observer.childList("#bofqi",n)}}}}}else{return{widget:{content:`\n \n \n 查看封面\n `,condition:async()=>{const e=await SpinQuery.select(()=>document.querySelector(".header-info-ctnr .room-cover"));return Boolean(e)},success:async()=>{const e=$(".header-info-ctnr .room-cover");const t=e.attr("href").match(/space\.bilibili\.com\/([\d]+)/);if(t&&t[1]){const e=t[1];const i=`https://api.live.bilibili.com/room/v1/Room/getRoomInfoOld?mid=${e}`;const n=await downloadText(i);const s=JSON.parse(n).data.cover;const a=new o(s);$("#view-cover").on("click",()=>{a.show()})}}}}}})()}})(); +offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/video-info.min.js"] = (()=>{return(t,i)=>{class e{constructor(t){this.aid=t}async fetchInfo(){const t=JSON.parse(await Ajax.getText(`https://api.bilibili.com/x/web-interface/view?aid=${this.aid}`));if(t.code!==0){throw new Error(t.message)}const i=t.data;this.cid=i.cid;this.pageCount=i.videos;this.coverUrl=i.pic;this.tagId=i.tid;this.tagName=i.tname;this.title=i.title;this.description=i.desc;this.up={uid:i.owner.mid,name:i.owner.name,faceUrl:i.owner.face};this.pages=i.pages.map(t=>{return{cid:t.cid,title:t.part,pageNumber:t.page}});return this}async fetchDanmaku(){this.danmaku=new s(this.cid);return this.danmaku.fetchInfo()}}class a{constructor(t,i){this.text=t;this.p=i}}class s{constructor(t){this.cid=t}async fetchInfo(){const t=await Ajax.getText(`https://api.bilibili.com/x/v1/dm/list.so?oid=${this.cid}`);this.rawXML=t;const i=(new DOMParser).parseFromString(t,"application/xml").documentElement;this.xml=i;this.danmakus=[].map.call(i.querySelectorAll("d[p]"),t=>{return new a(t.innerHTML,t.getAttribute("p"))})}}class n{constructor(t){this.ep=t;this.videos=[]}async fetchInfo(){const t=await Ajax.getText(`https://www.bilibili.com/bangumi/play/ep${this.ep}/`);const i=JSON.parse(t.match(/window\.__INITIAL_STATE__=(.*);\(function\(\){/)[1]);this.title=i.mediaInfo.title;this.cover=i.mediaInfo.cover;this.squareCover=i.mediaInfo.square_cover;this.aid=i.epInfo.aid;this.cid=i.epInfo.cid;this.videos=i.epList.map(async t=>{return{title:t.index_title,aid:t.aid,cid:t.cid,info:await new e(t.aid).fetchInfo()}});return this}}return{export:{VideoInfo:e,BangumiInfo:n,Danmaku:a,DanmakuInfo:s}}}})(); +offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/view-cover.min.js"] = (()=>{return(e,t)=>{const{VideoInfo:i}=t.import("video-info");const{getFriendlyTitle:n}=t.import("title");class o{constructor(e){this.url=e;if($(".image-viewer").length===0){this.createContainer()}this.viewer=$(".image-viewer-container");this.downloadImage()}createContainer(){$("body").append((t.data.imageViewerDom||t.data.imageViewerHtml).text);$(".image-viewer-container .close").on("click",()=>this.hide());t.applyStyle("imageViewerStyle")}downloadImage(){const e=new XMLHttpRequest;e.open("GET",this.url.replace("http:","https:"),true);e.responseType="blob";e.onload=(()=>{const t=n();const i=URL.createObjectURL(e.response);if(this.imageData){URL.revokeObjectURL(this.imageData)}this.imageData=i;this.viewer.find(".download").attr("href",i).attr("download",t+this.url.substring(this.url.lastIndexOf(".")));this.viewer.find(".copy-link").on("click",()=>GM_setClipboard(this.url));this.viewer.find(".new-tab").attr("href",this.url);this.viewer.find(".image").prop("src",i)});e.send()}show(){this.viewer.addClass("opened")}hide(){this.viewer.removeClass("opened")}}return(()=>{if($("meta[itemprop='image'],meta[property='og:image']").length>0){return{widget:{content:`\n \n \n 查看封面\n `,condition:async()=>{const e=await SpinQuery.select(()=>(unsafeWindow||window).aid);return Boolean(e)},success:async()=>{async function e(){const e=(unsafeWindow||window).aid;const t=new i(e);await t.fetchInfo();return t.coverUrl}let t=new o(await e());$("#view-cover").on("click",()=>{t.show()});const n=async()=>{t=new o(await e())};if(Observer.videoChange){Observer.videoChange(n)}else{Observer.childList("#bofqi",n)}}}}}else{return{widget:{content:`\n \n \n 查看封面\n `,condition:async()=>{const e=await SpinQuery.select(()=>document.querySelector(".header-info-ctnr .room-cover"));return Boolean(e)},success:async()=>{const e=$(".header-info-ctnr .room-cover");const t=e.attr("href").match(/space\.bilibili\.com\/([\d]+)/);if(t&&t[1]){const e=t[1];const i=`https://api.live.bilibili.com/room/v1/Room/getRoomInfoOld?mid=${e}`;const n=await Ajax.getText(i);const s=JSON.parse(n).data.cover;const a=new o(s);$("#view-cover").on("click",()=>{a.show()})}}}}}})()}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/watchlater.min.js"] = (()=>{return(e,t)=>{const r=e=>{const t=e.match(/(av[\d]+)\/p([\d]+)/);if(t){return`https://www.bilibili.com/video/${t[1]}/?p=${t[2]}`}else{return"javascript:;"}};const a=e=>{const t=e.map(e=>{const t=e.getAttribute("href");if(!t){return"javascript:;"}if(t.match(/.*watchlater.*|javascript:;/g)){return r(t)}if(t.indexOf("video/av")!==-1){return t}});e.forEach((e,r)=>$(e).attr("href",t[r]).attr("target","_blank"))};const i=(...e)=>{for(const t of e){SpinQuery.select(()=>document.querySelectorAll(t),e=>a([...e]))}};SpinQuery.any(()=>$(".watch-later-list"),()=>{(Observer.childListSubtree||Observer.subtree)("#viewlater-app",()=>{SpinQuery.condition(()=>document.URL.match(/(av[\d]+)\/p([\d]+)/),e=>e&&document.URL.indexOf("watchlater")!==-1,()=>{const e=r(document.URL);if(e!==null){window.location.replace(e)}});SpinQuery.any(()=>$("#viewlater-app .s-btn[href='#/']"),e=>e.remove());i(".av-pic",".av-about>a")})});SpinQuery.any(()=>$("li.nav-item[report-id*=watchlater]"),()=>{(Observer.childListSubtree||Observer.subtree)("li.nav-item[report-id*=watchlater]",()=>{i(".av-item>a",".av-about>a","div.watch-later-m>ul>div>li>a");SpinQuery.any(()=>$(".read-more.mr"),e=>e.remove());SpinQuery.any(()=>$(".read-more-grp>.read-more"),e=>e.css({float:"none",width:"auto"}))})})}})(); class ResourceType diff --git a/bilibili-evolved.preview.user.js b/bilibili-evolved.preview.user.js index b1e159f23..352bbbadf 100644 --- a/bilibili-evolved.preview.user.js +++ b/bilibili-evolved.preview.user.js @@ -974,7 +974,7 @@ class Resource this.text = cache; resolve(cache); } - downloadText(this.url).then(text => + Ajax.getText(this.url).then(text => { this.text = this.type.preprocessor(text); if (text === null) @@ -997,7 +997,7 @@ class Resource } else { - downloadText(this.url) + Ajax.getText(this.url) .then(text => { this.text = this.type.preprocessor(text); diff --git a/bilibili-evolved.user.js b/bilibili-evolved.user.js index 80bed11d7..e86fc46b4 100644 --- a/bilibili-evolved.user.js +++ b/bilibili-evolved.user.js @@ -974,7 +974,7 @@ class Resource this.text = cache; resolve(cache); } - downloadText(this.url).then(text => + Ajax.getText(this.url).then(text => { this.text = this.type.preprocessor(text); if (text === null) @@ -997,7 +997,7 @@ class Resource } else { - downloadText(this.url) + Ajax.getText(this.url) .then(text => { this.text = this.type.preprocessor(text); diff --git a/build.cache b/build.cache index ebebdb73b..206a4d77b 100644 --- a/build.cache +++ b/build.cache @@ -36,7 +36,7 @@ style\simplify-liveroom\simplify-liveroom.js|397DA0535B40AFCD85426767ECAA6101CEC style\tweets.css|A4F3590FC4A0C05FA06659AF142293A3D1FE09D0 touch\combo-like.js|3140FCDD2FAA19AD54BB7BE3886C20DF1BC617B2 touch\player\touch-player.css|12B4618CFA4A140463FF00CC1720C2785D6C3D65 -touch\player\touch-player.js|F3F502CF2D01CC1537BBC15D89607AB474AFFEF3 +touch\player\touch-player.js|2D41DE35BFB44CA3C0FD9E31569EE314E12A9A03 touch\touch-navbar.js|800A367309F6DC2710F61AF4A79BB63D4A6F413D utils\about\about.css|7039CA8905E0CACF72B69AF535A92B61C598C980 utils\about\about.html|E4DB0B7786D8CFC71E16008564850F60681A59B7 @@ -101,7 +101,7 @@ video\player-focus.js|1A23319B3F0413B69104B71AC10DBF8B6B6E5ECA video\skip-charge-list\skip-charge-list.css|5A81D57BB1077D32100BF6B3C57CAED65AF2345B video\skip-charge-list\skip-charge-list.js|A45110BFF47DA5F04F17138EE5CE2483E6F9CDAE video\title.js|77F14B26A6183441D0E9C322DCB28BCE0D1AAC65 -video\video-info.js|9EF4EF06B89F61245F613C3E55DF85C03BBDD17D +video\video-info.js|DDDBDFBC3888608CF5A905560F3D70A9E6CD5A94 video\view-cover\image-viewer.css|7075C4B76A8F1BDB1050B31372925696CB4A95F9 video\view-cover\image-viewer.html|C199EFDE5C7A90C434554F2D73B54AB0750739EC -video\view-cover\view-cover.js|7B3365E5B3C585F391FE519EF44E33C0CF4FE2E7 \ No newline at end of file +video\view-cover\view-cover.js|2563F07C0A7DD03A6347E8C2D40B2C1B43271FC6 \ No newline at end of file diff --git a/client/resource.js b/client/resource.js index 4e2510010..665539edc 100644 --- a/client/resource.js +++ b/client/resource.js @@ -72,7 +72,7 @@ export class Resource this.text = cache; resolve(cache); } - downloadText(this.url).then(text => + Ajax.getText(this.url).then(text => { this.text = this.type.preprocessor(text); if (text === null) @@ -95,7 +95,7 @@ export class Resource } else { - downloadText(this.url) + Ajax.getText(this.url) .then(text => { this.text = this.type.preprocessor(text); diff --git a/min/touch-player.min.js b/min/touch-player.min.js index ff3a86c99..bd1cc598b 100644 --- a/min/touch-player.min.js +++ b/min/touch-player.min.js @@ -1 +1 @@ -(()=>{return(t,i)=>{const e=t=>{let i=0;let e=0;while(t&&!isNaN(t.offsetLeft)&&!isNaN(t.offsetTop)){i+=t.offsetLeft-t.scrollLeft;e+=t.offsetTop-t.scrollTop;t=t.offsetParent}return{x:i,y:e}};const o=t=>{t=Math.abs(t);const i=Math.floor(t/3600);const e=Math.floor((t-i*3600)/60);const o=t-i*3600-e*60;let s=fixed(o)+"秒";if(e>0){s=e+"分"+s}if(i>0){s=i+"时"+s}return s};const s=t=>{t=Math.abs(t);const i=Math.floor(t/3600);const e=Math.floor((t-i*3600)/60);const o=t-i*3600-e*60;let s=(o<10?"0":"")+fixed(o);s=(e<10?"0":"")+e+":"+s;s=(i<10?"0":"")+i+":"+s;return s};class n{constructor(t){this.action=new l(t);this.onTouchStart=null;this.onTouchEnd=null;this.direction=null;t.addEventListener("touchstart",t=>{this.xDown=t.touches[0].clientX;this.yDown=t.touches[0].clientY;if(this.onTouchStart){this.onTouchStart(t)}});t.addEventListener("touchmove",i=>{if(!this.xDown||!this.yDown){return}const o=i.touches[0].clientX;const s=i.touches[0].clientY;const n=e(t);const l={x:(i.touches[0].pageX-n.x)/t.clientWidth,y:(i.touches[0].pageY-n.y)/t.clientHeight,width:t.clientWidth,height:t.clientHeight};const a=this.xDown-o;const c=this.yDown-s;if(!this.direction){let t="";if(Math.abs(a)>Math.abs(c)){t="horizontal"}else{t="vertical"}this.direction=t;i.preventDefault()}else{if(this.direction==="vertical"){this.action.startAction(this.direction,c,l)}else if(this.direction==="horizontal"){this.action.startAction(this.direction,-a,l)}i.preventDefault()}});t.addEventListener("touchend",t=>{this.xDown=null;this.yDown=null;this.direction=null;if(this.onTouchEnd){this.onTouchEnd(t)}})}}class l{constructor(t){this.lowSpeedForward=null;this.lowSpeedBackward=null;this.mediumSpeedForward=null;this.mediumSpeedBackward=null;this.highSpeedForward=null;this.highSpeedBackward=null;this.lowVolumeUp=null;this.lowVolumeDown=null;this.mediumVolumeUp=null;this.mediumVolumeDown=null;this.highVolumeUp=null;this.highVolumeDown=null;this.speedCancel=null;this.volumeCancel=null;this.minSwipeDistance=20;this.onActionStart=null;this.onActionEnd=null;this.element=t;this.touchStart=false;this.startPosition=null;this.lastAction=null;t.addEventListener("touchstart",t=>{this.touchStart=true});t.addEventListener("touchend",t=>{this.startPosition=null;this.onActionEnd&&this.onActionEnd(this.lastAction);this.lastAction=null})}startAction(t,i,e){if(this.touchStart){this.onActionStart&&this.onActionStart(t);this.startPosition=e;this.touchStart=false}if(t==="vertical"){if(Math.abs(i)=1/3&&this.startPosition.x<=2/3){t=1;o=this.mediumVolumeUp;s=this.mediumVolumeDown}else{t=2;o=this.highVolumeUp;s=this.highVolumeDown}if(i>0){const s=Math.round(t*100*(i-this.minSwipeDistance)/(1.5*e.height));o&&o(s);this.lastAction={type:"volume",volume:s}}else{const o=Math.round(t*100*(i+this.minSwipeDistance)/(1.5*e.height));s&&s(o);this.lastAction={type:"volume",volume:o}}}}else if(t==="horizontal"){if(e.y<1/3&&(e.x<.1||e.x>.9)||Math.abs(i)=1/3&&this.startPosition.y<=2/3){t=.2;e=this.mediumSpeedForward;o=this.mediumSpeedBackward}else{t=1;e=this.highSpeedForward;o=this.highSpeedBackward}if(i>0){const o=(i-this.minSwipeDistance)*t;e&&e(o);this.lastAction={type:"playback",seconds:o}}else{const e=(i+this.minSwipeDistance)*t;o&&o(e);this.lastAction={type:"playback",seconds:e}}}}}}class a{constructor(){this.aid=unsafeWindow.aid;this.cid=unsafeWindow.cid;this.cidData=null;this.supportWebp=a.supportWebp}getVideoshot(t,i){if(!this.cidData){downloadText(`https://api.bilibili.com/x/player/videoshot?aid=${this.aid}&cid=${this.cid}&index=1`).then(e=>{this.cidData=JSON.parse(e).data;this.getVideoshot(t,i)})}else{const e=this.cidData;const o=e.index;let s=0;for(let i=0;i=o[i]&&tt.replace(".jpg",".jpg@.webp"))}const l=parseInt(e.pv_x_len)||10;const a=parseInt(e.pv_y_len)||10;const c=parseInt(e.pv_x_size)||160;const r=parseInt(e.pv_y_size)||90;const d=-(s%100%l)*c;const h=-Math.floor(s%100/a)*r;i({width:c,height:r,backgroundImage:`url(${n[Math.floor(s/100)]})`,backgroundPosition:`${d}px ${h}px`})}}static get supportWebp(){try{const t=document.createElement("canvas");if(t.getContext&&t.getContext("2d"))try{return t.toDataURL("image/webp").indexOf("data:image/webp")===0}catch(t){return false}else return false}catch(t){return false}}}function c(t){t.unbind("click")}function r(i){if($(".touch-video-box").length!==0){return}$(".bilibili-player-video-subtitle").before(`\n
\n
\n
\n
\n
\n
`);const e=$("video");const l=e.prop("duration");const c=new n(i.get(0));const r=document.getElementsByClassName("touch-video-info")[0];const d=document.getElementsByClassName("touch-video-box")[0];let h=Math.round(e.prop("volume")*100);const u=t=>{t/=100;if(t<0){t=0}else if(t>1){t=1}e.prop("volume",t);const i=JSON.parse(localStorage.bilibili_player_settings);i.video_status.volume=t;localStorage.bilibili_player_settings=JSON.stringify(i);$(".bilibili-player-video-volume-num").text(Math.round(t*100));$(".bui-thumb").css("transform",`translateY(-${48*t}px)`);$(".bui-track-vertical .bui-bar").css("transform",`scaleY(${t})`);if(t===0){$(".bilibili-player-video-btn-volume").addClass("video-state-volume-min");$(".bilibili-player-video-btn-volume").removeClass("video-state-volume-max");e.prop("muted",true)}else if(t===1){$(".bilibili-player-video-btn-volume").removeClass("video-state-volume-min");$(".bilibili-player-video-btn-volume").addClass("video-state-volume-max");e.prop("muted",false)}else{$(".bilibili-player-video-btn-volume").removeClass("video-state-volume-min");$(".bilibili-player-video-btn-volume").removeClass("video-state-volume-max");e.prop("muted",false)}};if(t.touchVideoPlayerAnimation){d.classList.add("animation")}c.action.onActionStart=(t=>{d.classList.add("adjust-opened");r.innerHTML="";h=Math.round(e.prop("volume")*100)});const p=new a;const m=t=>{return i=>{const n=e.prop("currentTime");const a=fixed(100*n/l);let c=n+i;let d=fixed(100*c/l);let h=i;if(c>l){c=l;d=100;h=l-n}else if(c<0){c=0;d=0;h=n}const u=`${s(n)} (${a}%)
👇
${s(c)} (${d}%)`;const m=`\n
\n
\n ${t}速\n
\n
\n 进度: ${i>0?"+":"-"}${o(h)}\n
\n
\n
\n
\n
\n
\n
\n ${u}\n
\n
\n `;r.innerHTML=m;p.getVideoshot(c,t=>$(".videoshot").css(t));$(".touch-progress").css("transform",`scaleX(${d/100})`)}};c.action.lowSpeedBackward=m("低");c.action.lowSpeedForward=m("低");c.action.mediumSpeedBackward=m("中");c.action.mediumSpeedForward=m("中");c.action.highSpeedBackward=m("高");c.action.highSpeedForward=m("高");const v=t=>{return i=>{let e=h+i;let o=Math.abs(i);if(e>100){e=100;o=100-h}else if(e<0){e=0;o=h}const s=`${h} 👉 ${e}`;u(e);const n=`\n
\n
\n ${t}速\n
\n
\n 音量: ${i>0?"+":"-"}${o}\n
\n
\n
\n
\n ${s}\n
\n
\n `;r.innerHTML=n;$(".touch-progress").css("transform",`scaleX(${e/100})`)}};c.action.lowVolumeUp=v("低");c.action.lowVolumeDown=v("低");c.action.mediumVolumeUp=v("中");c.action.mediumVolumeDown=v("中");c.action.highVolumeUp=v("高");c.action.highVolumeDown=v("高");c.action.speedCancel=(()=>{r.innerHTML=`松开手指,取消进退`;$(".touch-progress").css("transform","scaleX(0)")});c.action.volumeCancel=(()=>{r.innerHTML=`松开手指,取消调整`;$(".touch-progress").css("transform","scaleX(0)");u(h)});if(!unsafeWindow.TOUCH_PLAYER_DEBUG){c.action.onActionEnd=(t=>{r.innerHTML="";if(t){if(t.type==="playback"){let i=e.prop("currentTime");i+=t.seconds;if(i<0){i=0}else if(i>l){i=l}e.prop("currentTime",i)}}d.classList.remove("adjust-opened")})}}function d(t){if(!t.hasClass("disable-original-hover")){t.addClass("disable-original-hover");const i=unsafeWindow.$(".bilibili-player-video");const e="touch-video-control-show";const o=i.data("events").click[0].handler;const s=new DoubleClickEvent(t=>o(t),()=>t.toggleClass(e));i.unbind("click");s.bind(i[0])}}const h=()=>{SpinQuery.any(()=>$(".bilibili-player-iconfont,.bilibili-player-video-quality-menu"),c);SpinQuery.condition(()=>$(".bilibili-player-video"),t=>t.length>0&&$("video").length>0&&$("video").prop("duration"),r);if(t.touchVideoPlayerDoubleTapControl){new SpinQuery(()=>$(".bilibili-player-area"),t=>t.length>0&&unsafeWindow.$&&unsafeWindow.$(".bilibili-player-video").data("events"),d).start()}};if(Observer.videoChange){Observer.videoChange(h)}else{Observer.childList("#bofqi",()=>h())}i.applyStyle("touchPlayerStyle")}})(); \ No newline at end of file +(()=>{return(t,i)=>{const e=t=>{let i=0;let e=0;while(t&&!isNaN(t.offsetLeft)&&!isNaN(t.offsetTop)){i+=t.offsetLeft-t.scrollLeft;e+=t.offsetTop-t.scrollTop;t=t.offsetParent}return{x:i,y:e}};const s=t=>{t=Math.abs(t);const i=Math.floor(t/3600);const e=Math.floor((t-i*3600)/60);const s=t-i*3600-e*60;let o=fixed(s)+"秒";if(e>0){o=e+"分"+o}if(i>0){o=i+"时"+o}return o};const o=t=>{t=Math.abs(t);const i=Math.floor(t/3600);const e=Math.floor((t-i*3600)/60);const s=t-i*3600-e*60;let o=(s<10?"0":"")+fixed(s);o=(e<10?"0":"")+e+":"+o;o=(i<10?"0":"")+i+":"+o;return o};class n{constructor(t){this.action=new l(t);this.onTouchStart=null;this.onTouchEnd=null;this.direction=null;t.addEventListener("touchstart",t=>{this.xDown=t.touches[0].clientX;this.yDown=t.touches[0].clientY;if(this.onTouchStart){this.onTouchStart(t)}});t.addEventListener("touchmove",i=>{if(!this.xDown||!this.yDown){return}const s=i.touches[0].clientX;const o=i.touches[0].clientY;const n=e(t);const l={x:(i.touches[0].pageX-n.x)/t.clientWidth,y:(i.touches[0].pageY-n.y)/t.clientHeight,width:t.clientWidth,height:t.clientHeight};const a=this.xDown-s;const c=this.yDown-o;if(!this.direction){let t="";if(Math.abs(a)>Math.abs(c)){t="horizontal"}else{t="vertical"}this.direction=t;i.preventDefault()}else{if(this.direction==="vertical"){this.action.startAction(this.direction,c,l)}else if(this.direction==="horizontal"){this.action.startAction(this.direction,-a,l)}i.preventDefault()}});t.addEventListener("touchend",t=>{this.xDown=null;this.yDown=null;this.direction=null;if(this.onTouchEnd){this.onTouchEnd(t)}})}}class l{constructor(t){this.lowSpeedForward=null;this.lowSpeedBackward=null;this.mediumSpeedForward=null;this.mediumSpeedBackward=null;this.highSpeedForward=null;this.highSpeedBackward=null;this.lowVolumeUp=null;this.lowVolumeDown=null;this.mediumVolumeUp=null;this.mediumVolumeDown=null;this.highVolumeUp=null;this.highVolumeDown=null;this.speedCancel=null;this.volumeCancel=null;this.minSwipeDistance=20;this.onActionStart=null;this.onActionEnd=null;this.element=t;this.touchStart=false;this.startPosition=null;this.lastAction=null;t.addEventListener("touchstart",t=>{this.touchStart=true});t.addEventListener("touchend",t=>{this.startPosition=null;this.onActionEnd&&this.onActionEnd(this.lastAction);this.lastAction=null})}startAction(t,i,e){if(this.touchStart){this.onActionStart&&this.onActionStart(t);this.startPosition=e;this.touchStart=false}if(t==="vertical"){if(Math.abs(i)=1/3&&this.startPosition.x<=2/3){t=1;s=this.mediumVolumeUp;o=this.mediumVolumeDown}else{t=2;s=this.highVolumeUp;o=this.highVolumeDown}if(i>0){const o=Math.round(t*100*(i-this.minSwipeDistance)/(1.5*e.height));s&&s(o);this.lastAction={type:"volume",volume:o}}else{const s=Math.round(t*100*(i+this.minSwipeDistance)/(1.5*e.height));o&&o(s);this.lastAction={type:"volume",volume:s}}}}else if(t==="horizontal"){if(e.y<1/3&&(e.x<.1||e.x>.9)||Math.abs(i)=1/3&&this.startPosition.y<=2/3){t=.2;e=this.mediumSpeedForward;s=this.mediumSpeedBackward}else{t=1;e=this.highSpeedForward;s=this.highSpeedBackward}if(i>0){const s=(i-this.minSwipeDistance)*t;e&&e(s);this.lastAction={type:"playback",seconds:s}}else{const e=(i+this.minSwipeDistance)*t;s&&s(e);this.lastAction={type:"playback",seconds:e}}}}}}class a{constructor(){this.aid=unsafeWindow.aid;this.cid=unsafeWindow.cid;this.cidData=null;this.supportWebp=a.supportWebp}getVideoshot(t,i){if(!(this.aid&&this.cid)){return}if(!this.cidData){Ajax.getText(`https://api.bilibili.com/x/player/videoshot?aid=${this.aid}&cid=${this.cid}&index=1`).then(e=>{this.cidData=JSON.parse(e).data;this.getVideoshot(t,i)})}else{const e=this.cidData;const s=e.index;let o=0;for(let i=0;i=s[i]&&tt.replace(".jpg",".jpg@.webp"))}const l=parseInt(e.pv_x_len)||10;const a=parseInt(e.pv_y_len)||10;const c=parseInt(e.pv_x_size)||160;const r=parseInt(e.pv_y_size)||90;const d=-(o%100%l)*c;const h=-Math.floor(o%100/a)*r;i({width:c,height:r,backgroundImage:`url(${n[Math.floor(o/100)]})`,backgroundPosition:`${d}px ${h}px`})}}static get supportWebp(){try{const t=document.createElement("canvas");if(t.getContext&&t.getContext("2d"))try{return t.toDataURL("image/webp").indexOf("data:image/webp")===0}catch(t){return false}else return false}catch(t){return false}}}function c(t){t.unbind("click")}function r(i){if($(".touch-video-box").length!==0){return}$(".bilibili-player-video-subtitle").before(`\n
\n
\n
\n
\n
\n
`);const e=$("video");const l=e.prop("duration");const c=new n(i.get(0));const r=document.getElementsByClassName("touch-video-info")[0];const d=document.getElementsByClassName("touch-video-box")[0];let h=Math.round(e.prop("volume")*100);const u=t=>{t/=100;if(t<0){t=0}else if(t>1){t=1}e.prop("volume",t);const i=JSON.parse(localStorage.bilibili_player_settings);i.video_status.volume=t;localStorage.bilibili_player_settings=JSON.stringify(i);$(".bilibili-player-video-volume-num").text(Math.round(t*100));$(".bui-thumb").css("transform",`translateY(-${48*t}px)`);$(".bui-track-vertical .bui-bar").css("transform",`scaleY(${t})`);if(t===0){$(".bilibili-player-video-btn-volume").addClass("video-state-volume-min");$(".bilibili-player-video-btn-volume").removeClass("video-state-volume-max");e.prop("muted",true)}else if(t===1){$(".bilibili-player-video-btn-volume").removeClass("video-state-volume-min");$(".bilibili-player-video-btn-volume").addClass("video-state-volume-max");e.prop("muted",false)}else{$(".bilibili-player-video-btn-volume").removeClass("video-state-volume-min");$(".bilibili-player-video-btn-volume").removeClass("video-state-volume-max");e.prop("muted",false)}};if(t.touchVideoPlayerAnimation){d.classList.add("animation")}c.action.onActionStart=(t=>{d.classList.add("adjust-opened");r.innerHTML="";h=Math.round(e.prop("volume")*100)});const p=new a;const m=t=>{return i=>{const n=e.prop("currentTime");const a=fixed(100*n/l);let c=n+i;let d=fixed(100*c/l);let h=i;if(c>l){c=l;d=100;h=l-n}else if(c<0){c=0;d=0;h=n}const u=`${o(n)} (${a}%)
👇
${o(c)} (${d}%)`;const m=`\n
\n
\n ${t}速\n
\n
\n 进度: ${i>0?"+":"-"}${s(h)}\n
\n
\n
\n
\n
\n
\n
\n ${u}\n
\n
\n `;r.innerHTML=m;p.getVideoshot(c,t=>$(".videoshot").css(t));$(".touch-progress").css("transform",`scaleX(${d/100})`)}};c.action.lowSpeedBackward=m("低");c.action.lowSpeedForward=m("低");c.action.mediumSpeedBackward=m("中");c.action.mediumSpeedForward=m("中");c.action.highSpeedBackward=m("高");c.action.highSpeedForward=m("高");const v=t=>{return i=>{let e=h+i;let s=Math.abs(i);if(e>100){e=100;s=100-h}else if(e<0){e=0;s=h}const o=`${h} 👉 ${e}`;u(e);const n=`\n
\n
\n ${t}速\n
\n
\n 音量: ${i>0?"+":"-"}${s}\n
\n
\n
\n
\n ${o}\n
\n
\n `;r.innerHTML=n;$(".touch-progress").css("transform",`scaleX(${e/100})`)}};c.action.lowVolumeUp=v("低");c.action.lowVolumeDown=v("低");c.action.mediumVolumeUp=v("中");c.action.mediumVolumeDown=v("中");c.action.highVolumeUp=v("高");c.action.highVolumeDown=v("高");c.action.speedCancel=(()=>{r.innerHTML=`松开手指,取消进退`;$(".touch-progress").css("transform","scaleX(0)")});c.action.volumeCancel=(()=>{r.innerHTML=`松开手指,取消调整`;$(".touch-progress").css("transform","scaleX(0)");u(h)});if(!unsafeWindow.TOUCH_PLAYER_DEBUG){c.action.onActionEnd=(t=>{r.innerHTML="";if(t){if(t.type==="playback"){let i=e.prop("currentTime");i+=t.seconds;if(i<0){i=0}else if(i>l){i=l}e.prop("currentTime",i)}}d.classList.remove("adjust-opened")})}}function d(t){if(!t.hasClass("disable-original-hover")){t.addClass("disable-original-hover");const i=unsafeWindow.$(".bilibili-player-video");const e="touch-video-control-show";const s=i.data("events").click[0].handler;const o=new DoubleClickEvent(t=>s(t),()=>t.toggleClass(e));i.unbind("click");o.bind(i[0])}}const h=()=>{SpinQuery.any(()=>$(".bilibili-player-iconfont,.bilibili-player-video-quality-menu"),c);SpinQuery.condition(()=>$(".bilibili-player-video"),t=>t.length>0&&$("video").length>0&&$("video").prop("duration"),r);if(t.touchVideoPlayerDoubleTapControl){new SpinQuery(()=>$(".bilibili-player-area"),t=>t.length>0&&unsafeWindow.$&&unsafeWindow.$(".bilibili-player-video").data("events"),d).start()}};if(Observer.videoChange){Observer.videoChange(h)}else{Observer.childList("#bofqi",()=>h())}i.applyStyle("touchPlayerStyle")}})(); \ No newline at end of file diff --git a/min/video-info.min.js b/min/video-info.min.js index 19fcbde7b..67e921145 100644 --- a/min/video-info.min.js +++ b/min/video-info.min.js @@ -1 +1 @@ -(()=>{return(t,i)=>{class e{constructor(t){this.aid=t}async fetchInfo(){const t=JSON.parse(await downloadText(`https://api.bilibili.com/x/web-interface/view?aid=${this.aid}`));if(t.code!==0){throw new Error(t.message)}const i=t.data;this.cid=i.cid;this.pageCount=i.videos;this.coverUrl=i.pic;this.tagId=i.tid;this.tagName=i.tname;this.title=i.title;this.description=i.desc;this.up={uid:i.owner.mid,name:i.owner.name,faceUrl:i.owner.face};this.pages=i.pages.map(t=>{return{cid:t.cid,title:t.part,pageNumber:t.page}});return this}async fetchDanmaku(){this.danmaku=new s(this.cid);return this.danmaku.fetchInfo()}}class a{constructor(t,i){this.text=t;this.p=i}}class s{constructor(t){this.cid=t}async fetchInfo(){const t=await downloadText(`https://api.bilibili.com/x/v1/dm/list.so?oid=${this.cid}`);this.rawXML=t;const i=(new DOMParser).parseFromString(t,"application/xml").documentElement;this.xml=i;this.danmakus=[].map.call(i.querySelectorAll("d[p]"),t=>{return new a(t.innerHTML,t.getAttribute("p"))})}}class n{constructor(t){this.ep=t;this.videos=[]}async fetchInfo(){const t=await downloadText(`https://www.bilibili.com/bangumi/play/ep${this.ep}/`);const i=JSON.parse(t.match(/window\.__INITIAL_STATE__=(.*);\(function\(\){/)[1]);this.title=i.mediaInfo.title;this.cover=i.mediaInfo.cover;this.squareCover=i.mediaInfo.square_cover;this.aid=i.epInfo.aid;this.cid=i.epInfo.cid;this.videos=i.epList.map(async t=>{return{title:t.index_title,aid:t.aid,cid:t.cid,info:await new e(t.aid).fetchInfo()}});return this}}return{export:{VideoInfo:e,BangumiInfo:n,Danmaku:a,DanmakuInfo:s}}}})(); \ No newline at end of file +(()=>{return(t,i)=>{class e{constructor(t){this.aid=t}async fetchInfo(){const t=JSON.parse(await Ajax.getText(`https://api.bilibili.com/x/web-interface/view?aid=${this.aid}`));if(t.code!==0){throw new Error(t.message)}const i=t.data;this.cid=i.cid;this.pageCount=i.videos;this.coverUrl=i.pic;this.tagId=i.tid;this.tagName=i.tname;this.title=i.title;this.description=i.desc;this.up={uid:i.owner.mid,name:i.owner.name,faceUrl:i.owner.face};this.pages=i.pages.map(t=>{return{cid:t.cid,title:t.part,pageNumber:t.page}});return this}async fetchDanmaku(){this.danmaku=new s(this.cid);return this.danmaku.fetchInfo()}}class a{constructor(t,i){this.text=t;this.p=i}}class s{constructor(t){this.cid=t}async fetchInfo(){const t=await Ajax.getText(`https://api.bilibili.com/x/v1/dm/list.so?oid=${this.cid}`);this.rawXML=t;const i=(new DOMParser).parseFromString(t,"application/xml").documentElement;this.xml=i;this.danmakus=[].map.call(i.querySelectorAll("d[p]"),t=>{return new a(t.innerHTML,t.getAttribute("p"))})}}class n{constructor(t){this.ep=t;this.videos=[]}async fetchInfo(){const t=await Ajax.getText(`https://www.bilibili.com/bangumi/play/ep${this.ep}/`);const i=JSON.parse(t.match(/window\.__INITIAL_STATE__=(.*);\(function\(\){/)[1]);this.title=i.mediaInfo.title;this.cover=i.mediaInfo.cover;this.squareCover=i.mediaInfo.square_cover;this.aid=i.epInfo.aid;this.cid=i.epInfo.cid;this.videos=i.epList.map(async t=>{return{title:t.index_title,aid:t.aid,cid:t.cid,info:await new e(t.aid).fetchInfo()}});return this}}return{export:{VideoInfo:e,BangumiInfo:n,Danmaku:a,DanmakuInfo:s}}}})(); \ No newline at end of file diff --git a/min/view-cover.min.js b/min/view-cover.min.js index 4271907df..2b89cc8a9 100644 --- a/min/view-cover.min.js +++ b/min/view-cover.min.js @@ -1 +1 @@ -(()=>{return(e,t)=>{const{VideoInfo:i}=t.import("video-info");const{getFriendlyTitle:n}=t.import("title");class o{constructor(e){this.url=e;if($(".image-viewer").length===0){this.createContainer()}this.viewer=$(".image-viewer-container");this.downloadImage()}createContainer(){$("body").append((t.data.imageViewerDom||t.data.imageViewerHtml).text);$(".image-viewer-container .close").on("click",()=>this.hide());t.applyStyle("imageViewerStyle")}downloadImage(){const e=new XMLHttpRequest;e.open("GET",this.url.replace("http:","https:"),true);e.responseType="blob";e.onload=(()=>{const t=n();const i=URL.createObjectURL(e.response);if(this.imageData){URL.revokeObjectURL(this.imageData)}this.imageData=i;this.viewer.find(".download").attr("href",i).attr("download",t+this.url.substring(this.url.lastIndexOf(".")));this.viewer.find(".copy-link").on("click",()=>GM_setClipboard(this.url));this.viewer.find(".new-tab").attr("href",this.url);this.viewer.find(".image").prop("src",i)});e.send()}show(){this.viewer.addClass("opened")}hide(){this.viewer.removeClass("opened")}}return(()=>{if($("meta[itemprop='image'],meta[property='og:image']").length>0){return{widget:{content:`\n \n \n 查看封面\n `,condition:async()=>{const e=await SpinQuery.select(()=>(unsafeWindow||window).aid);return Boolean(e)},success:async()=>{async function e(){const e=(unsafeWindow||window).aid;const t=new i(e);await t.fetchInfo();return t.coverUrl}let t=new o(await e());$("#view-cover").on("click",()=>{t.show()});const n=async()=>{t=new o(await e())};if(Observer.videoChange){Observer.videoChange(n)}else{Observer.childList("#bofqi",n)}}}}}else{return{widget:{content:`\n \n \n 查看封面\n `,condition:async()=>{const e=await SpinQuery.select(()=>document.querySelector(".header-info-ctnr .room-cover"));return Boolean(e)},success:async()=>{const e=$(".header-info-ctnr .room-cover");const t=e.attr("href").match(/space\.bilibili\.com\/([\d]+)/);if(t&&t[1]){const e=t[1];const i=`https://api.live.bilibili.com/room/v1/Room/getRoomInfoOld?mid=${e}`;const n=await downloadText(i);const s=JSON.parse(n).data.cover;const a=new o(s);$("#view-cover").on("click",()=>{a.show()})}}}}}})()}})(); \ No newline at end of file +(()=>{return(e,t)=>{const{VideoInfo:i}=t.import("video-info");const{getFriendlyTitle:n}=t.import("title");class o{constructor(e){this.url=e;if($(".image-viewer").length===0){this.createContainer()}this.viewer=$(".image-viewer-container");this.downloadImage()}createContainer(){$("body").append((t.data.imageViewerDom||t.data.imageViewerHtml).text);$(".image-viewer-container .close").on("click",()=>this.hide());t.applyStyle("imageViewerStyle")}downloadImage(){const e=new XMLHttpRequest;e.open("GET",this.url.replace("http:","https:"),true);e.responseType="blob";e.onload=(()=>{const t=n();const i=URL.createObjectURL(e.response);if(this.imageData){URL.revokeObjectURL(this.imageData)}this.imageData=i;this.viewer.find(".download").attr("href",i).attr("download",t+this.url.substring(this.url.lastIndexOf(".")));this.viewer.find(".copy-link").on("click",()=>GM_setClipboard(this.url));this.viewer.find(".new-tab").attr("href",this.url);this.viewer.find(".image").prop("src",i)});e.send()}show(){this.viewer.addClass("opened")}hide(){this.viewer.removeClass("opened")}}return(()=>{if($("meta[itemprop='image'],meta[property='og:image']").length>0){return{widget:{content:`\n \n \n 查看封面\n `,condition:async()=>{const e=await SpinQuery.select(()=>(unsafeWindow||window).aid);return Boolean(e)},success:async()=>{async function e(){const e=(unsafeWindow||window).aid;const t=new i(e);await t.fetchInfo();return t.coverUrl}let t=new o(await e());$("#view-cover").on("click",()=>{t.show()});const n=async()=>{t=new o(await e())};if(Observer.videoChange){Observer.videoChange(n)}else{Observer.childList("#bofqi",n)}}}}}else{return{widget:{content:`\n \n \n 查看封面\n `,condition:async()=>{const e=await SpinQuery.select(()=>document.querySelector(".header-info-ctnr .room-cover"));return Boolean(e)},success:async()=>{const e=$(".header-info-ctnr .room-cover");const t=e.attr("href").match(/space\.bilibili\.com\/([\d]+)/);if(t&&t[1]){const e=t[1];const i=`https://api.live.bilibili.com/room/v1/Room/getRoomInfoOld?mid=${e}`;const n=await Ajax.getText(i);const s=JSON.parse(n).data.cover;const a=new o(s);$("#view-cover").on("click",()=>{a.show()})}}}}}})()}})(); \ No newline at end of file diff --git a/touch/player/touch-player.js b/touch/player/touch-player.js index 3695f099d..422232f8e 100644 --- a/touch/player/touch-player.js +++ b/touch/player/touch-player.js @@ -286,9 +286,13 @@ class VideoShot } getVideoshot(currentTime, done) { + if (!(this.aid && this.cid)) + { + return; + } if (!this.cidData) { - downloadText(`https://api.bilibili.com/x/player/videoshot?aid=${this.aid}&cid=${this.cid}&index=1`).then(response => + Ajax.getText(`https://api.bilibili.com/x/player/videoshot?aid=${this.aid}&cid=${this.cid}&index=1`).then(response => { this.cidData = JSON.parse(response).data; this.getVideoshot(currentTime, done); diff --git a/video/video-info.js b/video/video-info.js index 17357bf0c..d9ba1fcd8 100644 --- a/video/video-info.js +++ b/video/video-info.js @@ -6,7 +6,7 @@ export class VideoInfo } async fetchInfo() { - const json = JSON.parse(await downloadText(`https://api.bilibili.com/x/web-interface/view?aid=${this.aid}`)); + const json = JSON.parse(await Ajax.getText(`https://api.bilibili.com/x/web-interface/view?aid=${this.aid}`)); if (json.code !== 0) { throw new Error(json.message); @@ -56,7 +56,7 @@ export class DanmakuInfo } async fetchInfo() { - const xml = await downloadText(`https://api.bilibili.com/x/v1/dm/list.so?oid=${this.cid}`); + const xml = await Ajax.getText(`https://api.bilibili.com/x/v1/dm/list.so?oid=${this.cid}`); this.rawXML = xml; const dom = new DOMParser().parseFromString(xml, "application/xml").documentElement; @@ -76,7 +76,7 @@ export class BangumiInfo } async fetchInfo() { - const data = await downloadText(`https://www.bilibili.com/bangumi/play/ep${this.ep}/`); + const data = await Ajax.getText(`https://www.bilibili.com/bangumi/play/ep${this.ep}/`); const json = JSON.parse(data.match(/window\.__INITIAL_STATE__=(.*);\(function\(\){/)[1]); this.title = json.mediaInfo.title; this.cover = json.mediaInfo.cover; diff --git a/video/view-cover/view-cover.js b/video/view-cover/view-cover.js index d90d51f66..d13ff1407 100644 --- a/video/view-cover/view-cover.js +++ b/video/view-cover/view-cover.js @@ -126,7 +126,7 @@ export default (() => { const uid = match[1]; const url = `https://api.live.bilibili.com/room/v1/Room/getRoomInfoOld?mid=${uid}`; - const text = await downloadText(url); + const text = await Ajax.getText(url); const coverUrl = JSON.parse(text).data.cover; const imageViewer = new ImageViewer(coverUrl); $("#view-cover").on("click", () =>