some fixes, cleanup needed
This commit is contained in:
parent
dcfb0b2cf7
commit
1f028f22c7
14
js/main.js
14
js/main.js
File diff suppressed because one or more lines are too long
|
@ -2817,7 +2817,8 @@
|
|||
"ansi-regex": {
|
||||
"version": "2.1.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"aproba": {
|
||||
"version": "1.2.0",
|
||||
|
@ -2838,12 +2839,14 @@
|
|||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
|
@ -2858,17 +2861,20 @@
|
|||
"code-point-at": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"console-control-strings": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
|
@ -2985,7 +2991,8 @@
|
|||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"ini": {
|
||||
"version": "1.3.5",
|
||||
|
@ -2997,6 +3004,7 @@
|
|||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"number-is-nan": "^1.0.0"
|
||||
}
|
||||
|
@ -3011,6 +3019,7 @@
|
|||
"version": "3.0.4",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
|
@ -3018,12 +3027,14 @@
|
|||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"minipass": {
|
||||
"version": "2.3.5",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"safe-buffer": "^5.1.2",
|
||||
"yallist": "^3.0.0"
|
||||
|
@ -3042,6 +3053,7 @@
|
|||
"version": "0.5.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
}
|
||||
|
@ -3122,7 +3134,8 @@
|
|||
"number-is-nan": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"object-assign": {
|
||||
"version": "4.1.1",
|
||||
|
@ -3134,6 +3147,7 @@
|
|||
"version": "1.4.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
|
@ -3219,7 +3233,8 @@
|
|||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
|
@ -3255,6 +3270,7 @@
|
|||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"code-point-at": "^1.0.0",
|
||||
"is-fullwidth-code-point": "^1.0.0",
|
||||
|
@ -3274,6 +3290,7 @@
|
|||
"version": "3.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ansi-regex": "^2.0.0"
|
||||
}
|
||||
|
@ -3317,12 +3334,14 @@
|
|||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"yallist": {
|
||||
"version": "3.0.3",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -44,7 +44,7 @@ export default new class CustomCSS extends Builtin {
|
|||
if (this.isDetached) return;
|
||||
if (this.nativeOpen) this.openNative();
|
||||
else if (this.startDetached) this.openDetached();
|
||||
else thisObject._reactInternalFiber.child.memoizedProps.children.props.onSetSection(this.name);
|
||||
else thisObject._reactInternalFiber.child.memoizedProps.children.props.onSetSection(Strings.Panels.customcss);
|
||||
this.setSection = thisObject._reactInternalFiber.child.memoizedProps.children.props.onSetSection;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -20,7 +20,7 @@ export default [
|
|||
name: "Categories",
|
||||
collapsible: true,
|
||||
settings: [
|
||||
{type: "switch", id: "", value: true},
|
||||
{type: "switch", id: "twitch", value: true},
|
||||
{type: "switch", id: "ffz", value: true},
|
||||
{type: "switch", id: "bttv", value: true}
|
||||
]
|
||||
|
|
|
@ -218,7 +218,7 @@ export default {
|
|||
}
|
||||
}
|
||||
},
|
||||
se: {
|
||||
sv: {
|
||||
Panels: {
|
||||
plugins: "Tillägg",
|
||||
themes: "Teman",
|
||||
|
|
|
@ -12,7 +12,7 @@ export default new class ReactComponents {
|
|||
get unknown() {return unknownComponents;}
|
||||
get listeners() {return listeners;}
|
||||
|
||||
initialize() {
|
||||
constructor() {
|
||||
this.walkReactTree(document.querySelector("#app-mount")._reactRootContainer._internalRoot.current);
|
||||
Patcher.after("ReactComponents", React, "createElement", (_, __, returnValue) => {
|
||||
this.walkRenderTree(returnValue);
|
||||
|
@ -23,8 +23,17 @@ export default new class ReactComponents {
|
|||
Patcher.instead("ReactComponents", React.Component.prototype, "UNSAFE_componentWillMount", (thisObject) => {
|
||||
this.addComponent(thisObject.constructor);
|
||||
});
|
||||
|
||||
Patcher.instead("ReactComponents", React.PureComponent.prototype, "componentWillMount", (thisObject) => {
|
||||
this.addComponent(thisObject.constructor);
|
||||
});
|
||||
Patcher.instead("ReactComponents", React.PureComponent.prototype, "UNSAFE_componentWillMount", (thisObject) => {
|
||||
this.addComponent(thisObject.constructor);
|
||||
});
|
||||
}
|
||||
|
||||
initialize() {}
|
||||
|
||||
get(name, filter) {
|
||||
return new Promise(resolve => {
|
||||
if (components[name]) return resolve(components[name]);
|
||||
|
|
|
@ -32,6 +32,7 @@ export default new class SettingsManager {
|
|||
button: button
|
||||
});
|
||||
this.setup();
|
||||
this.updateStrings();
|
||||
}
|
||||
|
||||
removeCollection(id) {
|
||||
|
@ -123,12 +124,12 @@ export default new class SettingsManager {
|
|||
}
|
||||
|
||||
onSettingChange(collection, category, id, value) {
|
||||
const before = this.collections.length + this.panels.length;
|
||||
// const before = this.collections.length + this.panels.length;
|
||||
this.state[collection][category][id] = value;
|
||||
Events.dispatch("setting-updated", collection, category, id, value);
|
||||
const after = this.collections.length + this.panels.length;
|
||||
// const after = this.collections.length + this.panels.length;
|
||||
this.saveSettings();
|
||||
if (before != after) setTimeout(this.forceUpdate.bind(this), 50);
|
||||
// if (before != after) setTimeout(this.forceUpdate.bind(this), 50);
|
||||
}
|
||||
|
||||
getSetting(collection, category, id) {
|
||||
|
@ -170,6 +171,7 @@ export default new class SettingsManager {
|
|||
for (let c = 0; c < this.collections.length; c++) {
|
||||
const collection = this.collections[c];
|
||||
const CS = Strings.Collections[collection.id];
|
||||
console.log(CS);
|
||||
if (!CS) continue;
|
||||
collection.name = CS.name || collection.name;
|
||||
const categories = this.collections[c].settings;
|
||||
|
|
|
@ -4,18 +4,23 @@ import Utilities from "./utilities";
|
|||
import FormattableString from "../structs/string";
|
||||
import Events from "./emitter";
|
||||
|
||||
const {Dispatcher, DiscordConstants} = DiscordModules;
|
||||
const {Dispatcher, DiscordConstants, UserSettingsStore} = DiscordModules;
|
||||
const Messages = {};
|
||||
|
||||
const discordLocale = UserSettingsStore.locale.split("-")[0];
|
||||
|
||||
export let currentLocale = "en";
|
||||
export function setLocale(newLocale) {
|
||||
currentLocale = newLocale;
|
||||
Utilities.extend(Messages, RawStrings[currentLocale]);
|
||||
Events.emit("strings-updated");
|
||||
console.log("Changed to " + newLocale);
|
||||
}
|
||||
|
||||
Utilities.extend(Messages, RawStrings[currentLocale]);
|
||||
|
||||
if (RawStrings[discordLocale] && discordLocale != "en") setLocale(discordLocale);
|
||||
|
||||
Dispatcher.subscribe(DiscordConstants.ActionTypes.USER_SETTINGS_UPDATE, ({settings}) => {
|
||||
const newLocale = settings.locale;
|
||||
if (newLocale && newLocale != currentLocale) setLocale(newLocale.split("-")[0]);
|
||||
|
|
|
@ -43,7 +43,9 @@ export default new class SettingsRenderer {
|
|||
Patcher.after("SettingsManager", WebpackModules.getByDisplayName("FluxContainer(GuildSettings)").prototype, "render", (thisObject) => {
|
||||
thisObject._reactInternalFiber.return.return.return.return.return.return.memoizedProps.id = "guild-settings";
|
||||
});
|
||||
console.log("getting user settings")
|
||||
const UserSettings = await ReactComponents.get("UserSettings", m => m.prototype && m.prototype.generateSections);
|
||||
console.log("got 'em")
|
||||
Patcher.after("SettingsManager", UserSettings.prototype, "render", (thisObject) => {
|
||||
thisObject._reactInternalFiber.return.return.return.return.return.return.return.memoizedProps.id = "user-settings";
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue