fix sorting

This commit is contained in:
Zack Rauen 2020-04-02 17:11:01 -04:00
parent dd6ae7248e
commit 488ffaf7d5
4 changed files with 14 additions and 6 deletions

File diff suppressed because one or more lines are too long

2
js/main.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -9,17 +9,25 @@ export default new class V2 {
delete req.m.__extra_id__; delete req.m.__extra_id__;
delete req.c.__extra_id__; delete req.c.__extra_id__;
const shouldProtect = theModule => {
if (theModule.remove && theModule.set && theModule.clear && theModule.get && !theModule.sort) return true;
if (theModule.getToken || theModule.getEmail || theModule.showToken) return true;
return false;
};
const protect = theModule => { const protect = theModule => {
if (theModule.remove && theModule.set && theModule.clear && theModule.get && !theModule.sort) return null; if (theModule.remove && theModule.set && theModule.clear && theModule.get && !theModule.sort) return null;
if (!theModule.getToken && !theModule.getEmail && !theModule.showToken) return theModule; if (!theModule.getToken && !theModule.getEmail && !theModule.showToken) return theModule;
return new Proxy(theModule, { const proxy = new Proxy(theModule, {
get: function(obj, func) { get: function(obj, func) {
if (func == "getToken") return () => "mfa.XCnbKzo0CLIqdJzBnL0D8PfDruqkJNHjwHXtr39UU3F8hHx43jojISyi5jdjO52e9_e9MjmafZFFpc-seOMa"; if (func == "getToken") return () => "mfa.XCnbKzo0CLIqdJzBnL0D8PfDruqkJNHjwHXtr39UU3F8hHx43jojISyi5jdjO52e9_e9MjmafZFFpc-seOMa";
if (func == "getEmail") return () => "puppet11112@gmail.com"; if (func == "getEmail") return () => "puppet11112@gmail.com";
if (func == "showToken") return () => true; if (func == "showToken") return () => true;
if (func == "__proto__") return proxy;
return obj[func]; return obj[func];
} }
}); });
return proxy;
}; };
const find = (filter) => { const find = (filter) => {

View File

@ -107,8 +107,8 @@ export default class CardList extends BDV2.reactComponent {
getAddons() { getAddons() {
const sortedAddons = this.props.list.sort((a, b) => { const sortedAddons = this.props.list.sort((a, b) => {
const cap = this.state.sort.charAt(0).toUpperCase() + this.state.sort.slice(1); const cap = this.state.sort.charAt(0).toUpperCase() + this.state.sort.slice(1);
const first = a.plugin ? this.getString(a.plugin[`get${cap}`]()) : a[this.state.sort]; const first = a.plugin && a.plugin[`get${cap}`] ? this.getString(a.plugin[`get${cap}`]()) : a[this.state.sort];
const second = b.plugin ? this.getString(b.plugin[`get${cap}`]()) : b[this.state.sort]; const second = b.plugin && b.plugin[`get${cap}`] ? this.getString(b.plugin[`get${cap}`]()) : b[this.state.sort];
if (typeof(first) == "string") return first.toLocaleLowerCase().localeCompare(second.toLocaleLowerCase()); if (typeof(first) == "string") return first.toLocaleLowerCase().localeCompare(second.toLocaleLowerCase());
if (first > second) return 1; if (first > second) return 1;
if (second > first) return -1; if (second > first) return -1;