From a46ddb6c2352bd962fff8a15e9ce66ff7c9db723 Mon Sep 17 00:00:00 2001 From: Flex Date: Sun, 13 May 2018 19:01:34 -0600 Subject: [PATCH] more plugins --- plugins/beautifuldiscord.js | 21 ++++++++++++++ plugins/guildcount.js | 58 +++++++++++++++++++++++++++++++++++++ plugins/osutyping.js | 6 ++-- plugins/sailboat.js | 13 +++++++++ 4 files changed, 95 insertions(+), 3 deletions(-) create mode 100644 plugins/beautifuldiscord.js create mode 100644 plugins/guildcount.js create mode 100644 plugins/sailboat.js diff --git a/plugins/beautifuldiscord.js b/plugins/beautifuldiscord.js new file mode 100644 index 0000000..78e88ba --- /dev/null +++ b/plugins/beautifuldiscord.js @@ -0,0 +1,21 @@ +bdwatcher = null, bdtag = null, setupCSS = function (n) { + var e = fs.readFileSync(n, "utf-8"); + null === bdtag && (bdtag = document.createElement("style"), document.head.appendChild(bdtag)), bdtag.innerHTML = e, null === bdwatcher && (bdwatcher = fs.watch(n, { + encoding: "utf-8" + }, function (e, w) { + if ("change" === e) { + var i = fs.readFileSync(n, "utf-8"); + bdtag.innerHTML = i + } + })) +}; + +exports.meta = { + author: "dr1ft", + name: "BeautifulDiscord Port", + desc: "Allows CSS to be imported and updated on the fly." +}, +exports.start = () => { + if (fs.existsSync($api.data + 'style.css')) + setupCSS($api.data + 'style.css'); +} \ No newline at end of file diff --git a/plugins/guildcount.js b/plugins/guildcount.js new file mode 100644 index 0000000..c08ca40 --- /dev/null +++ b/plugins/guildcount.js @@ -0,0 +1,58 @@ +function formattedGuildCount(shortened) { + const guildCount = document.querySelectorAll(".guild > div[draggable=true]").length; + return `${guildCount} Guilds`; +} + +function setupServerCount() { + if (document.querySelector(".server-count")) return; + + let gc = document.createElement("div"); + gc.className = "server-count"; + + let glist = document.querySelector(".friends-online"); + if (!glist) return; + + glist.parentNode.insertBefore(gc, glist.nextSibling); + } + +function updateServerCount() { + if (document.querySelector(".server-count") && document.querySelector(".server-count").innerHTML == formattedGuildCount()) return; + document.querySelector(".server-count").innerHTML = formattedGuildCount(); +} + +function scCSS() { + let css = document.createElement("style"); + css.type = "text/css"; + css.id = "css-scount"; + css.innerHTML = `.server-count { + color: hsla(0,0%,100%,.3); + font-size: 10px; + font-weight: 500; + line-height: 130%; + margin: 10px 0; + text-align: center; + text-transform: uppercase; + white-space: nowrap; + width: 50px; + word-wrap: normal; +}`; + document.body.appendChild(css); +} + +exports.meta = { + author: "Cynosphere", + name: "Guild Count", + desc: "Shows guild count under online count." +} +exports.start = () => { + scCSS(); + + let observer = new MutationObserver(() => { + setupServerCount(); + updateServerCount(); + }); + observer.observe(document.querySelector("div[class*=\"app-\"]"), { + childList: true, + subtree: true + }); +} \ No newline at end of file diff --git a/plugins/osutyping.js b/plugins/osutyping.js index 118f1e8..94acd21 100644 --- a/plugins/osutyping.js +++ b/plugins/osutyping.js @@ -1,15 +1,15 @@ exportsexports = { meta: { - author: "Cynosphere", + author: "Cynosphere, janeptrv", name: "osu! Typing", desc: "Adds typing sounds from osu!." }, start: function(){ var sounds = []; for (var i = 1; i < 4; i++) { - sounds.push(new Audio(`https://github.com/statefram/sounds/blob/master/osu_typing_click${i}.wav?raw=true`)); + sounds.push(new Audio(`https://github.com/janeptrv/sounds/blob/master/osu_typing_click${i}.wav?raw=true`)); } - const backspace = new Audio("https://github.com/statefram/sounds/blob/master/osu_typing_erase.wav?raw=true"); + const backspace = new Audio("https://github.com/janeptrv/sounds/blob/master/osu_typing_erase.wav?raw=true"); var keys = {}; function typingSound(ev) { diff --git a/plugins/sailboat.js b/plugins/sailboat.js new file mode 100644 index 0000000..b3638b7 --- /dev/null +++ b/plugins/sailboat.js @@ -0,0 +1,13 @@ +exports.meta = { + author: "BlockBuilder57, Cynosphere", + name: "Sailboat", + desc: "Login as bot accounts." +} +exports.replacements = { + '/i.default.Store.pauseEmittingChanges\\(\\),t.user.bot/':'false', + '/.\\._reset\\(!0,1e3,"Disconnect requested by user"\\)/':'console.log("delightfully devilish seymour")', + '/\\.experiments;v={},t\\.forEach/':'.experiments;if(t==undefined) return;v={},t.forEach', + '/CONNECTION_OPEN:function\\(e\\){f=e\\.connected/':'CONNECTION_OPEN:function(e){if(e.connectedAccounts==undefined) return; f=e.connected', + '/function S\\(e\\){var t=arguments/':'function S(e){if(e==undefined) return; var t=arguments', + 'totalUnavailableGuilds,n=[];':'totalUnavailableGuilds,n=[];if(e.readState==undefined) return;' +} \ No newline at end of file