This commit is contained in:
thororen 2024-04-17 14:29:47 -04:00
parent 538b87062a
commit ea7451bcdc
326 changed files with 24876 additions and 2280 deletions

View file

@ -16,24 +16,72 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { definePluginSettings, Settings } from "@api/Settings";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
import definePlugin, { OptionType } from "@utils/types";
const settings = definePluginSettings({
coinsEnabled: {
type: OptionType.BOOLEAN,
default: false,
description: "Enable coins feature (Requires reload)"
},
speed: {
description: "Speed of Da Cat :3",
type: OptionType.NUMBER,
default: 10,
isValid: (value: number) => {
if (value && value < 0) return "The number must be bigger than 0";
return true;
},
onChange: () => {
// note: cant call the start() function from here. so i just copy pasted it (This was pointed out in the last commit i made. So this is to just clear stuff up for any future devs that work on this :D )
if (Settings.plugins.oneko.enabled) {
document.getElementById("oneko")?.remove();
fetch("https://raw.githubusercontent.com/adryd325/oneko.js/8fa8a1864aa71cd7a794d58bc139e755e96a236c/oneko.js")
.then(x => x.text())
.then(s => s.replace("const nekoSpeed = 10;", `const nekoSpeed = ${settings.store.speed};`))
.then(s => s.replace("./oneko.gif", "https://raw.githubusercontent.com/adryd325/oneko.js/14bab15a755d0e35cd4ae19c931d96d306f99f42/oneko.gif")
.replace("(isReducedMotion)", "(false)"))
.then(eval);
}
return;
}
}
});
export default definePlugin({
name: "oneko",
description: "cat follow mouse (real)",
// Listing adryd here because this literally just evals her script
authors: [Devs.Ven, Devs.adryd],
authors: [Devs.Ven, Devs.adryd, Devs.Gingi, Devs.adryd],
settings,
start() {
fetch("https://raw.githubusercontent.com/adryd325/oneko.js/8fa8a1864aa71cd7a794d58bc139e755e96a236c/oneko.js")
.then(x => x.text())
.then(s => s.replace("./oneko.gif", "https://raw.githubusercontent.com/adryd325/oneko.js/14bab15a755d0e35cd4ae19c931d96d306f99f42/oneko.gif")
.replace("(isReducedMotion)", "(false)"))
.then(eval);
const { coinsEnabled } = settings.store;
if (coinsEnabled) {
fetch("https://raw.githubusercontent.com/0xGingi/oneko.js/acf1ae58ca8bacd9af47a783c2e134136c35f948/oneko.js")
.then(x => x.text())
.then(s => s.replace("const nekoSpeed = 10;", `const nekoSpeed = ${settings.store.speed};`))
.then(s => s.replace("./oneko.gif", "https://raw.githubusercontent.com/adryd325/oneko.js/14bab15a755d0e35cd4ae19c931d96d306f99f42/oneko.gif")
.replace("(isReducedMotion)", "(false)"))
.then(x => x.replace("./coin.gif", "https://raw.githubusercontent.com/0xGingi/oneko.js/3de1bf554bb82b58a2c70f828e2420a881e5f283/coin.gif"))
.then(eval);
}
if (!coinsEnabled) {
fetch("https://raw.githubusercontent.com/adryd325/oneko.js/8fa8a1864aa71cd7a794d58bc139e755e96a236c/oneko.js")
.then(x => x.text())
.then(s => s.replace("const nekoSpeed = 10;", `const nekoSpeed = ${settings.store.speed};`))
.then(s => s.replace("./oneko.gif", "https://raw.githubusercontent.com/adryd325/oneko.js/14bab15a755d0e35cd4ae19c931d96d306f99f42/oneko.gif")
.replace("(isReducedMotion)", "(false)"))
.then(eval);
}
},
stop() {
document.getElementById("oneko")?.remove();
if (typeof window.removeCoins === "function") {
window.removeCoins();
}
}
});