Fixes colored text & 24 hour timestamps
This commit is contained in:
parent
99d17bf4fe
commit
aca2010621
|
@ -3,7 +3,7 @@ import {DiscordModules} from "modules";
|
|||
|
||||
export default new class TwentyFourHour extends Builtin {
|
||||
get name() {return "24Hour";}
|
||||
get category() {return "general";}
|
||||
get category() {return "appearance";}
|
||||
get id() {return "twentyFourHour";}
|
||||
|
||||
enabled() {
|
|
@ -1,7 +1,7 @@
|
|||
import Builtin from "../../structs/builtin";
|
||||
import {WebpackModules} from "modules";
|
||||
|
||||
const MessageContent = WebpackModules.getModule(m => m.default && m.default.displayName && m.default.displayName == "Message");
|
||||
|
||||
|
||||
export default new class ColoredText extends Builtin {
|
||||
get name() {return "ColoredText";}
|
||||
|
@ -13,16 +13,28 @@ export default new class ColoredText extends Builtin {
|
|||
}
|
||||
|
||||
disabled() {
|
||||
this.removeColoredText();
|
||||
this.unpatchAll();
|
||||
}
|
||||
|
||||
injectColoredText() {
|
||||
this.after(MessageContent.prototype, "render", (thisObject, args, retVal) => {
|
||||
this.after(retVal.props, "children", {after: ({returnValue}) => {
|
||||
const markup = returnValue.props.children[1];
|
||||
const roleColor = thisObject.props.message.colorString;
|
||||
if (markup && roleColor) markup.props.style = {color: roleColor};
|
||||
}});
|
||||
const MessageContent = WebpackModules.getModule(m => m.default && m.default.displayName && m.default.displayName == "Message");
|
||||
this.before(MessageContent, "default", (thisObject, [props]) => {
|
||||
if (!props || !props.childrenMessageContent) return;
|
||||
const messageContent = props.childrenMessageContent;
|
||||
if (!messageContent.type || !messageContent.type.type || messageContent.type.type.displayName != "MessageContent") return;
|
||||
|
||||
const originalType = messageContent.type.type;
|
||||
if (originalType.__originalMethod) return; // Don't patch again
|
||||
messageContent.type.type = function(childProps) {
|
||||
const returnValue = originalType(childProps);
|
||||
const roleColor = childProps.message.colorString || "";
|
||||
returnValue.props.style = {color: roleColor};
|
||||
return returnValue;
|
||||
};
|
||||
|
||||
messageContent.type.type.__originalMethod = originalType;
|
||||
Object.assign(messageContent.type.type, originalType);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
export {default as CustomCSS} from "./customcss";
|
||||
export {default as WindowPrefs} from "./windowprefs";
|
||||
|
||||
export {default as TwentyFourHour} from "./general/24hour";
|
||||
export {default as TwentyFourHour} from "./appearance/24hour";
|
||||
export {default as ClassNormalizer} from "./general/classnormalizer";
|
||||
export {default as PublicServers} from "./general/publicservers";
|
||||
export {default as VoiceDisconnect} from "./general/voicedisconnect";
|
||||
|
|
|
@ -40,14 +40,14 @@ export default new class Core {
|
|||
{
|
||||
name: "jquery",
|
||||
type: "script",
|
||||
url: "//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js",
|
||||
backup: "//cdn.jsdelivr.net/gh/jquery/jquery@2.0.0/jquery.min.js"
|
||||
url: "https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js",
|
||||
backup: "https://cdn.jsdelivr.net/gh/jquery/jquery@2.0.0/jquery.min.js"
|
||||
},
|
||||
{
|
||||
name: "bd-stylesheet",
|
||||
type: "style",
|
||||
url: "https://gitcdn.xyz/repo/rauenzi/BetterDiscordApp/gh-pages/dist/style.css",
|
||||
backup: "//rauenzi.github.io/BetterDiscordApp/dist/style.css",
|
||||
url: "https://rauenzi.github.io/BetterDiscordApp/dist/style.css",
|
||||
backup: "https://gitcdn.xyz/repo/rauenzi/BetterDiscordApp/gh-pages/dist/style.css",
|
||||
localPath: "style.css"
|
||||
}
|
||||
];
|
||||
|
|
|
@ -112,6 +112,8 @@ export default class Patcher {
|
|||
children: []
|
||||
};
|
||||
patch.proxyFunction = module[functionName] = this.makeOverride(patch);
|
||||
module[functionName].__originalFunction = patch.originalFunction;
|
||||
module[functionName].toString = () => patch.originalFunction.toString();
|
||||
this.patches.push(patch);
|
||||
return patch;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue