From 784e9ec9cb0c81d8d3671be27f27af69cd07da05 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Sat, 1 Oct 2022 03:58:07 +0200 Subject: Expose QuickCss and Updater on global; consoleShortcuts plugin --- src/plugins/consoleShortcuts.ts | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/plugins/consoleShortcuts.ts (limited to 'src/plugins') diff --git a/src/plugins/consoleShortcuts.ts b/src/plugins/consoleShortcuts.ts new file mode 100644 index 0000000..4bc39c5 --- /dev/null +++ b/src/plugins/consoleShortcuts.ts @@ -0,0 +1,41 @@ +import { Devs } from "../utils/constants"; +import definePlugin from "../utils/types"; + +export default definePlugin({ + name: "ConsoleShortcuts", + description: "Adds shorter Aliases for many things on the window. Run `shortcutList` for a list.", + authors: [Devs.Ven], + + getShortcuts() { + return { + toClip: window.DiscordNative.clipboard.copy, + fromClip: window.DiscordNative.clipboard.read, + wp: Vencord.Webpack, + wpc: Vencord.Webpack.wreq.c, + wreq: Vencord.Webpack.wreq, + wpsearch: Vencord.Webpack.search, + wpex: Vencord.Webpack.extract, + findByProps: Vencord.Webpack.findByProps, + find: Vencord.Webpack.find, + Plugins: Vencord.Plugins, + React: Vencord.Webpack.Common.React, + Settings: Vencord.Settings, + Api: Vencord.Api, + reload: () => location.reload(), + restart: () => window.DiscordNative.app.relaunch() + }; + }, + + start() { + const shortcuts = this.getShortcuts(); + window.shortcutList = shortcuts; + for (const [key, val] of Object.entries(shortcuts)) + window[key] = val; + }, + + stop() { + delete window.shortcutList; + for (const key in this.getShortcuts()) + delete window[key]; + } +}); -- cgit