This commit is contained in:
Mirco Wittrien 2019-01-09 10:26:58 +01:00
parent 45d97c30af
commit 7fd7c78c10
2 changed files with 34 additions and 31 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,14 @@
//META{"name":"RepoControls"}*// //META{"name":"RepoControls"}*//
class RepoControls { class RepoControls {
getName () {return "RepoControls";}
getVersion () {return "1.2.4";}
getAuthor () {return "DevilBro";}
getDescription () {return "Lets you sort and filter your list of downloaded Themes and Plugins.";}
initConstructor () { initConstructor () {
this.patchModules = { this.patchModules = {
"V2C_List":"componentDidMount", "V2C_List":"componentDidMount",
@ -107,14 +115,6 @@ class RepoControls {
} }
}; };
} }
getName () {return "RepoControls";}
getDescription () {return "Lets you sort and filter your list of downloaded Themes and Plugins.";}
getVersion () {return "1.2.4";}
getAuthor () {return "DevilBro";}
getSettingsPanel () { getSettingsPanel () {
if (!this.started || typeof BDFDB !== "object") return; if (!this.started || typeof BDFDB !== "object") return;
@ -281,26 +281,28 @@ class RepoControls {
container.entries = {}; container.entries = {};
for (let li of container.children) { for (let li of container.children) {
let name = li.querySelector(BDFDB.dotCN._reponame).textContent; if (li.querySelector(BDFDB.dotCN._reponame)) {
let version = li.querySelector(BDFDB.dotCN._repoversion).textContent; let name = li.querySelector(BDFDB.dotCN._reponame).textContent;
let author = li.querySelector(BDFDB.dotCN._repoauthor).textContent; let version = li.querySelector(BDFDB.dotCN._repoversion).textContent;
let description = li.querySelector(BDFDB.dotCN._repodescription).textContent; let author = li.querySelector(BDFDB.dotCN._repoauthor).textContent;
let enabled = li.querySelector(BDFDB.dotCN._repocheckbox).checked; let description = li.querySelector(BDFDB.dotCN._repodescription).textContent;
let path = global[`bd${type}s`] && global[`bd${type}s`][name] ? this.path.join(this.dirs[type], global[`bd${type}s`][name].filename) : null; let enabled = li.querySelector(BDFDB.dotCN._repocheckbox).checked;
let stats = path ? this.fs.statSync(path) : null; let path = global[`bd${type}s`] && global[`bd${type}s`][name] ? this.path.join(this.dirs[type], global[`bd${type}s`][name].filename) : null;
container.entries[name] = { let stats = path ? this.fs.statSync(path) : null;
search: (name + " " + version + " " + author + " " + description).toUpperCase(), container.entries[name] = {
origName: name, search: (name + " " + version + " " + author + " " + description).toUpperCase(),
name: (name).toUpperCase(), origName: name,
version: (version).toUpperCase(), name: (name).toUpperCase(),
author: (author).toUpperCase(), version: (version).toUpperCase(),
description: (description).toUpperCase(), author: (author).toUpperCase(),
type: type, description: (description).toUpperCase(),
path: path, type: type,
adddate: stats ? stats.atime.getTime() : null, path: path,
moddate: stats ? stats.mtime.getTime() : null, adddate: stats ? stats.atime.getTime() : null,
enabled: enabled ? 0 : 1 moddate: stats ? stats.mtime.getTime() : null,
}; enabled: enabled ? 0 : 1
};
}
} }
this.sortEntries(container, repoControls); this.sortEntries(container, repoControls);
} }
@ -340,9 +342,10 @@ class RepoControls {
for (let ele of wrapper.querySelectorAll(BDFDB.dotCNC._reponame + BDFDB.dotCNC._repoversion + BDFDB.dotCNC._repoauthor + BDFDB.dotCN._repodescription)) { for (let ele of wrapper.querySelectorAll(BDFDB.dotCNC._reponame + BDFDB.dotCNC._repoversion + BDFDB.dotCNC._repoauthor + BDFDB.dotCN._repodescription)) {
if (ele.classList.contains(BDFDB.disCN._repodescription)) { if (ele.classList.contains(BDFDB.disCN._repodescription)) {
ele.style.display = "block"; ele.style.display = "block";
ele.innerHTML = BDFDB.highlightText(ele.innerText, searchstring); if (searchstring && searchstring.length > 2) ele.innerHTML = BDFDB.highlightText(ele.innerText, searchstring);
else ele.innerHTML = ele.innerText;
} }
else if (searchstring || ele.querySelector(".highlight")) ele.innerHTML = BDFDB.highlightText(ele.innerText, searchstring); else if (searchstring && searchstring.length > 2 || ele.querySelector(BDFDB.dotCN.highlight)) ele.innerHTML = BDFDB.highlightText(ele.innerText, searchstring);
} }
} }