mirror of
https://github.com/Equicord/Equicord.git
synced 2025-01-18 13:23:28 -05:00
Womp Womp 2
This commit is contained in:
parent
5ac9d0bc4c
commit
ef0810f5b1
5 changed files with 174 additions and 2 deletions
|
@ -21,7 +21,7 @@ An enhanced version of [Vencord](https://github.com/Vendicated/Vencord) by [Vend
|
|||
- Request for plugins from Discord.
|
||||
|
||||
<details>
|
||||
<summary>Extra included plugins (119 additional plugins)</summary>
|
||||
<summary>Extra included plugins (120 additional plugins)</summary>
|
||||
|
||||
- AllCallTimers by MaxHerbold and D3SOX
|
||||
- AltKrispSwitch by newwares
|
||||
|
@ -80,6 +80,7 @@ An enhanced version of [Vencord](https://github.com/Vendicated/Vencord) by [Vend
|
|||
- InRole by nin0dev
|
||||
- IrcColors by Grzesiek11
|
||||
- IRememberYou by zoodogood
|
||||
- Jumpscare by Joona
|
||||
- JumpToStart by Samwich
|
||||
- KeyboardSounds by HypedDomi
|
||||
- KeywordNotify by camila314 (maintained by thororen)
|
||||
|
@ -90,7 +91,6 @@ An enhanced version of [Vencord](https://github.com/Vendicated/Vencord) by [Vend
|
|||
- MessageLoggerEnhanced by Aria
|
||||
- MessageTranslate by Samwich
|
||||
- ModalFade by Kyuuhachi
|
||||
- MusicTitleRPC by Blackilykay
|
||||
- NewPluginsManager by Sqaaakoi
|
||||
- noAppsAllowed by kvba
|
||||
- NoBulletPoints by Samwich
|
||||
|
@ -130,6 +130,7 @@ An enhanced version of [Vencord](https://github.com/Vendicated/Vencord) by [Vend
|
|||
- Translate+ by Prince527 (Using Translate by Ven)
|
||||
- UnitConverter by sadan
|
||||
- UnlimitedAccounts by thororen
|
||||
- UnreadCountBadge by Joona
|
||||
- UserPFP by nexpid (maintained by thororen)
|
||||
- UwUifier by echo
|
||||
- VCSupport by thororen
|
||||
|
|
95
src/equicordplugins/jumpscare/index.tsx
Normal file
95
src/equicordplugins/jumpscare/index.tsx
Normal file
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2024 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import "./styles.css";
|
||||
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { FluxDispatcher, ReactDOM, useEffect, useState } from "@webpack/common";
|
||||
import { Root } from "react-dom/client";
|
||||
|
||||
let jumpscareRoot: Root | undefined;
|
||||
|
||||
const settings = definePluginSettings({
|
||||
imageSource: {
|
||||
type: OptionType.STRING,
|
||||
description: "Sets the image url of the jumpscare",
|
||||
default: "https://github.com/Equicord/Equibored/blob/main/misc/troll.gif?raw=true"
|
||||
},
|
||||
audioSource: {
|
||||
type: OptionType.STRING,
|
||||
description: "Sets the audio url of the jumpscare",
|
||||
default: "https://github.com/Equicord/Equibored/raw/main/misc/trollolol.mp3?raw=true"
|
||||
},
|
||||
chance: {
|
||||
type: OptionType.NUMBER,
|
||||
description: "The chance of a jumpscare happening (1 in X so: 100 = 1/100 or 1%, 50 = 1/50 or 2%, etc.)",
|
||||
default: 1000
|
||||
}
|
||||
});
|
||||
|
||||
function getJumpscareRoot(): Root {
|
||||
if (!jumpscareRoot) {
|
||||
const element = document.createElement("div");
|
||||
element.id = "jumpscare-root";
|
||||
element.classList.add("jumpscare-root");
|
||||
document.body.append(element);
|
||||
jumpscareRoot = ReactDOM.createRoot(element);
|
||||
}
|
||||
|
||||
return jumpscareRoot;
|
||||
}
|
||||
|
||||
export default definePlugin({
|
||||
name: "Jumpscare",
|
||||
description: "Adds a configurable chance of jumpscaring you whenever you open a channel. Inspired by Geometry Dash Mega Hack",
|
||||
authors: [Devs.surgedevs],
|
||||
settings,
|
||||
|
||||
start() {
|
||||
getJumpscareRoot().render(
|
||||
<this.JumpscareComponent />
|
||||
);
|
||||
},
|
||||
|
||||
stop() {
|
||||
jumpscareRoot?.unmount();
|
||||
jumpscareRoot = undefined;
|
||||
},
|
||||
|
||||
JumpscareComponent() {
|
||||
const [isPlaying, setIsPlaying] = useState(false);
|
||||
|
||||
const audio = new Audio(settings.store.audioSource);
|
||||
|
||||
const jumpscare = event => {
|
||||
if (isPlaying) return;
|
||||
|
||||
const chance = 1 / settings.store.chance;
|
||||
if (Math.random() > chance) return;
|
||||
|
||||
setIsPlaying(true);
|
||||
audio.play();
|
||||
|
||||
console.log(isPlaying);
|
||||
|
||||
setTimeout(() => {
|
||||
setIsPlaying(false);
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
FluxDispatcher.subscribe("CHANNEL_SELECT", jumpscare);
|
||||
|
||||
return () => {
|
||||
FluxDispatcher.unsubscribe("CHANNEL_SELECT", jumpscare);
|
||||
};
|
||||
});
|
||||
|
||||
return <img className={`jumpscare-img ${isPlaying ? "jumpscare-animate" : ""}`} src={settings.store.imageSource} />;
|
||||
}
|
||||
});
|
33
src/equicordplugins/jumpscare/styles.css
Normal file
33
src/equicordplugins/jumpscare/styles.css
Normal file
|
@ -0,0 +1,33 @@
|
|||
.jumpscare-root {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.jumpscare-img {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #000;
|
||||
z-index: 99999;
|
||||
object-fit: contain;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.jumpscare-animate {
|
||||
animation: jumpscare-animation 0.7s;
|
||||
}
|
||||
|
||||
@keyframes jumpscare-animation {
|
||||
0% {
|
||||
transform: scale(0);
|
||||
}
|
||||
|
||||
80% {
|
||||
transform: scale(1);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: scale(0);
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
36
src/equicordplugins/unreadBadgeCount/index.tsx
Normal file
36
src/equicordplugins/unreadBadgeCount/index.tsx
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2024 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin from "@utils/types";
|
||||
import { findByPropsLazy } from "@webpack";
|
||||
import { ReadStateStore, useStateFromStores } from "@webpack/common";
|
||||
const { NumberBadge } = findByPropsLazy("NumberBadge");
|
||||
|
||||
import "./styles.css";
|
||||
|
||||
export default definePlugin({
|
||||
name: "UnreadCountBadge",
|
||||
authors: [Devs.Joona],
|
||||
description: "Show unread count in the channel list",
|
||||
patches: [
|
||||
// Kanged from typingindicators
|
||||
{
|
||||
find: "UNREAD_IMPORTANT:",
|
||||
replacement: {
|
||||
match: /\.name\),.{0,120}\.children.+?:null(?<=,channel:(\i).+?)/,
|
||||
replace: "$&,$self.CountBadge({channelId:$1.id})"
|
||||
}
|
||||
},
|
||||
],
|
||||
|
||||
CountBadge: ErrorBoundary.wrap(({ channelId }: { channelId: string; }) => {
|
||||
const unreadCount = useStateFromStores([ReadStateStore], () => ReadStateStore.getUnreadCount(channelId));
|
||||
if (!unreadCount) return null;
|
||||
return <NumberBadge count={unreadCount} color="var(--brand-500)" className="unreadCountBadge" />;
|
||||
}, { noop: true })
|
||||
});
|
7
src/equicordplugins/unreadBadgeCount/styles.css
Normal file
7
src/equicordplugins/unreadBadgeCount/styles.css
Normal file
|
@ -0,0 +1,7 @@
|
|||
.unreadCountBadge {
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
[class*="modeMuted_"] .unreadCountBadge {
|
||||
display: none;
|
||||
}
|
Loading…
Reference in a new issue