mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Refactor code
This commit is contained in:
parent
2df673af9b
commit
b892275356
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
min/settings-search.min.js
vendored
2
min/settings-search.min.js
vendored
@ -1 +1 @@
|
||||
(()=>{return(t,e)=>{const{toolTips:s}=e.import("settings-tooltip");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=Resource.displayNames[i]+s[i].replace(/<span>|<\/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:{SettingsSearch:i}}}})();
|
||||
(()=>{return(t,e)=>{const{toolTips:s}=e.import("settings-tooltip");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.querySelector("input").getAttribute("key");const n=Resource.displayNames[i]+s[i].replace(/<span>|<\/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:{SettingsSearch:i}}}})();
|
||||
2
min/settings-tooltip.min.js
vendored
2
min/settings-tooltip.min.js
vendored
File diff suppressed because one or more lines are too long
@ -20,7 +20,7 @@ export class SettingsSearch
|
||||
}
|
||||
this.items.forEach(item =>
|
||||
{
|
||||
const key = $(item).find("input").attr("key");
|
||||
const key = item.querySelector("input").getAttribute("key");
|
||||
const texts = Resource.displayNames[key] + toolTips[key].replace(/<span>|<\/span>/g, "");
|
||||
if (texts.includes(value))
|
||||
{
|
||||
|
||||
@ -71,7 +71,7 @@ export const toolTips = {
|
||||
};
|
||||
function extractKey(listItem)
|
||||
{
|
||||
const input = $(listItem).find("input");
|
||||
const input = listItem.querySelector("input");
|
||||
if (input.length > 0)
|
||||
{
|
||||
return input.attr("key");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user