From 833ab8fe9c2d86a7a271decff0fe0a7028b1593b Mon Sep 17 00:00:00 2001 From: the1812 Date: Tue, 1 Jan 2019 15:32:16 +0800 Subject: [PATCH] Fix bugs --- bilibili-evolved.offline.user.js | 6 +++--- bilibili-evolved.preview-offline.user.js | 6 +++--- min/gui-settings.min.js | 2 +- min/settings-search.min.js | 2 +- utils/gui-settings/gui-settings.js | 6 ++++++ utils/gui-settings/settings-search.js | 7 ++++++- 6 files changed, 20 insertions(+), 9 deletions(-) diff --git a/bilibili-evolved.offline.user.js b/bilibili-evolved.offline.user.js index cbcfd2d2a..daeadef14 100644 --- a/bilibili-evolved.offline.user.js +++ b/bilibili-evolved.offline.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name Bilibili Evolved (Offline) -// @version 168.98 +// @version 168.99 // @description 增强哔哩哔哩Web端体验(离线版): 修复界面瑕疵, 删除广告, 使用夜间模式浏览; 下载视频,封面,弹幕, 以及增加对触屏设备的支持等. // @author Grant Howard, Coulomb-G // @copyright 2018, Grant Howrad (https://github.com/the1812) @@ -1067,8 +1067,8 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/theme-colors.min.js"] = (()=>{return(e,o)=>{const r={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"};class t{constructor(){this.reloadColor=(()=>{const e=document.querySelector("html");return function(o){const r=new ColorProcessor(o);const t=e=>r.rgbToString(r.hexToRgba(e));const l=r.hexToRgba(o+"70");$("div.custom-color-preview").css("background",o).css("box-shadow",`0px 2px 8px 1px rgba(${l.r},${l.g},${l.b},${l.a})`);e.style.setProperty("--theme-color",o);for(let r=10;r<=90;r+=10){e.style.setProperty(`--theme-color-${r}`,t(o+r))}e.style.setProperty("--foreground-color",r.foreground);e.style.setProperty("--foreground-color-b",t(r.foreground+"b"));e.style.setProperty("--foreground-color-d",t(r.foreground+"d"));e.style.setProperty("--blue-image-filter",r.blueImageFilter);e.style.setProperty("--pink-image-filter",r.pinkImageFilter);e.style.setProperty("--brightness",r.brightness);e.style.setProperty("--invert-filter",r.filterInvert)}})()}setupDom(){$(`input[key='customStyleColor']`).on("change",()=>{this.reloadColor($(`input[key='customStyleColor']`).val())});const e=$(".predefined-colors-grid");for(const o of Object.values(r)){$(`
`).appendTo(e).css("background",o).attr("data-color",o).on("click",e=>{const o=$(e.target).attr("data-color");$(`input[key='customStyleColor']`).val(o).trigger("input").change();$("div.custom-color-preview").on("click")})}$("div.custom-color-preview").on("click",()=>{const e=$(".predefined-colors");e.toggleClass("opened")})}}return{export:t}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/settings-tooltip.min.css"] = `.gui-settings-tooltip{position:fixed;left:420px;color:white;background:#0008;padding:1rem;font-size:12pt;top:50%;transform:translateY(-50%);transition:all .2s ease-out .8s;opacity:0;min-width:100%;max-height:60%;line-height:24px;white-space:pre-wrap;pointer-events:none;}.gui-settings-tooltip.show{pointer-events:initial;opacity:1;}.gui-settings-tooltip span{font-weight:bold;}`; offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/settings-tooltip.min.js"] = (()=>{return(n,a)=>{const e={defaultPlayerMode:`设置默认的播放器模式, 可以为常规, 宽屏网页全屏(全屏还未完成). 默认模式将在进入视频页面的首次播放时应用.`,defaultPlayerLayout:`设置视频页(非番剧/电影)默认的播放器布局.\n- 旧版: 传统布局/番剧区使用的布局\n- 新版: 视频区默认的新版布局\n注: 更改此设置将立即刷新页面; 旧版布局中, 很多功能将不适用, 如夜间模式, 样式调整, 历史纪录点播放等.`,useDefaultVideoQuality:`进入视频时自动选择指定的画质, 若视频最高画质低于所选画质, 则使用视频的最高画质.`,defaultVideoQuality:`设定自动选择的视频画质.`,autoLightOff:`首次播放时, 自动进入关灯模式.`,useDefaultDanmakuSettings:`设置默认是否开启弹幕, 以及是否记住弹幕屏蔽类型.`,enableDanmaku:`控制弹幕是否默认开启.`,rememberDanmakuBlock:`控制是否记住弹幕屏蔽类型, 在播放器中选择要屏蔽的弹幕类型后, 每个视频都会默认屏蔽这些类型的弹幕.`,expandDanmakuList:`新版播放页面中, 弹幕列表默认收起以显示推荐的其他视频. 启用此功能可在每次加载视频时自动展开弹幕列表.`,expandDescription:`长的视频简介默认会被折叠, 启用此功能可以强制展开完整的视频简介.`,autoContinue:`播放视频时如果检测到历史记录信息(上次看到...消息), 则自动跳转到相应的时间播放.`,skipChargeList:`自动跳过视频结尾的充电鸣谢.`,customStyleColor:`设定顶栏(样式调整启用时)和夜间模式使用的主题色, 可以点击颜色预览的圆圈打开色板, 其中含有预定义的16种主题色, 也可以在右侧的文本框直接输入任何有效的16进制颜色值(#rrggbb#rgb).`,useNewStyle:`主要会改变顶栏的样式, 并有一些其他地方的界面微调:\n- 为播放器增加主题色投影\n- 可控制顶栏对横幅的透明度\n- 使播放器按钮垂直对齐\n- 使部分搜索栏的提示文字的颜色更清晰\n- 隐藏播放页面的"返回旧版"侧栏\n- 修复直播间一些文字初始状态不正确`,blurBackgroundOpacity:`设置顶栏对横幅的透明度(0~1), 数值越高顶栏越淡, 当横幅关闭时此选项无效.`,useDarkStyle:`夜间模式更适合光线暗的环境, 并会大量应用主题颜色.`,darkSchedule:`设置一个使用夜间模式的时间段, 进入/离开此时间段时, 会自动开启/关闭夜间模式.\n结束时间小于起始时间时将视为次日, 如18:006:00表示晚上18:00到次日6:00.`,darkScheduleStart:`设置计划时段的起始时间.`,darkScheduleEnd:`设置计划时段的结束时间.`,overrideNavBar:`开启后, 在主站中总是把搜索框置于顶栏, 如果页面里没有搜索栏则不会显示.`,showBanner:`控制是否显示主站顶部的横幅`,preserveRank:`控制是否在搜索框左侧显示排行榜图标.`,blurVideoControl:`模糊视频控制栏背景, 原版的阴影效果将无效.`,customControlBackground:`给视频控制栏附上半透明的黑色, 代替原来的阴影.`,customControlBackgroundOpacity:`设置控制栏着色的黑色不透明度(0~1), 数值越大黑色越浓.`,harunaScale:`根据屏幕DPI缩放直播看板娘的大小以提高像素的清晰度.`,removeLiveWatermark:`删除观看直播时角落的水印.`,removeVideoTopMask:`删除视频里鼠标经过时出现在顶端的标题覆盖层.`,forceWide:`对主站强制使用宽屏样式, 将在宽度达到1300px时启用. 此功能的适用范围为屏幕宽度介于1300px1400px的设备.\n原有的宽屏样式会在宽度超过1400px时自动启用, 如果你的屏幕宽度大于1400px, 则没有必要开启此功能.\n非宽屏样式下, 首页视频排行为2行3列; 宽屏样式下, 首页视频排行为2行4列.`,removeAds:`删除站内的各种广告. 包括首页的推广模块, 手机app推荐, 视频页面右侧的广告等.`,watchLaterRedirect:`将稍后再看的链接重定向为普通播放网址, 以使用新版播放页面.`,hideTopSearch:`将搜索框的推荐词替换为搜索.`,fullTweetsTitle:`在顶栏的动态预览框中, 总是展开完整的标题.`,touchNavBar:`删除顶栏右侧的一级链接(从大会员历史), 以方便触屏设备快速预览信息. 被删除的链接可从各预览中的查看更多进入.`,touchVideoPlayer:`增大控制栏的按钮间距, 使触摸操作更准确. 并为播放器启用触摸支持:\n- 左右滑动可调整进度\n- 上下滑动可调整音量\n- 进度调整可在左上角和右上角取消\n- 在不同位置滑动, 可以使用3档不同的灵敏度.`,touchVideoPlayerAnimation:`决定是否要对触摸调整的提示框使用出现/消失动画, 此动画可能导致掉帧.`,touchVideoPlayerDoubleTapControl:`将操作方式更改为: 单击显示/隐藏控制栏, 双击播放/暂停.`,toast:`允许在网页左下角显示来自本脚本的消息, 如更新提醒, 错误提示等.`,toastInternalError:`开启后, 错误消息将显示详细的技术性错误信息及堆栈跟踪, 这通常用于准确地确定问题发生的原因, 所以报告问题时这些信息会非常有用.`,useCache:`使用缓存以提高脚本的加载速度.`};function s(n){const a=$(n).find("input");if(a.length>0){return a.attr("key")}return null}(async()=>{const n=await SpinQuery.select(()=>document.querySelector(".gui-settings-tooltip"));document.querySelectorAll(".gui-settings-content>ul>li").forEach(a=>{a.addEventListener("mouseover",()=>{const t=e[s(a)];if(t!==undefined){n.innerHTML=t;n.classList.add("show")}});a.addEventListener("mouseout",()=>{n.classList.remove("show")})})})();return{export:e}}})(); -offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/settings-search.min.js"] = (()=>{return(t,e)=>{const s=e.attributes.settingsTooltip.export;class i{constructor(){this.input=document.querySelector(".gui-settings-search");const t=[...document.querySelectorAll(".gui-settings-content>ul>li")];const e=t=>e=>e.classList.contains("category")===t;this.categories=t.filter(e(true));this.items=t.filter(e(false));this.input.addEventListener("input",()=>this.keywordChange())}keywordChange(){const t=this.input.value.trim();this.items.forEach(e=>{const i=$(e).find("input").attr("key");const n=e.innerText+s[i].replace(/|<\/span>/g,"");if(!t||n.includes(t)){e.classList.remove("folded")}else{e.classList.add("folded")}});this.foldCategories()}foldCategories(){for(const e of this.categories){function t(){let t=e.nextElementSibling;while(t!==null&&!t.classList.contains("category")){if(!t.classList.contains("folded")){return"remove"}t=t.nextElementSibling}return"add"}e.classList[t()]("folded")}}}return{export:i}}})(); -offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/gui-settings.min.js"] = (()=>{return(e,t)=>{const n=t.attributes.textValidate.export.Validator;const i=t.attributes.settingsSearch.export;const s=t.attributes.themeColors.export;const o=new s;const a=t.data.guiSettingsDom.text;function c(e){let t=e.nextElementSibling;const n=[];while(t!==null&&!t.classList.contains("category")){n.push(t);t=t.nextElementSibling}return n}function r(e,t){$(`input[type='checkbox'][key='${e}']`).prop("checked",t);$(`input[type='text'][key='${e}']`).val(t)}function l(){for(const[t,n]of Object.entries(e)){r(t,n)}}function p(){$(".gui-settings-mask").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-box,.gui-settings-mask").removeClass("opened")});$("input[type='text'][key]").each((t,n)=>{$(n).attr("placeholder",e[$(n).attr("key")])});$(".gui-settings-content ul li.category").on("click",e=>{e.currentTarget.classList.toggle("folded");c(e.currentTarget).forEach(e=>e.classList.toggle("folded"))});$(".gui-settings-dropdown>input").on("click",e=>{$(e.currentTarget).parent().toggleClass("opened")});onSettingsChange((t,n,i)=>{if(e[t]!==i){e[t]=i;$(`input[type='checkbox'][key='${t}']`).prop("checked",i).change();$(`input[type='text'][key='${t}']`).val(i).change()}})}function u(){const t=e=>{};$("input[type='checkbox'][key]").each((n,i)=>{$(i).on("change",()=>{const n=i.getAttribute("key");const s=i.checked;e[n]=s;t(n);saveSettings(e)})});$("input[type='text'][key]").each((i,s)=>{$(s).on("change",()=>{const i=s.getAttribute("key");const o=n.getValidator(i).validate(s.value);e[i]=o;s.value=o;t(i);saveSettings(e)})})}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 s=e[i].split(" ");if(s.indexOf(t.attr("key"))!==-1){let e=true;if(n&&s.every(e=>$(`input[key='${e}']`).prop("checked"))){e=false}const t=$(`li:has(input[key='${i}'])`);const o=e?"addClass":"removeClass";t[o]("disabled");$(`input[key='${i}'][type='text']`).parent()[o]("disabled")}}};$(`input[type='checkbox'][key]`).on("change",e=>t($(e.target))).each((e,n)=>t($(n)))}function g(){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)}if(window.devicePixelRatio===1){$("input[key=harunaScale]").prop("disabled",true);e.harunaScale=false;saveSettings(e)}}t.applyStyle("guiSettingsStyle");$("body").append(a);p();g();l();d();o.setupDom();u();y();k();new i;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/settings-search.min.js"] = (()=>{return(t,e)=>{const s=e.attributes.settingsTooltip.export;class i{constructor(){this.input=document.querySelector(".gui-settings-search");const t=[...document.querySelectorAll(".gui-settings-content>ul>li")];const e=t=>e=>e.classList.contains("category")===t;this.categories=t.filter(e(true));this.items=t.filter(e(false));this.input.addEventListener("input",()=>this.keywordChange())}keywordChange(){const t=this.input.value.trim();if(!t){this.categories.concat(this.items).forEach(t=>t.classList.add("folded"));return}this.items.forEach(e=>{const i=$(e).find("input").attr("key");const n=e.innerText+s[i].replace(/|<\/span>/g,"");if(n.includes(t)){e.classList.remove("folded")}else{e.classList.add("folded")}});this.foldCategories()}foldCategories(){for(const e of this.categories){function t(){let t=e.nextElementSibling;while(t!==null&&!t.classList.contains("category")){if(!t.classList.contains("folded")){return"remove"}t=t.nextElementSibling}return"add"}e.classList[t()]("folded")}}}return{export:i}}})(); +offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/gui-settings.min.js"] = (()=>{return(e,t)=>{const n=t.attributes.textValidate.export.Validator;const i=t.attributes.settingsSearch.export;const s=t.attributes.themeColors.export;const o=new s;const a=t.data.guiSettingsDom.text;function c(e){let t=e.nextElementSibling;const n=[];while(t!==null&&!t.classList.contains("category")){n.push(t);t=t.nextElementSibling}return n}function r(e,t){$(`input[type='checkbox'][key='${e}']`).prop("checked",t);$(`input[type='text'][key='${e}']`).val(t)}function u(){for(const[t,n]of Object.entries(e)){r(t,n)}}function l(){$(".gui-settings-mask").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-box,.gui-settings-mask").removeClass("opened")});$("input[type='text'][key]").each((t,n)=>{$(n).attr("placeholder",e[$(n).attr("key")])});$(".gui-settings-content ul li.category").on("click",e=>{const t=document.querySelector(".gui-settings-search");if(t.value!==""){t.value="";raiseEvent(t,"input")}e.currentTarget.classList.toggle("folded");c(e.currentTarget).forEach(e=>e.classList.toggle("folded"))});$(".gui-settings-dropdown>input").on("click",e=>{$(e.currentTarget).parent().toggleClass("opened")});onSettingsChange((t,n,i)=>{if(e[t]!==i){e[t]=i;$(`input[type='checkbox'][key='${t}']`).prop("checked",i).change();$(`input[type='text'][key='${t}']`).val(i).change()}})}function p(){const t=e=>{};$("input[type='checkbox'][key]").each((n,i)=>{$(i).on("change",()=>{const n=i.getAttribute("key");const s=i.checked;e[n]=s;t(n);saveSettings(e)})});$("input[type='text'][key]").each((i,s)=>{$(s).on("change",()=>{const i=s.getAttribute("key");const o=n.getValidator(i).validate(s.value);e[i]=o;s.value=o;t(i);saveSettings(e)})})}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 s=e[i].split(" ");if(s.indexOf(t.attr("key"))!==-1){let e=true;if(n&&s.every(e=>$(`input[key='${e}']`).prop("checked"))){e=false}const t=$(`li:has(input[key='${i}'])`);const o=e?"addClass":"removeClass";t[o]("disabled");$(`input[key='${i}'][type='text']`).parent()[o]("disabled")}}};$(`input[type='checkbox'][key]`).on("change",e=>t($(e.target))).each((e,n)=>t($(n)))}function g(){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)}if(window.devicePixelRatio===1){$("input[key=harunaScale]").prop("disabled",true);e.harunaScale=false;saveSettings(e)}}t.applyStyle("guiSettingsStyle");$("body").append(a);l();g();u();d();o.setupDom();p();y();k();new i;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(e,l)=>{if(e.useDarkStyle){l.applyStyle("scrollbarStyle");SpinQuery.any(()=>$(".custom-scrollbar"),e=>e.removeClass("custom-scrollbar"));if($("#banner_link").length===0||$("#banner_link").length>0&&e.overrideNavBar&&!e.showBanner){l.applyImportantStyle("darkStyleNavBar")}l.applyStyle("darkStyle");l.applyImportantStyle("darkStyleImportant")}else{l.removeStyle("scrollbarStyle");l.removeStyle("darkStyleNavBar");l.removeStyle("darkStyle");l.removeStyle("darkStyleImportant")}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/tweets.min.css"] = `.showSearch #nav_searchform{width:250px!important;}.nav-search-submit{display:block!important;color:var(--foreground-color-d)!important;transform:translateX(-125px);-webkit-tap-highlight-color:transparent;}.nav-search-submit:hover{color:var(--foreground-color)!important;}#nav_searchform{transition:all .3s ease-out;box-shadow:none;width:0!important;padding:0!important;}.preserve-rank>a{opacity:0!important;pointer-events:none;}.showSearch .preserve-rank>a{opacity:0.382!important;pointer-events:initial;}.showSearch #nav_searchform{box-shadow:0px 2px 10px 1px #0002;width:250px!important;}.showSearch .nav-search-submit,.showSearch .nav-search-submit:hover{color:#888!important;transform:none;}@media only screen and (max-width: 1291px){.showSearch #nav_searchform{width:140px!important;}}`; offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/new-styles.min.js"] = (()=>{return(e,t)=>{if(document.URL===`https://h.bilibili.com/`){return}SpinQuery.any(()=>$(".custom-scrollbar"),e=>e.removeClass("custom-scrollbar"));SpinQuery.any(()=>$("#banner_link"),()=>t.removeStyle("tweetsStyle"));const l={selectors:["div.nav-con.fl","#link-navbar-vm",".link-navbar",".nav-header-wrapper",".z_top .z_header"],get allSelectors(){return this.selectors.reduce((e,t)=>e+","+t)},get navbar(){let e=null;for(const t of this.selectors){e=e||document.querySelector(t)}return e},supports(e){if(e instanceof Element){const t=parseInt(window.getComputedStyle(e).height);const l=[60,50,0,56];return l.indexOf(t)!==-1}return false}};SpinQuery.any(()=>$(l.allSelectors),()=>{const e=l.navbar;if(l.supports(e)){t.applyStyle("style","bilibili-style-optimization")}else{t.applyStyle("oldStyle","bilibili-style-optimization")}})}})(); diff --git a/bilibili-evolved.preview-offline.user.js b/bilibili-evolved.preview-offline.user.js index e6623b4f5..08bb4e2ba 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 168.98 +// @version 168.99 // @description 增强哔哩哔哩Web端体验(预览离线版): 修复界面瑕疵, 删除广告, 使用夜间模式浏览; 下载视频,封面,弹幕, 以及增加对触屏设备的支持等. // @author Grant Howard, Coulomb-G // @copyright 2018, Grant Howrad (https://github.com/the1812) @@ -1067,8 +1067,8 @@ offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/m offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/theme-colors.min.js"] = (()=>{return(e,o)=>{const r={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"};class t{constructor(){this.reloadColor=(()=>{const e=document.querySelector("html");return function(o){const r=new ColorProcessor(o);const t=e=>r.rgbToString(r.hexToRgba(e));const l=r.hexToRgba(o+"70");$("div.custom-color-preview").css("background",o).css("box-shadow",`0px 2px 8px 1px rgba(${l.r},${l.g},${l.b},${l.a})`);e.style.setProperty("--theme-color",o);for(let r=10;r<=90;r+=10){e.style.setProperty(`--theme-color-${r}`,t(o+r))}e.style.setProperty("--foreground-color",r.foreground);e.style.setProperty("--foreground-color-b",t(r.foreground+"b"));e.style.setProperty("--foreground-color-d",t(r.foreground+"d"));e.style.setProperty("--blue-image-filter",r.blueImageFilter);e.style.setProperty("--pink-image-filter",r.pinkImageFilter);e.style.setProperty("--brightness",r.brightness);e.style.setProperty("--invert-filter",r.filterInvert)}})()}setupDom(){$(`input[key='customStyleColor']`).on("change",()=>{this.reloadColor($(`input[key='customStyleColor']`).val())});const e=$(".predefined-colors-grid");for(const o of Object.values(r)){$(`
`).appendTo(e).css("background",o).attr("data-color",o).on("click",e=>{const o=$(e.target).attr("data-color");$(`input[key='customStyleColor']`).val(o).trigger("input").change();$("div.custom-color-preview").on("click")})}$("div.custom-color-preview").on("click",()=>{const e=$(".predefined-colors");e.toggleClass("opened")})}}return{export:t}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/settings-tooltip.min.css"] = `.gui-settings-tooltip{position:fixed;left:420px;color:white;background:#0008;padding:1rem;font-size:12pt;top:50%;transform:translateY(-50%);transition:all .2s ease-out .8s;opacity:0;min-width:100%;max-height:60%;line-height:24px;white-space:pre-wrap;pointer-events:none;}.gui-settings-tooltip.show{pointer-events:initial;opacity:1;}.gui-settings-tooltip span{font-weight:bold;}`; offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/settings-tooltip.min.js"] = (()=>{return(n,a)=>{const e={defaultPlayerMode:`设置默认的播放器模式, 可以为常规, 宽屏网页全屏(全屏还未完成). 默认模式将在进入视频页面的首次播放时应用.`,defaultPlayerLayout:`设置视频页(非番剧/电影)默认的播放器布局.\n- 旧版: 传统布局/番剧区使用的布局\n- 新版: 视频区默认的新版布局\n注: 更改此设置将立即刷新页面; 旧版布局中, 很多功能将不适用, 如夜间模式, 样式调整, 历史纪录点播放等.`,useDefaultVideoQuality:`进入视频时自动选择指定的画质, 若视频最高画质低于所选画质, 则使用视频的最高画质.`,defaultVideoQuality:`设定自动选择的视频画质.`,autoLightOff:`首次播放时, 自动进入关灯模式.`,useDefaultDanmakuSettings:`设置默认是否开启弹幕, 以及是否记住弹幕屏蔽类型.`,enableDanmaku:`控制弹幕是否默认开启.`,rememberDanmakuBlock:`控制是否记住弹幕屏蔽类型, 在播放器中选择要屏蔽的弹幕类型后, 每个视频都会默认屏蔽这些类型的弹幕.`,expandDanmakuList:`新版播放页面中, 弹幕列表默认收起以显示推荐的其他视频. 启用此功能可在每次加载视频时自动展开弹幕列表.`,expandDescription:`长的视频简介默认会被折叠, 启用此功能可以强制展开完整的视频简介.`,autoContinue:`播放视频时如果检测到历史记录信息(上次看到...消息), 则自动跳转到相应的时间播放.`,skipChargeList:`自动跳过视频结尾的充电鸣谢.`,customStyleColor:`设定顶栏(样式调整启用时)和夜间模式使用的主题色, 可以点击颜色预览的圆圈打开色板, 其中含有预定义的16种主题色, 也可以在右侧的文本框直接输入任何有效的16进制颜色值(#rrggbb#rgb).`,useNewStyle:`主要会改变顶栏的样式, 并有一些其他地方的界面微调:\n- 为播放器增加主题色投影\n- 可控制顶栏对横幅的透明度\n- 使播放器按钮垂直对齐\n- 使部分搜索栏的提示文字的颜色更清晰\n- 隐藏播放页面的"返回旧版"侧栏\n- 修复直播间一些文字初始状态不正确`,blurBackgroundOpacity:`设置顶栏对横幅的透明度(0~1), 数值越高顶栏越淡, 当横幅关闭时此选项无效.`,useDarkStyle:`夜间模式更适合光线暗的环境, 并会大量应用主题颜色.`,darkSchedule:`设置一个使用夜间模式的时间段, 进入/离开此时间段时, 会自动开启/关闭夜间模式.\n结束时间小于起始时间时将视为次日, 如18:006:00表示晚上18:00到次日6:00.`,darkScheduleStart:`设置计划时段的起始时间.`,darkScheduleEnd:`设置计划时段的结束时间.`,overrideNavBar:`开启后, 在主站中总是把搜索框置于顶栏, 如果页面里没有搜索栏则不会显示.`,showBanner:`控制是否显示主站顶部的横幅`,preserveRank:`控制是否在搜索框左侧显示排行榜图标.`,blurVideoControl:`模糊视频控制栏背景, 原版的阴影效果将无效.`,customControlBackground:`给视频控制栏附上半透明的黑色, 代替原来的阴影.`,customControlBackgroundOpacity:`设置控制栏着色的黑色不透明度(0~1), 数值越大黑色越浓.`,harunaScale:`根据屏幕DPI缩放直播看板娘的大小以提高像素的清晰度.`,removeLiveWatermark:`删除观看直播时角落的水印.`,removeVideoTopMask:`删除视频里鼠标经过时出现在顶端的标题覆盖层.`,forceWide:`对主站强制使用宽屏样式, 将在宽度达到1300px时启用. 此功能的适用范围为屏幕宽度介于1300px1400px的设备.\n原有的宽屏样式会在宽度超过1400px时自动启用, 如果你的屏幕宽度大于1400px, 则没有必要开启此功能.\n非宽屏样式下, 首页视频排行为2行3列; 宽屏样式下, 首页视频排行为2行4列.`,removeAds:`删除站内的各种广告. 包括首页的推广模块, 手机app推荐, 视频页面右侧的广告等.`,watchLaterRedirect:`将稍后再看的链接重定向为普通播放网址, 以使用新版播放页面.`,hideTopSearch:`将搜索框的推荐词替换为搜索.`,fullTweetsTitle:`在顶栏的动态预览框中, 总是展开完整的标题.`,touchNavBar:`删除顶栏右侧的一级链接(从大会员历史), 以方便触屏设备快速预览信息. 被删除的链接可从各预览中的查看更多进入.`,touchVideoPlayer:`增大控制栏的按钮间距, 使触摸操作更准确. 并为播放器启用触摸支持:\n- 左右滑动可调整进度\n- 上下滑动可调整音量\n- 进度调整可在左上角和右上角取消\n- 在不同位置滑动, 可以使用3档不同的灵敏度.`,touchVideoPlayerAnimation:`决定是否要对触摸调整的提示框使用出现/消失动画, 此动画可能导致掉帧.`,touchVideoPlayerDoubleTapControl:`将操作方式更改为: 单击显示/隐藏控制栏, 双击播放/暂停.`,toast:`允许在网页左下角显示来自本脚本的消息, 如更新提醒, 错误提示等.`,toastInternalError:`开启后, 错误消息将显示详细的技术性错误信息及堆栈跟踪, 这通常用于准确地确定问题发生的原因, 所以报告问题时这些信息会非常有用.`,useCache:`使用缓存以提高脚本的加载速度.`};function s(n){const a=$(n).find("input");if(a.length>0){return a.attr("key")}return null}(async()=>{const n=await SpinQuery.select(()=>document.querySelector(".gui-settings-tooltip"));document.querySelectorAll(".gui-settings-content>ul>li").forEach(a=>{a.addEventListener("mouseover",()=>{const t=e[s(a)];if(t!==undefined){n.innerHTML=t;n.classList.add("show")}});a.addEventListener("mouseout",()=>{n.classList.remove("show")})})})();return{export:e}}})(); -offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/settings-search.min.js"] = (()=>{return(t,e)=>{const s=e.attributes.settingsTooltip.export;class i{constructor(){this.input=document.querySelector(".gui-settings-search");const t=[...document.querySelectorAll(".gui-settings-content>ul>li")];const e=t=>e=>e.classList.contains("category")===t;this.categories=t.filter(e(true));this.items=t.filter(e(false));this.input.addEventListener("input",()=>this.keywordChange())}keywordChange(){const t=this.input.value.trim();this.items.forEach(e=>{const i=$(e).find("input").attr("key");const n=e.innerText+s[i].replace(/|<\/span>/g,"");if(!t||n.includes(t)){e.classList.remove("folded")}else{e.classList.add("folded")}});this.foldCategories()}foldCategories(){for(const e of this.categories){function t(){let t=e.nextElementSibling;while(t!==null&&!t.classList.contains("category")){if(!t.classList.contains("folded")){return"remove"}t=t.nextElementSibling}return"add"}e.classList[t()]("folded")}}}return{export:i}}})(); -offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/gui-settings.min.js"] = (()=>{return(e,t)=>{const n=t.attributes.textValidate.export.Validator;const i=t.attributes.settingsSearch.export;const s=t.attributes.themeColors.export;const o=new s;const a=t.data.guiSettingsDom.text;function c(e){let t=e.nextElementSibling;const n=[];while(t!==null&&!t.classList.contains("category")){n.push(t);t=t.nextElementSibling}return n}function r(e,t){$(`input[type='checkbox'][key='${e}']`).prop("checked",t);$(`input[type='text'][key='${e}']`).val(t)}function l(){for(const[t,n]of Object.entries(e)){r(t,n)}}function p(){$(".gui-settings-mask").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-box,.gui-settings-mask").removeClass("opened")});$("input[type='text'][key]").each((t,n)=>{$(n).attr("placeholder",e[$(n).attr("key")])});$(".gui-settings-content ul li.category").on("click",e=>{e.currentTarget.classList.toggle("folded");c(e.currentTarget).forEach(e=>e.classList.toggle("folded"))});$(".gui-settings-dropdown>input").on("click",e=>{$(e.currentTarget).parent().toggleClass("opened")});onSettingsChange((t,n,i)=>{if(e[t]!==i){e[t]=i;$(`input[type='checkbox'][key='${t}']`).prop("checked",i).change();$(`input[type='text'][key='${t}']`).val(i).change()}})}function u(){const t=e=>{};$("input[type='checkbox'][key]").each((n,i)=>{$(i).on("change",()=>{const n=i.getAttribute("key");const s=i.checked;e[n]=s;t(n);saveSettings(e)})});$("input[type='text'][key]").each((i,s)=>{$(s).on("change",()=>{const i=s.getAttribute("key");const o=n.getValidator(i).validate(s.value);e[i]=o;s.value=o;t(i);saveSettings(e)})})}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 s=e[i].split(" ");if(s.indexOf(t.attr("key"))!==-1){let e=true;if(n&&s.every(e=>$(`input[key='${e}']`).prop("checked"))){e=false}const t=$(`li:has(input[key='${i}'])`);const o=e?"addClass":"removeClass";t[o]("disabled");$(`input[key='${i}'][type='text']`).parent()[o]("disabled")}}};$(`input[type='checkbox'][key]`).on("change",e=>t($(e.target))).each((e,n)=>t($(n)))}function g(){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)}if(window.devicePixelRatio===1){$("input[key=harunaScale]").prop("disabled",true);e.harunaScale=false;saveSettings(e)}}t.applyStyle("guiSettingsStyle");$("body").append(a);p();g();l();d();o.setupDom();u();y();k();new i;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/settings-search.min.js"] = (()=>{return(t,e)=>{const s=e.attributes.settingsTooltip.export;class i{constructor(){this.input=document.querySelector(".gui-settings-search");const t=[...document.querySelectorAll(".gui-settings-content>ul>li")];const e=t=>e=>e.classList.contains("category")===t;this.categories=t.filter(e(true));this.items=t.filter(e(false));this.input.addEventListener("input",()=>this.keywordChange())}keywordChange(){const t=this.input.value.trim();if(!t){this.categories.concat(this.items).forEach(t=>t.classList.add("folded"));return}this.items.forEach(e=>{const i=$(e).find("input").attr("key");const n=e.innerText+s[i].replace(/|<\/span>/g,"");if(n.includes(t)){e.classList.remove("folded")}else{e.classList.add("folded")}});this.foldCategories()}foldCategories(){for(const e of this.categories){function t(){let t=e.nextElementSibling;while(t!==null&&!t.classList.contains("category")){if(!t.classList.contains("folded")){return"remove"}t=t.nextElementSibling}return"add"}e.classList[t()]("folded")}}}return{export:i}}})(); +offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/gui-settings.min.js"] = (()=>{return(e,t)=>{const n=t.attributes.textValidate.export.Validator;const i=t.attributes.settingsSearch.export;const s=t.attributes.themeColors.export;const o=new s;const a=t.data.guiSettingsDom.text;function c(e){let t=e.nextElementSibling;const n=[];while(t!==null&&!t.classList.contains("category")){n.push(t);t=t.nextElementSibling}return n}function r(e,t){$(`input[type='checkbox'][key='${e}']`).prop("checked",t);$(`input[type='text'][key='${e}']`).val(t)}function u(){for(const[t,n]of Object.entries(e)){r(t,n)}}function l(){$(".gui-settings-mask").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-box,.gui-settings-mask").removeClass("opened")});$("input[type='text'][key]").each((t,n)=>{$(n).attr("placeholder",e[$(n).attr("key")])});$(".gui-settings-content ul li.category").on("click",e=>{const t=document.querySelector(".gui-settings-search");if(t.value!==""){t.value="";raiseEvent(t,"input")}e.currentTarget.classList.toggle("folded");c(e.currentTarget).forEach(e=>e.classList.toggle("folded"))});$(".gui-settings-dropdown>input").on("click",e=>{$(e.currentTarget).parent().toggleClass("opened")});onSettingsChange((t,n,i)=>{if(e[t]!==i){e[t]=i;$(`input[type='checkbox'][key='${t}']`).prop("checked",i).change();$(`input[type='text'][key='${t}']`).val(i).change()}})}function p(){const t=e=>{};$("input[type='checkbox'][key]").each((n,i)=>{$(i).on("change",()=>{const n=i.getAttribute("key");const s=i.checked;e[n]=s;t(n);saveSettings(e)})});$("input[type='text'][key]").each((i,s)=>{$(s).on("change",()=>{const i=s.getAttribute("key");const o=n.getValidator(i).validate(s.value);e[i]=o;s.value=o;t(i);saveSettings(e)})})}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 s=e[i].split(" ");if(s.indexOf(t.attr("key"))!==-1){let e=true;if(n&&s.every(e=>$(`input[key='${e}']`).prop("checked"))){e=false}const t=$(`li:has(input[key='${i}'])`);const o=e?"addClass":"removeClass";t[o]("disabled");$(`input[key='${i}'][type='text']`).parent()[o]("disabled")}}};$(`input[type='checkbox'][key]`).on("change",e=>t($(e.target))).each((e,n)=>t($(n)))}function g(){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)}if(window.devicePixelRatio===1){$("input[key=harunaScale]").prop("disabled",true);e.harunaScale=false;saveSettings(e)}}t.applyStyle("guiSettingsStyle");$("body").append(a);l();g();u();d();o.setupDom();p();y();k();new i;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(e,l)=>{if(e.useDarkStyle){l.applyStyle("scrollbarStyle");SpinQuery.any(()=>$(".custom-scrollbar"),e=>e.removeClass("custom-scrollbar"));if($("#banner_link").length===0||$("#banner_link").length>0&&e.overrideNavBar&&!e.showBanner){l.applyImportantStyle("darkStyleNavBar")}l.applyStyle("darkStyle");l.applyImportantStyle("darkStyleImportant")}else{l.removeStyle("scrollbarStyle");l.removeStyle("darkStyleNavBar");l.removeStyle("darkStyle");l.removeStyle("darkStyleImportant")}}})(); offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/tweets.min.css"] = `.showSearch #nav_searchform{width:250px!important;}.nav-search-submit{display:block!important;color:var(--foreground-color-d)!important;transform:translateX(-125px);-webkit-tap-highlight-color:transparent;}.nav-search-submit:hover{color:var(--foreground-color)!important;}#nav_searchform{transition:all .3s ease-out;box-shadow:none;width:0!important;padding:0!important;}.preserve-rank>a{opacity:0!important;pointer-events:none;}.showSearch .preserve-rank>a{opacity:0.382!important;pointer-events:initial;}.showSearch #nav_searchform{box-shadow:0px 2px 10px 1px #0002;width:250px!important;}.showSearch .nav-search-submit,.showSearch .nav-search-submit:hover{color:#888!important;transform:none;}@media only screen and (max-width: 1291px){.showSearch #nav_searchform{width:140px!important;}}`; offlineData["https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/min/new-styles.min.js"] = (()=>{return(e,t)=>{if(document.URL===`https://h.bilibili.com/`){return}SpinQuery.any(()=>$(".custom-scrollbar"),e=>e.removeClass("custom-scrollbar"));SpinQuery.any(()=>$("#banner_link"),()=>t.removeStyle("tweetsStyle"));const l={selectors:["div.nav-con.fl","#link-navbar-vm",".link-navbar",".nav-header-wrapper",".z_top .z_header"],get allSelectors(){return this.selectors.reduce((e,t)=>e+","+t)},get navbar(){let e=null;for(const t of this.selectors){e=e||document.querySelector(t)}return e},supports(e){if(e instanceof Element){const t=parseInt(window.getComputedStyle(e).height);const l=[60,50,0,56];return l.indexOf(t)!==-1}return false}};SpinQuery.any(()=>$(l.allSelectors),()=>{const e=l.navbar;if(l.supports(e)){t.applyStyle("style","bilibili-style-optimization")}else{t.applyStyle("oldStyle","bilibili-style-optimization")}})}})(); diff --git a/min/gui-settings.min.js b/min/gui-settings.min.js index aa876b942..ac04747df 100644 --- a/min/gui-settings.min.js +++ b/min/gui-settings.min.js @@ -1 +1 @@ -(()=>{return(e,t)=>{const n=t.attributes.textValidate.export.Validator;const i=t.attributes.settingsSearch.export;const s=t.attributes.themeColors.export;const o=new s;const a=t.data.guiSettingsDom.text;function c(e){let t=e.nextElementSibling;const n=[];while(t!==null&&!t.classList.contains("category")){n.push(t);t=t.nextElementSibling}return n}function r(e,t){$(`input[type='checkbox'][key='${e}']`).prop("checked",t);$(`input[type='text'][key='${e}']`).val(t)}function l(){for(const[t,n]of Object.entries(e)){r(t,n)}}function p(){$(".gui-settings-mask").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-box,.gui-settings-mask").removeClass("opened")});$("input[type='text'][key]").each((t,n)=>{$(n).attr("placeholder",e[$(n).attr("key")])});$(".gui-settings-content ul li.category").on("click",e=>{e.currentTarget.classList.toggle("folded");c(e.currentTarget).forEach(e=>e.classList.toggle("folded"))});$(".gui-settings-dropdown>input").on("click",e=>{$(e.currentTarget).parent().toggleClass("opened")});onSettingsChange((t,n,i)=>{if(e[t]!==i){e[t]=i;$(`input[type='checkbox'][key='${t}']`).prop("checked",i).change();$(`input[type='text'][key='${t}']`).val(i).change()}})}function u(){const t=e=>{};$("input[type='checkbox'][key]").each((n,i)=>{$(i).on("change",()=>{const n=i.getAttribute("key");const s=i.checked;e[n]=s;t(n);saveSettings(e)})});$("input[type='text'][key]").each((i,s)=>{$(s).on("change",()=>{const i=s.getAttribute("key");const o=n.getValidator(i).validate(s.value);e[i]=o;s.value=o;t(i);saveSettings(e)})})}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 s=e[i].split(" ");if(s.indexOf(t.attr("key"))!==-1){let e=true;if(n&&s.every(e=>$(`input[key='${e}']`).prop("checked"))){e=false}const t=$(`li:has(input[key='${i}'])`);const o=e?"addClass":"removeClass";t[o]("disabled");$(`input[key='${i}'][type='text']`).parent()[o]("disabled")}}};$(`input[type='checkbox'][key]`).on("change",e=>t($(e.target))).each((e,n)=>t($(n)))}function g(){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)}if(window.devicePixelRatio===1){$("input[key=harunaScale]").prop("disabled",true);e.harunaScale=false;saveSettings(e)}}t.applyStyle("guiSettingsStyle");$("body").append(a);p();g();l();d();o.setupDom();u();y();k();new i;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 +(()=>{return(e,t)=>{const n=t.attributes.textValidate.export.Validator;const i=t.attributes.settingsSearch.export;const s=t.attributes.themeColors.export;const o=new s;const a=t.data.guiSettingsDom.text;function c(e){let t=e.nextElementSibling;const n=[];while(t!==null&&!t.classList.contains("category")){n.push(t);t=t.nextElementSibling}return n}function r(e,t){$(`input[type='checkbox'][key='${e}']`).prop("checked",t);$(`input[type='text'][key='${e}']`).val(t)}function u(){for(const[t,n]of Object.entries(e)){r(t,n)}}function l(){$(".gui-settings-mask").on("click",()=>{$(".gui-settings-widgets-box,.gui-settings-box,.gui-settings-mask").removeClass("opened")});$("input[type='text'][key]").each((t,n)=>{$(n).attr("placeholder",e[$(n).attr("key")])});$(".gui-settings-content ul li.category").on("click",e=>{const t=document.querySelector(".gui-settings-search");if(t.value!==""){t.value="";raiseEvent(t,"input")}e.currentTarget.classList.toggle("folded");c(e.currentTarget).forEach(e=>e.classList.toggle("folded"))});$(".gui-settings-dropdown>input").on("click",e=>{$(e.currentTarget).parent().toggleClass("opened")});onSettingsChange((t,n,i)=>{if(e[t]!==i){e[t]=i;$(`input[type='checkbox'][key='${t}']`).prop("checked",i).change();$(`input[type='text'][key='${t}']`).val(i).change()}})}function p(){const t=e=>{};$("input[type='checkbox'][key]").each((n,i)=>{$(i).on("change",()=>{const n=i.getAttribute("key");const s=i.checked;e[n]=s;t(n);saveSettings(e)})});$("input[type='text'][key]").each((i,s)=>{$(s).on("change",()=>{const i=s.getAttribute("key");const o=n.getValidator(i).validate(s.value);e[i]=o;s.value=o;t(i);saveSettings(e)})})}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 s=e[i].split(" ");if(s.indexOf(t.attr("key"))!==-1){let e=true;if(n&&s.every(e=>$(`input[key='${e}']`).prop("checked"))){e=false}const t=$(`li:has(input[key='${i}'])`);const o=e?"addClass":"removeClass";t[o]("disabled");$(`input[key='${i}'][type='text']`).parent()[o]("disabled")}}};$(`input[type='checkbox'][key]`).on("change",e=>t($(e.target))).each((e,n)=>t($(n)))}function g(){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)}if(window.devicePixelRatio===1){$("input[key=harunaScale]").prop("disabled",true);e.harunaScale=false;saveSettings(e)}}t.applyStyle("guiSettingsStyle");$("body").append(a);l();g();u();d();o.setupDom();p();y();k();new i;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/min/settings-search.min.js b/min/settings-search.min.js index 7b046d2c8..59363ed2d 100644 --- a/min/settings-search.min.js +++ b/min/settings-search.min.js @@ -1 +1 @@ -(()=>{return(t,e)=>{const s=e.attributes.settingsTooltip.export;class i{constructor(){this.input=document.querySelector(".gui-settings-search");const t=[...document.querySelectorAll(".gui-settings-content>ul>li")];const e=t=>e=>e.classList.contains("category")===t;this.categories=t.filter(e(true));this.items=t.filter(e(false));this.input.addEventListener("input",()=>this.keywordChange())}keywordChange(){const t=this.input.value.trim();this.items.forEach(e=>{const i=$(e).find("input").attr("key");const n=e.innerText+s[i].replace(/|<\/span>/g,"");if(!t||n.includes(t)){e.classList.remove("folded")}else{e.classList.add("folded")}});this.foldCategories()}foldCategories(){for(const e of this.categories){function t(){let t=e.nextElementSibling;while(t!==null&&!t.classList.contains("category")){if(!t.classList.contains("folded")){return"remove"}t=t.nextElementSibling}return"add"}e.classList[t()]("folded")}}}return{export:i}}})(); \ No newline at end of file +(()=>{return(t,e)=>{const s=e.attributes.settingsTooltip.export;class i{constructor(){this.input=document.querySelector(".gui-settings-search");const t=[...document.querySelectorAll(".gui-settings-content>ul>li")];const e=t=>e=>e.classList.contains("category")===t;this.categories=t.filter(e(true));this.items=t.filter(e(false));this.input.addEventListener("input",()=>this.keywordChange())}keywordChange(){const t=this.input.value.trim();if(!t){this.categories.concat(this.items).forEach(t=>t.classList.add("folded"));return}this.items.forEach(e=>{const i=$(e).find("input").attr("key");const n=e.innerText+s[i].replace(/|<\/span>/g,"");if(n.includes(t)){e.classList.remove("folded")}else{e.classList.add("folded")}});this.foldCategories()}foldCategories(){for(const e of this.categories){function t(){let t=e.nextElementSibling;while(t!==null&&!t.classList.contains("category")){if(!t.classList.contains("folded")){return"remove"}t=t.nextElementSibling}return"add"}e.classList[t()]("folded")}}}return{export:i}}})(); \ No newline at end of file diff --git a/utils/gui-settings/gui-settings.js b/utils/gui-settings/gui-settings.js index 357b7123d..5d239bdc4 100644 --- a/utils/gui-settings/gui-settings.js +++ b/utils/gui-settings/gui-settings.js @@ -45,6 +45,12 @@ }); $(".gui-settings-content ul li.category").on("click", e => { + const searchBox = document.querySelector(".gui-settings-search"); + if (searchBox.value !== "") + { + searchBox.value = ""; + raiseEvent(searchBox, "input"); + } e.currentTarget.classList.toggle("folded"); getCategoriyItems(e.currentTarget).forEach(it => it.classList.toggle("folded")); }); diff --git a/utils/gui-settings/settings-search.js b/utils/gui-settings/settings-search.js index cb1623f34..0f53f4fc6 100644 --- a/utils/gui-settings/settings-search.js +++ b/utils/gui-settings/settings-search.js @@ -17,11 +17,16 @@ keywordChange() { const value = this.input.value.trim(); + if (!value) + { + this.categories.concat(this.items).forEach(it => it.classList.add("folded")); + return; + } this.items.forEach(item => { const key = $(item).find("input").attr("key"); const texts = item.innerText + toolTips[key].replace(/|<\/span>/g, ""); - if (!value || texts.includes(value)) + if (texts.includes(value)) { item.classList.remove("folded"); }