Fix lag when alt tabbing to Discord

This commit is contained in:
Vendicated 2023-02-09 19:36:30 +01:00
parent 992a77e76c
commit ae98401bd3
No known key found for this signature in database
GPG Key ID: A1DC0CFB5615D905
5 changed files with 18 additions and 16 deletions

@ -222,7 +222,7 @@ export default ErrorBoundary.wrap(function PluginSettings() {
const onStatusChange = (status: SearchStatus) => setSearchValue(prev => ({ ...prev, status })); const onStatusChange = (status: SearchStatus) => setSearchValue(prev => ({ ...prev, status }));
const pluginFilter = (plugin: typeof Plugins[keyof typeof Plugins]) => { const pluginFilter = (plugin: typeof Plugins[keyof typeof Plugins]) => {
const enabled = settings.plugins[plugin.name]?.enabled || plugin.started; const enabled = settings.plugins[plugin.name]?.enabled;
if (enabled && searchValue.status === SearchStatus.DISABLED) return false; if (enabled && searchValue.status === SearchStatus.DISABLED) return false;
if (!enabled && searchValue.status === SearchStatus.ENABLED) return false; if (!enabled && searchValue.status === SearchStatus.ENABLED) return false;
if (!searchValue.value.length) return true; if (!searchValue.value.length) return true;

@ -0,0 +1,3 @@
.messagelogger-deleted {
background-color: rgba(240 71 71 / 15%);
}

@ -0,0 +1,3 @@
.messagelogger-deleted div {
color: #f04747;
}

@ -19,19 +19,23 @@
import "./messageLogger.css"; import "./messageLogger.css";
import { Settings } from "@api/settings"; import { Settings } from "@api/settings";
import { disableStyle, enableStyle } from "@api/Styles";
import ErrorBoundary from "@components/ErrorBoundary"; import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import Logger from "@utils/Logger"; import Logger from "@utils/Logger";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
import { moment, Parser, Timestamp, UserStore } from "@webpack/common"; import { moment, Parser, Timestamp, UserStore } from "@webpack/common";
function addDeleteStyleClass() { import overlayStyle from "./deleteStyleOverlay.css?managed";
import textStyle from "./deleteStyleText.css?managed";
function addDeleteStyle() {
if (Settings.plugins.MessageLogger.deleteStyle === "text") { if (Settings.plugins.MessageLogger.deleteStyle === "text") {
document.body.classList.remove("messagelogger-red-overlay"); enableStyle(textStyle);
document.body.classList.add("messagelogger-red-text"); disableStyle(overlayStyle);
} else { } else {
document.body.classList.remove("messagelogger-red-text"); disableStyle(textStyle);
document.body.classList.add("messagelogger-red-overlay"); enableStyle(overlayStyle);
} }
} }
@ -41,7 +45,7 @@ export default definePlugin({
authors: [Devs.rushii, Devs.Ven], authors: [Devs.rushii, Devs.Ven],
start() { start() {
addDeleteStyleClass(); addDeleteStyle();
}, },
stop() { stop() {
@ -84,7 +88,7 @@ export default definePlugin({
{ label: "Red text", value: "text", default: true }, { label: "Red text", value: "text", default: true },
{ label: "Red overlay", value: "overlay" } { label: "Red overlay", value: "overlay" }
], ],
onChange: () => addDeleteStyleClass() onChange: () => addDeleteStyle()
}, },
ignoreBots: { ignoreBots: {
type: OptionType.BOOLEAN, type: OptionType.BOOLEAN,

@ -1,11 +1,3 @@
.messagelogger-red-overlay .messagelogger-deleted {
background-color: rgba(240 71 71 / 15%);
}
.messagelogger-red-text .messagelogger-deleted div {
color: #f04747;
}
.messagelogger-deleted [class^="buttons"] { .messagelogger-deleted [class^="buttons"] {
display: none; display: none;
} }