stuff
This commit is contained in:
parent
071520ce2c
commit
6064e1fbb5
|
@ -2,7 +2,7 @@
|
||||||
* @name OldTitleBar
|
* @name OldTitleBar
|
||||||
* @author DevilBro
|
* @author DevilBro
|
||||||
* @authorId 278543574059057154
|
* @authorId 278543574059057154
|
||||||
* @version 1.6.8
|
* @version 1.6.9
|
||||||
* @description Allows you to switch to Discord's old Titlebar or add the native OS Titlebar
|
* @description Allows you to switch to Discord's old Titlebar or add the native OS Titlebar
|
||||||
* @invite Jx3TjNS
|
* @invite Jx3TjNS
|
||||||
* @donate https://www.paypal.me/MircoWittrien
|
* @donate https://www.paypal.me/MircoWittrien
|
||||||
|
@ -17,7 +17,7 @@ module.exports = (_ => {
|
||||||
"info": {
|
"info": {
|
||||||
"name": "OldTitleBar",
|
"name": "OldTitleBar",
|
||||||
"author": "DevilBro",
|
"author": "DevilBro",
|
||||||
"version": "1.6.8",
|
"version": "1.6.9",
|
||||||
"description": "Allows you to switch to Discord's old Titlebar or add the native OS Titlebar"
|
"description": "Allows you to switch to Discord's old Titlebar or add the native OS Titlebar"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -61,18 +61,15 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
} : (([Plugin, BDFDB]) => {
|
} : (([Plugin, BDFDB]) => {
|
||||||
var patched, lastWindowRects;
|
var patched, lastWindowRects;
|
||||||
var settings = {};
|
|
||||||
|
|
||||||
return class OldTitleBar extends Plugin {
|
return class OldTitleBar extends Plugin {
|
||||||
onLoad () {
|
onLoad () {
|
||||||
patched = false;
|
patched = false;
|
||||||
|
|
||||||
this.defaults = {
|
this.defaults = {
|
||||||
settings: {
|
general: {
|
||||||
displayNative: {value: !!document.querySelector(".platform-linux"), description: "Display the native Titlebar"},
|
addToSettings: {value: true, description: "Adds a Titlebar to Settings Windows"},
|
||||||
addOldBar: {value: true, description: "Display the Titlebar in the old Fashion"},
|
reloadButton: {value: false, description: "Adds a Reload Button to the Titlebar"}
|
||||||
addToSettings: {value: true, description: "Add a Titlebar to Settings Windows"},
|
|
||||||
reloadButton: {value: false, description: "Add a Reload Button to the Titlebar"}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -142,68 +139,42 @@ module.exports = (_ => {
|
||||||
|
|
||||||
BDFDB.DOMUtils.addClass(document.body, BDFDB.disCN._oldtitlebarenabled);
|
BDFDB.DOMUtils.addClass(document.body, BDFDB.disCN._oldtitlebarenabled);
|
||||||
|
|
||||||
this.forceUpdateAll();
|
BDFDB.PatchUtils.forceAllUpdates(this);
|
||||||
|
|
||||||
this.patchMainScreen(settings.displayNative);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onStop () {
|
onStop () {
|
||||||
this.forceUpdateAll();
|
BDFDB.PatchUtils.forceAllUpdates(this);
|
||||||
|
|
||||||
BDFDB.DOMUtils.removeClassFromDOM(BDFDB.disCN._oldtitlebarenabled);
|
BDFDB.DOMUtils.removeClassFromDOM(BDFDB.disCN._oldtitlebarenabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
getSettingsPanel (collapseStates = {}) {
|
getSettingsPanel (collapseStates = {}) {
|
||||||
let settingsPanel, settingsItems = [];
|
let settingsPanel;
|
||||||
|
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, {
|
||||||
|
collapseStates: collapseStates,
|
||||||
|
children: _ => {
|
||||||
|
let settingsItems = [];
|
||||||
|
|
||||||
let isLinux = !!document.querySelector(".platform-linux");
|
for (let key in this.defaults.general) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||||
|
|
||||||
for (let key in settings) {
|
|
||||||
let isNativeTitlebarSetting = key == "displayNative";
|
|
||||||
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
|
||||||
type: "Switch",
|
type: "Switch",
|
||||||
plugin: this,
|
plugin: this,
|
||||||
keys: ["settings", key],
|
keys: ["general", key],
|
||||||
label: this.defaults.settings[key].description,
|
label: this.defaults.general[key].description,
|
||||||
value: isLinux && isNativeTitlebarSetting || settings[key],
|
value: this.settings.general[key],
|
||||||
disabled: isLinux && isNativeTitlebarSetting,
|
|
||||||
note: isLinux && isNativeTitlebarSetting && "This is disabled on Linux, because Discord/BD forces the Titlebar on Linux Systems!",
|
|
||||||
onChange: isNativeTitlebarSetting ? value => {
|
|
||||||
if (this.patchMainScreen(value)) {
|
|
||||||
patched = !patched;
|
|
||||||
let notifybar = document.querySelector("#OldTitleBarNotifyBar");
|
|
||||||
if (notifybar) notifybar.querySelector(BDFDB.dotCN.noticedismiss).click();
|
|
||||||
if (patched) {
|
|
||||||
notifybar = BDFDB.NotificationUtils.notice("Changed native Titlebar Settings. Please relaunch now:", {
|
|
||||||
type: "danger",
|
|
||||||
id: "OldTitleBarNotifyBar",
|
|
||||||
buttons: [{
|
|
||||||
contents: "Relaunch",
|
|
||||||
onClick: _ => {BDFDB.LibraryModules.WindowUtils.relaunch();}
|
|
||||||
}]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} : null
|
|
||||||
}));
|
}));
|
||||||
}
|
|
||||||
|
|
||||||
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
|
return settingsItems;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onSettingsClosed () {
|
onSettingsClosed () {
|
||||||
if (this.SettingsUpdated) {
|
if (this.SettingsUpdated) {
|
||||||
delete this.SettingsUpdated;
|
delete this.SettingsUpdated;
|
||||||
|
|
||||||
this.forceUpdateAll();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
forceUpdateAll () {
|
|
||||||
settings = BDFDB.DataUtils.get(this, "settings");
|
|
||||||
|
|
||||||
BDFDB.PatchUtils.forceAllUpdates(this);
|
BDFDB.PatchUtils.forceAllUpdates(this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
processApp (e) {
|
processApp (e) {
|
||||||
let [children, index] = BDFDB.ReactUtils.findParent(e.instance, {props: [["type", ["WINDOWS", "MACOS"]]]});
|
let [children, index] = BDFDB.ReactUtils.findParent(e.instance, {props: [["type", ["WINDOWS", "MACOS"]]]});
|
||||||
|
@ -215,7 +186,6 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
|
|
||||||
processHeaderBarContainer (e) {
|
processHeaderBarContainer (e) {
|
||||||
if (!settings.addOldBar) return;
|
|
||||||
let children = BDFDB.ObjectUtils.get(e.returnvalue, "props.toolbar.props.children");
|
let children = BDFDB.ObjectUtils.get(e.returnvalue, "props.toolbar.props.children");
|
||||||
if (!children) {
|
if (!children) {
|
||||||
let [oldToolbarParent, oldToolbarIndex] = BDFDB.ReactUtils.findParent(e.returnvalue, {key: "OldTitleBar-toolbar"});
|
let [oldToolbarParent, oldToolbarIndex] = BDFDB.ReactUtils.findParent(e.returnvalue, {key: "OldTitleBar-toolbar"});
|
||||||
|
@ -242,7 +212,7 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
|
|
||||||
injectSettingsToolbar (children, fixed) {
|
injectSettingsToolbar (children, fixed) {
|
||||||
if (!settings.addToSettings) return;
|
if (!this.settings.general.addToSettings) return;
|
||||||
let toolbar = BDFDB.ReactUtils.createElement("div", {
|
let toolbar = BDFDB.ReactUtils.createElement("div", {
|
||||||
className: BDFDB.disCNS.channelheadertoolbar + BDFDB.disCN._oldtitlebarsettingstoolbar,
|
className: BDFDB.disCNS.channelheadertoolbar + BDFDB.disCN._oldtitlebarsettingstoolbar,
|
||||||
children: [],
|
children: [],
|
||||||
|
@ -254,7 +224,7 @@ module.exports = (_ => {
|
||||||
|
|
||||||
injectButtons (children, addFirstDivider) {
|
injectButtons (children, addFirstDivider) {
|
||||||
if (addFirstDivider) children.push(BDFDB.ReactUtils.createElement("div", {className: BDFDB.disCN.channelheaderdivider}))
|
if (addFirstDivider) children.push(BDFDB.ReactUtils.createElement("div", {className: BDFDB.disCN.channelheaderdivider}))
|
||||||
if (settings.reloadButton) {
|
if (this.settings.general.reloadButton) {
|
||||||
children.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
|
children.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
|
||||||
text: BDFDB.LanguageUtils.LanguageStrings.ERRORS_RELOAD,
|
text: BDFDB.LanguageUtils.LanguageStrings.ERRORS_RELOAD,
|
||||||
tooltipConfig: {type: "bottom"},
|
tooltipConfig: {type: "bottom"},
|
||||||
|
@ -325,19 +295,6 @@ module.exports = (_ => {
|
||||||
getWindowRects () {
|
getWindowRects () {
|
||||||
return {x: window.screenX, y: window.screenY, width: window.outerWidth, height: window.outerHeight};
|
return {x: window.screenX, y: window.screenY, width: window.outerWidth, height: window.outerHeight};
|
||||||
}
|
}
|
||||||
|
|
||||||
patchMainScreen (enable) {
|
|
||||||
try {
|
|
||||||
if (BdApi.getWindowPreference("frame") != enable) {
|
|
||||||
BdApi.setWindowPreference("frame", enable);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
})(window.BDFDB_Global.PluginUtils.buildPlugin(config));
|
})(window.BDFDB_Global.PluginUtils.buildPlugin(config));
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* @name ServerHider
|
* @name ServerHider
|
||||||
* @author DevilBro
|
* @author DevilBro
|
||||||
* @authorId 278543574059057154
|
* @authorId 278543574059057154
|
||||||
* @version 6.1.9
|
* @version 6.2.0
|
||||||
* @description Allows you to hide certain Servers in your Server List
|
* @description Allows you to hide certain Servers in your Server List
|
||||||
* @invite Jx3TjNS
|
* @invite Jx3TjNS
|
||||||
* @donate https://www.paypal.me/MircoWittrien
|
* @donate https://www.paypal.me/MircoWittrien
|
||||||
|
@ -17,12 +17,12 @@ module.exports = (_ => {
|
||||||
"info": {
|
"info": {
|
||||||
"name": "ServerHider",
|
"name": "ServerHider",
|
||||||
"author": "DevilBro",
|
"author": "DevilBro",
|
||||||
"version": "6.1.9",
|
"version": "6.2.0",
|
||||||
"description": "Allows you to hide certain Servers in your Server List"
|
"description": "Allows you to hide certain Servers in your Server List"
|
||||||
},
|
},
|
||||||
"changeLog": {
|
"changeLog": {
|
||||||
"fixed": {
|
"added": {
|
||||||
"Works again": "Can discord stop messing with the server list, jeez"
|
"Streamer Mode": "Added Option to only hide Servers while in Streamer Mode"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -67,6 +67,12 @@ module.exports = (_ => {
|
||||||
} : (([Plugin, BDFDB]) => {
|
} : (([Plugin, BDFDB]) => {
|
||||||
return class ServerHider extends Plugin {
|
return class ServerHider extends Plugin {
|
||||||
onLoad () {
|
onLoad () {
|
||||||
|
this.defaults = {
|
||||||
|
general: {
|
||||||
|
onlyHideInStream: {value: false, description: "Only hide selected Servers while in Streamer Mode"}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
this.patchedModules = {
|
this.patchedModules = {
|
||||||
after: {
|
after: {
|
||||||
Guilds: "render"
|
Guilds: "render"
|
||||||
|
@ -75,6 +81,10 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
|
|
||||||
onStart () {
|
onStart () {
|
||||||
|
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.DispatchApiUtils, "dispatch", {after: e => {
|
||||||
|
if (e.methodArguments[0].type == BDFDB.DiscordConstants.ActionTypes.STREAMER_MODE_UPDATE) BDFDB.PatchUtils.forceAllUpdates(this);
|
||||||
|
}});
|
||||||
|
|
||||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.FolderStore, "getGuildFolderById", {after: e => {
|
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.FolderStore, "getGuildFolderById", {after: e => {
|
||||||
let hiddenGuildIds = BDFDB.DataUtils.load(this, "hidden", "servers") || [];
|
let hiddenGuildIds = BDFDB.DataUtils.load(this, "hidden", "servers") || [];
|
||||||
if (e.returnValue && hiddenGuildIds.length) {
|
if (e.returnValue && hiddenGuildIds.length) {
|
||||||
|
@ -93,14 +103,26 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
|
|
||||||
getSettingsPanel (collapseStates = {}) {
|
getSettingsPanel (collapseStates = {}) {
|
||||||
let settingsPanel, settingsItems = [];
|
let settingsPanel;
|
||||||
|
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, {
|
||||||
|
collapseStates: collapseStates,
|
||||||
|
children: _ => {
|
||||||
|
let settingsItems = [];
|
||||||
|
|
||||||
|
for (let key in this.defaults.general) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||||
|
type: "Switch",
|
||||||
|
plugin: this,
|
||||||
|
keys: ["general", key],
|
||||||
|
label: this.defaults.general[key].description,
|
||||||
|
value: this.settings.general[key],
|
||||||
|
}));
|
||||||
|
|
||||||
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
|
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
|
||||||
type: "Button",
|
type: "Button",
|
||||||
color: BDFDB.LibraryComponents.Button.Colors.RED,
|
color: BDFDB.LibraryComponents.Button.Colors.RED,
|
||||||
label: "Unhide all Servers/Folders",
|
label: "Unhide all Servers/Folders",
|
||||||
onClick: _ => {
|
onClick: _ => {
|
||||||
BDFDB.ModalUtils.confirm(this, "Are you sure you want to unhide all servers and folders?", _ => {
|
BDFDB.ModalUtils.confirm(this, "Are you sure you want to unhide all Servers and Folders?", _ => {
|
||||||
BDFDB.DataUtils.save([], this, "hidden");
|
BDFDB.DataUtils.save([], this, "hidden");
|
||||||
BDFDB.PatchUtils.forceAllUpdates(this);
|
BDFDB.PatchUtils.forceAllUpdates(this);
|
||||||
});
|
});
|
||||||
|
@ -108,7 +130,9 @@ module.exports = (_ => {
|
||||||
children: BDFDB.LanguageUtils.LanguageStrings.RESET
|
children: BDFDB.LanguageUtils.LanguageStrings.RESET
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
|
return settingsItems;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onGuildContextMenu (e) {
|
onGuildContextMenu (e) {
|
||||||
|
@ -185,6 +209,7 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleGuilds (returnvalue) {
|
handleGuilds (returnvalue) {
|
||||||
|
if (this.settings.general.onlyHideInStream && !BDFDB.LibraryModules.StreamerModeStore.enabled) return;
|
||||||
let hiddenEles = BDFDB.DataUtils.load(this, "hidden");
|
let hiddenEles = BDFDB.DataUtils.load(this, "hidden");
|
||||||
let hiddenGuildIds = hiddenEles.servers || [];
|
let hiddenGuildIds = hiddenEles.servers || [];
|
||||||
let hiddenFolderIds = hiddenEles.folders || [];
|
let hiddenFolderIds = hiddenEles.folders || [];
|
||||||
|
|
Loading…
Reference in New Issue