diff --git a/bilibili-evolved.offline.user.js b/bilibili-evolved.offline.user.js
index da5be9173..a3bc15948 100644
--- a/bilibili-evolved.offline.user.js
+++ b/bilibili-evolved.offline.user.js
@@ -1,6 +1,6 @@
// ==UserScript==
// @name Bilibili Evolved (Offline)
-// @version 145.09
+// @version 145.87
// @description 增强哔哩哔哩Web端体验(离线版): 修复界面瑕疵, 删除广告, 使用夜间模式浏览, 下载视频或视频封面, 以及增加对触屏设备的支持等.
// @author Grant Howard, Coulomb-G
// @copyright 2018, Grant Howrad (https://github.com/the1812)
@@ -469,6 +469,10 @@
defaultPlayerMode: "默认播放器模式",
autoLightOff: "播放时自动关灯",
},
+ dropdown: {
+ key: "defaultPlayerMode",
+ items: ["常规", "宽屏", "网页全屏"],
+ },
},
useDefaultVideoQuality: {
path: "min/default-video-quality.min.js",
@@ -476,6 +480,10 @@
useDefaultVideoQuality: "使用默认视频画质",
defaultVideoQuality: "画质设定",
},
+ dropdown: {
+ key: "defaultVideoQuality",
+ items: ["1080P60", "1080P+", "1080P", "720P", "480P", "360P", "自动"],
+ },
},
comboLike: {
path: "min/combo-like.min.js",
@@ -488,6 +496,7 @@
Resource.root = "https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/";
Resource.all = {};
Resource.displayNames = {};
+ Resource.manifest = resourceManifest;
for (const [key, data] of Object.entries(resourceManifest))
{
const resource = new Resource(data.path, data.order, data.styles);
@@ -911,9 +920,9 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/gui-settings.min.html"] = `
`;
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/image-viewer.min.html"] = ``;
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/download-video.min.html"] = ``;
-offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/version.txt"] = `1.6.7`;
+offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/version.txt"] = `1.6.8`;
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/icons.min.css"] = `.icons-enabled [class^=icon-]{width:24px;height:24px;display:inline-block;}.icons-enabled [class^=icon-]::after{content:"";width:24px;height:24px;display:inline-block;}.icons-enabled .icon-view::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-clear::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-download::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-update::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-info::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-settings::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-widgets::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-cancel::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-ok::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-video::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-style::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-tool::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-touch::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-other::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-arrow::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-rank::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-like::after{background-image:url('data:image/svg+xml;utf-8,');}`;
-offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/gui-settings.min.js"] = (()=>{return(t,e)=>{const n={red:"#e57373",pink:"#F06292",purple:"#BA68C8",deepPurple:"#9575CD",indigo:"#7986CB",blue:"#2196F3",lightBlue:"#00A0D8",cyan:"#00ACC1",teal:"#26A69A",green:"#81C784",lightGreen:"#9CCC65",orange:"#FF9800",deepOrange:"#FF7043",brown:"#A1887F",grey:"#757575",blueGrey:"#78909C"};const i={forceWideMinWidth:t=>t,customStyleColor:e=>{const n=e.match(/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/);if(n){if(e.length<7){return`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`}else{return e}}else{return t.customStyleColor}},blurBackgroundOpacity:e=>{const n=e.match(/^([-\+]?\d+)(\.\d+)?$/);if(n){const t=parseFloat(e);if(t>=0&&t<=1){return e}}return t.blurBackgroundOpacity},defaultPlayerMode:e=>{if(["常规","宽屏","网页全屏"].indexOf(e)!==-1){return e}return t.defaultPlayerMode},defaultVideoQuality:e=>{if(["1080P60","1080P+","1080P","720P","480P","360P","自动"].indexOf(e)!==-1){return e}return t.defaultVideoQuality}};function o(t){let e=t.nextElementSibling;const n=[];while(e!==null&&!e.classList.contains("category")){n.push(e);e=e.nextElementSibling}return n}function s(t,e){const n=t.match(/^([\d]{1,2}):([\d]{1,2})$/);if(n&&n.length>=3){const t={hour:parseInt(n[1]),minute:parseInt(n[2])};(function(){while(this.minute<0){this.minute+=60;this.hour-=1}while(this.minute>=60){this.minute-=60;this.hour+=1}while(this.hour<0){this.hour+=24}while(this.hour>=24){this.hour-=24}}).call(t);return`${t.hour}:${t.minute<10?"0"+t.minute:t.minute}`}else{return e}}i.darkScheduleStart=(e=>s(e,t.darkScheduleStart));i.darkScheduleEnd=(e=>s(e,t.darkScheduleEnd));function c(t,e){const n=t.match(/^([-\+]?\d+)(\.\d+)?$/);if(n){const e=parseFloat(t);if(e>=0&&e<=1){return t}}return e}i.blurBackgroundOpacity=(e=>c(e,t.blurBackgroundOpacity));i.customControlBackgroundOpacity=(e=>c(e,t.customControlBackgroundOpacity));function r(t,e,n){$(`input[type='checkbox'][key='${t}']`).prop("checked",n);$(`input[type='text'][key='${t}']`).val(n)}function u(){for(const e in t){r(e,undefined,t[e])}}function a(){$(".gui-settings-mask").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-box,.gui-settings-mask").removeClass("opened")});$("input[key='customStyleColor']").on("input",()=>{const t=i.customStyleColor($("input[key='customStyleColor']").val());const n=e.color.hexToRgba(t+"70");$("div.custom-color-preview").css("background",t).css("box-shadow",`0px 2px 8px 1px rgba(${n.r},${n.g},${n.b},${n.a})`)});$("input[type='text'][key]").each((e,n)=>{$(n).attr("placeholder",t[$(n).attr("key")])});$("div.custom-color-preview").on("click",()=>{const t=$(".predefined-colors");t.toggleClass("opened")});$(".gui-settings-content ul li.category").on("click",t=>{t.currentTarget.classList.toggle("folded");o(t.currentTarget).forEach(t=>t.classList.toggle("folded"))});$(".gui-settings-dropdown>input").on("click",t=>{$(t.currentTarget).parent().toggleClass("opened")});onSettingsChange(r)}function l(){const e=()=>{$("input[type='checkbox'][key]").each((e,n)=>{t[$(n).attr("key")]=$(n).prop("checked")});$("input[type='text'][key]").each((e,n)=>{const o=$(n);const s=o.attr("key");const c=i[s](o.val());t[s]=c;o.val(c)});saveSettings(t)};$("input[type='checkbox'][key]").on("change",()=>e());$("input[type='text'][key]").on("change",()=>e())}function d(){const t={};$(`input[dependencies]`).each((e,n)=>{const i=$(n).attr("dependencies");if(i){t[$(n).attr("key")]=i}});const e=e=>{const n=e.prop("checked");for(const i in t){const o=t[i].split(" ");if(o.indexOf(e.attr("key"))!==-1){let t=true;if(n&&o.every(t=>$(`input[key='${t}']`).prop("checked"))){t=false}const e=$(`li:has(input[key='${i}'])`);const s=t?"addClass":"removeClass";e[s]("disabled");$(`input[key='${i}'][type='text']`).parent()[s]("disabled")}}};$(`input[type='checkbox'][key]`).on("change",t=>e($(t.target))).each((t,n)=>e($(n)))}function p(t){if($(".gui-settings").length===0){t.append(``);$(".gui-settings").on("click",()=>{$(".gui-settings-box,.gui-settings-mask").addClass("opened")});$(".gui-settings-widgets").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-mask").addClass("opened")})}e.applyStyle("guiSettingsStyle")}function g(){const t=$(".predefined-colors-grid");for(const e of Object.values(n)){$(``).appendTo(t).css("background",e).attr("data-color",e).on("click",t=>{$(`input[key='customStyleColor']`).val($(t.target).attr("data-color")).trigger("input").change();$("div.custom-color-preview").on("click")})}}function h(){if(t.blurSettingsPanel){$(".gui-settings-box").addClass("blur")}}function f(){if(typeof offlineData!=="undefined"){$("li:has(input[key=useCache])").addClass("disabled");$("input[key=useCache]").prop("disabled",true)}}function y(){$(".gui-settings-content ul li.category").each((t,e)=>{$(e).click()})}function k(){if(!CSS.supports("backdrop-filter","blur(24px)")&&!CSS.supports("-webkit-backdrop-filter","blur(24px)")){$("input[key=blurVideoControl]").prop("disabled",true);t.blurVideoControl=false;saveSettings(t)}}p($("body"));const b=e.data.guiSettingsDom.text;if(b){$("body").append(b);a();f();u();d();g();l();y();k()}new SpinQuery(()=>$("body"),t=>t.length>0&&!(unsafeWindow.parent.window===unsafeWindow),t=>$(".gui-settings-icon-panel").css("display","none")).start()}})();
+offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/gui-settings.min.js"] = (()=>{return(e,t)=>{const n={red:"#e57373",pink:"#F06292",purple:"#BA68C8",deepPurple:"#9575CD",indigo:"#7986CB",blue:"#2196F3",lightBlue:"#00A0D8",cyan:"#00ACC1",teal:"#26A69A",green:"#81C784",lightGreen:"#9CCC65",orange:"#FF9800",deepOrange:"#FF7043",brown:"#A1887F",grey:"#757575",blueGrey:"#78909C"};const i={forceWideMinWidth:e=>e,customStyleColor:t=>{const n=t.match(/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/);if(n){if(t.length<7){return`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`}else{return t}}else{return e.customStyleColor}},blurBackgroundOpacity:t=>{const n=t.match(/^([-\+]?\d+)(\.\d+)?$/);if(n){const e=parseFloat(t);if(e>=0&&e<=1){return t}}return e.blurBackgroundOpacity},defaultPlayerMode:t=>{if(Resource.manifest.useDefaultPlayerMode.dropdown.items.indexOf(t)!==-1){return t}return e.defaultPlayerMode},defaultVideoQuality:t=>{if(Resource.manifest.useDefaultVideoQuality.dropdown.items.indexOf(t)!==-1){return t}return e.defaultVideoQuality}};function o(e){let t=e.nextElementSibling;const n=[];while(t!==null&&!t.classList.contains("category")){n.push(t);t=t.nextElementSibling}return n}function s(e,t){const n=e.match(/^([\d]{1,2}):([\d]{1,2})$/);if(n&&n.length>=3){const e={hour:parseInt(n[1]),minute:parseInt(n[2])};(function(){while(this.minute<0){this.minute+=60;this.hour-=1}while(this.minute>=60){this.minute-=60;this.hour+=1}while(this.hour<0){this.hour+=24}while(this.hour>=24){this.hour-=24}}).call(e);return`${e.hour}:${e.minute<10?"0"+e.minute:e.minute}`}else{return t}}i.darkScheduleStart=(t=>s(t,e.darkScheduleStart));i.darkScheduleEnd=(t=>s(t,e.darkScheduleEnd));function c(e,t){const n=e.match(/^([-\+]?\d+)(\.\d+)?$/);if(n){const t=parseFloat(e);if(t>=0&&t<=1){return e}}return t}i.blurBackgroundOpacity=(t=>c(t,e.blurBackgroundOpacity));i.customControlBackgroundOpacity=(t=>c(t,e.customControlBackgroundOpacity));function r(e,t,n){$(`input[type='checkbox'][key='${e}']`).prop("checked",n);$(`input[type='text'][key='${e}']`).val(n)}function u(){for(const t in e){r(t,undefined,e[t])}}function a(){$(".gui-settings-mask").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-box,.gui-settings-mask").removeClass("opened")});$("input[key='customStyleColor']").on("input",()=>{const e=i.customStyleColor($("input[key='customStyleColor']").val());const n=t.color.hexToRgba(e+"70");$("div.custom-color-preview").css("background",e).css("box-shadow",`0px 2px 8px 1px rgba(${n.r},${n.g},${n.b},${n.a})`)});$("input[type='text'][key]").each((t,n)=>{$(n).attr("placeholder",e[$(n).attr("key")])});$("div.custom-color-preview").on("click",()=>{const e=$(".predefined-colors");e.toggleClass("opened")});$(".gui-settings-content ul li.category").on("click",e=>{e.currentTarget.classList.toggle("folded");o(e.currentTarget).forEach(e=>e.classList.toggle("folded"))});$(".gui-settings-dropdown>input").on("click",e=>{$(e.currentTarget).parent().toggleClass("opened")});onSettingsChange(r)}function l(){const t=()=>{$("input[type='checkbox'][key]").each((t,n)=>{e[$(n).attr("key")]=$(n).prop("checked")});$("input[type='text'][key]").each((t,n)=>{const o=$(n);const s=o.attr("key");const c=i[s](o.val());e[s]=c;o.val(c)});saveSettings(e)};$("input[type='checkbox'][key]").on("change",()=>t());$("input[type='text'][key]").on("change",()=>t())}function d(){const e={};$(`input[dependencies]`).each((t,n)=>{const i=$(n).attr("dependencies");if(i){e[$(n).attr("key")]=i}});const t=t=>{const n=t.prop("checked");for(const i in e){const o=e[i].split(" ");if(o.indexOf(t.attr("key"))!==-1){let e=true;if(n&&o.every(e=>$(`input[key='${e}']`).prop("checked"))){e=false}const t=$(`li:has(input[key='${i}'])`);const s=e?"addClass":"removeClass";t[s]("disabled");$(`input[key='${i}'][type='text']`).parent()[s]("disabled")}}};$(`input[type='checkbox'][key]`).on("change",e=>t($(e.target))).each((e,n)=>t($(n)))}function p(e){if($(".gui-settings").length===0){e.append(``);$(".gui-settings").on("click",()=>{$(".gui-settings-box,.gui-settings-mask").addClass("opened")});$(".gui-settings-widgets").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-mask").addClass("opened")})}t.applyStyle("guiSettingsStyle")}function g(){const e=$(".predefined-colors-grid");for(const t of Object.values(n)){$(``).appendTo(e).css("background",t).attr("data-color",t).on("click",e=>{$(`input[key='customStyleColor']`).val($(e.target).attr("data-color")).trigger("input").change();$("div.custom-color-preview").on("click")})}}function f(){if(e.blurSettingsPanel){$(".gui-settings-box").addClass("blur")}}function h(){if(typeof offlineData!=="undefined"){$("li:has(input[key=useCache])").addClass("disabled");$("input[key=useCache]").prop("disabled",true)}}function y(){$(".gui-settings-content ul li.category").each((e,t)=>{$(t).click()})}function k(){if(!CSS.supports("backdrop-filter","blur(24px)")&&!CSS.supports("-webkit-backdrop-filter","blur(24px)")){$("input[key=blurVideoControl]").prop("disabled",true);e.blurVideoControl=false;saveSettings(e)}}p($("body"));const b=t.data.guiSettingsDom.text;if(b){$("body").append(b);a();h();u();d();g();l();y();k()}new SpinQuery(()=>$("body"),e=>e.length>0&&!(unsafeWindow.parent.window===unsafeWindow),e=>$(".gui-settings-icon-panel").css("display","none")).start()}})();
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/dark-styles.min.js"] = (()=>{return(l,e)=>{if(l.useDarkStyle){e.applyStyle("scrollbarStyle");SpinQuery.any(()=>$(".custom-scrollbar"),l=>l.removeClass("custom-scrollbar"));if($("#banner_link").length===0||$("#banner_link").length>0&&l.overrideNavBar&&!l.showBanner){e.applyImportantStyle("darkStyleNavBar")}e.applyStyle("darkStyle");e.applyImportantStyle("darkStyleImportant")}else{$("#bilibili-scrollbar-style,#bilibili-new-style-dark-nav-bar,#bilibili-new-style-dark,#bilibili-new-style-dark-important").remove()}}})();
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"));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(n,e)=>{new SpinQuery(()=>$(".head-content.bili-wrapper>div.search:not(.filter-item)"),n=>n.length>0&&$(".nav-con.fr").filter((n,e)=>e.innerText).length>0,n=>{const e=$(".nav-con.fr").filter((n,e)=>e.innerText);n.detach().insertAfter(e)}).start();if(n.preserveRank){SpinQuery.any(()=>$(".head-content.bili-wrapper>div.search:not(.filter-item) .searchform,.nav-con #nav_searchform"),n=>{n.addClass("preserve-rank");n.prepend(`\n \n \n \n `)})}}})();
@@ -941,8 +950,8 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/about.min.js"] = (()=>{return(e,n)=>{$("body").append(n.data.aboutDom.text);const o=GM_info.script.name.replace("Bilibili Evolved","").replace(/^[\(\) ]+|[\(\) ]+$/g,"")+" · "+e.currentVersion;$(".bilibili-evolved-version").text(o);const i=[{name:"jQuery",homepage:"https://jquery.com/",license:"MIT",version:"3.2.1"},{name:"JSZip",homepage:"https://stuk.github.io/jszip/",license:"MIT",version:"3.1.5"}];i.forEach(e=>{$(".open-source-components").append(`\n \n \n ${e.name}
\n ${e.version} · ${e.license}
\n \n \n `)});function t(){n.applyStyle("aboutStyle");$("#about-link,#about-close").on("click",()=>{$(".bilibili-evolved-about").toggleClass("opened")})}}})();
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-control-background.min.scss"] = `.bilibili-player-video-control-mask{background:transparent!important;}.bilibili-player-video-control-bottom,.bui-slider .bui-track.bui-track-video-progress .bui-bar-wrap{background:rgba(0,0,0,$customControlBackgroundOpacity)!important;}`;
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-control-background.min.js"] = (()=>{return(o,t)=>{if(o.customControlBackgroundOpacity>0){t.applyStyle("customControlBackgroundStyle");if(!o.touchVideoPlayer){t.applyImportantStyleFromText(`\n\n `)}}}})();
-offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-player-mode.min.js"] = (()=>{return(e,i)=>{const n=[{name:"常规",action:()=>{}},{name:"宽屏",action:()=>{$(".bilibili-player-video-btn-widescreen").click()}},{name:"网页全屏",action:()=>{$(".bilibili-player-video-web-fullscreen").click()}}];SpinQuery.any(()=>$(".gui-settings-dropdown:has(input[key=defaultPlayerMode])"),e=>{const i=e.find("ul");const t=e.find("input");Object.values(n).forEach(e=>{$(`${e.name}`).appendTo(i).on("click",()=>{t.val(e.name).trigger("input").change()})})});let t=()=>{};async function l(){if(e.autoLightOff){const e=await SpinQuery.unsafeJquery();const i=await SpinQuery.any(()=>e(".bilibili-player-video-btn-setting"));i.mouseover().mouseout();t=(()=>{SpinQuery.any(()=>$(".bilibili-player-video-btn-setting-panel-others-content-lightoff .bui-checkbox-input"),e=>{const i=e[0];const n=document.createEvent("HTMLEvents");n.initEvent("change",true,true);i.checked=true;i.dispatchEvent(n)})})}}async function a(){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.length===0){return}const a=n.find(i=>i.name===e.defaultPlayerMode);if(a.name==="全屏"){const e=await SpinQuery.unsafeJquery();const i=document.querySelector(".bilibili-player-video-btn-start");const n=()=>{const t=e(".bilibili-player-video-btn-fullscreen").data("events");if(t.click&&t.click[0]&&t.click[0].handler){const i=e(".bilibili-player-video-btn-fullscreen").data("events").click[0].handler;console.log(i);i()}i.removeEventListener("click",n)};i.addEventListener("click",n)}else{const e=()=>{if(a&&$("#bilibiliPlayer[class*=mode-]").length===0){a.action()}t();i.removeEventListener("play",e)};i.addEventListener("play",e)}}Observer.subtree("#bofqi",()=>a())}})();
-offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-video-quality.min.js"] = (()=>{return(e,a)=>{(async()=>{const a=[{name:"1080P60",value:116},{name:"1080P+",value:112},{name:"1080P",value:80},{name:"720P",value:64},{name:"480P",value:32},{name:"360P",value:15},{name:"自动",value:0}];const t=await SpinQuery.any(()=>$(".gui-settings-dropdown:has(input[key=defaultVideoQuality])"));const i=t.find("ul");const n=t.find("input");a.forEach(e=>{$(`${e.name}`).appendTo(i).on("click",()=>{n.val(e.name).trigger("input").change()})});const l=await SpinQuery.condition(()=>$(".bilibili-player-video-quality-menu .bui-select-list>li.bui-select-item"),e=>e.length>0&&$("li.profile-info").length>0);const[u]=l.toArray().map(e=>e.getAttribute("data-value")).sort().reverse();const[o]=a.filter(a=>a.name===e.defaultVideoQuality).map(e=>e.value);const[r]=a.map(e=>e.value).filter(e=>e<=Math.min(o,u)).sort().reverse();l.each((e,a)=>{if(parseInt(a.getAttribute("data-value"))===r){a.click()}})})()}})();
+offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-player-mode.min.js"] = (()=>{return(e,i)=>{const n=[{name:"常规",action:()=>{}},{name:"宽屏",action:()=>{$(".bilibili-player-video-btn-widescreen").click()}},{name:"网页全屏",action:()=>{$(".bilibili-player-video-web-fullscreen").click()}}];let t=()=>{};async function l(){if(e.autoLightOff){const e=await SpinQuery.unsafeJquery();const i=await SpinQuery.any(()=>e(".bilibili-player-video-btn-setting"));i.mouseover().mouseout();t=(()=>{SpinQuery.any(()=>$(".bilibili-player-video-btn-setting-panel-others-content-lightoff .bui-checkbox-input"),e=>{const i=e[0];const n=document.createEvent("HTMLEvents");n.initEvent("change",true,true);i.checked=true;i.dispatchEvent(n)})})}}async function a(){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.length===0){return}const a=n.find(i=>i.name===e.defaultPlayerMode);if(a.name==="全屏"){const e=await SpinQuery.unsafeJquery();const i=document.querySelector(".bilibili-player-video-btn-start");const n=()=>{const t=e(".bilibili-player-video-btn-fullscreen").data("events");if(t.click&&t.click[0]&&t.click[0].handler){const i=e(".bilibili-player-video-btn-fullscreen").data("events").click[0].handler;console.log(i);i()}i.removeEventListener("click",n)};i.addEventListener("click",n)}else{const e=()=>{if(a&&$("#bilibiliPlayer[class*=mode-]").length===0){a.action()}t();i.removeEventListener("play",e)};i.addEventListener("play",e)}}Observer.subtree("#bofqi",()=>a())}})();
+offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-video-quality.min.js"] = (()=>{return(e,a)=>{const t=[{name:"1080P60",value:116},{name:"1080P+",value:112},{name:"1080P",value:80},{name:"720P",value:64},{name:"480P",value:32},{name:"360P",value:15},{name:"自动",value:0}];(async()=>{const a=await SpinQuery.condition(()=>$(".bilibili-player-video-quality-menu .bui-select-list>li.bui-select-item"),e=>e.length>0&&$("li.profile-info").length>0);const[l]=a.toArray().map(e=>e.getAttribute("data-value")).sort().reverse();const[i]=t.filter(a=>a.name===e.defaultVideoQuality).map(e=>e.value);const[n]=t.map(e=>e.value).filter(e=>e<=Math.min(i,l)).sort().reverse();a.each((e,a)=>{if(parseInt(a.getAttribute("data-value"))===n){a.click()}})})()}})();
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/combo-like.min.js"] = (()=>{return(n,e)=>{let t=false;async function i(){const[n]=await SpinQuery.any(()=>document.querySelectorAll("div.ops>span.like"));if(!n.classList.contains("on")){t=true;n.click()}}async function c(){const[e]=await SpinQuery.any(()=>document.querySelectorAll("div.ops>span.coin"));if(!e.classList.contains("on")){e.click();const t=await SpinQuery.any(()=>$(".mc-box"));const i=await SpinQuery.any(()=>$(".coin-operated-m"));const c=i.children().filter((n,e)=>e.innerText==="2硬币").length!==0;const o=(()=>{if(n.doubleCoins&&c){return 2}else{return 1}})();const s=t.filter((n,e)=>e.innerText.indexOf(o)!==-1)[0];s.click();const a=$(".bi-btn").filter((n,e)=>e.innerText==="确定")[0];a.click();await SpinQuery.condition(()=>$(".mc-box"),n=>n.length===0)}}async function o(){const[n]=await SpinQuery.any(()=>document.querySelectorAll("div.ops>span.collect"));if(!n.classList.contains("on")){n.click();const e=await SpinQuery.any(()=>$(".group-list label:has(input)"));const t=e.filter((n,e)=>e.innerText.indexOf("默认收藏夹")!==-1).find("input")[0];if(!t.checked){const n=document.createEvent("HTMLEvents");n.initEvent("change",true,true);t.checked=true;t.dispatchEvent(n);const e=$(".btn.submit-move")[0];e.disabled=false;e.click()}else{const n=$("i.close")[0];n.click()}await SpinQuery.condition(()=>$(".mc-box"),n=>n.length===0)}}async function s(){console.log("combo start");await i();await o();await c();console.log("combo end")}(async()=>{const[n]=await SpinQuery.any(()=>document.querySelectorAll("div.ops>span.like"));n.style.userSelect="none";const e=2e3;n.addEventListener("pointerdown",n=>{t=true;if(n.type==="touch"){n.preventDefault()}setTimeout(()=>{if(t===true){t=false;s()}},e)});n.addEventListener("click",n=>{if(t===false){n.preventDefault();n.stopImmediatePropagation()}else{t=false}});n.addEventListener("touchend",n=>{if(t===false){n.preventDefault()}})})();return{widget:{content:`\n `,condition:async()=>{const n=await SpinQuery.any(()=>document.querySelectorAll("div.ops>span.like"));return n!==undefined},success:()=>{$("#combo-like").on("click",()=>{s();$(".gui-settings-mask").click()})}}}}})();
class ResourceType
@@ -1274,6 +1283,7 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m
}
}
await Promise.all(promises);
+ await this.applyDropdownOptions();
await this.applyWidgets();
saveSettings(settings);
}
@@ -1329,6 +1339,28 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m
.map(it => applyWidget(it.widget))
);
}
+ async applyDropdownOptions()
+ {
+ async function applyDropdownOption(info)
+ {
+ const dropdown = await SpinQuery.any(
+ () => $(`.gui-settings-dropdown:has(input[key=${info.key}])`));
+ const list = dropdown.find("ul");
+ const input = dropdown.find("input");
+ info.items.forEach(item =>
+ {
+ $(`${item}`).appendTo(list)
+ .on("click", () =>
+ {
+ input.val(item).trigger("input").change();
+ });
+ });
+ }
+ await Promise.all(Object.values(Resource.manifest)
+ .filter(it => it.dropdown)
+ .map(it => applyDropdownOption(it.dropdown))
+ );
+ }
getDefaultStyleId(key)
{
return key.replace(/([a-z][A-Z])/g,
diff --git a/bilibili-evolved.preview-offline.user.js b/bilibili-evolved.preview-offline.user.js
index 40a47d802..2a9e8570e 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 145.09
+// @version 145.87
// @description 增强哔哩哔哩Web端体验(预览离线版): 修复界面瑕疵, 删除广告, 使用夜间模式浏览, 下载视频或视频封面, 以及增加对触屏设备的支持等.
// @author Grant Howard, Coulomb-G
// @copyright 2018, Grant Howrad (https://github.com/the1812)
@@ -469,6 +469,10 @@
defaultPlayerMode: "默认播放器模式",
autoLightOff: "播放时自动关灯",
},
+ dropdown: {
+ key: "defaultPlayerMode",
+ items: ["常规", "宽屏", "网页全屏"],
+ },
},
useDefaultVideoQuality: {
path: "min/default-video-quality.min.js",
@@ -476,6 +480,10 @@
useDefaultVideoQuality: "使用默认视频画质",
defaultVideoQuality: "画质设定",
},
+ dropdown: {
+ key: "defaultVideoQuality",
+ items: ["1080P60", "1080P+", "1080P", "720P", "480P", "360P", "自动"],
+ },
},
comboLike: {
path: "min/combo-like.min.js",
@@ -488,6 +496,7 @@
Resource.root = "https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/";
Resource.all = {};
Resource.displayNames = {};
+ Resource.manifest = resourceManifest;
for (const [key, data] of Object.entries(resourceManifest))
{
const resource = new Resource(data.path, data.order, data.styles);
@@ -911,9 +920,9 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/gui-settings.min.html"] = ``;
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/image-viewer.min.html"] = ``;
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/download-video.min.html"] = ``;
-offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/version.txt"] = `1.6.7`;
+offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/version.txt"] = `1.6.8`;
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/icons.min.css"] = `.icons-enabled [class^=icon-]{width:24px;height:24px;display:inline-block;}.icons-enabled [class^=icon-]::after{content:"";width:24px;height:24px;display:inline-block;}.icons-enabled .icon-view::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-clear::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-download::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-update::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-info::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-settings::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-widgets::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-cancel::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-ok::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-video::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-style::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-tool::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-touch::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-other::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-arrow::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-rank::after{background-image:url('data:image/svg+xml;utf-8,');}.icons-enabled .icon-like::after{background-image:url('data:image/svg+xml;utf-8,');}`;
-offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/gui-settings.min.js"] = (()=>{return(t,e)=>{const n={red:"#e57373",pink:"#F06292",purple:"#BA68C8",deepPurple:"#9575CD",indigo:"#7986CB",blue:"#2196F3",lightBlue:"#00A0D8",cyan:"#00ACC1",teal:"#26A69A",green:"#81C784",lightGreen:"#9CCC65",orange:"#FF9800",deepOrange:"#FF7043",brown:"#A1887F",grey:"#757575",blueGrey:"#78909C"};const i={forceWideMinWidth:t=>t,customStyleColor:e=>{const n=e.match(/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/);if(n){if(e.length<7){return`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`}else{return e}}else{return t.customStyleColor}},blurBackgroundOpacity:e=>{const n=e.match(/^([-\+]?\d+)(\.\d+)?$/);if(n){const t=parseFloat(e);if(t>=0&&t<=1){return e}}return t.blurBackgroundOpacity},defaultPlayerMode:e=>{if(["常规","宽屏","网页全屏"].indexOf(e)!==-1){return e}return t.defaultPlayerMode},defaultVideoQuality:e=>{if(["1080P60","1080P+","1080P","720P","480P","360P","自动"].indexOf(e)!==-1){return e}return t.defaultVideoQuality}};function o(t){let e=t.nextElementSibling;const n=[];while(e!==null&&!e.classList.contains("category")){n.push(e);e=e.nextElementSibling}return n}function s(t,e){const n=t.match(/^([\d]{1,2}):([\d]{1,2})$/);if(n&&n.length>=3){const t={hour:parseInt(n[1]),minute:parseInt(n[2])};(function(){while(this.minute<0){this.minute+=60;this.hour-=1}while(this.minute>=60){this.minute-=60;this.hour+=1}while(this.hour<0){this.hour+=24}while(this.hour>=24){this.hour-=24}}).call(t);return`${t.hour}:${t.minute<10?"0"+t.minute:t.minute}`}else{return e}}i.darkScheduleStart=(e=>s(e,t.darkScheduleStart));i.darkScheduleEnd=(e=>s(e,t.darkScheduleEnd));function c(t,e){const n=t.match(/^([-\+]?\d+)(\.\d+)?$/);if(n){const e=parseFloat(t);if(e>=0&&e<=1){return t}}return e}i.blurBackgroundOpacity=(e=>c(e,t.blurBackgroundOpacity));i.customControlBackgroundOpacity=(e=>c(e,t.customControlBackgroundOpacity));function r(t,e,n){$(`input[type='checkbox'][key='${t}']`).prop("checked",n);$(`input[type='text'][key='${t}']`).val(n)}function u(){for(const e in t){r(e,undefined,t[e])}}function a(){$(".gui-settings-mask").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-box,.gui-settings-mask").removeClass("opened")});$("input[key='customStyleColor']").on("input",()=>{const t=i.customStyleColor($("input[key='customStyleColor']").val());const n=e.color.hexToRgba(t+"70");$("div.custom-color-preview").css("background",t).css("box-shadow",`0px 2px 8px 1px rgba(${n.r},${n.g},${n.b},${n.a})`)});$("input[type='text'][key]").each((e,n)=>{$(n).attr("placeholder",t[$(n).attr("key")])});$("div.custom-color-preview").on("click",()=>{const t=$(".predefined-colors");t.toggleClass("opened")});$(".gui-settings-content ul li.category").on("click",t=>{t.currentTarget.classList.toggle("folded");o(t.currentTarget).forEach(t=>t.classList.toggle("folded"))});$(".gui-settings-dropdown>input").on("click",t=>{$(t.currentTarget).parent().toggleClass("opened")});onSettingsChange(r)}function l(){const e=()=>{$("input[type='checkbox'][key]").each((e,n)=>{t[$(n).attr("key")]=$(n).prop("checked")});$("input[type='text'][key]").each((e,n)=>{const o=$(n);const s=o.attr("key");const c=i[s](o.val());t[s]=c;o.val(c)});saveSettings(t)};$("input[type='checkbox'][key]").on("change",()=>e());$("input[type='text'][key]").on("change",()=>e())}function d(){const t={};$(`input[dependencies]`).each((e,n)=>{const i=$(n).attr("dependencies");if(i){t[$(n).attr("key")]=i}});const e=e=>{const n=e.prop("checked");for(const i in t){const o=t[i].split(" ");if(o.indexOf(e.attr("key"))!==-1){let t=true;if(n&&o.every(t=>$(`input[key='${t}']`).prop("checked"))){t=false}const e=$(`li:has(input[key='${i}'])`);const s=t?"addClass":"removeClass";e[s]("disabled");$(`input[key='${i}'][type='text']`).parent()[s]("disabled")}}};$(`input[type='checkbox'][key]`).on("change",t=>e($(t.target))).each((t,n)=>e($(n)))}function p(t){if($(".gui-settings").length===0){t.append(``);$(".gui-settings").on("click",()=>{$(".gui-settings-box,.gui-settings-mask").addClass("opened")});$(".gui-settings-widgets").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-mask").addClass("opened")})}e.applyStyle("guiSettingsStyle")}function g(){const t=$(".predefined-colors-grid");for(const e of Object.values(n)){$(``).appendTo(t).css("background",e).attr("data-color",e).on("click",t=>{$(`input[key='customStyleColor']`).val($(t.target).attr("data-color")).trigger("input").change();$("div.custom-color-preview").on("click")})}}function h(){if(t.blurSettingsPanel){$(".gui-settings-box").addClass("blur")}}function f(){if(typeof offlineData!=="undefined"){$("li:has(input[key=useCache])").addClass("disabled");$("input[key=useCache]").prop("disabled",true)}}function y(){$(".gui-settings-content ul li.category").each((t,e)=>{$(e).click()})}function k(){if(!CSS.supports("backdrop-filter","blur(24px)")&&!CSS.supports("-webkit-backdrop-filter","blur(24px)")){$("input[key=blurVideoControl]").prop("disabled",true);t.blurVideoControl=false;saveSettings(t)}}p($("body"));const b=e.data.guiSettingsDom.text;if(b){$("body").append(b);a();f();u();d();g();l();y();k()}new SpinQuery(()=>$("body"),t=>t.length>0&&!(unsafeWindow.parent.window===unsafeWindow),t=>$(".gui-settings-icon-panel").css("display","none")).start()}})();
+offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/gui-settings.min.js"] = (()=>{return(e,t)=>{const n={red:"#e57373",pink:"#F06292",purple:"#BA68C8",deepPurple:"#9575CD",indigo:"#7986CB",blue:"#2196F3",lightBlue:"#00A0D8",cyan:"#00ACC1",teal:"#26A69A",green:"#81C784",lightGreen:"#9CCC65",orange:"#FF9800",deepOrange:"#FF7043",brown:"#A1887F",grey:"#757575",blueGrey:"#78909C"};const i={forceWideMinWidth:e=>e,customStyleColor:t=>{const n=t.match(/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/);if(n){if(t.length<7){return`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`}else{return t}}else{return e.customStyleColor}},blurBackgroundOpacity:t=>{const n=t.match(/^([-\+]?\d+)(\.\d+)?$/);if(n){const e=parseFloat(t);if(e>=0&&e<=1){return t}}return e.blurBackgroundOpacity},defaultPlayerMode:t=>{if(Resource.manifest.useDefaultPlayerMode.dropdown.items.indexOf(t)!==-1){return t}return e.defaultPlayerMode},defaultVideoQuality:t=>{if(Resource.manifest.useDefaultVideoQuality.dropdown.items.indexOf(t)!==-1){return t}return e.defaultVideoQuality}};function o(e){let t=e.nextElementSibling;const n=[];while(t!==null&&!t.classList.contains("category")){n.push(t);t=t.nextElementSibling}return n}function s(e,t){const n=e.match(/^([\d]{1,2}):([\d]{1,2})$/);if(n&&n.length>=3){const e={hour:parseInt(n[1]),minute:parseInt(n[2])};(function(){while(this.minute<0){this.minute+=60;this.hour-=1}while(this.minute>=60){this.minute-=60;this.hour+=1}while(this.hour<0){this.hour+=24}while(this.hour>=24){this.hour-=24}}).call(e);return`${e.hour}:${e.minute<10?"0"+e.minute:e.minute}`}else{return t}}i.darkScheduleStart=(t=>s(t,e.darkScheduleStart));i.darkScheduleEnd=(t=>s(t,e.darkScheduleEnd));function c(e,t){const n=e.match(/^([-\+]?\d+)(\.\d+)?$/);if(n){const t=parseFloat(e);if(t>=0&&t<=1){return e}}return t}i.blurBackgroundOpacity=(t=>c(t,e.blurBackgroundOpacity));i.customControlBackgroundOpacity=(t=>c(t,e.customControlBackgroundOpacity));function r(e,t,n){$(`input[type='checkbox'][key='${e}']`).prop("checked",n);$(`input[type='text'][key='${e}']`).val(n)}function u(){for(const t in e){r(t,undefined,e[t])}}function a(){$(".gui-settings-mask").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-box,.gui-settings-mask").removeClass("opened")});$("input[key='customStyleColor']").on("input",()=>{const e=i.customStyleColor($("input[key='customStyleColor']").val());const n=t.color.hexToRgba(e+"70");$("div.custom-color-preview").css("background",e).css("box-shadow",`0px 2px 8px 1px rgba(${n.r},${n.g},${n.b},${n.a})`)});$("input[type='text'][key]").each((t,n)=>{$(n).attr("placeholder",e[$(n).attr("key")])});$("div.custom-color-preview").on("click",()=>{const e=$(".predefined-colors");e.toggleClass("opened")});$(".gui-settings-content ul li.category").on("click",e=>{e.currentTarget.classList.toggle("folded");o(e.currentTarget).forEach(e=>e.classList.toggle("folded"))});$(".gui-settings-dropdown>input").on("click",e=>{$(e.currentTarget).parent().toggleClass("opened")});onSettingsChange(r)}function l(){const t=()=>{$("input[type='checkbox'][key]").each((t,n)=>{e[$(n).attr("key")]=$(n).prop("checked")});$("input[type='text'][key]").each((t,n)=>{const o=$(n);const s=o.attr("key");const c=i[s](o.val());e[s]=c;o.val(c)});saveSettings(e)};$("input[type='checkbox'][key]").on("change",()=>t());$("input[type='text'][key]").on("change",()=>t())}function d(){const e={};$(`input[dependencies]`).each((t,n)=>{const i=$(n).attr("dependencies");if(i){e[$(n).attr("key")]=i}});const t=t=>{const n=t.prop("checked");for(const i in e){const o=e[i].split(" ");if(o.indexOf(t.attr("key"))!==-1){let e=true;if(n&&o.every(e=>$(`input[key='${e}']`).prop("checked"))){e=false}const t=$(`li:has(input[key='${i}'])`);const s=e?"addClass":"removeClass";t[s]("disabled");$(`input[key='${i}'][type='text']`).parent()[s]("disabled")}}};$(`input[type='checkbox'][key]`).on("change",e=>t($(e.target))).each((e,n)=>t($(n)))}function p(e){if($(".gui-settings").length===0){e.append(``);$(".gui-settings").on("click",()=>{$(".gui-settings-box,.gui-settings-mask").addClass("opened")});$(".gui-settings-widgets").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-mask").addClass("opened")})}t.applyStyle("guiSettingsStyle")}function g(){const e=$(".predefined-colors-grid");for(const t of Object.values(n)){$(``).appendTo(e).css("background",t).attr("data-color",t).on("click",e=>{$(`input[key='customStyleColor']`).val($(e.target).attr("data-color")).trigger("input").change();$("div.custom-color-preview").on("click")})}}function f(){if(e.blurSettingsPanel){$(".gui-settings-box").addClass("blur")}}function h(){if(typeof offlineData!=="undefined"){$("li:has(input[key=useCache])").addClass("disabled");$("input[key=useCache]").prop("disabled",true)}}function y(){$(".gui-settings-content ul li.category").each((e,t)=>{$(t).click()})}function k(){if(!CSS.supports("backdrop-filter","blur(24px)")&&!CSS.supports("-webkit-backdrop-filter","blur(24px)")){$("input[key=blurVideoControl]").prop("disabled",true);e.blurVideoControl=false;saveSettings(e)}}p($("body"));const b=t.data.guiSettingsDom.text;if(b){$("body").append(b);a();h();u();d();g();l();y();k()}new SpinQuery(()=>$("body"),e=>e.length>0&&!(unsafeWindow.parent.window===unsafeWindow),e=>$(".gui-settings-icon-panel").css("display","none")).start()}})();
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/dark-styles.min.js"] = (()=>{return(l,e)=>{if(l.useDarkStyle){e.applyStyle("scrollbarStyle");SpinQuery.any(()=>$(".custom-scrollbar"),l=>l.removeClass("custom-scrollbar"));if($("#banner_link").length===0||$("#banner_link").length>0&&l.overrideNavBar&&!l.showBanner){e.applyImportantStyle("darkStyleNavBar")}e.applyStyle("darkStyle");e.applyImportantStyle("darkStyleImportant")}else{$("#bilibili-scrollbar-style,#bilibili-new-style-dark-nav-bar,#bilibili-new-style-dark,#bilibili-new-style-dark-important").remove()}}})();
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"));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(n,e)=>{new SpinQuery(()=>$(".head-content.bili-wrapper>div.search:not(.filter-item)"),n=>n.length>0&&$(".nav-con.fr").filter((n,e)=>e.innerText).length>0,n=>{const e=$(".nav-con.fr").filter((n,e)=>e.innerText);n.detach().insertAfter(e)}).start();if(n.preserveRank){SpinQuery.any(()=>$(".head-content.bili-wrapper>div.search:not(.filter-item) .searchform,.nav-con #nav_searchform"),n=>{n.addClass("preserve-rank");n.prepend(`\n \n \n \n `)})}}})();
@@ -941,8 +950,8 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/about.min.js"] = (()=>{return(e,n)=>{$("body").append(n.data.aboutDom.text);const o=GM_info.script.name.replace("Bilibili Evolved","").replace(/^[\(\) ]+|[\(\) ]+$/g,"")+" · "+e.currentVersion;$(".bilibili-evolved-version").text(o);const i=[{name:"jQuery",homepage:"https://jquery.com/",license:"MIT",version:"3.2.1"},{name:"JSZip",homepage:"https://stuk.github.io/jszip/",license:"MIT",version:"3.1.5"}];i.forEach(e=>{$(".open-source-components").append(`\n \n \n ${e.name}
\n ${e.version} · ${e.license}
\n \n \n `)});function t(){n.applyStyle("aboutStyle");$("#about-link,#about-close").on("click",()=>{$(".bilibili-evolved-about").toggleClass("opened")})}}})();
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-control-background.min.scss"] = `.bilibili-player-video-control-mask{background:transparent!important;}.bilibili-player-video-control-bottom,.bui-slider .bui-track.bui-track-video-progress .bui-bar-wrap{background:rgba(0,0,0,$customControlBackgroundOpacity)!important;}`;
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/custom-control-background.min.js"] = (()=>{return(o,t)=>{if(o.customControlBackgroundOpacity>0){t.applyStyle("customControlBackgroundStyle");if(!o.touchVideoPlayer){t.applyImportantStyleFromText(`\n\n `)}}}})();
-offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-player-mode.min.js"] = (()=>{return(e,i)=>{const n=[{name:"常规",action:()=>{}},{name:"宽屏",action:()=>{$(".bilibili-player-video-btn-widescreen").click()}},{name:"网页全屏",action:()=>{$(".bilibili-player-video-web-fullscreen").click()}}];SpinQuery.any(()=>$(".gui-settings-dropdown:has(input[key=defaultPlayerMode])"),e=>{const i=e.find("ul");const t=e.find("input");Object.values(n).forEach(e=>{$(`${e.name}`).appendTo(i).on("click",()=>{t.val(e.name).trigger("input").change()})})});let t=()=>{};async function l(){if(e.autoLightOff){const e=await SpinQuery.unsafeJquery();const i=await SpinQuery.any(()=>e(".bilibili-player-video-btn-setting"));i.mouseover().mouseout();t=(()=>{SpinQuery.any(()=>$(".bilibili-player-video-btn-setting-panel-others-content-lightoff .bui-checkbox-input"),e=>{const i=e[0];const n=document.createEvent("HTMLEvents");n.initEvent("change",true,true);i.checked=true;i.dispatchEvent(n)})})}}async function a(){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.length===0){return}const a=n.find(i=>i.name===e.defaultPlayerMode);if(a.name==="全屏"){const e=await SpinQuery.unsafeJquery();const i=document.querySelector(".bilibili-player-video-btn-start");const n=()=>{const t=e(".bilibili-player-video-btn-fullscreen").data("events");if(t.click&&t.click[0]&&t.click[0].handler){const i=e(".bilibili-player-video-btn-fullscreen").data("events").click[0].handler;console.log(i);i()}i.removeEventListener("click",n)};i.addEventListener("click",n)}else{const e=()=>{if(a&&$("#bilibiliPlayer[class*=mode-]").length===0){a.action()}t();i.removeEventListener("play",e)};i.addEventListener("play",e)}}Observer.subtree("#bofqi",()=>a())}})();
-offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-video-quality.min.js"] = (()=>{return(e,a)=>{(async()=>{const a=[{name:"1080P60",value:116},{name:"1080P+",value:112},{name:"1080P",value:80},{name:"720P",value:64},{name:"480P",value:32},{name:"360P",value:15},{name:"自动",value:0}];const t=await SpinQuery.any(()=>$(".gui-settings-dropdown:has(input[key=defaultVideoQuality])"));const i=t.find("ul");const n=t.find("input");a.forEach(e=>{$(`${e.name}`).appendTo(i).on("click",()=>{n.val(e.name).trigger("input").change()})});const l=await SpinQuery.condition(()=>$(".bilibili-player-video-quality-menu .bui-select-list>li.bui-select-item"),e=>e.length>0&&$("li.profile-info").length>0);const[u]=l.toArray().map(e=>e.getAttribute("data-value")).sort().reverse();const[o]=a.filter(a=>a.name===e.defaultVideoQuality).map(e=>e.value);const[r]=a.map(e=>e.value).filter(e=>e<=Math.min(o,u)).sort().reverse();l.each((e,a)=>{if(parseInt(a.getAttribute("data-value"))===r){a.click()}})})()}})();
+offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-player-mode.min.js"] = (()=>{return(e,i)=>{const n=[{name:"常规",action:()=>{}},{name:"宽屏",action:()=>{$(".bilibili-player-video-btn-widescreen").click()}},{name:"网页全屏",action:()=>{$(".bilibili-player-video-web-fullscreen").click()}}];let t=()=>{};async function l(){if(e.autoLightOff){const e=await SpinQuery.unsafeJquery();const i=await SpinQuery.any(()=>e(".bilibili-player-video-btn-setting"));i.mouseover().mouseout();t=(()=>{SpinQuery.any(()=>$(".bilibili-player-video-btn-setting-panel-others-content-lightoff .bui-checkbox-input"),e=>{const i=e[0];const n=document.createEvent("HTMLEvents");n.initEvent("change",true,true);i.checked=true;i.dispatchEvent(n)})})}}async function a(){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.length===0){return}const a=n.find(i=>i.name===e.defaultPlayerMode);if(a.name==="全屏"){const e=await SpinQuery.unsafeJquery();const i=document.querySelector(".bilibili-player-video-btn-start");const n=()=>{const t=e(".bilibili-player-video-btn-fullscreen").data("events");if(t.click&&t.click[0]&&t.click[0].handler){const i=e(".bilibili-player-video-btn-fullscreen").data("events").click[0].handler;console.log(i);i()}i.removeEventListener("click",n)};i.addEventListener("click",n)}else{const e=()=>{if(a&&$("#bilibiliPlayer[class*=mode-]").length===0){a.action()}t();i.removeEventListener("play",e)};i.addEventListener("play",e)}}Observer.subtree("#bofqi",()=>a())}})();
+offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/default-video-quality.min.js"] = (()=>{return(e,a)=>{const t=[{name:"1080P60",value:116},{name:"1080P+",value:112},{name:"1080P",value:80},{name:"720P",value:64},{name:"480P",value:32},{name:"360P",value:15},{name:"自动",value:0}];(async()=>{const a=await SpinQuery.condition(()=>$(".bilibili-player-video-quality-menu .bui-select-list>li.bui-select-item"),e=>e.length>0&&$("li.profile-info").length>0);const[l]=a.toArray().map(e=>e.getAttribute("data-value")).sort().reverse();const[i]=t.filter(a=>a.name===e.defaultVideoQuality).map(e=>e.value);const[n]=t.map(e=>e.value).filter(e=>e<=Math.min(i,l)).sort().reverse();a.each((e,a)=>{if(parseInt(a.getAttribute("data-value"))===n){a.click()}})})()}})();
offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/combo-like.min.js"] = (()=>{return(n,e)=>{let t=false;async function i(){const[n]=await SpinQuery.any(()=>document.querySelectorAll("div.ops>span.like"));if(!n.classList.contains("on")){t=true;n.click()}}async function c(){const[e]=await SpinQuery.any(()=>document.querySelectorAll("div.ops>span.coin"));if(!e.classList.contains("on")){e.click();const t=await SpinQuery.any(()=>$(".mc-box"));const i=await SpinQuery.any(()=>$(".coin-operated-m"));const c=i.children().filter((n,e)=>e.innerText==="2硬币").length!==0;const o=(()=>{if(n.doubleCoins&&c){return 2}else{return 1}})();const s=t.filter((n,e)=>e.innerText.indexOf(o)!==-1)[0];s.click();const a=$(".bi-btn").filter((n,e)=>e.innerText==="确定")[0];a.click();await SpinQuery.condition(()=>$(".mc-box"),n=>n.length===0)}}async function o(){const[n]=await SpinQuery.any(()=>document.querySelectorAll("div.ops>span.collect"));if(!n.classList.contains("on")){n.click();const e=await SpinQuery.any(()=>$(".group-list label:has(input)"));const t=e.filter((n,e)=>e.innerText.indexOf("默认收藏夹")!==-1).find("input")[0];if(!t.checked){const n=document.createEvent("HTMLEvents");n.initEvent("change",true,true);t.checked=true;t.dispatchEvent(n);const e=$(".btn.submit-move")[0];e.disabled=false;e.click()}else{const n=$("i.close")[0];n.click()}await SpinQuery.condition(()=>$(".mc-box"),n=>n.length===0)}}async function s(){console.log("combo start");await i();await o();await c();console.log("combo end")}(async()=>{const[n]=await SpinQuery.any(()=>document.querySelectorAll("div.ops>span.like"));n.style.userSelect="none";const e=2e3;n.addEventListener("pointerdown",n=>{t=true;if(n.type==="touch"){n.preventDefault()}setTimeout(()=>{if(t===true){t=false;s()}},e)});n.addEventListener("click",n=>{if(t===false){n.preventDefault();n.stopImmediatePropagation()}else{t=false}});n.addEventListener("touchend",n=>{if(t===false){n.preventDefault()}})})();return{widget:{content:`\n `,condition:async()=>{const n=await SpinQuery.any(()=>document.querySelectorAll("div.ops>span.like"));return n!==undefined},success:()=>{$("#combo-like").on("click",()=>{s();$(".gui-settings-mask").click()})}}}}})();
class ResourceType
@@ -1274,6 +1283,7 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m
}
}
await Promise.all(promises);
+ await this.applyDropdownOptions();
await this.applyWidgets();
saveSettings(settings);
}
@@ -1329,6 +1339,28 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m
.map(it => applyWidget(it.widget))
);
}
+ async applyDropdownOptions()
+ {
+ async function applyDropdownOption(info)
+ {
+ const dropdown = await SpinQuery.any(
+ () => $(`.gui-settings-dropdown:has(input[key=${info.key}])`));
+ const list = dropdown.find("ul");
+ const input = dropdown.find("input");
+ info.items.forEach(item =>
+ {
+ $(`${item}`).appendTo(list)
+ .on("click", () =>
+ {
+ input.val(item).trigger("input").change();
+ });
+ });
+ }
+ await Promise.all(Object.values(Resource.manifest)
+ .filter(it => it.dropdown)
+ .map(it => applyDropdownOption(it.dropdown))
+ );
+ }
getDefaultStyleId(key)
{
return key.replace(/([a-z][A-Z])/g,
diff --git a/bilibili-evolved.preview.user.js b/bilibili-evolved.preview.user.js
index 42237af5f..66adf7756 100644
--- a/bilibili-evolved.preview.user.js
+++ b/bilibili-evolved.preview.user.js
@@ -1,6 +1,6 @@
// ==UserScript==
// @name Bilibili Evolved (Preview)
-// @version 1.6.7
+// @version 1.6.8
// @description 增强哔哩哔哩Web端体验(预览版分支): 修复界面瑕疵, 删除广告, 使用夜间模式浏览, 下载视频或视频封面, 以及增加对触屏设备的支持等.
// @author Grant Howard, Coulomb-G
// @copyright 2018, Grant Howrad (https://github.com/the1812)
@@ -468,6 +468,10 @@
defaultPlayerMode: "默认播放器模式",
autoLightOff: "播放时自动关灯",
},
+ dropdown: {
+ key: "defaultPlayerMode",
+ items: ["常规", "宽屏", "网页全屏"],
+ },
},
useDefaultVideoQuality: {
path: "min/default-video-quality.min.js",
@@ -475,6 +479,10 @@
useDefaultVideoQuality: "使用默认视频画质",
defaultVideoQuality: "画质设定",
},
+ dropdown: {
+ key: "defaultVideoQuality",
+ items: ["1080P60", "1080P+", "1080P", "720P", "480P", "360P", "自动"],
+ },
},
comboLike: {
path: "min/combo-like.min.js",
@@ -487,6 +495,7 @@
Resource.root = "https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/";
Resource.all = {};
Resource.displayNames = {};
+ Resource.manifest = resourceManifest;
for (const [key, data] of Object.entries(resourceManifest))
{
const resource = new Resource(data.path, data.order, data.styles);
@@ -1259,6 +1268,7 @@
}
}
await Promise.all(promises);
+ await this.applyDropdownOptions();
await this.applyWidgets();
saveSettings(settings);
}
@@ -1314,6 +1324,28 @@
.map(it => applyWidget(it.widget))
);
}
+ async applyDropdownOptions()
+ {
+ async function applyDropdownOption(info)
+ {
+ const dropdown = await SpinQuery.any(
+ () => $(`.gui-settings-dropdown:has(input[key=${info.key}])`));
+ const list = dropdown.find("ul");
+ const input = dropdown.find("input");
+ info.items.forEach(item =>
+ {
+ $(`${item}`).appendTo(list)
+ .on("click", () =>
+ {
+ input.val(item).trigger("input").change();
+ });
+ });
+ }
+ await Promise.all(Object.values(Resource.manifest)
+ .filter(it => it.dropdown)
+ .map(it => applyDropdownOption(it.dropdown))
+ );
+ }
getDefaultStyleId(key)
{
return key.replace(/([a-z][A-Z])/g,
diff --git a/bilibili-evolved.user.js b/bilibili-evolved.user.js
index 014898c75..cd9f7b5e2 100644
--- a/bilibili-evolved.user.js
+++ b/bilibili-evolved.user.js
@@ -1,6 +1,6 @@
// ==UserScript==
// @name Bilibili Evolved
-// @version 1.6.7
+// @version 1.6.8
// @description 增强哔哩哔哩Web端体验: 修复界面瑕疵, 删除广告, 使用夜间模式浏览, 下载视频或视频封面, 以及增加对触屏设备的支持等.
// @author Grant Howard, Coulomb-G
// @copyright 2018, Grant Howrad (https://github.com/the1812)
@@ -468,6 +468,10 @@
defaultPlayerMode: "默认播放器模式",
autoLightOff: "播放时自动关灯",
},
+ dropdown: {
+ key: "defaultPlayerMode",
+ items: ["常规", "宽屏", "网页全屏"],
+ },
},
useDefaultVideoQuality: {
path: "min/default-video-quality.min.js",
@@ -475,6 +479,10 @@
useDefaultVideoQuality: "使用默认视频画质",
defaultVideoQuality: "画质设定",
},
+ dropdown: {
+ key: "defaultVideoQuality",
+ items: ["1080P60", "1080P+", "1080P", "720P", "480P", "360P", "自动"],
+ },
},
comboLike: {
path: "min/combo-like.min.js",
@@ -487,6 +495,7 @@
Resource.root = "https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/";
Resource.all = {};
Resource.displayNames = {};
+ Resource.manifest = resourceManifest;
for (const [key, data] of Object.entries(resourceManifest))
{
const resource = new Resource(data.path, data.order, data.styles);
@@ -1259,6 +1268,7 @@
}
}
await Promise.all(promises);
+ await this.applyDropdownOptions();
await this.applyWidgets();
saveSettings(settings);
}
@@ -1314,6 +1324,28 @@
.map(it => applyWidget(it.widget))
);
}
+ async applyDropdownOptions()
+ {
+ async function applyDropdownOption(info)
+ {
+ const dropdown = await SpinQuery.any(
+ () => $(`.gui-settings-dropdown:has(input[key=${info.key}])`));
+ const list = dropdown.find("ul");
+ const input = dropdown.find("input");
+ info.items.forEach(item =>
+ {
+ $(`${item}`).appendTo(list)
+ .on("click", () =>
+ {
+ input.val(item).trigger("input").change();
+ });
+ });
+ }
+ await Promise.all(Object.values(Resource.manifest)
+ .filter(it => it.dropdown)
+ .map(it => applyDropdownOption(it.dropdown))
+ );
+ }
getDefaultStyleId(key)
{
return key.replace(/([a-z][A-Z])/g,
diff --git a/min/default-player-mode.min.js b/min/default-player-mode.min.js
index 57d20a9e1..deb531ca5 100644
--- a/min/default-player-mode.min.js
+++ b/min/default-player-mode.min.js
@@ -1 +1 @@
-(()=>{return(e,i)=>{const n=[{name:"常规",action:()=>{}},{name:"宽屏",action:()=>{$(".bilibili-player-video-btn-widescreen").click()}},{name:"网页全屏",action:()=>{$(".bilibili-player-video-web-fullscreen").click()}}];SpinQuery.any(()=>$(".gui-settings-dropdown:has(input[key=defaultPlayerMode])"),e=>{const i=e.find("ul");const t=e.find("input");Object.values(n).forEach(e=>{$(`${e.name}`).appendTo(i).on("click",()=>{t.val(e.name).trigger("input").change()})})});let t=()=>{};async function l(){if(e.autoLightOff){const e=await SpinQuery.unsafeJquery();const i=await SpinQuery.any(()=>e(".bilibili-player-video-btn-setting"));i.mouseover().mouseout();t=(()=>{SpinQuery.any(()=>$(".bilibili-player-video-btn-setting-panel-others-content-lightoff .bui-checkbox-input"),e=>{const i=e[0];const n=document.createEvent("HTMLEvents");n.initEvent("change",true,true);i.checked=true;i.dispatchEvent(n)})})}}async function a(){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.length===0){return}const a=n.find(i=>i.name===e.defaultPlayerMode);if(a.name==="全屏"){const e=await SpinQuery.unsafeJquery();const i=document.querySelector(".bilibili-player-video-btn-start");const n=()=>{const t=e(".bilibili-player-video-btn-fullscreen").data("events");if(t.click&&t.click[0]&&t.click[0].handler){const i=e(".bilibili-player-video-btn-fullscreen").data("events").click[0].handler;console.log(i);i()}i.removeEventListener("click",n)};i.addEventListener("click",n)}else{const e=()=>{if(a&&$("#bilibiliPlayer[class*=mode-]").length===0){a.action()}t();i.removeEventListener("play",e)};i.addEventListener("play",e)}}Observer.subtree("#bofqi",()=>a())}})();
\ No newline at end of file
+(()=>{return(e,i)=>{const n=[{name:"常规",action:()=>{}},{name:"宽屏",action:()=>{$(".bilibili-player-video-btn-widescreen").click()}},{name:"网页全屏",action:()=>{$(".bilibili-player-video-web-fullscreen").click()}}];let t=()=>{};async function l(){if(e.autoLightOff){const e=await SpinQuery.unsafeJquery();const i=await SpinQuery.any(()=>e(".bilibili-player-video-btn-setting"));i.mouseover().mouseout();t=(()=>{SpinQuery.any(()=>$(".bilibili-player-video-btn-setting-panel-others-content-lightoff .bui-checkbox-input"),e=>{const i=e[0];const n=document.createEvent("HTMLEvents");n.initEvent("change",true,true);i.checked=true;i.dispatchEvent(n)})})}}async function a(){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.length===0){return}const a=n.find(i=>i.name===e.defaultPlayerMode);if(a.name==="全屏"){const e=await SpinQuery.unsafeJquery();const i=document.querySelector(".bilibili-player-video-btn-start");const n=()=>{const t=e(".bilibili-player-video-btn-fullscreen").data("events");if(t.click&&t.click[0]&&t.click[0].handler){const i=e(".bilibili-player-video-btn-fullscreen").data("events").click[0].handler;console.log(i);i()}i.removeEventListener("click",n)};i.addEventListener("click",n)}else{const e=()=>{if(a&&$("#bilibiliPlayer[class*=mode-]").length===0){a.action()}t();i.removeEventListener("play",e)};i.addEventListener("play",e)}}Observer.subtree("#bofqi",()=>a())}})();
\ No newline at end of file
diff --git a/min/default-video-quality.min.js b/min/default-video-quality.min.js
index 8a45b7c6c..c0abd7cf6 100644
--- a/min/default-video-quality.min.js
+++ b/min/default-video-quality.min.js
@@ -1 +1 @@
-(()=>{return(e,a)=>{(async()=>{const a=[{name:"1080P60",value:116},{name:"1080P+",value:112},{name:"1080P",value:80},{name:"720P",value:64},{name:"480P",value:32},{name:"360P",value:15},{name:"自动",value:0}];const t=await SpinQuery.any(()=>$(".gui-settings-dropdown:has(input[key=defaultVideoQuality])"));const i=t.find("ul");const n=t.find("input");a.forEach(e=>{$(`${e.name}`).appendTo(i).on("click",()=>{n.val(e.name).trigger("input").change()})});const l=await SpinQuery.condition(()=>$(".bilibili-player-video-quality-menu .bui-select-list>li.bui-select-item"),e=>e.length>0&&$("li.profile-info").length>0);const[u]=l.toArray().map(e=>e.getAttribute("data-value")).sort().reverse();const[o]=a.filter(a=>a.name===e.defaultVideoQuality).map(e=>e.value);const[r]=a.map(e=>e.value).filter(e=>e<=Math.min(o,u)).sort().reverse();l.each((e,a)=>{if(parseInt(a.getAttribute("data-value"))===r){a.click()}})})()}})();
\ No newline at end of file
+(()=>{return(e,a)=>{const t=[{name:"1080P60",value:116},{name:"1080P+",value:112},{name:"1080P",value:80},{name:"720P",value:64},{name:"480P",value:32},{name:"360P",value:15},{name:"自动",value:0}];(async()=>{const a=await SpinQuery.condition(()=>$(".bilibili-player-video-quality-menu .bui-select-list>li.bui-select-item"),e=>e.length>0&&$("li.profile-info").length>0);const[l]=a.toArray().map(e=>e.getAttribute("data-value")).sort().reverse();const[i]=t.filter(a=>a.name===e.defaultVideoQuality).map(e=>e.value);const[n]=t.map(e=>e.value).filter(e=>e<=Math.min(i,l)).sort().reverse();a.each((e,a)=>{if(parseInt(a.getAttribute("data-value"))===n){a.click()}})})()}})();
\ No newline at end of file
diff --git a/min/gui-settings.min.js b/min/gui-settings.min.js
index bd048c5f7..56629a5b0 100644
--- a/min/gui-settings.min.js
+++ b/min/gui-settings.min.js
@@ -1 +1 @@
-(()=>{return(t,e)=>{const n={red:"#e57373",pink:"#F06292",purple:"#BA68C8",deepPurple:"#9575CD",indigo:"#7986CB",blue:"#2196F3",lightBlue:"#00A0D8",cyan:"#00ACC1",teal:"#26A69A",green:"#81C784",lightGreen:"#9CCC65",orange:"#FF9800",deepOrange:"#FF7043",brown:"#A1887F",grey:"#757575",blueGrey:"#78909C"};const i={forceWideMinWidth:t=>t,customStyleColor:e=>{const n=e.match(/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/);if(n){if(e.length<7){return`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`}else{return e}}else{return t.customStyleColor}},blurBackgroundOpacity:e=>{const n=e.match(/^([-\+]?\d+)(\.\d+)?$/);if(n){const t=parseFloat(e);if(t>=0&&t<=1){return e}}return t.blurBackgroundOpacity},defaultPlayerMode:e=>{if(["常规","宽屏","网页全屏"].indexOf(e)!==-1){return e}return t.defaultPlayerMode},defaultVideoQuality:e=>{if(["1080P60","1080P+","1080P","720P","480P","360P","自动"].indexOf(e)!==-1){return e}return t.defaultVideoQuality}};function o(t){let e=t.nextElementSibling;const n=[];while(e!==null&&!e.classList.contains("category")){n.push(e);e=e.nextElementSibling}return n}function s(t,e){const n=t.match(/^([\d]{1,2}):([\d]{1,2})$/);if(n&&n.length>=3){const t={hour:parseInt(n[1]),minute:parseInt(n[2])};(function(){while(this.minute<0){this.minute+=60;this.hour-=1}while(this.minute>=60){this.minute-=60;this.hour+=1}while(this.hour<0){this.hour+=24}while(this.hour>=24){this.hour-=24}}).call(t);return`${t.hour}:${t.minute<10?"0"+t.minute:t.minute}`}else{return e}}i.darkScheduleStart=(e=>s(e,t.darkScheduleStart));i.darkScheduleEnd=(e=>s(e,t.darkScheduleEnd));function c(t,e){const n=t.match(/^([-\+]?\d+)(\.\d+)?$/);if(n){const e=parseFloat(t);if(e>=0&&e<=1){return t}}return e}i.blurBackgroundOpacity=(e=>c(e,t.blurBackgroundOpacity));i.customControlBackgroundOpacity=(e=>c(e,t.customControlBackgroundOpacity));function r(t,e,n){$(`input[type='checkbox'][key='${t}']`).prop("checked",n);$(`input[type='text'][key='${t}']`).val(n)}function u(){for(const e in t){r(e,undefined,t[e])}}function a(){$(".gui-settings-mask").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-box,.gui-settings-mask").removeClass("opened")});$("input[key='customStyleColor']").on("input",()=>{const t=i.customStyleColor($("input[key='customStyleColor']").val());const n=e.color.hexToRgba(t+"70");$("div.custom-color-preview").css("background",t).css("box-shadow",`0px 2px 8px 1px rgba(${n.r},${n.g},${n.b},${n.a})`)});$("input[type='text'][key]").each((e,n)=>{$(n).attr("placeholder",t[$(n).attr("key")])});$("div.custom-color-preview").on("click",()=>{const t=$(".predefined-colors");t.toggleClass("opened")});$(".gui-settings-content ul li.category").on("click",t=>{t.currentTarget.classList.toggle("folded");o(t.currentTarget).forEach(t=>t.classList.toggle("folded"))});$(".gui-settings-dropdown>input").on("click",t=>{$(t.currentTarget).parent().toggleClass("opened")});onSettingsChange(r)}function l(){const e=()=>{$("input[type='checkbox'][key]").each((e,n)=>{t[$(n).attr("key")]=$(n).prop("checked")});$("input[type='text'][key]").each((e,n)=>{const o=$(n);const s=o.attr("key");const c=i[s](o.val());t[s]=c;o.val(c)});saveSettings(t)};$("input[type='checkbox'][key]").on("change",()=>e());$("input[type='text'][key]").on("change",()=>e())}function d(){const t={};$(`input[dependencies]`).each((e,n)=>{const i=$(n).attr("dependencies");if(i){t[$(n).attr("key")]=i}});const e=e=>{const n=e.prop("checked");for(const i in t){const o=t[i].split(" ");if(o.indexOf(e.attr("key"))!==-1){let t=true;if(n&&o.every(t=>$(`input[key='${t}']`).prop("checked"))){t=false}const e=$(`li:has(input[key='${i}'])`);const s=t?"addClass":"removeClass";e[s]("disabled");$(`input[key='${i}'][type='text']`).parent()[s]("disabled")}}};$(`input[type='checkbox'][key]`).on("change",t=>e($(t.target))).each((t,n)=>e($(n)))}function p(t){if($(".gui-settings").length===0){t.append(``);$(".gui-settings").on("click",()=>{$(".gui-settings-box,.gui-settings-mask").addClass("opened")});$(".gui-settings-widgets").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-mask").addClass("opened")})}e.applyStyle("guiSettingsStyle")}function g(){const t=$(".predefined-colors-grid");for(const e of Object.values(n)){$(``).appendTo(t).css("background",e).attr("data-color",e).on("click",t=>{$(`input[key='customStyleColor']`).val($(t.target).attr("data-color")).trigger("input").change();$("div.custom-color-preview").on("click")})}}function h(){if(t.blurSettingsPanel){$(".gui-settings-box").addClass("blur")}}function f(){if(typeof offlineData!=="undefined"){$("li:has(input[key=useCache])").addClass("disabled");$("input[key=useCache]").prop("disabled",true)}}function y(){$(".gui-settings-content ul li.category").each((t,e)=>{$(e).click()})}function k(){if(!CSS.supports("backdrop-filter","blur(24px)")&&!CSS.supports("-webkit-backdrop-filter","blur(24px)")){$("input[key=blurVideoControl]").prop("disabled",true);t.blurVideoControl=false;saveSettings(t)}}p($("body"));const b=e.data.guiSettingsDom.text;if(b){$("body").append(b);a();f();u();d();g();l();y();k()}new SpinQuery(()=>$("body"),t=>t.length>0&&!(unsafeWindow.parent.window===unsafeWindow),t=>$(".gui-settings-icon-panel").css("display","none")).start()}})();
\ No newline at end of file
+(()=>{return(e,t)=>{const n={red:"#e57373",pink:"#F06292",purple:"#BA68C8",deepPurple:"#9575CD",indigo:"#7986CB",blue:"#2196F3",lightBlue:"#00A0D8",cyan:"#00ACC1",teal:"#26A69A",green:"#81C784",lightGreen:"#9CCC65",orange:"#FF9800",deepOrange:"#FF7043",brown:"#A1887F",grey:"#757575",blueGrey:"#78909C"};const i={forceWideMinWidth:e=>e,customStyleColor:t=>{const n=t.match(/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/);if(n){if(t.length<7){return`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`}else{return t}}else{return e.customStyleColor}},blurBackgroundOpacity:t=>{const n=t.match(/^([-\+]?\d+)(\.\d+)?$/);if(n){const e=parseFloat(t);if(e>=0&&e<=1){return t}}return e.blurBackgroundOpacity},defaultPlayerMode:t=>{if(Resource.manifest.useDefaultPlayerMode.dropdown.items.indexOf(t)!==-1){return t}return e.defaultPlayerMode},defaultVideoQuality:t=>{if(Resource.manifest.useDefaultVideoQuality.dropdown.items.indexOf(t)!==-1){return t}return e.defaultVideoQuality}};function o(e){let t=e.nextElementSibling;const n=[];while(t!==null&&!t.classList.contains("category")){n.push(t);t=t.nextElementSibling}return n}function s(e,t){const n=e.match(/^([\d]{1,2}):([\d]{1,2})$/);if(n&&n.length>=3){const e={hour:parseInt(n[1]),minute:parseInt(n[2])};(function(){while(this.minute<0){this.minute+=60;this.hour-=1}while(this.minute>=60){this.minute-=60;this.hour+=1}while(this.hour<0){this.hour+=24}while(this.hour>=24){this.hour-=24}}).call(e);return`${e.hour}:${e.minute<10?"0"+e.minute:e.minute}`}else{return t}}i.darkScheduleStart=(t=>s(t,e.darkScheduleStart));i.darkScheduleEnd=(t=>s(t,e.darkScheduleEnd));function c(e,t){const n=e.match(/^([-\+]?\d+)(\.\d+)?$/);if(n){const t=parseFloat(e);if(t>=0&&t<=1){return e}}return t}i.blurBackgroundOpacity=(t=>c(t,e.blurBackgroundOpacity));i.customControlBackgroundOpacity=(t=>c(t,e.customControlBackgroundOpacity));function r(e,t,n){$(`input[type='checkbox'][key='${e}']`).prop("checked",n);$(`input[type='text'][key='${e}']`).val(n)}function u(){for(const t in e){r(t,undefined,e[t])}}function a(){$(".gui-settings-mask").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-box,.gui-settings-mask").removeClass("opened")});$("input[key='customStyleColor']").on("input",()=>{const e=i.customStyleColor($("input[key='customStyleColor']").val());const n=t.color.hexToRgba(e+"70");$("div.custom-color-preview").css("background",e).css("box-shadow",`0px 2px 8px 1px rgba(${n.r},${n.g},${n.b},${n.a})`)});$("input[type='text'][key]").each((t,n)=>{$(n).attr("placeholder",e[$(n).attr("key")])});$("div.custom-color-preview").on("click",()=>{const e=$(".predefined-colors");e.toggleClass("opened")});$(".gui-settings-content ul li.category").on("click",e=>{e.currentTarget.classList.toggle("folded");o(e.currentTarget).forEach(e=>e.classList.toggle("folded"))});$(".gui-settings-dropdown>input").on("click",e=>{$(e.currentTarget).parent().toggleClass("opened")});onSettingsChange(r)}function l(){const t=()=>{$("input[type='checkbox'][key]").each((t,n)=>{e[$(n).attr("key")]=$(n).prop("checked")});$("input[type='text'][key]").each((t,n)=>{const o=$(n);const s=o.attr("key");const c=i[s](o.val());e[s]=c;o.val(c)});saveSettings(e)};$("input[type='checkbox'][key]").on("change",()=>t());$("input[type='text'][key]").on("change",()=>t())}function d(){const e={};$(`input[dependencies]`).each((t,n)=>{const i=$(n).attr("dependencies");if(i){e[$(n).attr("key")]=i}});const t=t=>{const n=t.prop("checked");for(const i in e){const o=e[i].split(" ");if(o.indexOf(t.attr("key"))!==-1){let e=true;if(n&&o.every(e=>$(`input[key='${e}']`).prop("checked"))){e=false}const t=$(`li:has(input[key='${i}'])`);const s=e?"addClass":"removeClass";t[s]("disabled");$(`input[key='${i}'][type='text']`).parent()[s]("disabled")}}};$(`input[type='checkbox'][key]`).on("change",e=>t($(e.target))).each((e,n)=>t($(n)))}function p(e){if($(".gui-settings").length===0){e.append(``);$(".gui-settings").on("click",()=>{$(".gui-settings-box,.gui-settings-mask").addClass("opened")});$(".gui-settings-widgets").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-mask").addClass("opened")})}t.applyStyle("guiSettingsStyle")}function g(){const e=$(".predefined-colors-grid");for(const t of Object.values(n)){$(``).appendTo(e).css("background",t).attr("data-color",t).on("click",e=>{$(`input[key='customStyleColor']`).val($(e.target).attr("data-color")).trigger("input").change();$("div.custom-color-preview").on("click")})}}function f(){if(e.blurSettingsPanel){$(".gui-settings-box").addClass("blur")}}function h(){if(typeof offlineData!=="undefined"){$("li:has(input[key=useCache])").addClass("disabled");$("input[key=useCache]").prop("disabled",true)}}function y(){$(".gui-settings-content ul li.category").each((e,t)=>{$(t).click()})}function k(){if(!CSS.supports("backdrop-filter","blur(24px)")&&!CSS.supports("-webkit-backdrop-filter","blur(24px)")){$("input[key=blurVideoControl]").prop("disabled",true);e.blurVideoControl=false;saveSettings(e)}}p($("body"));const b=t.data.guiSettingsDom.text;if(b){$("body").append(b);a();h();u();d();g();l();y();k()}new SpinQuery(()=>$("body"),e=>e.length>0&&!(unsafeWindow.parent.window===unsafeWindow),e=>$(".gui-settings-icon-panel").css("display","none")).start()}})();
\ No newline at end of file
diff --git a/utils/gui-settings/gui-settings.js b/utils/gui-settings/gui-settings.js
index afdb9f407..10161fbb6 100644
--- a/utils/gui-settings/gui-settings.js
+++ b/utils/gui-settings/gui-settings.js
@@ -56,9 +56,7 @@
},
defaultPlayerMode: text =>
{
- if (["常规", "宽屏", "网页全屏",
- //"全屏"
- ].indexOf(text) !== -1)
+ if (Resource.manifest.useDefaultPlayerMode.dropdown.items.indexOf(text) !== -1)
{
return text;
}
@@ -66,15 +64,7 @@
},
defaultVideoQuality: text =>
{
- if ([
- "1080P60",
- "1080P+",
- "1080P",
- "720P",
- "480P",
- "360P",
- "自动",
- ].indexOf(text) !== -1)
+ if (Resource.manifest.useDefaultVideoQuality.dropdown.items.indexOf(text) !== -1)
{
return text;
}
diff --git a/version.txt b/version.txt
index 60fdb8d5d..cfe11fd6f 100644
--- a/version.txt
+++ b/version.txt
@@ -1 +1 @@
-1.6.7
\ No newline at end of file
+1.6.8
\ No newline at end of file
diff --git a/video/default-player-mode.js b/video/default-player-mode.js
index 947d65ba8..e7a8638f1 100644
--- a/video/default-player-mode.js
+++ b/video/default-player-mode.js
@@ -25,22 +25,6 @@
// name: "全屏",
// },
];
- SpinQuery.any(
- () => $(".gui-settings-dropdown:has(input[key=defaultPlayerMode])"),
- dropdown =>
- {
- const list = dropdown.find("ul");
- const input = dropdown.find("input");
- Object.values(playerModes).forEach(value =>
- {
- $(`${value.name}`).appendTo(list)
- .on("click", () =>
- {
- input.val(value.name).trigger("input").change();
- });
- });
- }
- );
let lightOff = () => { };
async function initLightOff()
{
diff --git a/video/default-video-quality.js b/video/default-video-quality.js
index 62ca14724..b6eb38d32 100644
--- a/video/default-video-quality.js
+++ b/video/default-video-quality.js
@@ -2,51 +2,38 @@
{
return (settings, resources) =>
{
+ const qualities = [
+ {
+ name: "1080P60",
+ value: 116,
+ },
+ {
+ name: "1080P+",
+ value: 112,
+ },
+ {
+ name: "1080P",
+ value: 80
+ },
+ {
+ name: "720P",
+ value: 64
+ },
+ {
+ name: "480P",
+ value: 32
+ },
+ {
+ name: "360P",
+ value: 15
+ },
+ {
+ name: "自动",
+ value: 0
+ },
+ ];
(async () =>
{
- const qualities = [
- {
- name: "1080P60",
- value: 116,
- },
- {
- name: "1080P+",
- value: 112,
- },
- {
- name: "1080P",
- value: 80
- },
- {
- name: "720P",
- value: 64
- },
- {
- name: "480P",
- value: 32
- },
- {
- name: "360P",
- value: 15
- },
- {
- name: "自动",
- value: 0
- },
- ];
- const dropdown = await SpinQuery.any(
- () => $(".gui-settings-dropdown:has(input[key=defaultVideoQuality])"));
- const list = dropdown.find("ul");
- const input = dropdown.find("input");
- qualities.forEach(item =>
- {
- $(`${item.name}`).appendTo(list)
- .on("click", () =>
- {
- input.val(item.name).trigger("input").change();
- });
- });
-
const qualityItems = await SpinQuery.condition(
() => $(".bilibili-player-video-quality-menu .bui-select-list>li.bui-select-item"),
it => it.length > 0 && $("li.profile-info").length > 0