This commit is contained in:
Mirco Wittrien 2020-04-11 19:02:19 +02:00
parent 7c2ef84292
commit 0033dbf5c4
3 changed files with 72 additions and 24 deletions

View File

@ -5948,30 +5948,30 @@
BDFDB.DiscordClasses = Object.assign({}, DiscordClasses); BDFDB.DiscordClasses = Object.assign({}, DiscordClasses);
InternalBDFDB.getDiscordClass = (item, selector) => { InternalBDFDB.getDiscordClass = (item, selector) => {
var classname = DiscordClassModules.BDFDB.BDFDBundefined; let className = DiscordClassModules.BDFDB.BDFDBundefined;
if (DiscordClasses[item] === undefined) { if (DiscordClasses[item] === undefined) {
BDFDB.LogUtils.warn(item + " not found in DiscordClasses"); BDFDB.LogUtils.warn(item + " not found in DiscordClasses");
return classname; return className;
} }
else if (!BDFDB.ArrayUtils.is(DiscordClasses[item]) || DiscordClasses[item].length != 2) { else if (!BDFDB.ArrayUtils.is(DiscordClasses[item]) || DiscordClasses[item].length != 2) {
BDFDB.LogUtils.warn(item + " is not an Array of Length 2 in DiscordClasses"); BDFDB.LogUtils.warn(item + " is not an Array of Length 2 in DiscordClasses");
return classname; return className;
} }
else if (DiscordClassModules[DiscordClasses[item][0]] === undefined) { else if (DiscordClassModules[DiscordClasses[item][0]] === undefined) {
BDFDB.LogUtils.warn(DiscordClasses[item][0] + " not found in DiscordClassModules"); BDFDB.LogUtils.warn(DiscordClasses[item][0] + " not found in DiscordClassModules");
return classname; return className;
} }
else if (DiscordClassModules[DiscordClasses[item][0]][DiscordClasses[item][1]] === undefined) { else if (DiscordClassModules[DiscordClasses[item][0]][DiscordClasses[item][1]] === undefined) {
BDFDB.LogUtils.warn(DiscordClasses[item][1] + " not found in " + DiscordClasses[item][0] + " in DiscordClassModules"); BDFDB.LogUtils.warn(DiscordClasses[item][1] + " not found in " + DiscordClasses[item][0] + " in DiscordClassModules");
return classname; return className;
} }
else { else {
classname = DiscordClassModules[DiscordClasses[item][0]][DiscordClasses[item][1]]; className = DiscordClassModules[DiscordClasses[item][0]][DiscordClasses[item][1]];
if (selector) { if (selector) {
classname = classname.split(" ").filter(n => n.indexOf("da-") != 0).join(selector ? "." : " "); className = className.split(" ").filter(n => n.indexOf("da-") != 0).join(selector ? "." : " ");
classname = classname || DiscordClassModules.BDFDB.BDFDBundefined; className = className || DiscordClassModules.BDFDB.BDFDBundefined;
} }
return classname; return className;
} }
}; };
BDFDB.disCN = new Proxy(DiscordClasses, { BDFDB.disCN = new Proxy(DiscordClasses, {
@ -5991,20 +5991,20 @@
}); });
BDFDB.dotCN = new Proxy(DiscordClasses, { BDFDB.dotCN = new Proxy(DiscordClasses, {
get: function (list, item) { get: function (list, item) {
let classname = InternalBDFDB.getDiscordClass(item, true); let className = InternalBDFDB.getDiscordClass(item, true);
return (classname.indexOf("#") == 0 ? "" : ".") + classname; return (className.indexOf("#") == 0 ? "" : ".") + className;
} }
}); });
BDFDB.dotCNS = new Proxy(DiscordClasses, { BDFDB.dotCNS = new Proxy(DiscordClasses, {
get: function (list, item) { get: function (list, item) {
let classname = InternalBDFDB.getDiscordClass(item, true); let className = InternalBDFDB.getDiscordClass(item, true);
return (classname.indexOf("#") == 0 ? "" : ".") + classname + " "; return (className.indexOf("#") == 0 ? "" : ".") + className + " ";
} }
}); });
BDFDB.dotCNC = new Proxy(DiscordClasses, { BDFDB.dotCNC = new Proxy(DiscordClasses, {
get: function (list, item) { get: function (list, item) {
let classname = InternalBDFDB.getDiscordClass(item, true); let className = InternalBDFDB.getDiscordClass(item, true);
return (classname.indexOf("#") == 0 ? "" : ".") + classname + ","; return (className.indexOf("#") == 0 ? "" : ".") + className + ",";
} }
}); });
BDFDB.notCN = new Proxy(DiscordClasses, { BDFDB.notCN = new Proxy(DiscordClasses, {

File diff suppressed because one or more lines are too long

View File

@ -122,20 +122,61 @@
} }
} }
}; };
let disCN = new Proxy(DiscordClasses, {
let disCN = new Proxy({}, {
get: function (list, item) { get: function (list, item) {
return getDiscordClass(item).replace('#', ''); return getDiscordClass(item, false).replace("#", "");
} }
}); });
let getDiscordClass = function (item) { let disCNS = new Proxy(DiscordClasses, {
get: function (list, item) {
return getDiscordClass(item, false).replace("#", "") + " ";
}
});
let disCNC = new Proxy(DiscordClasses, {
get: function (list, item) {
return getDiscordClass(item, false).replace("#", "") + ",";
}
});
let dotCN = new Proxy(DiscordClasses, {
get: function (list, item) {
let className = getDiscordClass(item, true);
return (className.indexOf("#") == 0 ? "" : ".") + className;
}
});
let dotCNS = new Proxy(DiscordClasses, {
get: function (list, item) {
let className = getDiscordClass(item, true);
return (className.indexOf("#") == 0 ? "" : ".") + className + " ";
}
});
let dotCNC = new Proxy(DiscordClasses, {
get: function (list, item) {
let className = getDiscordClass(item, true);
return (className.indexOf("#") == 0 ? "" : ".") + className + ",";
}
});
let notCN = new Proxy(DiscordClasses, {
get: function (list, item) {
return `:not(.${getDiscordClass(item, true).split(".")[0]})`;
}
});
let notCNS = new Proxy(DiscordClasses, {
get: function (list, item) {
return `:not(.${getDiscordClass(item, true).split(".")[0]}) `;
}
});
let notCNC = new Proxy(DiscordClasses, {
get: function (list, item) {
return `:not(.${getDiscordClass(item, true).split(".")[0]}),`;
}
});
let getDiscordClass = function (item, selector) {
let className = "Preview_undefined"; let className = "Preview_undefined";
if (DiscordClasses === undefined || DiscordClassModules === undefined) return className; if (DiscordClasses[item] === undefined) {
else if (DiscordClasses[item] === undefined) {
if (userId == "278543574059057154") console.warn(`%c[Preview]%c`, 'color:#3a71c1; font-weight:700;', '', item + ' not found in DiscordClasses'); if (userId == "278543574059057154") console.warn(`%c[Preview]%c`, 'color:#3a71c1; font-weight:700;', '', item + ' not found in DiscordClasses');
return className; return className;
} }
else if (!Array.isArray(DiscordClasses[item]) || DiscordClasses[item].length != 2) { else if (!BDFDB.ArrayUtils.is(DiscordClasses[item]) || DiscordClasses[item].length != 2) {
if (userId == "278543574059057154") console.warn(`%c[Preview]%c`, 'color:#3a71c1; font-weight:700;', '', item + ' is not an Array of Length 2 in DiscordClasses'); if (userId == "278543574059057154") console.warn(`%c[Preview]%c`, 'color:#3a71c1; font-weight:700;', '', item + ' is not an Array of Length 2 in DiscordClasses');
return className; return className;
} }
@ -147,7 +188,14 @@
if (userId == "278543574059057154") console.warn(`%c[Preview]%c`, 'color:#3a71c1; font-weight:700;', '', DiscordClasses[item][1] + ' not found in ' + DiscordClasses[item][0] + ' in DiscordClassModules'); if (userId == "278543574059057154") console.warn(`%c[Preview]%c`, 'color:#3a71c1; font-weight:700;', '', DiscordClasses[item][1] + ' not found in ' + DiscordClasses[item][0] + ' in DiscordClassModules');
return className; return className;
} }
else return className = DiscordClassModules[DiscordClasses[item][0]][DiscordClasses[item][1]]; else {
className = DiscordClassModules[DiscordClasses[item][0]][DiscordClasses[item][1]];
if (selector) {
className = className.split(" ").filter(n => n.indexOf("da-") != 0).join(selector ? "." : " ");
className = className || "Preview_undefined";
}
return className;
}
}; };
if (typeof window.require != "function") window.require = function () { if (typeof window.require != "function") window.require = function () {