diff --git a/bilibili-evolved.offline.user.js b/bilibili-evolved.offline.user.js index 678f3e447..2abd0f1bd 100644 --- a/bilibili-evolved.offline.user.js +++ b/bilibili-evolved.offline.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name Bilibili Evolved (Offline) -// @version 139.00 +// @version 139.01 // @description 增强哔哩哔哩Web端体验(离线版): 修复界面瑕疵, 删除广告, 使用夜间模式浏览, 下载视频或视频封面, 以及增加对触屏设备的支持等. // @author Grant Howard, Coulomb-G // @copyright 2018, Grant Howrad (https://github.com/the1812) @@ -892,7 +892,7 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m 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.5.41`; -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={settings:"M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z",widget:"M3,3H11V7.34L16.66,1.69L22.31,7.34L16.66,13H21V21H13V13H16.66L11,7.34V11H3V3M3,13H11V21H3V13Z",close:"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",ok:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"};const s={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}};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 c(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}}s.darkScheduleStart=(e=>c(e,t.darkScheduleStart));s.darkScheduleEnd=(e=>c(e,t.darkScheduleEnd));function a(t,e){const n=t.match(/^([-\+]?\d+)(\.\d+)?$/);if(n){const e=parseFloat(t);if(e>=0&&e<=1){return t}}return e}s.blurBackgroundOpacity=(e=>a(e,t.blurBackgroundOpacity));s.customControlBackgroundOpacity=(e=>a(e,t.customControlBackgroundOpacity));function r(t,e,n){$(`input[type='checkbox'][key='${t}']`).prop("checked",n);$(`input[type='text'][key='${t}']`).val(n)}function l(){for(const e in t){r(e,undefined,t[e])}$(".gui-settings-content ul li.category").each((t,e)=>{const n=o(e);if(n.filter(t=>!t.classList.contains("disabled")).every(t=>$(t).has("input:checked").length===0)){$(e).click()}})}function u(){$(".gui-settings-header .gui-settings-close").on("click",()=>{$(".gui-settings-panel").removeClass("opened")});$(".gui-settings-mask").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-mask").removeClass("opened")});$("input[key='customStyleColor']").on("input",()=>{const t=s.customStyleColor($("input[key='customStyleColor']").val());$("div.custom-color-preview").css("background",t)});$("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")});$(".gui-settings-panel").on("click",t=>{if(t.target===document.querySelector(".gui-settings-panel")){$(".gui-settings-panel .popup").removeClass("opened")}});onSettingsChange(r)}function d(){const e=()=>{$("input[type='checkbox'][key]").each((e,n)=>{t[$(n).attr("key")]=$(n).prop("checked")});$("input[type='text'][key]").each((e,n)=>{const i=$(n);const o=i.attr("key");const c=s[o](i.val());t[o]=c;i.val(c)});saveSettings(t)};$("input[type='checkbox'][key]").on("change",()=>e());$("input[type='text'][key]").on("change",()=>e())}function g(){$(".gui-settings-close path").attr("d",i.close);$(".gui-settings-ok path").attr("d",i.ok);$(".gui-settings svg path").attr("d",i.settings);$(".gui-settings-widgets svg path").attr("d",i.widget)}function p(){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 s=t[i].split(" ");if(s.indexOf(e.attr("key"))!==-1){let t=true;if(n&&s.every(t=>$(`input[key='${t}']`).prop("checked"))){t=false}const e=$(`li:has(input[key='${i}'])`);const o=t?"addClass":"removeClass";e[o]("disabled");$(`input[key='${i}'][type='text']`).parent()[o]("disabled")}}$(".gui-settings-panel .popup").removeClass("opened")};$(`input[type='checkbox'][key]`).on("change",t=>e($(t.target))).each((t,n)=>e($(n)))}function h(t){if($(".gui-settings").length===0){t.append(`
\n
\n \n \n \n
\n
\n \n \n \n
`);$(".gui-settings").on("click",()=>{$(".gui-settings-panel").addClass("opened")});$(".gui-settings-widgets").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-mask").addClass("opened")})}e.applyStyle("guiSettingsStyle")}function y(){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 k(){if(t.blurSettingsPanel){$(".gui-settings-box").addClass("blur")}else{$(".gui-settings-panel").addClass("animation")}}function f(){if(typeof offlineData!=="undefined"){$("li:has(input[key=useCache])").addClass("disabled");$("input[key=useCache]").prop("disabled",true)}}h($("body"));const C=e.data.guiSettingsDom.text;if(C){$("body").append(C);u();g();f();l();p();y();d();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(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={settings:"M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z",widget:"M3,3H11V7.34L16.66,1.69L22.31,7.34L16.66,13H21V21H13V13H16.66L11,7.34V11H3V3M3,13H11V21H3V13Z",close:"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",ok:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"};const s={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}};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 c(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}}s.darkScheduleStart=(e=>c(e,t.darkScheduleStart));s.darkScheduleEnd=(e=>c(e,t.darkScheduleEnd));function a(t,e){const n=t.match(/^([-\+]?\d+)(\.\d+)?$/);if(n){const e=parseFloat(t);if(e>=0&&e<=1){return t}}return e}s.blurBackgroundOpacity=(e=>a(e,t.blurBackgroundOpacity));s.customControlBackgroundOpacity=(e=>a(e,t.customControlBackgroundOpacity));function l(t,e,n){$(`input[type='checkbox'][key='${t}']`).prop("checked",n);$(`input[type='text'][key='${t}']`).val(n)}function r(){for(const e in t){l(e,undefined,t[e])}$(".gui-settings-content ul li.category").each((t,e)=>{const n=o(e);if(n.filter(t=>!t.classList.contains("disabled")).every(t=>$(t).has("input:checked").length===0)){$(e).click()}})}function u(){$(".gui-settings-header .gui-settings-close").on("click",()=>{$(".gui-settings-panel").removeClass("opened")});$(".gui-settings-mask").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-mask").removeClass("opened")});$("input[key='customStyleColor']").on("input",()=>{const t=s.customStyleColor($("input[key='customStyleColor']").val());$("div.custom-color-preview").css("background",t)});$("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")});$(".gui-settings-panel").on("click",t=>{if(t.target===document.querySelector(".gui-settings-panel")){$(".gui-settings-panel .popup").removeClass("opened")}});onSettingsChange(l)}function d(){const e=()=>{$("input[type='checkbox'][key]").each((e,n)=>{t[$(n).attr("key")]=$(n).prop("checked")});$("input[type='text'][key]").each((e,n)=>{const i=$(n);const o=i.attr("key");const c=s[o](i.val());t[o]=c;i.val(c)});saveSettings(t)};$("input[type='checkbox'][key]").on("change",()=>e());$("input[type='text'][key]").on("change",()=>e())}function g(){$(".gui-settings-close path").attr("d",i.close);$(".gui-settings-ok path").attr("d",i.ok);$(".gui-settings svg path").attr("d",i.settings);$(".gui-settings-widgets svg path").attr("d",i.widget)}function p(){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 s=t[i].split(" ");if(s.indexOf(e.attr("key"))!==-1){let t=true;if(n&&s.every(t=>$(`input[key='${t}']`).prop("checked"))){t=false}const e=$(`li:has(input[key='${i}'])`);const o=t?"addClass":"removeClass";e[o]("disabled");$(`input[key='${i}'][type='text']`).parent()[o]("disabled")}}$(".gui-settings-panel .popup").removeClass("opened")};$(`input[type='checkbox'][key]`).on("change",t=>e($(t.target))).each((t,n)=>e($(n)))}function h(t){if($(".gui-settings").length===0){t.append(`
\n
\n \n \n \n
\n
\n \n \n \n
`);$(".gui-settings").on("click",()=>{$(".gui-settings-panel").addClass("opened")});$(".gui-settings-widgets").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-mask").addClass("opened")})}e.applyStyle("guiSettingsStyle")}function y(){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 k(){if(t.blurSettingsPanel){$(".gui-settings-box").addClass("blur")}else{$(".gui-settings-panel").addClass("animation")}}function f(){if(typeof offlineData!=="undefined"){$("li:has(input[key=useCache])").addClass("disabled");$("input[key=useCache]").prop("disabled",true)}}h($("body"));const C=e.data.guiSettingsDom.text;if(C){$("body").append(C);u();g();f();r();p();y();d();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/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(e,n)=>{new SpinQuery(()=>$(".head-content.bili-wrapper>div.search").not(".filter-item"),e=>e.length>0&&$(".nav-con.fr").length>0,e=>{e.detach().insertAfter(".nav-con.fr")}).start()}})(); diff --git a/bilibili-evolved.preview-offline.user.js b/bilibili-evolved.preview-offline.user.js index 219d71167..123717f4e 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 139.00 +// @version 139.01 // @description 增强哔哩哔哩Web端体验(预览离线版): 修复界面瑕疵, 删除广告, 使用夜间模式浏览, 下载视频或视频封面, 以及增加对触屏设备的支持等. // @author Grant Howard, Coulomb-G // @copyright 2018, Grant Howrad (https://github.com/the1812) @@ -892,7 +892,7 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m 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.5.41`; -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={settings:"M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z",widget:"M3,3H11V7.34L16.66,1.69L22.31,7.34L16.66,13H21V21H13V13H16.66L11,7.34V11H3V3M3,13H11V21H3V13Z",close:"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",ok:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"};const s={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}};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 c(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}}s.darkScheduleStart=(e=>c(e,t.darkScheduleStart));s.darkScheduleEnd=(e=>c(e,t.darkScheduleEnd));function a(t,e){const n=t.match(/^([-\+]?\d+)(\.\d+)?$/);if(n){const e=parseFloat(t);if(e>=0&&e<=1){return t}}return e}s.blurBackgroundOpacity=(e=>a(e,t.blurBackgroundOpacity));s.customControlBackgroundOpacity=(e=>a(e,t.customControlBackgroundOpacity));function r(t,e,n){$(`input[type='checkbox'][key='${t}']`).prop("checked",n);$(`input[type='text'][key='${t}']`).val(n)}function l(){for(const e in t){r(e,undefined,t[e])}$(".gui-settings-content ul li.category").each((t,e)=>{const n=o(e);if(n.filter(t=>!t.classList.contains("disabled")).every(t=>$(t).has("input:checked").length===0)){$(e).click()}})}function u(){$(".gui-settings-header .gui-settings-close").on("click",()=>{$(".gui-settings-panel").removeClass("opened")});$(".gui-settings-mask").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-mask").removeClass("opened")});$("input[key='customStyleColor']").on("input",()=>{const t=s.customStyleColor($("input[key='customStyleColor']").val());$("div.custom-color-preview").css("background",t)});$("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")});$(".gui-settings-panel").on("click",t=>{if(t.target===document.querySelector(".gui-settings-panel")){$(".gui-settings-panel .popup").removeClass("opened")}});onSettingsChange(r)}function d(){const e=()=>{$("input[type='checkbox'][key]").each((e,n)=>{t[$(n).attr("key")]=$(n).prop("checked")});$("input[type='text'][key]").each((e,n)=>{const i=$(n);const o=i.attr("key");const c=s[o](i.val());t[o]=c;i.val(c)});saveSettings(t)};$("input[type='checkbox'][key]").on("change",()=>e());$("input[type='text'][key]").on("change",()=>e())}function g(){$(".gui-settings-close path").attr("d",i.close);$(".gui-settings-ok path").attr("d",i.ok);$(".gui-settings svg path").attr("d",i.settings);$(".gui-settings-widgets svg path").attr("d",i.widget)}function p(){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 s=t[i].split(" ");if(s.indexOf(e.attr("key"))!==-1){let t=true;if(n&&s.every(t=>$(`input[key='${t}']`).prop("checked"))){t=false}const e=$(`li:has(input[key='${i}'])`);const o=t?"addClass":"removeClass";e[o]("disabled");$(`input[key='${i}'][type='text']`).parent()[o]("disabled")}}$(".gui-settings-panel .popup").removeClass("opened")};$(`input[type='checkbox'][key]`).on("change",t=>e($(t.target))).each((t,n)=>e($(n)))}function h(t){if($(".gui-settings").length===0){t.append(`
\n
\n \n \n \n
\n
\n \n \n \n
`);$(".gui-settings").on("click",()=>{$(".gui-settings-panel").addClass("opened")});$(".gui-settings-widgets").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-mask").addClass("opened")})}e.applyStyle("guiSettingsStyle")}function y(){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 k(){if(t.blurSettingsPanel){$(".gui-settings-box").addClass("blur")}else{$(".gui-settings-panel").addClass("animation")}}function f(){if(typeof offlineData!=="undefined"){$("li:has(input[key=useCache])").addClass("disabled");$("input[key=useCache]").prop("disabled",true)}}h($("body"));const C=e.data.guiSettingsDom.text;if(C){$("body").append(C);u();g();f();l();p();y();d();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(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={settings:"M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z",widget:"M3,3H11V7.34L16.66,1.69L22.31,7.34L16.66,13H21V21H13V13H16.66L11,7.34V11H3V3M3,13H11V21H3V13Z",close:"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",ok:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"};const s={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}};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 c(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}}s.darkScheduleStart=(e=>c(e,t.darkScheduleStart));s.darkScheduleEnd=(e=>c(e,t.darkScheduleEnd));function a(t,e){const n=t.match(/^([-\+]?\d+)(\.\d+)?$/);if(n){const e=parseFloat(t);if(e>=0&&e<=1){return t}}return e}s.blurBackgroundOpacity=(e=>a(e,t.blurBackgroundOpacity));s.customControlBackgroundOpacity=(e=>a(e,t.customControlBackgroundOpacity));function l(t,e,n){$(`input[type='checkbox'][key='${t}']`).prop("checked",n);$(`input[type='text'][key='${t}']`).val(n)}function r(){for(const e in t){l(e,undefined,t[e])}$(".gui-settings-content ul li.category").each((t,e)=>{const n=o(e);if(n.filter(t=>!t.classList.contains("disabled")).every(t=>$(t).has("input:checked").length===0)){$(e).click()}})}function u(){$(".gui-settings-header .gui-settings-close").on("click",()=>{$(".gui-settings-panel").removeClass("opened")});$(".gui-settings-mask").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-mask").removeClass("opened")});$("input[key='customStyleColor']").on("input",()=>{const t=s.customStyleColor($("input[key='customStyleColor']").val());$("div.custom-color-preview").css("background",t)});$("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")});$(".gui-settings-panel").on("click",t=>{if(t.target===document.querySelector(".gui-settings-panel")){$(".gui-settings-panel .popup").removeClass("opened")}});onSettingsChange(l)}function d(){const e=()=>{$("input[type='checkbox'][key]").each((e,n)=>{t[$(n).attr("key")]=$(n).prop("checked")});$("input[type='text'][key]").each((e,n)=>{const i=$(n);const o=i.attr("key");const c=s[o](i.val());t[o]=c;i.val(c)});saveSettings(t)};$("input[type='checkbox'][key]").on("change",()=>e());$("input[type='text'][key]").on("change",()=>e())}function g(){$(".gui-settings-close path").attr("d",i.close);$(".gui-settings-ok path").attr("d",i.ok);$(".gui-settings svg path").attr("d",i.settings);$(".gui-settings-widgets svg path").attr("d",i.widget)}function p(){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 s=t[i].split(" ");if(s.indexOf(e.attr("key"))!==-1){let t=true;if(n&&s.every(t=>$(`input[key='${t}']`).prop("checked"))){t=false}const e=$(`li:has(input[key='${i}'])`);const o=t?"addClass":"removeClass";e[o]("disabled");$(`input[key='${i}'][type='text']`).parent()[o]("disabled")}}$(".gui-settings-panel .popup").removeClass("opened")};$(`input[type='checkbox'][key]`).on("change",t=>e($(t.target))).each((t,n)=>e($(n)))}function h(t){if($(".gui-settings").length===0){t.append(`
\n
\n \n \n \n
\n
\n \n \n \n
`);$(".gui-settings").on("click",()=>{$(".gui-settings-panel").addClass("opened")});$(".gui-settings-widgets").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-mask").addClass("opened")})}e.applyStyle("guiSettingsStyle")}function y(){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 k(){if(t.blurSettingsPanel){$(".gui-settings-box").addClass("blur")}else{$(".gui-settings-panel").addClass("animation")}}function f(){if(typeof offlineData!=="undefined"){$("li:has(input[key=useCache])").addClass("disabled");$("input[key=useCache]").prop("disabled",true)}}h($("body"));const C=e.data.guiSettingsDom.text;if(C){$("body").append(C);u();g();f();r();p();y();d();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/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(e,n)=>{new SpinQuery(()=>$(".head-content.bili-wrapper>div.search").not(".filter-item"),e=>e.length>0&&$(".nav-con.fr").length>0,e=>{e.detach().insertAfter(".nav-con.fr")}).start()}})(); diff --git a/min/gui-settings.min.js b/min/gui-settings.min.js index 360a721aa..abce4dda8 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={settings:"M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z",widget:"M3,3H11V7.34L16.66,1.69L22.31,7.34L16.66,13H21V21H13V13H16.66L11,7.34V11H3V3M3,13H11V21H3V13Z",close:"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",ok:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"};const s={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}};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 c(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}}s.darkScheduleStart=(e=>c(e,t.darkScheduleStart));s.darkScheduleEnd=(e=>c(e,t.darkScheduleEnd));function a(t,e){const n=t.match(/^([-\+]?\d+)(\.\d+)?$/);if(n){const e=parseFloat(t);if(e>=0&&e<=1){return t}}return e}s.blurBackgroundOpacity=(e=>a(e,t.blurBackgroundOpacity));s.customControlBackgroundOpacity=(e=>a(e,t.customControlBackgroundOpacity));function r(t,e,n){$(`input[type='checkbox'][key='${t}']`).prop("checked",n);$(`input[type='text'][key='${t}']`).val(n)}function l(){for(const e in t){r(e,undefined,t[e])}$(".gui-settings-content ul li.category").each((t,e)=>{const n=o(e);if(n.filter(t=>!t.classList.contains("disabled")).every(t=>$(t).has("input:checked").length===0)){$(e).click()}})}function u(){$(".gui-settings-header .gui-settings-close").on("click",()=>{$(".gui-settings-panel").removeClass("opened")});$(".gui-settings-mask").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-mask").removeClass("opened")});$("input[key='customStyleColor']").on("input",()=>{const t=s.customStyleColor($("input[key='customStyleColor']").val());$("div.custom-color-preview").css("background",t)});$("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")});$(".gui-settings-panel").on("click",t=>{if(t.target===document.querySelector(".gui-settings-panel")){$(".gui-settings-panel .popup").removeClass("opened")}});onSettingsChange(r)}function d(){const e=()=>{$("input[type='checkbox'][key]").each((e,n)=>{t[$(n).attr("key")]=$(n).prop("checked")});$("input[type='text'][key]").each((e,n)=>{const i=$(n);const o=i.attr("key");const c=s[o](i.val());t[o]=c;i.val(c)});saveSettings(t)};$("input[type='checkbox'][key]").on("change",()=>e());$("input[type='text'][key]").on("change",()=>e())}function g(){$(".gui-settings-close path").attr("d",i.close);$(".gui-settings-ok path").attr("d",i.ok);$(".gui-settings svg path").attr("d",i.settings);$(".gui-settings-widgets svg path").attr("d",i.widget)}function p(){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 s=t[i].split(" ");if(s.indexOf(e.attr("key"))!==-1){let t=true;if(n&&s.every(t=>$(`input[key='${t}']`).prop("checked"))){t=false}const e=$(`li:has(input[key='${i}'])`);const o=t?"addClass":"removeClass";e[o]("disabled");$(`input[key='${i}'][type='text']`).parent()[o]("disabled")}}$(".gui-settings-panel .popup").removeClass("opened")};$(`input[type='checkbox'][key]`).on("change",t=>e($(t.target))).each((t,n)=>e($(n)))}function h(t){if($(".gui-settings").length===0){t.append(`
\n
\n \n \n \n
\n
\n \n \n \n
`);$(".gui-settings").on("click",()=>{$(".gui-settings-panel").addClass("opened")});$(".gui-settings-widgets").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-mask").addClass("opened")})}e.applyStyle("guiSettingsStyle")}function y(){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 k(){if(t.blurSettingsPanel){$(".gui-settings-box").addClass("blur")}else{$(".gui-settings-panel").addClass("animation")}}function f(){if(typeof offlineData!=="undefined"){$("li:has(input[key=useCache])").addClass("disabled");$("input[key=useCache]").prop("disabled",true)}}h($("body"));const C=e.data.guiSettingsDom.text;if(C){$("body").append(C);u();g();f();l();p();y();d();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(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={settings:"M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z",widget:"M3,3H11V7.34L16.66,1.69L22.31,7.34L16.66,13H21V21H13V13H16.66L11,7.34V11H3V3M3,13H11V21H3V13Z",close:"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",ok:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"};const s={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}};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 c(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}}s.darkScheduleStart=(e=>c(e,t.darkScheduleStart));s.darkScheduleEnd=(e=>c(e,t.darkScheduleEnd));function a(t,e){const n=t.match(/^([-\+]?\d+)(\.\d+)?$/);if(n){const e=parseFloat(t);if(e>=0&&e<=1){return t}}return e}s.blurBackgroundOpacity=(e=>a(e,t.blurBackgroundOpacity));s.customControlBackgroundOpacity=(e=>a(e,t.customControlBackgroundOpacity));function l(t,e,n){$(`input[type='checkbox'][key='${t}']`).prop("checked",n);$(`input[type='text'][key='${t}']`).val(n)}function r(){for(const e in t){l(e,undefined,t[e])}$(".gui-settings-content ul li.category").each((t,e)=>{const n=o(e);if(n.filter(t=>!t.classList.contains("disabled")).every(t=>$(t).has("input:checked").length===0)){$(e).click()}})}function u(){$(".gui-settings-header .gui-settings-close").on("click",()=>{$(".gui-settings-panel").removeClass("opened")});$(".gui-settings-mask").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-mask").removeClass("opened")});$("input[key='customStyleColor']").on("input",()=>{const t=s.customStyleColor($("input[key='customStyleColor']").val());$("div.custom-color-preview").css("background",t)});$("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")});$(".gui-settings-panel").on("click",t=>{if(t.target===document.querySelector(".gui-settings-panel")){$(".gui-settings-panel .popup").removeClass("opened")}});onSettingsChange(l)}function d(){const e=()=>{$("input[type='checkbox'][key]").each((e,n)=>{t[$(n).attr("key")]=$(n).prop("checked")});$("input[type='text'][key]").each((e,n)=>{const i=$(n);const o=i.attr("key");const c=s[o](i.val());t[o]=c;i.val(c)});saveSettings(t)};$("input[type='checkbox'][key]").on("change",()=>e());$("input[type='text'][key]").on("change",()=>e())}function g(){$(".gui-settings-close path").attr("d",i.close);$(".gui-settings-ok path").attr("d",i.ok);$(".gui-settings svg path").attr("d",i.settings);$(".gui-settings-widgets svg path").attr("d",i.widget)}function p(){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 s=t[i].split(" ");if(s.indexOf(e.attr("key"))!==-1){let t=true;if(n&&s.every(t=>$(`input[key='${t}']`).prop("checked"))){t=false}const e=$(`li:has(input[key='${i}'])`);const o=t?"addClass":"removeClass";e[o]("disabled");$(`input[key='${i}'][type='text']`).parent()[o]("disabled")}}$(".gui-settings-panel .popup").removeClass("opened")};$(`input[type='checkbox'][key]`).on("change",t=>e($(t.target))).each((t,n)=>e($(n)))}function h(t){if($(".gui-settings").length===0){t.append(`
\n
\n \n \n \n
\n
\n \n \n \n
`);$(".gui-settings").on("click",()=>{$(".gui-settings-panel").addClass("opened")});$(".gui-settings-widgets").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-mask").addClass("opened")})}e.applyStyle("guiSettingsStyle")}function y(){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 k(){if(t.blurSettingsPanel){$(".gui-settings-box").addClass("blur")}else{$(".gui-settings-panel").addClass("animation")}}function f(){if(typeof offlineData!=="undefined"){$("li:has(input[key=useCache])").addClass("disabled");$("input[key=useCache]").prop("disabled",true)}}h($("body"));const C=e.data.guiSettingsDom.text;if(C){$("body").append(C);u();g();f();r();p();y();d();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 diff --git a/utils/gui-settings/gui-settings.js b/utils/gui-settings/gui-settings.js index 55852fa2e..eaaef4534 100644 --- a/utils/gui-settings/gui-settings.js +++ b/utils/gui-settings/gui-settings.js @@ -272,12 +272,12 @@ if ($(".gui-settings").length === 0) { body.append(`
-
+
-
+