From b6debffe1847287acaab1a091ee028703bd045f1 Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Wed, 21 Sep 2022 15:46:58 +0200 Subject: [PATCH] stuff --- Plugins/ThemeRepo/ThemeRepo.plugin.js | 384 +--- Plugins/_res/DiscordPreview.html | 2502 ------------------------- Plugins/_res/DiscordPreview.js | 318 ---- Plugins/_res/REPLACE_AVATAR | Bin 2964 -> 0 bytes 4 files changed, 5 insertions(+), 3199 deletions(-) delete mode 100644 Plugins/_res/DiscordPreview.html delete mode 100644 Plugins/_res/DiscordPreview.js delete mode 100644 Plugins/_res/REPLACE_AVATAR diff --git a/Plugins/ThemeRepo/ThemeRepo.plugin.js b/Plugins/ThemeRepo/ThemeRepo.plugin.js index ce6ad06d36..35f65d26a6 100644 --- a/Plugins/ThemeRepo/ThemeRepo.plugin.js +++ b/Plugins/ThemeRepo/ThemeRepo.plugin.js @@ -2,7 +2,7 @@ * @name ThemeRepo * @author DevilBro * @authorId 278543574059057154 - * @version 2.3.8 + * @version 2.3.9 * @description Allows you to download all Themes from BD's Website within Discord * @invite Jx3TjNS * @donate https://www.paypal.me/MircoWittrien @@ -58,7 +58,7 @@ module.exports = (_ => { } : (([Plugin, BDFDB]) => { var _this; - var list, header, preview; + var list, header; var loading, cachedThemes, grabbedThemes, generatorThemes, updateInterval; var searchString, searchTimeout, forcedSort, forcedOrder, showOnlyOutdated; @@ -120,7 +120,6 @@ module.exports = (_ => { } componentWillUnmount() { list = null; - this.closePreview(); } filterThemes() { let themes = grabbedThemes.map(theme => { @@ -148,191 +147,6 @@ module.exports = (_ => { if (reverseSorts.includes(this.props.sortKey)) themes.reverse(); return themes; } - openPreview() { - preview = BDFDB.DOMUtils.create(`
-
-
-
- -
-
-
-
-
-
-
-
`); - preview.frame = document.createElement("iframe"); - preview.frame.src = "https://mwittrien.github.io/BetterDiscordAddons/Plugins/_res/DiscordPreview.html"; - preview.querySelector(BDFDB.dotCN._themerepomovebar).addEventListener("mousedown", e => { - let moving = false; - let rects = BDFDB.DOMUtils.getRects(preview).toJSON(); - let oldX = e.pageX, oldY = e.pageY; - let mouseUp = _ => { - BDFDB.DOMUtils.removeClass(preview, BDFDB.disCN._themerepopreviewmoving); - document.removeEventListener("mouseup", mouseUp); - document.removeEventListener("mousemove", mouseMove); - }; - let mouseMove = e2 => { - if (moving || Math.sqrt((e.pageX - e2.pageX)**2) > 20 || Math.sqrt((e.pageY - e2.pageY)**2) > 20) { - if (!moving) BDFDB.DOMUtils.addClass(preview, BDFDB.disCN._themerepopreviewmoving); - moving = true; - BDFDB.ListenerUtils.stopEvent(e); - rects.top = rects.top - (oldY - e2.pageY); - rects.left = rects.left - (oldX - e2.pageX); - oldX = e2.pageX, oldY = e2.pageY; - preview.style.setProperty("top", `${rects.top}px`); - preview.style.setProperty("left", `${rects.left}px`); - } - }; - document.addEventListener("mouseup", mouseUp); - document.addEventListener("mousemove", mouseMove); - }); - for (let ele of preview.querySelectorAll(BDFDB.dotCNC._themerepodragbar + BDFDB.dotCN._themerepodragcorner)) ele.addEventListener("mousedown", e => { - let moving = false; - let rects = BDFDB.DOMUtils.getRects(preview).toJSON(); - let oldX = e.pageX, oldY = e.pageY; - let mouseUp = _ => { - BDFDB.DOMUtils.removeClass(preview, BDFDB.disCN._themerepopreviewmoving); - document.removeEventListener("mouseup", mouseUp); - document.removeEventListener("mousemove", mouseMove); - }; - let vertical = ele.getAttribute("vertical"); - let horizontal = ele.getAttribute("horizontal"); - let mouseMove = e2 => { - if (moving || Math.sqrt((e.pageX - e2.pageX)**2) > 20 || Math.sqrt((e.pageY - e2.pageY)**2) > 20) { - if (!moving) BDFDB.DOMUtils.addClass(preview, BDFDB.disCN._themerepopreviewmoving); - moving = true; - BDFDB.ListenerUtils.stopEvent(e); - if (vertical) switch (vertical) { - case "top": - rects.top = rects.top - (oldY - e2.pageY); - if (rects.bottom - rects.top > 25) { - preview.style.setProperty("top", `${rects.top}px`); - preview.style.setProperty("height", `${rects.bottom - rects.top}px`); - } - break; - case "bottom": - rects.bottom = rects.bottom - (oldY - e2.pageY); - if (rects.bottom - rects.top > 25) preview.style.setProperty("height", `${rects.bottom - rects.top}px`); - break; - } - if (horizontal) switch (horizontal) { - case "right": - rects.right = rects.right - (oldX - e2.pageX); - if (rects.right - rects.left > 200) preview.style.setProperty("width", `${rects.right - rects.left}px`); - break; - case "left": - rects.left = rects.left - (oldX - e2.pageX); - if (rects.right - rects.left > 200) { - preview.style.setProperty("left", `${rects.left}px`); - preview.style.setProperty("width", `${rects.right - rects.left}px`); - } - break; - } - oldX = e2.pageX, oldY = e2.pageY; - } - }; - document.addEventListener("mouseup", mouseUp); - document.addEventListener("mousemove", mouseMove); - }); - preview.frame.addEventListener("load", _ => { - let titleBar = document.querySelector(BDFDB.dotCN.titlebar); - this.runInPreview({ - reason: "OnLoad", - username: BDFDB.UserUtils.me.username, - id: BDFDB.UserUtils.me.id, - discriminator: BDFDB.UserUtils.me.discriminator, - avatar: BDFDB.UserUtils.getAvatar(), - classes: JSON.stringify(BDFDB.DiscordClasses), - classModules: JSON.stringify(BDFDB.DiscordClassModules), - nativeCSS: (nativeCSS || "").replace(/\/assets\//g, document.location.origin + "/assets/").replace(/[\t\r\n]/g, ""), - bdCSS: (document.querySelector("#bd-stylesheet") || {}).innerText || "", - htmlClassName: document.documentElement.className, - titleBar: titleBar && titleBar.outerHTML || "" - }); - if (this.props.currentTheme) this.runInPreview({ - reason: "NewTheme", - checked: true, - css: this.props.currentTheme.css - }); - if (this.props.currentGenerator) this.runInPreview({ - reason: "NewTheme", - checked: true, - css: (generatorThemes.find(t => t.id == this.props.currentGenerator) || {}).fullCSS - }); - if (this.props.useLightMode) this.runInPreview({ - reason: "DarkLight", - checked: true - }); - if (this.props.useCustomCSS) this.runInPreview({ - reason: "CustomCSS", - checked: true - }); - if (this.props.useThemeFixer) this.runInPreview({ - reason: "ThemeFixer", - checked: true - }); - }); - preview.appendChild(preview.frame); - document.body.appendChild(preview); - let outerRects = BDFDB.DOMUtils.getRects(document.body); - preview.style.setProperty("top", `${outerRects.width/4}px`); - preview.style.setProperty("left", `${outerRects.height/4}px`); - preview.style.setProperty("width", `${outerRects.width/2}px`); - preview.style.setProperty("height", `${outerRects.height/2}px`); - window.removeEventListener("message", list.onPreviewMessage); - window.addEventListener("message", list.onPreviewMessage); - } - closePreview() { - if (list) window.removeEventListener("message", list.onPreviewMessage); - if (preview) preview.remove(); - preview = null; - } - runInPreview(data) { - if (preview && preview.frame) preview.frame.contentWindow.postMessage(Object.assign({origin: "ThemeRepo"}, data), "*"); - } - onPreviewMessage(e) { - let rects, outerRects; - if (preview && e.data && e.data.origin == "DiscordPreview") switch (e.data.reason) { - case "close": - list.closePreview(); - break; - case "minimize": - outerRects = BDFDB.DOMUtils.getRects(document.body); - preview.style.setProperty("top", `${outerRects.height - 25}px`); - preview.style.setProperty("left", "0px"); - preview.style.setProperty("width", "520px"); - preview.style.setProperty("height", "25px"); - break; - case "maximize": - rects = BDFDB.DOMUtils.getRects(preview), outerRects = BDFDB.DOMUtils.getRects(document.body); - if (!(rects.x == 0 && rects.y == 0 && outerRects.width - rects.width == 0 && outerRects.height - rects.height == 0)) { - preview.rects = rects; - BDFDB.DOMUtils.addClass(preview, BDFDB.disCN._themerepopreviewfullscreen); - preview.style.setProperty("top", "0px"); - preview.style.setProperty("left", "0px"); - preview.style.setProperty("width", `${outerRects.width}px`); - preview.style.setProperty("height", `${outerRects.height}px`); - } - else { - BDFDB.DOMUtils.removeClass(preview, BDFDB.disCN._themerepopreviewfullscreen); - if (!preview.rects || (outerRects.width - preview.rects.width == 0 && outerRects.height - preview.rects.height == 0)) { - preview.style.setProperty("top", `${outerRects.width/4}px`); - preview.style.setProperty("left", `${outerRects.height/4}px`); - preview.style.setProperty("width", `${outerRects.width/2}px`); - preview.style.setProperty("height", `${outerRects.height/2}px`); - } - else { - preview.style.setProperty("top", `${preview.rects.x}px`); - preview.style.setProperty("left", `${preview.rects.y}px`); - preview.style.setProperty("width", `${preview.rects.width}px`); - preview.style.setProperty("height", `${preview.rects.height}px`); - } - } - break; - } - } createThemeFile(name, filename, body, autoloadKey) { return new Promise(callback => BDFDB.LibraryRequires.fs.writeFile(BDFDB.LibraryRequires.path.join(BDFDB.BDUtils.getThemesFolder(), filename), body, error => { if (error) { @@ -434,12 +248,6 @@ module.exports = (_ => { delete this.props.generatorValues; } delete this.props.currentTheme; - if (preview) this.runInPreview({ - reason: "NewTheme", - checked: true, - css: (generatorTheme || {}).fullCSS - }); - else this.openPreview(); BDFDB.ReactUtils.forceUpdate(this); } }), @@ -462,7 +270,7 @@ module.exports = (_ => { } else { let generatorTheme = generatorThemes.find(t => t.id == this.props.currentGenerator); - if (generatorTheme) this.createThemeFile(generatorTheme.name, generatorTheme.name + ".theme.css", this.generateTheme(generatorTheme.fullCSS), "startDownloaded"); + if (generatorTheme) this.createThemeFile(generatorTheme.name, generatorTheme.rawSourceUrl.split("/").pop(), this.generateTheme(generatorTheme.fullCSS), "startDownloaded"); } } }), @@ -518,14 +326,7 @@ module.exports = (_ => { placeholder: oldValue, onChange: value => { BDFDB.TimeUtils.clear(updateGeneratorTimeout); - updateGeneratorTimeout = BDFDB.TimeUtils.timeout(_ => { - this.props.generatorValues[varName] = {value, oldValue}; - if (preview) this.runInPreview({ - reason: "NewTheme", - checked: true, - css: this.generateTheme(this.props.currentGeneratorIsNative ? nativeCSSvars : (generatorTheme || {}).fullCSS) - }); - }, 1000); + updateGeneratorTimeout = BDFDB.TimeUtils.timeout(_ => this.props.generatorValues[varName] = {value, oldValue}, 1000); } })); } @@ -564,65 +365,7 @@ module.exports = (_ => { _this.settings.general[key] = value; BDFDB.ReactUtils.forceUpdate(this); } - })), - BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelList, { - title: "Preview Settings", - children: [ - BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, { - type: "Switch", - label: "Use Light Mode", - value: this.props.useLightMode, - onChange: value => { - this.props.useLightMode = value; - if (preview) this.runInPreview({ - reason: "DarkLight", - checked: this.props.useLightMode - }); - } - }), - BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, { - type: "Switch", - label: "Include Custom CSS", - value: this.props.useCustomCSS, - onChange: value => { - this.props.useCustomCSS = value; - let customCSS = document.querySelector("style#customcss"); - if (preview && customCSS && customCSS.innerText.length > 0) this.runInPreview({ - reason: "CustomCSS", - checked: this.props.useCustomCSS, - css: customCSS.innerText - }); - } - }), - BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, { - type: "Switch", - margin: 20, - label: "Include ThemeFixer", - value: this.props.useThemeFixer, - onChange: value => { - this.props.useThemeFixer = value; - BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/ThemeRepo/_res/ThemeFixer.css", (error, response, body) => { - if (preview) this.runInPreview({ - reason: "ThemeFixer", - checked: this.props.useThemeFixer, - css: this.createFixerCSS(body) - }); - }); - } - }) - ] - }), - BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, { - type: "Button", - margin: 20, - label: "Download ThemeFixer", - children: "Download", - onClick: _ => { - BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/ThemeRepo/_res/ThemeFixer.css", (error, response, body) => { - this.createThemeFile("ThemeFixer", "ThemeFixer.theme.css", `/**\n * @name ThemeFixer\n * @description ThemeFixerCSS for transparent themes\n * @author DevilBro\n * @version 1.0.3\n * @authorId 278543574059057154\n * @invite Jx3TjNS\n * @donate https://www.paypal.me/MircoWittrien\n * @patreon https://www.patreon.com/MircoWittrien\n */\n\n` + this.createFixerCSS(body), "startDownloaded"); - }); - } - }) + })) ].flat(10).filter(n => n) }) ]; @@ -753,34 +496,6 @@ module.exports = (_ => { className: BDFDB.disCN.discoverycardname, children: this.props.data.name }), - BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, { - text: BDFDB.LanguageUtils.LanguageStrings.FORM_LABEL_VIDEO_PREVIEW, - children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, { - className: BDFDB.disCN.discoverycardtitlebutton, - children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, { - nativeClass: true, - width: 16, - height: 16, - name: BDFDB.LibraryComponents.SvgIcon.Names.EYE - }) - }), - onClick: _ => { - if (!list) return; - - list.props.currentTheme = this.props.data; - delete list.props.currentGenerator; - delete list.props.generatorValues; - - if (preview) list.runInPreview({ - reason: "NewTheme", - checked: value, - css: this.props.data.css - }); - else list.openPreview(); - - BDFDB.ReactUtils.forceUpdate(this); - } - }), this.props.data.latestSourceUrl && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, { text: BDFDB.LanguageUtils.LanguageStrings.SCREENSHARE_SOURCE, @@ -1084,95 +799,6 @@ module.exports = (_ => { StandardSidebarView: "default" } }; - - this.css = ` - ${BDFDB.dotCN._themerepopreview} { - border: 2px solid transparent; - box-shadow: var(--elevation-medium); - box-sizing: border-box; - position: absolute; - z-index: 10000000; - } - ${BDFDB.dotCN._themerepopreviewfullscreen} { - border: none; - } - ${BDFDB.dotCN._themerepomovebar} { - position: absolute; - height: 21px; - right: 100px; - left: 100px; - cursor: move; - z-index: 10000002; - } - ${BDFDB.dotCN._themerepodragbar} { - position: absolute; - z-index: 10000002; - } - ${BDFDB.dotCN._themerepodragcorner} { - position: absolute; - z-index: 10000003; - } - ${BDFDB.dotCN._themerepodragbar}#top { - top: -2px; - width: 100%; - height: 2px; - cursor: n-resize; - } - ${BDFDB.dotCN._themerepodragbar}#right { - right: -2px; - width: 2px; - height: 100%; - cursor: e-resize; - } - ${BDFDB.dotCN._themerepodragbar}#bottom { - bottom: -2px; - width: 100%; - height: 2px; - cursor: s-resize; - } - ${BDFDB.dotCN._themerepodragbar}#left { - left: -2px; - width: 2px; - height: 100%; - cursor: w-resize; - } - ${BDFDB.dotCN._themerepodragcorner} { - width: 4px; - height: 4px; - } - ${BDFDB.dotCN._themerepodragcorner}#top-left { - top: -2px; - left: -2px; - cursor: nw-resize; - } - ${BDFDB.dotCN._themerepodragcorner}#top-right { - top: -2px; - right: -2px; - cursor: ne-resize; - } - ${BDFDB.dotCN._themerepodragcorner}#bottom-right { - right: -2px; - bottom: -2px; - cursor: se-resize; - } - ${BDFDB.dotCN._themerepodragcorner}#bottom-left { - bottom: -2px; - left: -2px; - cursor: sw-resize; - } - ${BDFDB.dotCNS._themerepopreviewfullscreen + BDFDB.dotCN._themerepomovebar}, - ${BDFDB.dotCNS._themerepopreviewfullscreen + BDFDB.dotCN._themerepodraginterface} { - display: none; - } - ${BDFDB.dotCN._themerepopreview} iframe { - width: 100%; - height: 100%; - z-index: 10000001; - } - ${BDFDB.dotCN._themerepopreviewmoving} iframe { - pointer-events: none; - } - `; } onStart () { diff --git a/Plugins/_res/DiscordPreview.html b/Plugins/_res/DiscordPreview.html deleted file mode 100644 index 1b48e46fb1..0000000000 --- a/Plugins/_res/DiscordPreview.html +++ /dev/null @@ -1,2502 +0,0 @@ - - - - - - - - - - -
-
-
-
-
- -
-
-
-
-
-
Selected Server
-
-
-
- - - diff --git a/Plugins/_res/DiscordPreview.js b/Plugins/_res/DiscordPreview.js deleted file mode 100644 index cfb39fcf9d..0000000000 --- a/Plugins/_res/DiscordPreview.js +++ /dev/null @@ -1,318 +0,0 @@ -(_ => { - let DiscordClassModules, DiscordClasses, userId; - - window.global = window; - - const nativeRequire = window.require || (_ => {}); - const nativeWebpackJsonp = window.webpackJsonp; - const getWindow = _ => { - let electron = nativeRequire("electron"); - if (electron && electron.remote) { - let browserWindow = electron.remote.getCurrentWindow(); - if (browserWindow) return browserWindow; - } - }; - const respondToParent = (data = {}) => { - if (window.parent && typeof window.parent.postMessage == "function") window.parent.postMessage(data, "*"); - if (data.hostId != null && data.hostName != null) { - let ipcRenderer = (nativeRequire("electron") || {}).ipcRenderer; - if (ipcRenderer && typeof ipcRenderer.sendTo == "function") ipcRenderer.sendTo(data.hostId, data.hostName, data); - } - }; - - window.onload = function () { - respondToParent({ - origin: "DiscordPreview", - reason: "OnLoad" - }); - }; - window.onkeyup = function (e) { - respondToParent({ - origin: "DiscordPreview", - reason: "KeyUp", - which: e.which - }); - }; - window.onmessage = function (e) { - let data = e.data || e; - if (typeof data === "object" && (data.origin == "PluginRepo" || data.origin == "ThemeRepo")) { - switch (data.reason) { - case "OnLoad": - document.body.innerHTML = document.body.innerHTML.replace(/\t|\n|\r/g, ""); - - if (data.username) { - document.body.innerHTML = document.body.innerHTML.replace(/REPLACE_USERNAMESMALL/gi, data.username.toLowerCase()); - document.body.innerHTML = document.body.innerHTML.replace(/REPLACE_USERNAME/gi, data.username); - } - if (data.id) { - userId = data.id; - document.body.innerHTML = document.body.innerHTML.replace(/REPLACE_USERID/gi, data.id); - } - if (data.avatar) document.body.innerHTML = document.body.innerHTML.replace(/REPLACE_AVATAR/gi, data.avatar.split('"').join('') + "?size="); - if (data.discriminator) document.body.innerHTML = document.body.innerHTML.replace(/REPLACE_DISCRIMINATOR/gi, data.discriminator); - if (data.classes) DiscordClasses = JSON.parse(data.classes); - if (data.classModules) DiscordClassModules = JSON.parse(data.classModules); - - if (disCN != undefined && DiscordClasses != undefined && DiscordClassModules != undefined) { - let oldHTML = document.body.innerHTML.split("REPLACE_CLASS_"); - let newHTML = oldHTML.shift(); - for (let html of oldHTML) { - let reg = /([A-z0-9_]+)(.+)/.exec(html); - newHTML += disCN[reg[1]] + reg[2]; - } - document.body.innerHTML = newHTML; - } - - if (data.nativeCSS) { - let theme = document.createElement("style"); - theme.innerText = data.nativeCSS; - document.head.appendChild(theme); - } - - if (data.bdCSS) { - let theme = document.createElement("style"); - theme.innerText = data.bdCSS; - document.head.appendChild(theme); - } - - if (data.htmlClassName) document.documentElement.className = data.htmlClassName; - if (window.parent && typeof window.parent.postMessage == "function") document.documentElement.classList.add("iframe-mode"); - document.documentElement.classList.add("app-focused"); - document.documentElement.classList.add("mouse-mode"); - document.documentElement.classList.add("full-motion"); - - if (data.titleBar) document.querySelector(".preview-titlebar").outerHTML = data.titleBar; - - document.body.firstElementChild.style.removeProperty("display"); - document.addEventListener("click", event => { - let button = getParent(dotCNC.titlebarmacbutton + dotCN.titlebarwinbutton, event.target); - if (button) { - let browserWindow = getWindow(); - if (button.className.indexOf(disCN.titlebarmacbuttonclose) > -1 || button.className.indexOf(disCN.titlebarwinbuttonclose) > -1) { - if (browserWindow) browserWindow.close(); - respondToParent({ - origin: "DiscordPreview", - reason: "close" - }); - } - else if (button.className.indexOf(disCN.titlebarmacbuttonmax) > -1 || (button.className.indexOf(disCN.titlebarwinbuttonminmax) > -1 && button.parentElement.lastElementChild != button)) { - if (browserWindow) { - if (browserWindow.isMaximized()) browserWindow.unmaximize(); - else browserWindow.maximize(); - } - respondToParent({ - origin: "DiscordPreview", - reason: "maximize" - }); - } - else if (button.className.indexOf(disCN.titlebarmacbuttonmin) > -1 || (button.className.indexOf(disCN.titlebarwinbuttonminmax) > -1 && button.parentElement.lastElementChild == button)) { - if (browserWindow) browserWindow.minimize(); - respondToParent({ - origin: "DiscordPreview", - reason: "minimize" - }); - } - } - }); - break; - case "NewTheme": - case "CustomCSS": - case "ThemeFixer": - document.querySelectorAll("style." + data.reason).forEach(theme => theme.remove()); - if (data.checked) { - let theme = document.createElement("style"); - theme.classList.add(data.reason); - theme.innerText = data.css; - document.head.appendChild(theme); - } - break; - case "DarkLight": - if (data.checked) { - document.documentElement.className = document.documentElement.className.replace(new RegExp(disCN.themedark, "g"), disCN.themelight); - document.body.innerHTML = document.body.innerHTML.replace(new RegExp(disCN.themedark, "g"), disCN.themelight); - } - else { - document.documentElement.className = document.documentElement.className.replace(new RegExp(disCN.themelight, "g"), disCN.themedark); - document.body.innerHTML = document.body.innerHTML.replace(new RegExp(disCN.themelight, "g"), disCN.themedark); - } - break; - case "Normalize": - let oldHTML2 = document.body.innerHTML.split('class="'); - let newHTML2 = oldHTML2.shift(); - for (let html of oldHTML2) { - html = html.split('"'); - newHTML2 += 'class="' + (data.checked ? html[0].split(" ").map(n => n.replace(/([A-z0-9]+?)-([A-z0-9_-]{6})/g, "$1-$2 da-$1")).join(" ") : html[0].split(" ").filter(n => n.indexOf("da-") != 0).join(" ")) + '"' + html.slice(1).join('"'); - } - document.body.innerHTML = newHTML2; - break; - } - } - }; - let disCN = new Proxy({}, { - get: function (list, item) { - return getDiscordClass(item, false).replace("#", ""); - } - }); - let disCNS = new Proxy({}, { - get: function (list, item) { - return getDiscordClass(item, false).replace("#", "") + " "; - } - }); - let disCNC = new Proxy({}, { - get: function (list, item) { - return getDiscordClass(item, false).replace("#", "") + ","; - } - }); - let dotCN = new Proxy({}, { - get: function (list, item) { - let className = getDiscordClass(item, true); - return (className.indexOf("#") == 0 ? "" : ".") + className; - } - }); - let dotCNS = new Proxy({}, { - get: function (list, item) { - let className = getDiscordClass(item, true); - return (className.indexOf("#") == 0 ? "" : ".") + className + " "; - } - }); - let dotCNC = new Proxy({}, { - get: function (list, item) { - let className = getDiscordClass(item, true); - return (className.indexOf("#") == 0 ? "" : ".") + className + ","; - } - }); - let notCN = new Proxy({}, { - get: function (list, item) { - return `:not(.${getDiscordClass(item, true).split(".")[0]})`; - } - }); - let notCNS = new Proxy({}, { - get: function (list, item) { - return `:not(.${getDiscordClass(item, true).split(".")[0]}) `; - } - }); - let notCNC = new Proxy({}, { - get: function (list, item) { - return `:not(.${getDiscordClass(item, true).split(".")[0]}),`; - } - }); - let getDiscordClass = function (item, selector) { - let className = fallbackClassName = "Preview_undefined"; - if (DiscordClasses[item] === undefined) { - if (userId == "278543574059057154") console.warn(`%c[Preview]%c`, 'color: #3a71c1; font-weight: 700;', '', item + ' not found in DiscordClasses'); - return className; - } - else if (!Array.isArray(DiscordClasses[item]) || DiscordClasses[item].length != 2) { - if (userId == "278543574059057154") console.warn(`%c[Preview]%c`, 'color: #3a71c1; font-weight: 700;', '', item + ' is not an Array of Length 2 in DiscordClasses'); - return className; - } - else if (DiscordClassModules[DiscordClasses[item][0]] === undefined) { - if (userId == "278543574059057154") console.warn(`%c[Preview]%c`, 'color: #3a71c1; font-weight: 700;', '', DiscordClasses[item][0] + ' not found in DiscordClassModules'); - return className; - } - else if ([DiscordClasses[item][1]].flat().every(prop => DiscordClassModules[DiscordClasses[item][0]][prop] === undefined)) { - if (userId == "278543574059057154") console.warn(`%c[Preview]%c`, 'color: #3a71c1; font-weight: 700;', '', DiscordClasses[item][1] + ' not found in ' + DiscordClasses[item][0] + ' in DiscordClassModules'); - return className; - } - else { - for (let prop of [DiscordClasses[item][1]].flat()) { - className = DiscordClassModules[DiscordClasses[item][0]][prop]; - if (className) break; - else className = fallbackClassName; - } - className = DiscordClassModules[DiscordClasses[item][0]][DiscordClasses[item][1]]; - if (selector) { - className = className.split(" ").filter(n => n.indexOf("da-") != 0).join(selector ? "." : " "); - className = className || fallbackClassName; - } - return className || fallbackClassName; - } - }; - - let getParent = function (listOrSelector, node) { - let parent = null; - if (Node.prototype.isPrototypeOf(node) && listOrSelector) { - let list = NodeList.prototype.isPrototypeOf(listOrSelector) ? listOrSelector : typeof listOrSelector == "string" ? document.querySelectorAll(listOrSelector) : null; - if (list) for (let listNode of list) if (listNode.contains(node)) { - parent = listNode; - break; - } - } - return parent; - }; - - window.require = function () { - return _ => {}; - }; - - window.getString = function (obj) { - let string = ""; - if (typeof obj == "string") string = obj; - else if (obj && obj.props) { - if (typeof obj.props.children == "string") string = obj.props.children; - else if (Array.isArray(obj.props.children)) for (let c of obj.props.children) string += typeof c == "string" ? c : getString(c); - } - return string; - }; - - window.webpackJsonp = { - push: _ => ({ - m: {}, - c: {} - }) - }; - - window.fetch = function () { - return new Promise(_ => {}); - }; - - let XMLHttpRequestProto = XMLHttpRequest.prototype; - window.XMLHttpRequest = class {}; - for (let key of Object.keys(XMLHttpRequestProto)) try { - if (typeof XMLHttpRequestProto[key] == "function") window.XMLHttpRequest.prototype[key] = _ => {return new Promise(_ => {});}; - } catch(err) {} - - let WebModulesFind = function (filter) { - const id = "PluginRepo-WebModules"; - const req = nativeWebpackJsonp.push([[], {[id]: (module, exports, req) => module.exports = req}, [[id]]]); - delete req.m[id]; - delete req.c[id]; - for (let m in req.c) { - if (req.c.hasOwnProperty(m)) { - var module = req.c[m].exports; - if (module && module.__esModule && module.default && filter(module.default)) return module.default; - if (module && filter(module)) return module; - } - } - }; - let WebModulesFindByProperties = function (properties) { - properties = Array.isArray(properties) ? properties : Array.from(arguments); - let module = WebModulesFind(module => properties.every(prop => module[prop] !== undefined)); - if (!module) { - module = {}; - for (let property of properties) module[property] = property; - } - return module; - }; - let WebModulesFindByName = function (name) { - return WebModulesFind(module => module.displayName === name) || ""; - }; - - window.BDV2 = {}; - window.BDV2.react = window.React; - window.BDV2.reactDom = window.ReactDOM; - window.BDV2.WebpackModules = {}; - window.BDV2.WebpackModules.find = WebModulesFind; - window.BDV2.WebpackModules.findByUniqueProperties = WebModulesFindByProperties; - window.BDV2.WebpackModules.findByDisplayName = WebModulesFindByName; - - window.BdApi = {}; - window.BdApi.getData = _ => ({}); - window.BdApi.loadData = _ => ({}); - window.BdApi.saveData = _ => {}; - window.BdApi.React = window.React; - window.BdApi.ReactDOM = window.ReactDOM; - window.BdApi.findModule = WebModulesFind; - window.BdApi.findModuleByProps = WebModulesFindByProperties; - window.BdApi.findModuleByDisplayName = WebModulesFindByName; -})(); diff --git a/Plugins/_res/REPLACE_AVATAR b/Plugins/_res/REPLACE_AVATAR deleted file mode 100644 index b6295ad82bcd597ff936095560e45498f54bae95..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2964 zcmV;F3v2X=P)7?;*Fo-sJ7^{zw4{H>EGq| z@ACVty6JX|+soAPn5g8Wv*(_!=HBD>>FoK@*z=I0;+d)B=-G2ixy0@1 z?fKl|_UrEY`~3dQ)bgsh>D%D-{QUlsq~e;Z<&>u5-QxDY%I=n^-Q)JU#qErr;k(A|(%SRZ-SpYu^^c+Ap04G+$nMeE^W*3E&)4#_ z!0Y1Y_n)ukf|lO6!|au&1E=eWe|*4*^P&hW<1@Q$J3|NsB<_56sO z;G?qV{QdsI%vfFV_W1pSm)@JJ<#>+V z$*wqFps?oB+4JdaJSPAE2=PfoK~#7F?7@Km0001h zp#7;AsR95100000000000001BYVP`>jckts_=yL1m%6*Vd)M9F?YSHvqyn_KLxm-4 zU3}ZH8zk*}OFhe9wNgvcCc{kjj^y)u0-3pY#l-QC%TU{*H?ESj&-yh zYiup!9ku09ro5JSbhS1fYnw#eX*gMVzJ@_vKR}VbCWfdvKXI}F@uRNuOBX{7-aIh` zWrqJ3U^v&8opp!@S5KW~sIe9|Vp4wQIv;ZOR6C6AbVaX+A>F1r1A4noY@;$pbbuVEN{2OSJ@eEcSYuI5#m zpJz-q^?V!hBkTU1$}o;wIWUBzIcpf?%{B!uiifw%=buwHJ+}_`v{$Aw%$l`H(BH}c zLyWp{SHj~H0g4gWvo{HMT+MYbOyWxD%y-MnpwC4y$U)o^MTiG zSlDc)MjR_nz;}hATA{r(-sgF3sHD4#TH2k4Oe;gAL37J^&yBwn-^!rY4lS)~Wza@w z?E>%laz~GYdU$T>1cR!ev3Gb^@;L|fQuw2b_Z2}~Q@krRm3mso2dbf|Y#PlLXld9% zqp7(H4Shi4X@Pb+tTZ0WBs4RZM)W;2lSm`F4y|0EF`a-$w$PXsK^r;SX-u0-poz6K zsY8q7lTBxFNt%L@0X&6+&G$8eJV!b%sXw15|a0Mt9cuJ0PC-z*-t#CseeI#G#t3Jbn5`gY~x+ zs!3)%NQPQEHZvZiPC_LwF+S{sN)9qU+=5D)7$3%vbvt8V`E=v!%WD{uDyZNGDi)YiJ%m4uA3IMayuIn|_(M|FTLngm ziu6*Uk5(Z>)r*wvV-te>OPUN39Z$%hBHKHM5H8(LSqfGmTt}r5E&^3l#Bu_Ua5qtg z!hSp=&q-yf^u7dGrVzpK7-#fi2O`+()cqpRO9h@lu7y4#k>N}iCh89gg|pBpKA!x@?(94 z`X0h1W893jiUjQKA{rxAW$t8xEXV;>0(GKq7tqngA-x~YiE zhNzykQbOVoqFPLay7g-lnvOZL^aP?w3Q(b39kXJ2h@#C)N%lHKahyu^>ewl0cO#4z0B2Nm8WF6_qGDMP#Yg21OyLo>0A<*>ACE}OVhnt` zR!3!|;~`5elx0&D!X>TuFc#xF&kNXAiV*I%DVOI+J3^ccFg6z;$YsW8+16p)(bqiS zr2?+(r9RwIzIHWZbs2&zVC=e-m#sMG9U@j@Pe0W8n}c% zJZ9m{EZUaIdS1pIroUUMlB~*c+>yRr+p$vFlqI_XccdKNO%_*@rb;3)j(js%3rnb=I3W<$Jm59M-QF(I5OJ@-%z)hi2N$+CGfU=8Vj3&{Ue4(*C3AM0axFQLKn8^QIE2#5bJ6gqqxyh4BZSZZnQ80R~tmzGR>mw#8wr(P{4 zd@tZbydSmf^1~3G-T6lH4F)wr4UG)Ck^IKaXJITkkEI{)Nq%nr8n1aF)UeR(T{Hi= z