From f9583509bc4efeffb698e010b4c0f444101ef7eb Mon Sep 17 00:00:00 2001 From: the1812 Date: Sat, 3 Oct 2020 16:08:35 +0800 Subject: [PATCH] Add 4K option for live quality --- bilibili-evolved.offline.user.js | 4 ++-- bilibili-evolved.preview-offline.user.js | 4 ++-- bilibili-evolved.preview.user.js | 4 ++-- bilibili-evolved.user.js | 4 ++-- min/bundle.json | 2 +- min/bundle.zip | Bin 2370688 -> 2370680 bytes min/default-live-quality.min.js | 2 +- src/client/resource-manifest.js | 2 +- src/live/default-live-quality.ts | 4 +--- 9 files changed, 12 insertions(+), 14 deletions(-) diff --git a/bilibili-evolved.offline.user.js b/bilibili-evolved.offline.user.js index e5c3e600a..3bf6e57d1 100644 --- a/bilibili-evolved.offline.user.js +++ b/bilibili-evolved.offline.user.js @@ -1355,7 +1355,7 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/debounce.min.js"] = (()=>{return(n,l)=>{function u(n,l,u){var e,t,i,r,f;if(null==l)l=100;function o(){var a=Date.now()-r;if(a=0){e=setTimeout(o,l-a)}else{e=null;if(!u){f=n.apply(i,t);i=t=null}}}var a=function(){i=this;t=arguments;r=Date.now();var a=u&&!e;if(!e)e=setTimeout(o,l);if(a){f=n.apply(i,t);i=t=null}return f};a.clear=function(){if(e){clearTimeout(e);e=null}};a.flush=function(){if(e){f=n.apply(i,t);i=t=null;clearTimeout(e);e=null}};return a}return{export:{debounce:u}}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-danmaku-settings.min.css"] = `.bilibili-player-video-danmaku-setting-wrap{display:none!important}`; offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-danmaku-settings.min.js"] = (()=>{return(e,t)=>{async function i(e,t){const i=await SpinQuery.select(()=>document.querySelector(e));if(!i){return}i.checked=t;raiseEvent(i,"change")}Observer.videoChange(()=>{if(!e.enableDanmaku){i(".bilibili-player-video-danmaku-switch>input",false)}if(e.rememberDanmakuSettings){const i={subtitlesPreserve:".bilibili-player-video-danmaku-setting-left-preventshade input",smartMask:".bilibili-player-video-danmaku-setting-left-danmaku-mask input"};async function n(){const n=await SpinQuery.select(()=>document.querySelector(".bilibili-player-video-danmaku-setting"));if(!n){return}await loadLazyPanel(".bilibili-player-video-danmaku-setting");setTimeout(()=>t.removeStyle("defaultDanmakuSettingsStyle"),300);for(const[t,n]of Object.entries(e.danmakuSettings)){const e=await SpinQuery.select(()=>document.querySelector(i[t]));if(e!==null&&e.checked!==undefined&&e.checked!==n){e.click()}}}async function a(){for(const t in e.danmakuSettings){const n=await SpinQuery.select(()=>document.querySelector(i[t]));if(!n){return}n.addEventListener("click",()=>{e.danmakuSettings=Object.assign(e.danmakuSettings,{[t]:n.checked})})}}n();a()}})}})(); -offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-live-quality.min.js"] = (()=>{return(t,i)=>{(async()=>{if(!document.URL.match(/^https:\/\/live.bilibili.com\/(blanc\/)?(\d+)/)){return}const i=Resource.all.useDefaultLiveQuality.dropdown;const l=i.items;const e=t.defaultLiveQuality;const o=await SpinQuery.select(".bilibili-live-player-video-controller-switch-quality-btn");if(o===null){console.warn("qualitySettings null");return}const n=async()=>{const t=o.children[0].getAttribute("data-title");const i=dqa(o,".bilibili-live-player-video-controller-html-tooltip-option .text-btn");const n=i.map(t=>t.getAttribute("data-title"));console.log(t,n,e);if(t!==e){let t=e;while(!n.includes(t)){const i=l.indexOf(t);if(i>=l.length-1){console.log("reached lowest quality");return}t=l[i+1]}const o=i[n.indexOf(t)];console.log(o);while(!(o.classList.contains("active")||dq(".bilibili-live-player-video-controller-switch-quality-info"))){await(()=>new Promise(t=>setTimeout(()=>t(),3e3)))();o.click();console.log("click")}}};const c=Observer.childList(o,()=>{console.log(o.childElementCount);if(o.childElementCount>0){n()}})})()}})(); +offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-live-quality.min.js"] = (()=>{return(t,i)=>{(async()=>{if(!document.URL.match(/^https:\/\/live.bilibili.com\/(blanc\/)?(\d+)/)){return}const i=Resource.all.useDefaultLiveQuality.dropdown;const l=i.items;const e=t.defaultLiveQuality;const o=await SpinQuery.select(".bilibili-live-player-video-controller-switch-quality-btn");if(o===null){console.warn("qualitySettings null");return}const n=async()=>{const t=o.children[0].getAttribute("data-title");const i=dqa(o,".bilibili-live-player-video-controller-html-tooltip-option .text-btn");const n=i.map(t=>t.getAttribute("data-title"));console.log(t,n,e);if(t!==e){let t=e;while(!n.includes(t)){const i=l.indexOf(t);if(i>=l.length-1){console.log("reached lowest quality");return}t=l[i+1]}const o=i[n.indexOf(t)];console.log(o);while(!(o.classList.contains("active")||dq(".bilibili-live-player-video-controller-switch-quality-info"))){await(()=>new Promise(t=>setTimeout(()=>t(),3e3)))();o.click();console.log("click")}}};Observer.childList(o,()=>{console.log(o.childElementCount);if(o.childElementCount>0){n()}})})()}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-player-layout.min.js"] = (()=>{return(e,o)=>{class t{setCookie(e,o){document.cookie=`${e}=${o};path=/;domain=.bilibili.com;max-age=31536000`}clearCookie(e){document.cookie=`${e}=;path=/;domain=.bilibili.com;max-age=0`}getValue(e){return document.cookie.replace(new RegExp(`(?:(?:^|.*;\\s*)${e}\\s*\\=\\s*([^;]*).*$)|^.*$`),"$1")}checkSettings(){return e.useDefaultPlayerLayout}checkCookies(){}useNewLayout(){}useOldLayout(){}setLayout(e){if(e){this.useNewLayout()}else{this.useOldLayout()}}}class s extends t{checkCookies(){super.checkCookies();const o=this.getValue(this.cookieKey);if(o===""||parseInt(o)<0&&e.defaultPlayerLayout!=="旧版"){console.log(`default/old -> new`);this.useNewLayout()}else if(e.defaultPlayerLayout!=="新版"){console.log(`new -> old`);this.useOldLayout()}}constructor(){super();this.cookieKey="stardustvideo";this.checkCookies()}useNewLayout(){super.useNewLayout();this.setCookie(this.cookieKey,1)}useOldLayout(){super.useOldLayout();this.setCookie(this.cookieKey,-1)}}class u extends t{checkCookies(){super.checkCookies();const o=this.getValue(this.cookieKey);if(o===""||parseInt(o)<=0&&e.defaultBangumiLayout!=="旧版"){console.log(`default/old -> new`);this.useNewLayout()}else if(e.defaultBangumiLayout!=="新版"){console.log(`new -> old`);this.useOldLayout()}}constructor(){super();this.cookieKey="stardustpgcv";this.checkCookies()}useNewLayout(){super.useNewLayout();this.setCookie(this.cookieKey,"0606")}useOldLayout(){super.useOldLayout();this.setCookie(this.cookieKey,0)}}const i=new s;addSettingsListener("defaultPlayerLayout",e=>{i.setLayout(e==="新版")});const a=new u;addSettingsListener("defaultBangumiLayout",e=>{a.setLayout(e==="新版")})}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-player-mode.min.js"] = (()=>{return(e,i)=>{if(typeof isEmbeddedPlayer!=="undefined"&&isEmbeddedPlayer()){return}const t=[{name:"常规",action:()=>{}},{name:"宽屏",action:()=>{document.querySelector(".bilibili-player-video-btn-widescreen").click()}},{name:"网页全屏",action:()=>{document.querySelector(".bilibili-player-video-web-fullscreen").click()}},{name:"全屏",action:async()=>{const e=await SpinQuery.condition(()=>document.querySelector(".bilibili-player-video video"),e=>{return e!==null&&e.readyState===4&&document.readyState==="complete"&&document.hasFocus()});if(e===null){console.warn("[默认播放器模式] 未能应用全屏模式, 等待超时.");return}document.querySelector(".bilibili-player-video-btn-fullscreen").click()}}];let n=()=>{};let a=()=>{};async function l(){if(e.autoLightOff){await SpinQuery.unsafeJquery();const e=await SpinQuery.any(()=>unsafeWindow.$(".bilibili-player-video-btn-setting"));if(!e){return}e.mouseover().mouseout();const i=async e=>{const i=await SpinQuery.select(".bilibili-player-video-btn-setting-right-others-content-lightoff .bui-checkbox-input");i.checked=e;raiseEvent(i,"change")};n=(()=>i(true));a=(()=>i(false))}}async function o(){await l();await SpinQuery.condition(()=>$(".bilibili-player-video,.bilibili-player-video-btn-start,.bilibili-player-area"),e=>e.length===3&&$("video").length>0&&$("video").prop("duration"));const i=document.querySelector("video");if(!i){return}const o=t.find(i=>i.name===e.defaultPlayerMode);{const t=()=>{if(o&&$("#bilibiliPlayer[class*=mode-]").length===0){o.action()}};const l=_.get(JSON.parse(localStorage.getItem("bilibili_player_settings")),"video_status.autoplay",false);if(e.applyPlayerModeOnPlay&&!l){i.addEventListener("play",t,{once:true})}else{t()}if(l){n()}i.addEventListener("ended",a);i.addEventListener("pause",a);i.addEventListener("play",n)}}Observer.videoChange(o)}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-video-quality.min.js"] = (()=>{return(e,a)=>{const t=[{name:"4K",value:120},{name:"1080P60",value:116},{name:"1080P+",value:112},{name:"1080P",value:80},{name:"720P60",value:74},{name:"720P",value:64},{name:"480P",value:32},{name:"360P",value:15},{name:"自动",value:0}];async function n(){const a=".bilibili-player-video-quality-menu .bui-select-list>li.bui-select-item";await SpinQuery.select(a);const n=dqa(a);if(!n){return}const[i]=n.map(e=>parseInt(e.getAttribute("data-value"))).sort(descendingSort(e=>e));const[l]=t.filter(a=>a.name===e.defaultVideoQuality).map(e=>e.value).sort(descendingSort(e=>e));const[u]=t.map(e=>e.value).filter(e=>e<=Math.min(l,i)).sort(descendingSort(e=>e));const r=await SpinQuery.select("video");function s(){n.forEach(e=>{if(parseInt(e.getAttribute("data-value"))===u){e.click()}});this.removeEventListener("play",s)}r.addEventListener("play",s)}Observer.videoChange(n)}})(); @@ -2517,7 +2517,7 @@ Resource.manifest = { }, dropdown: { key: 'defaultLiveQuality', - items: ['原画', '蓝光', '超清', '高清', '流畅'], + items: ['原画', '4K', '蓝光', '超清', '高清', '流畅'], }, }, downloadLiveRecords: { diff --git a/bilibili-evolved.preview-offline.user.js b/bilibili-evolved.preview-offline.user.js index bdd619a84..16e6c2081 100644 --- a/bilibili-evolved.preview-offline.user.js +++ b/bilibili-evolved.preview-offline.user.js @@ -1355,7 +1355,7 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/debounce.min.js"] = (()=>{return(n,l)=>{function u(n,l,u){var e,t,i,r,f;if(null==l)l=100;function o(){var a=Date.now()-r;if(a=0){e=setTimeout(o,l-a)}else{e=null;if(!u){f=n.apply(i,t);i=t=null}}}var a=function(){i=this;t=arguments;r=Date.now();var a=u&&!e;if(!e)e=setTimeout(o,l);if(a){f=n.apply(i,t);i=t=null}return f};a.clear=function(){if(e){clearTimeout(e);e=null}};a.flush=function(){if(e){f=n.apply(i,t);i=t=null;clearTimeout(e);e=null}};return a}return{export:{debounce:u}}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-danmaku-settings.min.css"] = `.bilibili-player-video-danmaku-setting-wrap{display:none!important}`; offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-danmaku-settings.min.js"] = (()=>{return(e,t)=>{async function i(e,t){const i=await SpinQuery.select(()=>document.querySelector(e));if(!i){return}i.checked=t;raiseEvent(i,"change")}Observer.videoChange(()=>{if(!e.enableDanmaku){i(".bilibili-player-video-danmaku-switch>input",false)}if(e.rememberDanmakuSettings){const i={subtitlesPreserve:".bilibili-player-video-danmaku-setting-left-preventshade input",smartMask:".bilibili-player-video-danmaku-setting-left-danmaku-mask input"};async function n(){const n=await SpinQuery.select(()=>document.querySelector(".bilibili-player-video-danmaku-setting"));if(!n){return}await loadLazyPanel(".bilibili-player-video-danmaku-setting");setTimeout(()=>t.removeStyle("defaultDanmakuSettingsStyle"),300);for(const[t,n]of Object.entries(e.danmakuSettings)){const e=await SpinQuery.select(()=>document.querySelector(i[t]));if(e!==null&&e.checked!==undefined&&e.checked!==n){e.click()}}}async function a(){for(const t in e.danmakuSettings){const n=await SpinQuery.select(()=>document.querySelector(i[t]));if(!n){return}n.addEventListener("click",()=>{e.danmakuSettings=Object.assign(e.danmakuSettings,{[t]:n.checked})})}}n();a()}})}})(); -offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-live-quality.min.js"] = (()=>{return(t,i)=>{(async()=>{if(!document.URL.match(/^https:\/\/live.bilibili.com\/(blanc\/)?(\d+)/)){return}const i=Resource.all.useDefaultLiveQuality.dropdown;const l=i.items;const e=t.defaultLiveQuality;const o=await SpinQuery.select(".bilibili-live-player-video-controller-switch-quality-btn");if(o===null){console.warn("qualitySettings null");return}const n=async()=>{const t=o.children[0].getAttribute("data-title");const i=dqa(o,".bilibili-live-player-video-controller-html-tooltip-option .text-btn");const n=i.map(t=>t.getAttribute("data-title"));console.log(t,n,e);if(t!==e){let t=e;while(!n.includes(t)){const i=l.indexOf(t);if(i>=l.length-1){console.log("reached lowest quality");return}t=l[i+1]}const o=i[n.indexOf(t)];console.log(o);while(!(o.classList.contains("active")||dq(".bilibili-live-player-video-controller-switch-quality-info"))){await(()=>new Promise(t=>setTimeout(()=>t(),3e3)))();o.click();console.log("click")}}};const c=Observer.childList(o,()=>{console.log(o.childElementCount);if(o.childElementCount>0){n()}})})()}})(); +offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-live-quality.min.js"] = (()=>{return(t,i)=>{(async()=>{if(!document.URL.match(/^https:\/\/live.bilibili.com\/(blanc\/)?(\d+)/)){return}const i=Resource.all.useDefaultLiveQuality.dropdown;const l=i.items;const e=t.defaultLiveQuality;const o=await SpinQuery.select(".bilibili-live-player-video-controller-switch-quality-btn");if(o===null){console.warn("qualitySettings null");return}const n=async()=>{const t=o.children[0].getAttribute("data-title");const i=dqa(o,".bilibili-live-player-video-controller-html-tooltip-option .text-btn");const n=i.map(t=>t.getAttribute("data-title"));console.log(t,n,e);if(t!==e){let t=e;while(!n.includes(t)){const i=l.indexOf(t);if(i>=l.length-1){console.log("reached lowest quality");return}t=l[i+1]}const o=i[n.indexOf(t)];console.log(o);while(!(o.classList.contains("active")||dq(".bilibili-live-player-video-controller-switch-quality-info"))){await(()=>new Promise(t=>setTimeout(()=>t(),3e3)))();o.click();console.log("click")}}};Observer.childList(o,()=>{console.log(o.childElementCount);if(o.childElementCount>0){n()}})})()}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-player-layout.min.js"] = (()=>{return(e,o)=>{class t{setCookie(e,o){document.cookie=`${e}=${o};path=/;domain=.bilibili.com;max-age=31536000`}clearCookie(e){document.cookie=`${e}=;path=/;domain=.bilibili.com;max-age=0`}getValue(e){return document.cookie.replace(new RegExp(`(?:(?:^|.*;\\s*)${e}\\s*\\=\\s*([^;]*).*$)|^.*$`),"$1")}checkSettings(){return e.useDefaultPlayerLayout}checkCookies(){}useNewLayout(){}useOldLayout(){}setLayout(e){if(e){this.useNewLayout()}else{this.useOldLayout()}}}class s extends t{checkCookies(){super.checkCookies();const o=this.getValue(this.cookieKey);if(o===""||parseInt(o)<0&&e.defaultPlayerLayout!=="旧版"){console.log(`default/old -> new`);this.useNewLayout()}else if(e.defaultPlayerLayout!=="新版"){console.log(`new -> old`);this.useOldLayout()}}constructor(){super();this.cookieKey="stardustvideo";this.checkCookies()}useNewLayout(){super.useNewLayout();this.setCookie(this.cookieKey,1)}useOldLayout(){super.useOldLayout();this.setCookie(this.cookieKey,-1)}}class u extends t{checkCookies(){super.checkCookies();const o=this.getValue(this.cookieKey);if(o===""||parseInt(o)<=0&&e.defaultBangumiLayout!=="旧版"){console.log(`default/old -> new`);this.useNewLayout()}else if(e.defaultBangumiLayout!=="新版"){console.log(`new -> old`);this.useOldLayout()}}constructor(){super();this.cookieKey="stardustpgcv";this.checkCookies()}useNewLayout(){super.useNewLayout();this.setCookie(this.cookieKey,"0606")}useOldLayout(){super.useOldLayout();this.setCookie(this.cookieKey,0)}}const i=new s;addSettingsListener("defaultPlayerLayout",e=>{i.setLayout(e==="新版")});const a=new u;addSettingsListener("defaultBangumiLayout",e=>{a.setLayout(e==="新版")})}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-player-mode.min.js"] = (()=>{return(e,i)=>{if(typeof isEmbeddedPlayer!=="undefined"&&isEmbeddedPlayer()){return}const t=[{name:"常规",action:()=>{}},{name:"宽屏",action:()=>{document.querySelector(".bilibili-player-video-btn-widescreen").click()}},{name:"网页全屏",action:()=>{document.querySelector(".bilibili-player-video-web-fullscreen").click()}},{name:"全屏",action:async()=>{const e=await SpinQuery.condition(()=>document.querySelector(".bilibili-player-video video"),e=>{return e!==null&&e.readyState===4&&document.readyState==="complete"&&document.hasFocus()});if(e===null){console.warn("[默认播放器模式] 未能应用全屏模式, 等待超时.");return}document.querySelector(".bilibili-player-video-btn-fullscreen").click()}}];let n=()=>{};let a=()=>{};async function l(){if(e.autoLightOff){await SpinQuery.unsafeJquery();const e=await SpinQuery.any(()=>unsafeWindow.$(".bilibili-player-video-btn-setting"));if(!e){return}e.mouseover().mouseout();const i=async e=>{const i=await SpinQuery.select(".bilibili-player-video-btn-setting-right-others-content-lightoff .bui-checkbox-input");i.checked=e;raiseEvent(i,"change")};n=(()=>i(true));a=(()=>i(false))}}async function o(){await l();await SpinQuery.condition(()=>$(".bilibili-player-video,.bilibili-player-video-btn-start,.bilibili-player-area"),e=>e.length===3&&$("video").length>0&&$("video").prop("duration"));const i=document.querySelector("video");if(!i){return}const o=t.find(i=>i.name===e.defaultPlayerMode);{const t=()=>{if(o&&$("#bilibiliPlayer[class*=mode-]").length===0){o.action()}};const l=_.get(JSON.parse(localStorage.getItem("bilibili_player_settings")),"video_status.autoplay",false);if(e.applyPlayerModeOnPlay&&!l){i.addEventListener("play",t,{once:true})}else{t()}if(l){n()}i.addEventListener("ended",a);i.addEventListener("pause",a);i.addEventListener("play",n)}}Observer.videoChange(o)}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-video-quality.min.js"] = (()=>{return(e,a)=>{const t=[{name:"4K",value:120},{name:"1080P60",value:116},{name:"1080P+",value:112},{name:"1080P",value:80},{name:"720P60",value:74},{name:"720P",value:64},{name:"480P",value:32},{name:"360P",value:15},{name:"自动",value:0}];async function n(){const a=".bilibili-player-video-quality-menu .bui-select-list>li.bui-select-item";await SpinQuery.select(a);const n=dqa(a);if(!n){return}const[i]=n.map(e=>parseInt(e.getAttribute("data-value"))).sort(descendingSort(e=>e));const[l]=t.filter(a=>a.name===e.defaultVideoQuality).map(e=>e.value).sort(descendingSort(e=>e));const[u]=t.map(e=>e.value).filter(e=>e<=Math.min(l,i)).sort(descendingSort(e=>e));const r=await SpinQuery.select("video");function s(){n.forEach(e=>{if(parseInt(e.getAttribute("data-value"))===u){e.click()}});this.removeEventListener("play",s)}r.addEventListener("play",s)}Observer.videoChange(n)}})(); @@ -2517,7 +2517,7 @@ Resource.manifest = { }, dropdown: { key: 'defaultLiveQuality', - items: ['原画', '蓝光', '超清', '高清', '流畅'], + items: ['原画', '4K', '蓝光', '超清', '高清', '流畅'], }, }, downloadLiveRecords: { diff --git a/bilibili-evolved.preview.user.js b/bilibili-evolved.preview.user.js index c6a6d05be..f4e38ba32 100644 --- a/bilibili-evolved.preview.user.js +++ b/bilibili-evolved.preview.user.js @@ -1354,7 +1354,7 @@ onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/m onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/min/debounce.min.js"] = (()=>{return(n,l)=>{function u(n,l,u){var e,t,i,r,f;if(null==l)l=100;function o(){var a=Date.now()-r;if(a=0){e=setTimeout(o,l-a)}else{e=null;if(!u){f=n.apply(i,t);i=t=null}}}var a=function(){i=this;t=arguments;r=Date.now();var a=u&&!e;if(!e)e=setTimeout(o,l);if(a){f=n.apply(i,t);i=t=null}return f};a.clear=function(){if(e){clearTimeout(e);e=null}};a.flush=function(){if(e){f=n.apply(i,t);i=t=null;clearTimeout(e);e=null}};return a}return{export:{debounce:u}}}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/min/default-danmaku-settings.min.css"] = `.bilibili-player-video-danmaku-setting-wrap{display:none!important}`; onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/min/default-danmaku-settings.min.js"] = (()=>{return(e,t)=>{async function i(e,t){const i=await SpinQuery.select(()=>document.querySelector(e));if(!i){return}i.checked=t;raiseEvent(i,"change")}Observer.videoChange(()=>{if(!e.enableDanmaku){i(".bilibili-player-video-danmaku-switch>input",false)}if(e.rememberDanmakuSettings){const i={subtitlesPreserve:".bilibili-player-video-danmaku-setting-left-preventshade input",smartMask:".bilibili-player-video-danmaku-setting-left-danmaku-mask input"};async function n(){const n=await SpinQuery.select(()=>document.querySelector(".bilibili-player-video-danmaku-setting"));if(!n){return}await loadLazyPanel(".bilibili-player-video-danmaku-setting");setTimeout(()=>t.removeStyle("defaultDanmakuSettingsStyle"),300);for(const[t,n]of Object.entries(e.danmakuSettings)){const e=await SpinQuery.select(()=>document.querySelector(i[t]));if(e!==null&&e.checked!==undefined&&e.checked!==n){e.click()}}}async function a(){for(const t in e.danmakuSettings){const n=await SpinQuery.select(()=>document.querySelector(i[t]));if(!n){return}n.addEventListener("click",()=>{e.danmakuSettings=Object.assign(e.danmakuSettings,{[t]:n.checked})})}}n();a()}})}})(); -onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/min/default-live-quality.min.js"] = (()=>{return(t,i)=>{(async()=>{if(!document.URL.match(/^https:\/\/live.bilibili.com\/(blanc\/)?(\d+)/)){return}const i=Resource.all.useDefaultLiveQuality.dropdown;const l=i.items;const e=t.defaultLiveQuality;const o=await SpinQuery.select(".bilibili-live-player-video-controller-switch-quality-btn");if(o===null){console.warn("qualitySettings null");return}const n=async()=>{const t=o.children[0].getAttribute("data-title");const i=dqa(o,".bilibili-live-player-video-controller-html-tooltip-option .text-btn");const n=i.map(t=>t.getAttribute("data-title"));console.log(t,n,e);if(t!==e){let t=e;while(!n.includes(t)){const i=l.indexOf(t);if(i>=l.length-1){console.log("reached lowest quality");return}t=l[i+1]}const o=i[n.indexOf(t)];console.log(o);while(!(o.classList.contains("active")||dq(".bilibili-live-player-video-controller-switch-quality-info"))){await(()=>new Promise(t=>setTimeout(()=>t(),3e3)))();o.click();console.log("click")}}};const c=Observer.childList(o,()=>{console.log(o.childElementCount);if(o.childElementCount>0){n()}})})()}})(); +onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/min/default-live-quality.min.js"] = (()=>{return(t,i)=>{(async()=>{if(!document.URL.match(/^https:\/\/live.bilibili.com\/(blanc\/)?(\d+)/)){return}const i=Resource.all.useDefaultLiveQuality.dropdown;const l=i.items;const e=t.defaultLiveQuality;const o=await SpinQuery.select(".bilibili-live-player-video-controller-switch-quality-btn");if(o===null){console.warn("qualitySettings null");return}const n=async()=>{const t=o.children[0].getAttribute("data-title");const i=dqa(o,".bilibili-live-player-video-controller-html-tooltip-option .text-btn");const n=i.map(t=>t.getAttribute("data-title"));console.log(t,n,e);if(t!==e){let t=e;while(!n.includes(t)){const i=l.indexOf(t);if(i>=l.length-1){console.log("reached lowest quality");return}t=l[i+1]}const o=i[n.indexOf(t)];console.log(o);while(!(o.classList.contains("active")||dq(".bilibili-live-player-video-controller-switch-quality-info"))){await(()=>new Promise(t=>setTimeout(()=>t(),3e3)))();o.click();console.log("click")}}};Observer.childList(o,()=>{console.log(o.childElementCount);if(o.childElementCount>0){n()}})})()}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/min/default-player-layout.min.js"] = (()=>{return(e,o)=>{class t{setCookie(e,o){document.cookie=`${e}=${o};path=/;domain=.bilibili.com;max-age=31536000`}clearCookie(e){document.cookie=`${e}=;path=/;domain=.bilibili.com;max-age=0`}getValue(e){return document.cookie.replace(new RegExp(`(?:(?:^|.*;\\s*)${e}\\s*\\=\\s*([^;]*).*$)|^.*$`),"$1")}checkSettings(){return e.useDefaultPlayerLayout}checkCookies(){}useNewLayout(){}useOldLayout(){}setLayout(e){if(e){this.useNewLayout()}else{this.useOldLayout()}}}class s extends t{checkCookies(){super.checkCookies();const o=this.getValue(this.cookieKey);if(o===""||parseInt(o)<0&&e.defaultPlayerLayout!=="旧版"){console.log(`default/old -> new`);this.useNewLayout()}else if(e.defaultPlayerLayout!=="新版"){console.log(`new -> old`);this.useOldLayout()}}constructor(){super();this.cookieKey="stardustvideo";this.checkCookies()}useNewLayout(){super.useNewLayout();this.setCookie(this.cookieKey,1)}useOldLayout(){super.useOldLayout();this.setCookie(this.cookieKey,-1)}}class u extends t{checkCookies(){super.checkCookies();const o=this.getValue(this.cookieKey);if(o===""||parseInt(o)<=0&&e.defaultBangumiLayout!=="旧版"){console.log(`default/old -> new`);this.useNewLayout()}else if(e.defaultBangumiLayout!=="新版"){console.log(`new -> old`);this.useOldLayout()}}constructor(){super();this.cookieKey="stardustpgcv";this.checkCookies()}useNewLayout(){super.useNewLayout();this.setCookie(this.cookieKey,"0606")}useOldLayout(){super.useOldLayout();this.setCookie(this.cookieKey,0)}}const i=new s;addSettingsListener("defaultPlayerLayout",e=>{i.setLayout(e==="新版")});const a=new u;addSettingsListener("defaultBangumiLayout",e=>{a.setLayout(e==="新版")})}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/min/default-player-mode.min.js"] = (()=>{return(e,i)=>{if(typeof isEmbeddedPlayer!=="undefined"&&isEmbeddedPlayer()){return}const t=[{name:"常规",action:()=>{}},{name:"宽屏",action:()=>{document.querySelector(".bilibili-player-video-btn-widescreen").click()}},{name:"网页全屏",action:()=>{document.querySelector(".bilibili-player-video-web-fullscreen").click()}},{name:"全屏",action:async()=>{const e=await SpinQuery.condition(()=>document.querySelector(".bilibili-player-video video"),e=>{return e!==null&&e.readyState===4&&document.readyState==="complete"&&document.hasFocus()});if(e===null){console.warn("[默认播放器模式] 未能应用全屏模式, 等待超时.");return}document.querySelector(".bilibili-player-video-btn-fullscreen").click()}}];let n=()=>{};let a=()=>{};async function l(){if(e.autoLightOff){await SpinQuery.unsafeJquery();const e=await SpinQuery.any(()=>unsafeWindow.$(".bilibili-player-video-btn-setting"));if(!e){return}e.mouseover().mouseout();const i=async e=>{const i=await SpinQuery.select(".bilibili-player-video-btn-setting-right-others-content-lightoff .bui-checkbox-input");i.checked=e;raiseEvent(i,"change")};n=(()=>i(true));a=(()=>i(false))}}async function o(){await l();await SpinQuery.condition(()=>$(".bilibili-player-video,.bilibili-player-video-btn-start,.bilibili-player-area"),e=>e.length===3&&$("video").length>0&&$("video").prop("duration"));const i=document.querySelector("video");if(!i){return}const o=t.find(i=>i.name===e.defaultPlayerMode);{const t=()=>{if(o&&$("#bilibiliPlayer[class*=mode-]").length===0){o.action()}};const l=_.get(JSON.parse(localStorage.getItem("bilibili_player_settings")),"video_status.autoplay",false);if(e.applyPlayerModeOnPlay&&!l){i.addEventListener("play",t,{once:true})}else{t()}if(l){n()}i.addEventListener("ended",a);i.addEventListener("pause",a);i.addEventListener("play",n)}}Observer.videoChange(o)}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/min/default-video-quality.min.js"] = (()=>{return(e,a)=>{const t=[{name:"4K",value:120},{name:"1080P60",value:116},{name:"1080P+",value:112},{name:"1080P",value:80},{name:"720P60",value:74},{name:"720P",value:64},{name:"480P",value:32},{name:"360P",value:15},{name:"自动",value:0}];async function n(){const a=".bilibili-player-video-quality-menu .bui-select-list>li.bui-select-item";await SpinQuery.select(a);const n=dqa(a);if(!n){return}const[i]=n.map(e=>parseInt(e.getAttribute("data-value"))).sort(descendingSort(e=>e));const[l]=t.filter(a=>a.name===e.defaultVideoQuality).map(e=>e.value).sort(descendingSort(e=>e));const[u]=t.map(e=>e.value).filter(e=>e<=Math.min(l,i)).sort(descendingSort(e=>e));const r=await SpinQuery.select("video");function s(){n.forEach(e=>{if(parseInt(e.getAttribute("data-value"))===u){e.click()}});this.removeEventListener("play",s)}r.addEventListener("play",s)}Observer.videoChange(n)}})(); @@ -2576,7 +2576,7 @@ Resource.manifest = { }, dropdown: { key: 'defaultLiveQuality', - items: ['原画', '蓝光', '超清', '高清', '流畅'], + items: ['原画', '4K', '蓝光', '超清', '高清', '流畅'], }, }, downloadLiveRecords: { diff --git a/bilibili-evolved.user.js b/bilibili-evolved.user.js index 3fde62a47..2bebd21f4 100644 --- a/bilibili-evolved.user.js +++ b/bilibili-evolved.user.js @@ -1354,7 +1354,7 @@ onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/mi onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/debounce.min.js"] = (()=>{return(n,l)=>{function u(n,l,u){var e,t,i,r,f;if(null==l)l=100;function o(){var a=Date.now()-r;if(a=0){e=setTimeout(o,l-a)}else{e=null;if(!u){f=n.apply(i,t);i=t=null}}}var a=function(){i=this;t=arguments;r=Date.now();var a=u&&!e;if(!e)e=setTimeout(o,l);if(a){f=n.apply(i,t);i=t=null}return f};a.clear=function(){if(e){clearTimeout(e);e=null}};a.flush=function(){if(e){f=n.apply(i,t);i=t=null;clearTimeout(e);e=null}};return a}return{export:{debounce:u}}}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-danmaku-settings.min.css"] = `.bilibili-player-video-danmaku-setting-wrap{display:none!important}`; onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-danmaku-settings.min.js"] = (()=>{return(e,t)=>{async function i(e,t){const i=await SpinQuery.select(()=>document.querySelector(e));if(!i){return}i.checked=t;raiseEvent(i,"change")}Observer.videoChange(()=>{if(!e.enableDanmaku){i(".bilibili-player-video-danmaku-switch>input",false)}if(e.rememberDanmakuSettings){const i={subtitlesPreserve:".bilibili-player-video-danmaku-setting-left-preventshade input",smartMask:".bilibili-player-video-danmaku-setting-left-danmaku-mask input"};async function n(){const n=await SpinQuery.select(()=>document.querySelector(".bilibili-player-video-danmaku-setting"));if(!n){return}await loadLazyPanel(".bilibili-player-video-danmaku-setting");setTimeout(()=>t.removeStyle("defaultDanmakuSettingsStyle"),300);for(const[t,n]of Object.entries(e.danmakuSettings)){const e=await SpinQuery.select(()=>document.querySelector(i[t]));if(e!==null&&e.checked!==undefined&&e.checked!==n){e.click()}}}async function a(){for(const t in e.danmakuSettings){const n=await SpinQuery.select(()=>document.querySelector(i[t]));if(!n){return}n.addEventListener("click",()=>{e.danmakuSettings=Object.assign(e.danmakuSettings,{[t]:n.checked})})}}n();a()}})}})(); -onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-live-quality.min.js"] = (()=>{return(t,i)=>{(async()=>{if(!document.URL.match(/^https:\/\/live.bilibili.com\/(blanc\/)?(\d+)/)){return}const i=Resource.all.useDefaultLiveQuality.dropdown;const l=i.items;const e=t.defaultLiveQuality;const o=await SpinQuery.select(".bilibili-live-player-video-controller-switch-quality-btn");if(o===null){console.warn("qualitySettings null");return}const n=async()=>{const t=o.children[0].getAttribute("data-title");const i=dqa(o,".bilibili-live-player-video-controller-html-tooltip-option .text-btn");const n=i.map(t=>t.getAttribute("data-title"));console.log(t,n,e);if(t!==e){let t=e;while(!n.includes(t)){const i=l.indexOf(t);if(i>=l.length-1){console.log("reached lowest quality");return}t=l[i+1]}const o=i[n.indexOf(t)];console.log(o);while(!(o.classList.contains("active")||dq(".bilibili-live-player-video-controller-switch-quality-info"))){await(()=>new Promise(t=>setTimeout(()=>t(),3e3)))();o.click();console.log("click")}}};const c=Observer.childList(o,()=>{console.log(o.childElementCount);if(o.childElementCount>0){n()}})})()}})(); +onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-live-quality.min.js"] = (()=>{return(t,i)=>{(async()=>{if(!document.URL.match(/^https:\/\/live.bilibili.com\/(blanc\/)?(\d+)/)){return}const i=Resource.all.useDefaultLiveQuality.dropdown;const l=i.items;const e=t.defaultLiveQuality;const o=await SpinQuery.select(".bilibili-live-player-video-controller-switch-quality-btn");if(o===null){console.warn("qualitySettings null");return}const n=async()=>{const t=o.children[0].getAttribute("data-title");const i=dqa(o,".bilibili-live-player-video-controller-html-tooltip-option .text-btn");const n=i.map(t=>t.getAttribute("data-title"));console.log(t,n,e);if(t!==e){let t=e;while(!n.includes(t)){const i=l.indexOf(t);if(i>=l.length-1){console.log("reached lowest quality");return}t=l[i+1]}const o=i[n.indexOf(t)];console.log(o);while(!(o.classList.contains("active")||dq(".bilibili-live-player-video-controller-switch-quality-info"))){await(()=>new Promise(t=>setTimeout(()=>t(),3e3)))();o.click();console.log("click")}}};Observer.childList(o,()=>{console.log(o.childElementCount);if(o.childElementCount>0){n()}})})()}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-player-layout.min.js"] = (()=>{return(e,o)=>{class t{setCookie(e,o){document.cookie=`${e}=${o};path=/;domain=.bilibili.com;max-age=31536000`}clearCookie(e){document.cookie=`${e}=;path=/;domain=.bilibili.com;max-age=0`}getValue(e){return document.cookie.replace(new RegExp(`(?:(?:^|.*;\\s*)${e}\\s*\\=\\s*([^;]*).*$)|^.*$`),"$1")}checkSettings(){return e.useDefaultPlayerLayout}checkCookies(){}useNewLayout(){}useOldLayout(){}setLayout(e){if(e){this.useNewLayout()}else{this.useOldLayout()}}}class s extends t{checkCookies(){super.checkCookies();const o=this.getValue(this.cookieKey);if(o===""||parseInt(o)<0&&e.defaultPlayerLayout!=="旧版"){console.log(`default/old -> new`);this.useNewLayout()}else if(e.defaultPlayerLayout!=="新版"){console.log(`new -> old`);this.useOldLayout()}}constructor(){super();this.cookieKey="stardustvideo";this.checkCookies()}useNewLayout(){super.useNewLayout();this.setCookie(this.cookieKey,1)}useOldLayout(){super.useOldLayout();this.setCookie(this.cookieKey,-1)}}class u extends t{checkCookies(){super.checkCookies();const o=this.getValue(this.cookieKey);if(o===""||parseInt(o)<=0&&e.defaultBangumiLayout!=="旧版"){console.log(`default/old -> new`);this.useNewLayout()}else if(e.defaultBangumiLayout!=="新版"){console.log(`new -> old`);this.useOldLayout()}}constructor(){super();this.cookieKey="stardustpgcv";this.checkCookies()}useNewLayout(){super.useNewLayout();this.setCookie(this.cookieKey,"0606")}useOldLayout(){super.useOldLayout();this.setCookie(this.cookieKey,0)}}const i=new s;addSettingsListener("defaultPlayerLayout",e=>{i.setLayout(e==="新版")});const a=new u;addSettingsListener("defaultBangumiLayout",e=>{a.setLayout(e==="新版")})}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-player-mode.min.js"] = (()=>{return(e,i)=>{if(typeof isEmbeddedPlayer!=="undefined"&&isEmbeddedPlayer()){return}const t=[{name:"常规",action:()=>{}},{name:"宽屏",action:()=>{document.querySelector(".bilibili-player-video-btn-widescreen").click()}},{name:"网页全屏",action:()=>{document.querySelector(".bilibili-player-video-web-fullscreen").click()}},{name:"全屏",action:async()=>{const e=await SpinQuery.condition(()=>document.querySelector(".bilibili-player-video video"),e=>{return e!==null&&e.readyState===4&&document.readyState==="complete"&&document.hasFocus()});if(e===null){console.warn("[默认播放器模式] 未能应用全屏模式, 等待超时.");return}document.querySelector(".bilibili-player-video-btn-fullscreen").click()}}];let n=()=>{};let a=()=>{};async function l(){if(e.autoLightOff){await SpinQuery.unsafeJquery();const e=await SpinQuery.any(()=>unsafeWindow.$(".bilibili-player-video-btn-setting"));if(!e){return}e.mouseover().mouseout();const i=async e=>{const i=await SpinQuery.select(".bilibili-player-video-btn-setting-right-others-content-lightoff .bui-checkbox-input");i.checked=e;raiseEvent(i,"change")};n=(()=>i(true));a=(()=>i(false))}}async function o(){await l();await SpinQuery.condition(()=>$(".bilibili-player-video,.bilibili-player-video-btn-start,.bilibili-player-area"),e=>e.length===3&&$("video").length>0&&$("video").prop("duration"));const i=document.querySelector("video");if(!i){return}const o=t.find(i=>i.name===e.defaultPlayerMode);{const t=()=>{if(o&&$("#bilibiliPlayer[class*=mode-]").length===0){o.action()}};const l=_.get(JSON.parse(localStorage.getItem("bilibili_player_settings")),"video_status.autoplay",false);if(e.applyPlayerModeOnPlay&&!l){i.addEventListener("play",t,{once:true})}else{t()}if(l){n()}i.addEventListener("ended",a);i.addEventListener("pause",a);i.addEventListener("play",n)}}Observer.videoChange(o)}})(); onlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-video-quality.min.js"] = (()=>{return(e,a)=>{const t=[{name:"4K",value:120},{name:"1080P60",value:116},{name:"1080P+",value:112},{name:"1080P",value:80},{name:"720P60",value:74},{name:"720P",value:64},{name:"480P",value:32},{name:"360P",value:15},{name:"自动",value:0}];async function n(){const a=".bilibili-player-video-quality-menu .bui-select-list>li.bui-select-item";await SpinQuery.select(a);const n=dqa(a);if(!n){return}const[i]=n.map(e=>parseInt(e.getAttribute("data-value"))).sort(descendingSort(e=>e));const[l]=t.filter(a=>a.name===e.defaultVideoQuality).map(e=>e.value).sort(descendingSort(e=>e));const[u]=t.map(e=>e.value).filter(e=>e<=Math.min(l,i)).sort(descendingSort(e=>e));const r=await SpinQuery.select("video");function s(){n.forEach(e=>{if(parseInt(e.getAttribute("data-value"))===u){e.click()}});this.removeEventListener("play",s)}r.addEventListener("play",s)}Observer.videoChange(n)}})(); @@ -2576,7 +2576,7 @@ Resource.manifest = { }, dropdown: { key: 'defaultLiveQuality', - items: ['原画', '蓝光', '超清', '高清', '流畅'], + items: ['原画', '4K', '蓝光', '超清', '高清', '流畅'], }, }, downloadLiveRecords: { diff --git a/min/bundle.json b/min/bundle.json index 7002e12d1..f281b4eab 100644 --- a/min/bundle.json +++ b/min/bundle.json @@ -74,7 +74,7 @@ "debounce.min.js": "54D33E1273C1F3FE19550BF1844339C3D54D6B01DF8A39C3162D95B93B079CFA", "default-danmaku-settings.min.css": "D9942B184FEDA7B08CFA0C34920E97D7A83B81762DCBF757642EBB60F95FF25D", "default-danmaku-settings.min.js": "9DBC9AC9B5A3B59EBCC6F04D36527B523D66203AC5FE7C2AD5DB46FFB84F9382", - "default-live-quality.min.js": "60975363D8175FE1747982A9B749DBF31E1EB48CE469B840A12F3B333A72FD6F", + "default-live-quality.min.js": "90B619A987E832540B130DF3795D45F928133AE5ECC1D55F72D58D8729784DFA", "default-player-layout.min.js": "C6CE64216569A006566ADD7FC69451897612F46CC9641B8B15E0A13D5B1F2455", "default-player-mode.min.js": "3DF0FE367EB990B018C57C1B73BB82CE38FF0631D4C329051F3FD9F4D504071D", "default-video-quality.min.js": "A24225E0F72D5BCA7DFE529E5B90B03F494C8720ADEF91D466A923FD767EB907", diff --git a/min/bundle.zip b/min/bundle.zip index 7018fad0ccd850138fd7b8ce228a6616e5898c47..6925620cce334c6ab423e8aa48f6d7c9f384a204 100644 GIT binary patch delta 2282 zcmY*b3vg8B6~6zyo9rgpWH-6{PIC8g4Z+HB^AKdy{UnSbmcu%htguVCl8gUT+h)a*4U{bF!?afjp1U1!( zp-DX=cH-ouUaQoSicV7fhzYWy=$>vu@s#cp+puy~y7LILPhvv_9_q6ljL*z?}{9BcxPjvp`JNVUp_0S9&sI6N3p zIFdCkGGVTne98~EOzWLE;in9AuuA@93*Iwxs{75HYB$c9smeU(X@|7#@eV|;>D&ej zY3#qw!dc&s7c5k+jLdi9xAUDYd}^V5(F$71D^+q|3@e|N;gprT^fXdaIZ!7ajI$gJ#aRIFq|zeuC5KyzMT*fX z$N?>l?G9sU8lNA+)--xRY{wgEv{)R#tu&6!yvdEiO>PewY#iGGY_@S9{(v`a>}(;X zY_x;}UTmku)-Oif(uUZkXt+DpJyWxn?WCnWHu^txU)S1>C?Z#M2YzwP%|U$o+kMO} zZERf^TN_^28$-`+zLAm6alL^^IxQ5>BbLrikK&i+gyEF|?Ik*bDaM-~}wd1;jugJL1NyW;eFKXEO zqLzuRbIFdMI=Q{8@tTvWl!-<^o~ie{Ft3neATV;+h@(m zcd^Yyl~z3Fm%3X!y27!}c8n3ZVb9=%KI7NLOE9^)5IU;dT%8&`$4nVI;m6ns_BD-~ zYi`nH&s%8r@U%c78zLS~@iLk`RFN9_$S?J_c6Nj}#QOSY*2J&*SpI~dc{#2xJX9pk zA=}G!eq<4jd3iqeT-R-Il>}zbv`_A(F`V6l&uadEc!7#rny(?=CbVKji| zXh6llHQf$9lfz$yl1#4ND|jl-coyT#g0C~V#}`nN#XI12?8st3_TZ0MRH^LU6Tn-0 z0$wbiWE<`K0<-JYgr;m-A^-jynzMQ9zLrf3#2Nf6o9dJu3xe2R9CTrYMqy>3cv|wz zSXutP;A|`RacJMPq+$In_G|b#_J!E*r&^QaNKnH5cY*;} z0~8S&N&?iN44n;P>})U_M*@^@`tsyudOTb z=VhW459z!Y4q`;7VoT@GLsDP=<_*}TFb1yc?EWUwh^mz(r$bnCI+QiD9k&sme1LsK zHOi55A^iCqM>I){_A=zo;pM*PQbTw9P(NIay2CNceVDR=bFxIa1OuSfs1o! z5zm7shf0(bvyLJ&kMhPGHWI<sILAt<925)9( zXZQQwe!IW@?cPAwKC$a6OI*YaaXD^`o8k#^b38Gg6t~2ao)S-u+v92R^wUbn zWP4a)UcMsv!d0(PlDuc0F)5d1^ZJHpOH5mj%bOgI-RVgR%cxdaoGdODH%kVKhsDd1 z$>L-2vjkW)mLN;$OnQ=Ddfm|0c&6gE{zJ#p@1gg9`f9l@NkMCp;zNd!tf+L65u1l} zkI2LRA$^fJfvZD$nOF;bn5|=|9oEZ?2SSR3i%%34e;w9mh~*d=))$N2So}mU7GbnK z(M#mHg$kAxa@?yfj@vz~8=;03d$RQHFBQHKeStAl&cV*j)|^;cu9&ekhp)diqWcAK zVnh$iwJ`;|Vv4)nO1bjxH^vM{`x43%r`oqsp*-i2f~AiXCwkoc&J&xUo)9p8P3W`vw&k9)GQ;;VsQ#3Mh>zPdyVvx zTvqA8+DeBL+7sQ1K_mIa0%Vx@o`wn&%@>V0Y@#9t@rH@QhU6x6n@Gi+1e#{>H;)@T z6DZH<-s+H0zRjV6`gCQiP<)oamB#QWfl5R(^39w?4|bYqq2aY1c->5HTsJdNQ<0oV zFIXGzJERTOv8mBl>tBYJ$FHnUWC-#fI8gq8;~q?82!4(~CUSB$FehPyS;;4Wve%fQipX(Nw0=f7j8NE3{~=QfUY z2SYZRE#AZPDO8Ynl3Y>^&mo#r@}eV!v)_wfr%=8)j@}e16sgEdWyp`CDV65Se`$5$ zW~1~$c59$C-xzd#-RNM@27F8Z{n*oX5vqm`EhKSKY+onbvst2lSe+Ze9V=J zEjg5eBk5eyL!3*e#bOsM3a7dhEd9;K%nG{C?C0c(|r#F@isGFdPSQ)WIBgmFr;-cjRi2W5+*LW`_g4ncxH90zk;mN0efM}VR5-bWd8^0#D%zY(*&{gX zWHtdqtmG*l22k{2KppQsFDbt$$LlUe=51VXF)|vAZYKXXD0QAa6poOxvKtr%V%NSo(VR7BMx}gQ<@9CMC?Bn@eby!3FVa<S2T2AVe8L*Opa?agLdn;8&~>tCYt=D zU}$F0h7rDQ*gtF3<3dLwyZ6ivPUPqh(CDWUL;kAqk3RO(Eb&4|fEF809)<{T{+j~a zszM;ZYcdlz1N0p^>ueBn&jv%IFkA78#tFWCDTw2jg1&LrDRzloT-0cVT+tUqQ(w@9 z7lRDl-?1Uc-E-iBAa^!|-XPEQb9gqy`^@k>wuP9-6*wQF1@ir(5SofYPWW_Qjf;vy z5}JB~3MzG)k#J&TNNTA=tDmQP^#1^-bVhhHI(5pI2mcU4>PI0DY6qBpW5;Ekp^0UO zv4p6UcOEM*%J1tb7~{lmuRL|_G_Dh;Sqg0u6ZJ46lW30k4DU{&d~?g=kQ8f(Ks?qn z@MsdhZh<|E$4WtY7T=zOeOWZ$uwoweXEE;Cc|5d7A2JsPvdCk7FQQAa=IUq_HyR_! zRL8W$&O|n`ZL?^Rz4Ngtw)cWzwWLm<5KQEW9N!XFgSL`^S%WPhVkx}P& zQ80xkII~N~j4s`Ycc)OUQM#t{|I+7N=rh;!MD(yPS?boMEs@yzjdc-326Sh*tuefO x;L1DoX6E9kOjtN{return(t,i)=>{(async()=>{if(!document.URL.match(/^https:\/\/live.bilibili.com\/(blanc\/)?(\d+)/)){return}const i=Resource.all.useDefaultLiveQuality.dropdown;const l=i.items;const e=t.defaultLiveQuality;const o=await SpinQuery.select(".bilibili-live-player-video-controller-switch-quality-btn");if(o===null){console.warn("qualitySettings null");return}const n=async()=>{const t=o.children[0].getAttribute("data-title");const i=dqa(o,".bilibili-live-player-video-controller-html-tooltip-option .text-btn");const n=i.map(t=>t.getAttribute("data-title"));console.log(t,n,e);if(t!==e){let t=e;while(!n.includes(t)){const i=l.indexOf(t);if(i>=l.length-1){console.log("reached lowest quality");return}t=l[i+1]}const o=i[n.indexOf(t)];console.log(o);while(!(o.classList.contains("active")||dq(".bilibili-live-player-video-controller-switch-quality-info"))){await(()=>new Promise(t=>setTimeout(()=>t(),3e3)))();o.click();console.log("click")}}};const c=Observer.childList(o,()=>{console.log(o.childElementCount);if(o.childElementCount>0){n()}})})()}})(); \ No newline at end of file +(()=>{return(t,i)=>{(async()=>{if(!document.URL.match(/^https:\/\/live.bilibili.com\/(blanc\/)?(\d+)/)){return}const i=Resource.all.useDefaultLiveQuality.dropdown;const l=i.items;const e=t.defaultLiveQuality;const o=await SpinQuery.select(".bilibili-live-player-video-controller-switch-quality-btn");if(o===null){console.warn("qualitySettings null");return}const n=async()=>{const t=o.children[0].getAttribute("data-title");const i=dqa(o,".bilibili-live-player-video-controller-html-tooltip-option .text-btn");const n=i.map(t=>t.getAttribute("data-title"));console.log(t,n,e);if(t!==e){let t=e;while(!n.includes(t)){const i=l.indexOf(t);if(i>=l.length-1){console.log("reached lowest quality");return}t=l[i+1]}const o=i[n.indexOf(t)];console.log(o);while(!(o.classList.contains("active")||dq(".bilibili-live-player-video-controller-switch-quality-info"))){await(()=>new Promise(t=>setTimeout(()=>t(),3e3)))();o.click();console.log("click")}}};Observer.childList(o,()=>{console.log(o.childElementCount);if(o.childElementCount>0){n()}})})()}})(); \ No newline at end of file diff --git a/src/client/resource-manifest.js b/src/client/resource-manifest.js index 9d6358b92..0dd28f494 100644 --- a/src/client/resource-manifest.js +++ b/src/client/resource-manifest.js @@ -844,7 +844,7 @@ Resource.manifest = { }, dropdown: { key: 'defaultLiveQuality', - items: ['原画', '蓝光', '超清', '高清', '流畅'], + items: ['原画', '4K', '蓝光', '超清', '高清', '流畅'], }, }, downloadLiveRecords: { diff --git a/src/live/default-live-quality.ts b/src/live/default-live-quality.ts index 6450ae51d..88ebdb427 100644 --- a/src/live/default-live-quality.ts +++ b/src/live/default-live-quality.ts @@ -35,12 +35,10 @@ } } } - const observer = Observer.childList(qualitySettings, () => { + Observer.childList(qualitySettings, () => { console.log(qualitySettings.childElementCount) if (qualitySettings.childElementCount > 0) { setQuality() - // 干脆就不stop了, 主播下播再开播可以再来一次setQuality - // observer.stop() } }) })() \ No newline at end of file