From b544b45d41652061cacf06764969301b19c74f21 Mon Sep 17 00:00:00 2001 From: the1812 Date: Mon, 11 Feb 2019 13:44:34 +0800 Subject: [PATCH] Fix bug in override navbar --- bilibili-evolved.offline.user.js | 2 +- bilibili-evolved.preview-offline.user.js | 2 +- min/override-navbar.min.js | 2 +- style/override-navbar/override-navbar.js | 17 +++++++++-------- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/bilibili-evolved.offline.user.js b/bilibili-evolved.offline.user.js index e7b97c026..dc4fa7e47 100644 --- a/bilibili-evolved.offline.user.js +++ b/bilibili-evolved.offline.user.js @@ -1228,7 +1228,7 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/dark-styles.min.js"] = (()=>{return(e,l)=>{if(e.useDarkStyle){l.applyStyle("scrollbarStyle");SpinQuery.any(()=>$(".custom-scrollbar"),e=>e.removeClass("custom-scrollbar"));if($("#banner_link").length===0||$("#banner_link").length>0&&e.overrideNavBar&&!e.showBanner){l.applyImportantStyle("darkStyleNavBar")}l.applyStyle("darkStyle");l.applyImportantStyle("darkStyleImportant")}else{l.removeStyle("scrollbarStyle");l.removeStyle("darkStyleNavBar");l.removeStyle("darkStyle");l.removeStyle("darkStyleImportant")}}})(); 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/new-styles.min.js"] = (()=>{return(e,t)=>{if(document.URL===`https://h.bilibili.com/`){return}SpinQuery.any(()=>$(".custom-scrollbar"),e=>e.removeClass("custom-scrollbar"));SpinQuery.any(()=>$("#banner_link"),()=>t.removeStyle("tweetsStyle"));const l={selectors:["div.nav-con.fl","#link-navbar-vm",".link-navbar",".nav-header-wrapper",".z_top .z_header"],get allSelectors(){return this.selectors.reduce((e,t)=>e+","+t)},get navbar(){let e=null;for(const t of this.selectors){e=e||document.querySelector(t)}return e},supports(e){if(e instanceof Element){const t=parseInt(window.getComputedStyle(e).height);const l=[60,50,0,56];return l.indexOf(t)!==-1}return false}};SpinQuery.any(()=>$(l.allSelectors),()=>{const e=l.navbar;if(l.supports(e)){t.applyStyle("style","bilibili-style-optimization")}else{t.applyStyle("oldStyle","bilibili-style-optimization")}})}})(); -offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/override-navbar.min.js"] = (()=>{return(e,n)=>{SpinQuery.any(()=>$(".head-content.bili-wrapper>div.search:not(.filter-item)"),e=>{e.detach().insertAfter(".nav-con.fr")});if(e.preserveRank){SpinQuery.any(()=>$(".nav-wrapper .searchform,.nav-con #nav_searchform"),e=>{e.addClass("preserve-rank");if(e.find("a.icons-enabled").length===0){e.prepend(`\n \n \n \n `)}})}else{SpinQuery.any(()=>$(".nav-wrapper .searchform,.nav-con #nav_searchform"),e=>{e.removeClass("preserve-rank");e.find("a.icons-enabled").remove()})}SpinQuery.any(()=>$("#banner_link"),()=>n.removeStyle("tweetsStyle"));if(!e.showBanner){n.applyStyle("noBannerStyle")}else{n.removeStyle("noBannerStyle")}}})(); +offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/override-navbar.min.js"] = (()=>{return(e,n)=>{SpinQuery.any(()=>$(".head-content.bili-wrapper>div.search:not(.filter-item)"),e=>{const n=$(document.querySelector(".nav-con.fr"));e.detach().insertAfter(n)});if(e.preserveRank){SpinQuery.any(()=>$(".nav-wrapper .searchform,.nav-con #nav_searchform"),e=>{e.addClass("preserve-rank");if(e.find("a.icons-enabled").length===0){e.prepend(`\n \n \n \n `)}})}else{SpinQuery.any(()=>$(".nav-wrapper .searchform,.nav-con #nav_searchform"),e=>{e.removeClass("preserve-rank");e.find("a.icons-enabled").remove()})}SpinQuery.any(()=>$("#banner_link"),()=>n.removeStyle("tweetsStyle"));if(!e.showBanner){n.applyStyle("noBannerStyle")}else{n.removeStyle("noBannerStyle")}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/touch-navbar.min.js"] = (()=>{return()=>{SpinQuery.count(()=>$("ul.fr>li.nav-item").not(".profile-info"),6,n=>{const r=(n,r)=>{const t=$(r);t.css("cursor","pointer");const o=t.find("a.t");o.removeAttr("href")};n.each(r)})}})(); 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);$(".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);new SpinQuery(()=>$(".bilibili-player-video"),t=>t.length>0&&$("video").length>0&&$("video").prop("duration"),r).start();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/expand-danmaku.min.js"] = (()=>{return()=>{const e=()=>{SpinQuery.any(()=>$(".bui-collapse-header"),e=>{if(parseInt($(".bui-collapse-body").css("height"))===0&&$(".bui-collapse-arrow-text").text()==="展开"){e.click()}})};if(Observer.videoChange){Observer.videoChange(e)}else{Observer.childList("#bofqi",e)}}})(); diff --git a/bilibili-evolved.preview-offline.user.js b/bilibili-evolved.preview-offline.user.js index cd46e947c..96775b366 100644 --- a/bilibili-evolved.preview-offline.user.js +++ b/bilibili-evolved.preview-offline.user.js @@ -1228,7 +1228,7 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/dark-styles.min.js"] = (()=>{return(e,l)=>{if(e.useDarkStyle){l.applyStyle("scrollbarStyle");SpinQuery.any(()=>$(".custom-scrollbar"),e=>e.removeClass("custom-scrollbar"));if($("#banner_link").length===0||$("#banner_link").length>0&&e.overrideNavBar&&!e.showBanner){l.applyImportantStyle("darkStyleNavBar")}l.applyStyle("darkStyle");l.applyImportantStyle("darkStyleImportant")}else{l.removeStyle("scrollbarStyle");l.removeStyle("darkStyleNavBar");l.removeStyle("darkStyle");l.removeStyle("darkStyleImportant")}}})(); 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/new-styles.min.js"] = (()=>{return(e,t)=>{if(document.URL===`https://h.bilibili.com/`){return}SpinQuery.any(()=>$(".custom-scrollbar"),e=>e.removeClass("custom-scrollbar"));SpinQuery.any(()=>$("#banner_link"),()=>t.removeStyle("tweetsStyle"));const l={selectors:["div.nav-con.fl","#link-navbar-vm",".link-navbar",".nav-header-wrapper",".z_top .z_header"],get allSelectors(){return this.selectors.reduce((e,t)=>e+","+t)},get navbar(){let e=null;for(const t of this.selectors){e=e||document.querySelector(t)}return e},supports(e){if(e instanceof Element){const t=parseInt(window.getComputedStyle(e).height);const l=[60,50,0,56];return l.indexOf(t)!==-1}return false}};SpinQuery.any(()=>$(l.allSelectors),()=>{const e=l.navbar;if(l.supports(e)){t.applyStyle("style","bilibili-style-optimization")}else{t.applyStyle("oldStyle","bilibili-style-optimization")}})}})(); -offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/override-navbar.min.js"] = (()=>{return(e,n)=>{SpinQuery.any(()=>$(".head-content.bili-wrapper>div.search:not(.filter-item)"),e=>{e.detach().insertAfter(".nav-con.fr")});if(e.preserveRank){SpinQuery.any(()=>$(".nav-wrapper .searchform,.nav-con #nav_searchform"),e=>{e.addClass("preserve-rank");if(e.find("a.icons-enabled").length===0){e.prepend(`\n \n \n \n `)}})}else{SpinQuery.any(()=>$(".nav-wrapper .searchform,.nav-con #nav_searchform"),e=>{e.removeClass("preserve-rank");e.find("a.icons-enabled").remove()})}SpinQuery.any(()=>$("#banner_link"),()=>n.removeStyle("tweetsStyle"));if(!e.showBanner){n.applyStyle("noBannerStyle")}else{n.removeStyle("noBannerStyle")}}})(); +offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/override-navbar.min.js"] = (()=>{return(e,n)=>{SpinQuery.any(()=>$(".head-content.bili-wrapper>div.search:not(.filter-item)"),e=>{const n=$(document.querySelector(".nav-con.fr"));e.detach().insertAfter(n)});if(e.preserveRank){SpinQuery.any(()=>$(".nav-wrapper .searchform,.nav-con #nav_searchform"),e=>{e.addClass("preserve-rank");if(e.find("a.icons-enabled").length===0){e.prepend(`\n \n \n \n `)}})}else{SpinQuery.any(()=>$(".nav-wrapper .searchform,.nav-con #nav_searchform"),e=>{e.removeClass("preserve-rank");e.find("a.icons-enabled").remove()})}SpinQuery.any(()=>$("#banner_link"),()=>n.removeStyle("tweetsStyle"));if(!e.showBanner){n.applyStyle("noBannerStyle")}else{n.removeStyle("noBannerStyle")}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/touch-navbar.min.js"] = (()=>{return()=>{SpinQuery.count(()=>$("ul.fr>li.nav-item").not(".profile-info"),6,n=>{const r=(n,r)=>{const t=$(r);t.css("cursor","pointer");const o=t.find("a.t");o.removeAttr("href")};n.each(r)})}})(); 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);$(".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);new SpinQuery(()=>$(".bilibili-player-video"),t=>t.length>0&&$("video").length>0&&$("video").prop("duration"),r).start();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/expand-danmaku.min.js"] = (()=>{return()=>{const e=()=>{SpinQuery.any(()=>$(".bui-collapse-header"),e=>{if(parseInt($(".bui-collapse-body").css("height"))===0&&$(".bui-collapse-arrow-text").text()==="展开"){e.click()}})};if(Observer.videoChange){Observer.videoChange(e)}else{Observer.childList("#bofqi",e)}}})(); diff --git a/min/override-navbar.min.js b/min/override-navbar.min.js index da3409055..9ab0cbcd6 100644 --- a/min/override-navbar.min.js +++ b/min/override-navbar.min.js @@ -1 +1 @@ -(()=>{return(e,n)=>{SpinQuery.any(()=>$(".head-content.bili-wrapper>div.search:not(.filter-item)"),e=>{e.detach().insertAfter(".nav-con.fr")});if(e.preserveRank){SpinQuery.any(()=>$(".nav-wrapper .searchform,.nav-con #nav_searchform"),e=>{e.addClass("preserve-rank");if(e.find("a.icons-enabled").length===0){e.prepend(`\n \n \n \n `)}})}else{SpinQuery.any(()=>$(".nav-wrapper .searchform,.nav-con #nav_searchform"),e=>{e.removeClass("preserve-rank");e.find("a.icons-enabled").remove()})}SpinQuery.any(()=>$("#banner_link"),()=>n.removeStyle("tweetsStyle"));if(!e.showBanner){n.applyStyle("noBannerStyle")}else{n.removeStyle("noBannerStyle")}}})(); \ No newline at end of file +(()=>{return(e,n)=>{SpinQuery.any(()=>$(".head-content.bili-wrapper>div.search:not(.filter-item)"),e=>{const n=$(document.querySelector(".nav-con.fr"));e.detach().insertAfter(n)});if(e.preserveRank){SpinQuery.any(()=>$(".nav-wrapper .searchform,.nav-con #nav_searchform"),e=>{e.addClass("preserve-rank");if(e.find("a.icons-enabled").length===0){e.prepend(`\n \n \n \n `)}})}else{SpinQuery.any(()=>$(".nav-wrapper .searchform,.nav-con #nav_searchform"),e=>{e.removeClass("preserve-rank");e.find("a.icons-enabled").remove()})}SpinQuery.any(()=>$("#banner_link"),()=>n.removeStyle("tweetsStyle"));if(!e.showBanner){n.applyStyle("noBannerStyle")}else{n.removeStyle("noBannerStyle")}}})(); \ No newline at end of file diff --git a/style/override-navbar/override-navbar.js b/style/override-navbar/override-navbar.js index ff519100f..533b0c67e 100644 --- a/style/override-navbar/override-navbar.js +++ b/style/override-navbar/override-navbar.js @@ -6,7 +6,8 @@ () => $(".head-content.bili-wrapper>div.search:not(.filter-item)"), textBox => { - textBox.detach().insertAfter(".nav-con.fr"); + const rightNavbar = $(document.querySelector(".nav-con.fr")); + textBox.detach().insertAfter(rightNavbar); }, ); if (settings.preserveRank) @@ -19,13 +20,13 @@ if (searchForm.find("a.icons-enabled").length === 0) { searchForm.prepend(` - - - - `); + + + + `); } } );