This commit is contained in:
poslop
2022-11-04 11:13:13 -05:00
parent 623a84748b
commit a81ed41ae7
25 changed files with 1909 additions and 2385 deletions

View File

@@ -1,6 +1,9 @@
{ {
"currentVersionInfo": { "currentVersionInfo": {
"version": "0.2.5", "version": "1.0.1",
"hasShownChangelog": true "hasShownChangelog": true
} },
"blurred": [],
"sen": [],
"seen": []
} }

View File

@@ -1,12 +1,11 @@
/** /**
* @name BlurNSFW * @name BlurNSFW
* @version 0.2.5 * @description Blurs images and videos until you hover over them.
* @authorLink https://twitter.com/IAmZerebos * @version 1.0.1
* @donate https://paypal.me/ZackRauen * @author Zerebos
* @patreon https://patreon.com/Zerebos * @authorId 249746236008169473
* @website https://github.com/rauenzi/BetterDiscordAddons/tree/master/Plugins/BlurNSFW * @website https://github.com/rauenzi/BetterDiscordAddons/tree/master/Plugins/BlurNSFW
* @source https://raw.githubusercontent.com/rauenzi/BetterDiscordAddons/master/Plugins/BlurNSFW/BlurNSFW.plugin.js * @source https://raw.githubusercontent.com/rauenzi/BetterDiscordAddons/master/Plugins/BlurNSFW/BlurNSFW.plugin.js
* @updateUrl https://raw.githubusercontent.com/rauenzi/BetterDiscordAddons/master/Plugins/BlurNSFW/BlurNSFW.plugin.js
*/ */
/*@cc_on /*@cc_on
@if (@_jscript) @if (@_jscript)
@@ -31,100 +30,243 @@
WScript.Quit(); WScript.Quit();
@else@*/ @else@*/
const config = {
module.exports = (() => { info: {
const config = {info:{name:"BlurNSFW",authors:[{name:"Zerebos",discord_id:"249746236008169473",github_username:"rauenzi",twitter_username:"ZackRauen"}],version:"0.2.5",description:"Blurs images in NSFW channels until you hover over it.",github:"https://github.com/rauenzi/BetterDiscordAddons/tree/master/Plugins/BlurNSFW",github_raw:"https://raw.githubusercontent.com/rauenzi/BetterDiscordAddons/master/Plugins/BlurNSFW/BlurNSFW.plugin.js"},changelog:[{title:"New Option",items:["An option to stop blurring a picture when clicking on it/expanding it was added to settings."]}],defaultConfig:[{type:"slider",id:"blurSize",name:"Blur Size",note:"The size (in px) of the blurred pixels.",value:10,min:0,max:50,units:"px"},{type:"slider",id:"blurTime",name:"Blur Time",note:"The time (in ms) it takes for the blur to disappear and reappear.",value:200,min:0,max:5000,units:"ms"},{type:"switch",id:"blurOnFocus",name:"Blur When Focused",note:"This setting keeps the blur when clicking on/expanding an image.",value:true}],main:"index.js"}; name: "BlurNSFW",
authors: [
return !global.ZeresPluginLibrary ? class { {
constructor() {this._config = config;} name: "Zerebos",
getName() {return config.info.name;} discord_id: "249746236008169473",
getAuthor() {return config.info.authors.map(a => a.name).join(", ");} github_username: "rauenzi",
getDescription() {return config.info.description;} twitter_username: "ZackRauen"
getVersion() {return config.info.version;} }
load() { ],
BdApi.showConfirmationModal("Library Missing", `The library plugin needed for ${config.info.name} is missing. Please click Download Now to install it.`, { version: "1.0.1",
confirmText: "Download Now", description: "Blurs images and videos until you hover over them.",
cancelText: "Cancel", github: "https://github.com/rauenzi/BetterDiscordAddons/tree/master/Plugins/BlurNSFW",
onConfirm: () => { github_raw: "https://raw.githubusercontent.com/rauenzi/BetterDiscordAddons/master/Plugins/BlurNSFW/BlurNSFW.plugin.js"
require("request").get("https://rauenzi.github.io/BDPluginLibrary/release/0PluginLibrary.plugin.js", async (error, response, body) => { },
if (error) return require("electron").shell.openExternal("https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js"); changelog: [
await new Promise(r => require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0PluginLibrary.plugin.js"), body, r)); {
title: "What's New?",
type: "fixed",
items: [
"Context menu and blurring should work again!",
"Blurring and unblurring happen quicker and using less resources now!"
]
},
{
title: "Known Issues",
items: [
"The checkbox in the context menu won't update after clicking.",
"This is just a visual issue, the functionality is fine."
]
}
],
defaultConfig: [
{
type: "switch",
id: "blurNSFW",
name: "Blur NSFW Channels",
note: "This setting automatically blurs media in channels marked NSFW.",
value: true
},
{
type: "slider",
id: "blurSize",
name: "Blur Size",
note: "The size (in px) of the blurred pixels.",
value: 10,
min: 0,
max: 50,
units: "px"
},
{
type: "slider",
id: "blurTime",
name: "Blur Time",
note: "The time (in ms) it takes for the blur to disappear and reappear.",
value: 200,
min: 0,
max: 5000,
units: "ms"
},
{
type: "switch",
id: "blurOnFocus",
name: "Blur When Focused",
note: "This setting keeps the blur when clicking on/expanding an image.",
value: true
}
],
main: "index.js"
};
class Dummy {
constructor() {this._config = config;}
start() {}
stop() {}
}
if (!global.ZeresPluginLibrary) {
BdApi.showConfirmationModal("Library Missing", `The library plugin needed for ${config.name ?? config.info.name} is missing. Please click Download Now to install it.`, {
confirmText: "Download Now",
cancelText: "Cancel",
onConfirm: () => {
require("request").get("https://betterdiscord.app/gh-redirect?id=9", async (err, resp, body) => {
if (err) return require("electron").shell.openExternal("https://betterdiscord.app/Download?id=9");
if (resp.statusCode === 302) {
require("request").get(resp.headers.location, async (error, response, content) => {
if (error) return require("electron").shell.openExternal("https://betterdiscord.app/Download?id=9");
await new Promise(r => require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0PluginLibrary.plugin.js"), content, r));
}); });
} }
else {
await new Promise(r => require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0PluginLibrary.plugin.js"), body, r));
}
}); });
} }
start() {} });
stop() {} }
} : (([Plugin, Api]) => {
const plugin = (Plugin, Api) => { module.exports = !global.ZeresPluginLibrary ? Dummy : (([Plugin, Api]) => {
const {Patcher, WebpackModules, DiscordModules, PluginUtilities, Utilities} = Api; const plugin = (Plugin, Api) => {
const {ContextMenu, DOM, Webpack, Patcher} = window.BdApi;
const SelectedChannelStore = DiscordModules.SelectedChannelStore; const SelectedChannelStore = Webpack.getModule(m => m.getCurrentlySelectedChannelId);
const ChannelStore = DiscordModules.ChannelStore; const ChannelStore = Webpack.getModule(m => m.getDMFromUserId);
const ReactDOM = DiscordModules.ReactDOM; const InlineMediaWrapper = Webpack.getModule(m => m.toString().includes("renderAccessory"));
const InlineMediaWrapper = WebpackModules.getByProps("ImageReadyStates").default; const WrapperClasses = Webpack.getModule(m => m.wrapperPlaying);
const Events = require("events");
const Dispatcher = new Events();
return class BlurNSFW extends Plugin { const formatString = (string, values) => {
constructor() { for (const val in values) {
let replacement = values[val];
if (Array.isArray(replacement)) replacement = JSON.stringify(replacement);
if (typeof(replacement) === "object" && replacement !== null) replacement = replacement.toString();
string = string.replace(new RegExp(`{{${val}}}`, "g"), replacement);
}
return string;
};
/* globals BdApi:false */
return class BlurMedia extends Plugin {
constructor(meta) {
super(); super();
this.meta = meta;
this.styleTemplate = ` this.styleTemplate = `
{{blurOnFocus}} {{blurOnFocus}}
img.blur:hover, .${WrapperClasses.wrapperPlaying.split(" ").join(".")} video,
video.blur:hover { .${WrapperClasses.wrapperControlsHidden.split(" ").join(".")} video,
.blur:hover img,
.blur:hover video,
a:hover + div > .blur {
transition: {{time}}ms cubic-bezier(.2, .11, 0, 1) !important; transition: {{time}}ms cubic-bezier(.2, .11, 0, 1) !important;
filter: blur(0px) !important; filter: blur(0px) !important;
} }
img.blur, .blur img,
video.blur { .blur video {
filter: blur({{size}}px) !important; filter: blur({{size}}px) !important;
transition: {{time}}ms cubic-bezier(.2, .11, 0, 1) !important; transition: {{time}}ms cubic-bezier(.2, .11, 0, 1) !important;
}`; }`;
this.channelChange = this.channelChange.bind(this);
} }
onStart() { onStart() {
const blurAccessory = (thisObject) => { /** @type {Set<string>} */
this.blurredChannels = new Set(BdApi.loadData(this.meta.name, "blurred") ?? []);
/** @type {Set<string>} */
this.seenChannels = new Set(BdApi.loadData(this.meta.name, "seen") ?? []);
Patcher.after(this.meta.name, InlineMediaWrapper.prototype, "render", (thisObject, _, retVal) => {
const channel = ChannelStore.getChannel(SelectedChannelStore.getChannelId()); const channel = ChannelStore.getChannel(SelectedChannelStore.getChannelId());
if (!channel || !channel.isNSFW || !channel.isNSFW()) return; if (!this.hasBlur(channel)) return;
const element = ReactDOM.findDOMNode(thisObject); if (retVal.props.className) retVal.props.className = retVal.props.className + " blur";
const mediaElement = element.querySelector("img") || element.querySelector("video"); else retVal.props.className = "blur";
if (!mediaElement) return; });
mediaElement.classList.add("blur"); Patcher.after(this.meta.name, InlineMediaWrapper.prototype, "componentDidMount", (thisObject) => {
if (thisObject.cancelBlurListener) return;
if (mediaElement.tagName !== "VIDEO") return; const listener = () => thisObject.forceUpdate();
mediaElement.addEventListener("play", () => { Dispatcher.on("blur", listener);
if (mediaElement.autoplay) return; thisObject.cancelBlurListener = () => Dispatcher.off("blur", listener);
mediaElement.classList.remove("blur"); });
});
mediaElement.addEventListener("pause", () => { Patcher.after(this.meta.name, InlineMediaWrapper.prototype, "componentWillUnmount", (thisObject) => {
if (mediaElement.autoplay) return; if (!thisObject.cancelBlurListener) return;
mediaElement.classList.add("blur"); thisObject.cancelBlurListener();
}); delete thisObject.cancelBlurListener;
}; });
Patcher.after(InlineMediaWrapper.prototype, "componentDidMount", blurAccessory);
Patcher.after(InlineMediaWrapper.prototype, "componentDidUpdate", blurAccessory);
this.addStyle(); this.addStyle();
SelectedChannelStore.addChangeListener(this.channelChange);
this.promises = {state: {cancelled: false}, cancel() {this.state.cancelled = true;}};
this.patchChannelContextMenu();
} }
onStop() { onStop() {
Patcher.unpatchAll(); BdApi.saveData(this.meta.name, "blurred", this.blurredChannels);
BdApi.saveData(this.meta.name, "seen", this.seenChannels);
this.contextMenuPatch?.();
this.removeStyle(); this.removeStyle();
SelectedChannelStore.removeChangeListener(this.channelChange);
}
hasBlur(channel) {
return this.blurredChannels.has(channel.id);
}
addBlur(channel) {
this.blurredChannels.add(channel.id);
Dispatcher.emit("blur");
}
removeBlur(channel) {
this.blurredChannels.delete(channel.id);
Dispatcher.emit("blur");
}
channelChange() {
Dispatcher?.removeAllListeners();
const channel = ChannelStore.getChannel(SelectedChannelStore.getChannelId());
if (this.seenChannels.has(channel.id)) return;
this.seenChannels.add(channel.id);
if (this.settings.blurNSFW && channel.nsfw) this.addBlur(channel);
}
patchChannelContextMenu() {
this.contextMenuPatch = ContextMenu.patch("channel-context", (retVal, props) => {
const newItem = ContextMenu.buildItem({
type: "toggle",
label: "Blur Media",
active: this.hasBlur(props.channel),
action: () => {
if (this.hasBlur(props.channel)) this.removeBlur(props.channel);
else this.addBlur(props.channel);
}
});
retVal.props.children.splice(1, 0, newItem);
});
} }
addStyle() { addStyle() {
const styleString = Utilities.formatString(this.styleTemplate, { const styleString = formatString(this.styleTemplate, {
size: Math.round(this.settings.blurSize), size: Math.round(this.settings.blurSize),
time: Math.round(this.settings.blurTime), time: Math.round(this.settings.blurTime),
blurOnFocus: this.settings.blurOnFocus ? "" : ".layer-2KE1M9 img.blur," blurOnFocus: this.settings.blurOnFocus ? "" : ".layer-1Ixpg3 .blur img,"
}); });
PluginUtilities.addStyle(this.getName(), styleString); DOM.addStyle(this.meta.name, styleString);
} }
removeStyle() { removeStyle() {
PluginUtilities.removeStyle(this.getName()); DOM.removeStyle(this.meta.name);
} }
getSettingsPanel() { getSettingsPanel() {
@@ -138,7 +280,6 @@ module.exports = (() => {
}; };
}; };
return plugin(Plugin, Api); return plugin(Plugin, Api);
})(global.ZeresPluginLibrary.buildPlugin(config)); })(global.ZeresPluginLibrary.buildPlugin(config));
})();
/*@end@*/ /*@end@*/

View File

@@ -2,44 +2,19 @@
* @name CreationDate * @name CreationDate
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 1.4.6 * @version 9.9.9
* @description Displays the Creation Date of an Account in the UserPopout and UserModal * @description PLUGIN WAS DISCONTINUED
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
* @patreon https://www.patreon.com/MircoWittrien
* @website https://mwittrien.github.io/
* @source https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/CreationDate/
* @updateUrl https://mwittrien.github.io/BetterDiscordAddons/Plugins/CreationDate/CreationDate.plugin.js
*/ */
module.exports = (_ => { module.exports = (_ => {
const config = { const changeLog = {};
"info": {
"name": "CreationDate",
"author": "DevilBro",
"version": "1.4.6",
"description": "Displays the Creation Date of an Account in the UserPopout and UserModal"
},
"changeLog": {
"fixed": {
"User Popout": "Fixing Stuff for the User Popout Update, thanks Discord"
}
}
};
return (window.Lightcord && !Node.prototype.isPrototypeOf(window.Lightcord) || window.LightCord && !Node.prototype.isPrototypeOf(window.LightCord) || window.Astra && !Node.prototype.isPrototypeOf(window.Astra)) ? class { return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class {
getName () {return config.info.name;} constructor (meta) {for (let key in meta) this[key] = meta[key];}
getAuthor () {return config.info.author;} getName () {return this.name;}
getVersion () {return config.info.version;} getAuthor () {return this.author;}
getDescription () {return "Do not use LightCord!";} getVersion () {return this.version;}
load () {BdApi.alert("Attention!", "By using LightCord you are risking your Discord Account, due to using a 3rd Party Client. Switch to an official Discord Client (https://discord.com/) with the proper BD Injection (https://betterdiscord.app/)");} getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;}
start() {}
stop() {}
} : !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class {
getName () {return config.info.name;}
getAuthor () {return config.info.author;}
getVersion () {return config.info.version;}
getDescription () {return `The Library Plugin needed for ${config.info.name} is missing. Open the Plugin Settings to download it. \n\n${config.info.description}`;}
downloadLibrary () { downloadLibrary () {
require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => {
@@ -52,7 +27,7 @@ module.exports = (_ => {
if (!window.BDFDB_Global || !Array.isArray(window.BDFDB_Global.pluginQueue)) window.BDFDB_Global = Object.assign({}, window.BDFDB_Global, {pluginQueue: []}); if (!window.BDFDB_Global || !Array.isArray(window.BDFDB_Global.pluginQueue)) window.BDFDB_Global = Object.assign({}, window.BDFDB_Global, {pluginQueue: []});
if (!window.BDFDB_Global.downloadModal) { if (!window.BDFDB_Global.downloadModal) {
window.BDFDB_Global.downloadModal = true; window.BDFDB_Global.downloadModal = true;
BdApi.showConfirmationModal("Library Missing", `The Library Plugin needed for ${config.info.name} is missing. Please click "Download Now" to install it.`, { BdApi.showConfirmationModal("Library Missing", `The Library Plugin needed for ${this.name} is missing. Please click "Download Now" to install it.`, {
confirmText: "Download Now", confirmText: "Download Now",
cancelText: "Cancel", cancelText: "Cancel",
onCancel: _ => {delete window.BDFDB_Global.downloadModal;}, onCancel: _ => {delete window.BDFDB_Global.downloadModal;},
@@ -62,248 +37,40 @@ module.exports = (_ => {
} }
}); });
} }
if (!window.BDFDB_Global.pluginQueue.includes(config.info.name)) window.BDFDB_Global.pluginQueue.push(config.info.name); if (!window.BDFDB_Global.pluginQueue.includes(this.name)) window.BDFDB_Global.pluginQueue.push(this.name);
} }
start () {this.load();} start () {this.load();}
stop () {} stop () {}
getSettingsPanel () { getSettingsPanel () {
let template = document.createElement("template"); let template = document.createElement("template");
template.innerHTML = `<div style="color: var(--header-primary); font-size: 16px; font-weight: 300; white-space: pre; line-height: 22px;">The Library Plugin needed for ${config.info.name} is missing.\nPlease click <a style="font-weight: 500;">Download Now</a> to install it.</div>`; template.innerHTML = `<div style="color: var(--header-primary); font-size: 16px; font-weight: 300; white-space: pre; line-height: 22px;">The Library Plugin needed for ${this.name} is missing.\nPlease click <a style="font-weight: 500;">Download Now</a> to install it.</div>`;
template.content.firstElementChild.querySelector("a").addEventListener("click", this.downloadLibrary); template.content.firstElementChild.querySelector("a").addEventListener("click", this.downloadLibrary);
return template.content.firstElementChild; return template.content.firstElementChild;
} }
} : (([Plugin, BDFDB]) => { } : (([Plugin, BDFDB]) => {
return class CreationDate extends Plugin { return class CreationDate extends Plugin {
onLoad () { onLoad () {}
this.defaults = {
general: {
displayText: {value: true, description: "Display '{{presuffix}}' in the Date"}
},
places: {
userPopout: {value: true, description: "User Popouts"},
userProfile: {value: true, description: "User Profile Modal"}
},
dates: {
creationDate: {value: {}, description: "Creation Date"},
}
};
this.patchedModules = {
after: {
UserPopoutInfo: "UserPopoutInfo",
UserProfileModalHeader: "default"
}
};
}
onStart () { onStart () {
BDFDB.PatchUtils.forceAllUpdates(this); BDFDB.ModalUtils.open(this, {
} header: "PLUGIN WAS DISCONTINUED",
children: [
onStop () { BDFDB.ReactUtils.createElement("span", {children: "DISCORD ADDED THIS FEATURE BY THEMSELVES, MAKING THIS PLUGIN USELESS "}),
BDFDB.PatchUtils.forceAllUpdates(this); BDFDB.ReactUtils.createElement("strong", {children: "DELETE"}),
} BDFDB.ReactUtils.createElement("span", {children: " TO REMOVE THIS EMPTY PLUGIN FILE."})
BDFDB.ReactUtils.createElement("strong", {children: "DELETE"}),
getSettingsPanel (collapseStates = {}) { BDFDB.ReactUtils.createElement("span", {children: " TO REMOVE THIS EMPTY PLUGIN FILE."})
let settingsPanel; ],
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, { buttons: [
collapseStates: collapseStates, {contents: "DELETE", close: true, color: "RED", onClick: _ => {
children: _ => { BDFDB.LibraryRequires.fs.unlink(BDFDB.LibraryRequires.path.join(BDFDB.BDUtils.getPluginsFolder(), "CreationDate.plugin.js"), error => {});
let settingsItems = []; BDFDB.LibraryRequires.fs.unlink(BDFDB.LibraryRequires.path.join(BDFDB.BDUtils.getPluginsFolder(), "CreationDate.config.json"), error => {});
}}
settingsItems.push(Object.keys(this.defaults.general).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, { ]
type: "Switch",
plugin: this,
keys: ["general", key],
label: key == "displayText" ? this.defaults.general[key].description.replace("{{presuffix}}", this.labels.created_at.replace("{{time}}", "").trim()) : this.defaults.general[key].description,
value: this.settings.general[key]
})));
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
className: BDFDB.disCN.marginbottom8
}));
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelList, {
title: "Add Date in:",
children: Object.keys(this.defaults.places).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
type: "Switch",
plugin: this,
keys: ["places", key],
label: this.defaults.places[key].description,
value: this.settings.places[key]
}))
}));
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
className: BDFDB.disCN.marginbottom8
}));
settingsItems.push(Object.keys(this.defaults.dates).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.DateInput, Object.assign({}, this.settings.dates[key], {
label: this.defaults.dates[key].description,
prefix: _ => (this.settings.general.displayText && this.labels.created_at.split("{{time}}")[0] || "").trim(),
suffix: _ => (this.settings.general.displayText && this.labels.created_at.split("{{time}}")[1] || "").trim(),
onChange: valueObj => {
this.SettingsUpdated = true;
this.settings.dates[key] = valueObj;
BDFDB.DataUtils.save(this.settings.dates, this, "dates");
}
}))));
return settingsItems.flat(10);
}
}); });
} }
onSettingsClosed () {
if (this.SettingsUpdated) {
delete this.SettingsUpdated;
BDFDB.PatchUtils.forceAllUpdates(this);
}
}
processUserPopoutInfo (e) {
if (e.instance.props.user && this.settings.places.userPopout) {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: ["DiscordTag", "ColoredFluxTag"]});
if (index > -1) this.injectDate(children, index + 1, e.instance.props.user);
}
}
processUserProfileModalHeader (e) {
if (e.instance.props.user && this.settings.places.userProfile) {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: ["DiscordTag", "ColoredFluxTag"]});
if (index > -1) this.injectDate(children, index + 1, e.instance.props.user);
}
}
injectDate (children, index, user) { onStop () {}
let timestamp = BDFDB.LibraryComponents.DateInput.format(this.settings.dates.creationDate, user.createdAt);
children.splice(index, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextScroller, {
className: BDFDB.disCNS._creationdatedate + BDFDB.disCNS.userinfodate + BDFDB.disCN.textrow,
children: this.settings.general.displayText ? this.labels.created_at.replace("{{time}}", timestamp) : timestamp
}));
}
setLabelsByLanguage () {
switch (BDFDB.LanguageUtils.getLanguage().id) {
case "bg": // Bulgarian
return {
created_at: "Създадено на {{time}}"
};
case "cs": // Czech
return {
created_at: "Vytvořeno {{time}}"
};
case "da": // Danish
return {
created_at: "Oprettet den {{time}}"
};
case "de": // German
return {
created_at: "Erstellt am {{time}}"
};
case "el": // Greek
return {
created_at: "Δημιουργήθηκε στις {{time}}"
};
case "es": // Spanish
return {
created_at: "Creado el {{time}}"
};
case "fi": // Finnish
return {
created_at: "Luotu {{time}}"
};
case "fr": // French
return {
created_at: "Créé le {{time}}"
};
case "hi": // Hindi
return {
created_at: "{{time}} को बनाया गया"
};
case "hr": // Croatian
return {
created_at: "Izrađeno {{time}}"
};
case "hu": // Hungarian
return {
created_at: "Létrehozva: {{time}}"
};
case "it": // Italian
return {
created_at: "Creato il {{time}}"
};
case "ja": // Japanese
return {
created_at: "{{time}}に作成"
};
case "ko": // Korean
return {
created_at: "{{time}}에 생성됨"
};
case "lt": // Lithuanian
return {
created_at: "Sukurta {{time}}"
};
case "nl": // Dutch
return {
created_at: "Gemaakt op {{time}}"
};
case "no": // Norwegian
return {
created_at: "Opprettet {{time}}"
};
case "pl": // Polish
return {
created_at: "Utworzono {{time}}"
};
case "pt-BR": // Portuguese (Brazil)
return {
created_at: "Criado em {{time}}"
};
case "ro": // Romanian
return {
created_at: "Creat la {{time}}"
};
case "ru": // Russian
return {
created_at: "Создано {{time}}"
};
case "sv": // Swedish
return {
created_at: "Skapad {{time}}"
};
case "th": // Thai
return {
created_at: "สร้างเมื่อ {{time}}"
};
case "tr": // Turkish
return {
created_at: "{{time}} tarihinde oluşturuldu"
};
case "uk": // Ukrainian
return {
created_at: "Створено {{time}}"
};
case "vi": // Vietnamese
return {
created_at: "Được tạo vào {{time}}"
};
case "zh-CN": // Chinese (China)
return {
created_at: "创建于{{time}}"
};
case "zh-TW": // Chinese (Taiwan)
return {
created_at: "創建於{{time}}"
};
default: // English
return {
created_at: "Created on {{time}}"
};
}
}
}; };
})(window.BDFDB_Global.PluginUtils.buildPlugin(config)); })(window.BDFDB_Global.PluginUtils.buildPlugin(changeLog));
})(); })();

View File

@@ -2,7 +2,7 @@
* @name EditRoles * @name EditRoles
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 1.0.9 * @version 1.1.2
* @description Allows you to locally edit Roles * @description Allows you to locally edit Roles
* @invite Jx3TjNS * @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien * @donate https://www.paypal.me/MircoWittrien
@@ -13,25 +13,16 @@
*/ */
module.exports = (_ => { module.exports = (_ => {
const config = { const changeLog = {
"info": {
"name": "EditRoles",
"author": "DevilBro",
"version": "1.0.9",
"description": "Allows you to locally edit Roles"
},
"changeLog": {
"fixed": {
"Remove Icon": "Now works again"
}
}
}; };
return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class { return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class {
getName () {return config.info.name;} constructor (meta) {for (let key in meta) this[key] = meta[key];}
getAuthor () {return config.info.author;} getName () {return this.name;}
getVersion () {return config.info.version;} getAuthor () {return this.author;}
getDescription () {return `The Library Plugin needed for ${config.info.name} is missing. Open the Plugin Settings to download it. \n\n${config.info.description}`;} getVersion () {return this.version;}
getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;}
downloadLibrary () { downloadLibrary () {
require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => {
@@ -44,7 +35,7 @@ module.exports = (_ => {
if (!window.BDFDB_Global || !Array.isArray(window.BDFDB_Global.pluginQueue)) window.BDFDB_Global = Object.assign({}, window.BDFDB_Global, {pluginQueue: []}); if (!window.BDFDB_Global || !Array.isArray(window.BDFDB_Global.pluginQueue)) window.BDFDB_Global = Object.assign({}, window.BDFDB_Global, {pluginQueue: []});
if (!window.BDFDB_Global.downloadModal) { if (!window.BDFDB_Global.downloadModal) {
window.BDFDB_Global.downloadModal = true; window.BDFDB_Global.downloadModal = true;
BdApi.showConfirmationModal("Library Missing", `The Library Plugin needed for ${config.info.name} is missing. Please click "Download Now" to install it.`, { BdApi.showConfirmationModal("Library Missing", `The Library Plugin needed for ${this.name} is missing. Please click "Download Now" to install it.`, {
confirmText: "Download Now", confirmText: "Download Now",
cancelText: "Cancel", cancelText: "Cancel",
onCancel: _ => {delete window.BDFDB_Global.downloadModal;}, onCancel: _ => {delete window.BDFDB_Global.downloadModal;},
@@ -54,13 +45,13 @@ module.exports = (_ => {
} }
}); });
} }
if (!window.BDFDB_Global.pluginQueue.includes(config.info.name)) window.BDFDB_Global.pluginQueue.push(config.info.name); if (!window.BDFDB_Global.pluginQueue.includes(this.name)) window.BDFDB_Global.pluginQueue.push(this.name);
} }
start () {this.load();} start () {this.load();}
stop () {} stop () {}
getSettingsPanel () { getSettingsPanel () {
let template = document.createElement("template"); let template = document.createElement("template");
template.innerHTML = `<div style="color: var(--header-primary); font-size: 16px; font-weight: 300; white-space: pre; line-height: 22px;">The Library Plugin needed for ${config.info.name} is missing.\nPlease click <a style="font-weight: 500;">Download Now</a> to install it.</div>`; template.innerHTML = `<div style="color: var(--header-primary); font-size: 16px; font-weight: 300; white-space: pre; line-height: 22px;">The Library Plugin needed for ${this.name} is missing.\nPlease click <a style="font-weight: 500;">Download Now</a> to install it.</div>`;
template.content.firstElementChild.querySelector("a").addEventListener("click", this.downloadLibrary); template.content.firstElementChild.querySelector("a").addEventListener("click", this.downloadLibrary);
return template.content.firstElementChild; return template.content.firstElementChild;
} }
@@ -71,18 +62,21 @@ module.exports = (_ => {
onLoad () { onLoad () {
this.patchedModules = { this.patchedModules = {
before: { before: {
RoleMention: "default",
AutocompleteRoleResult: "render",
MessageHeader: "default", MessageHeader: "default",
ChannelMembers: "render", ChannelMembers: "render",
MemberListItem: "render", MemberListItem: "render",
UserPopoutBodySection: "default",
UserPopoutBody: "default" UserPopoutBody: "default"
},
after: {
RichRoleMention: "RoleMention"
} }
}; };
} }
onStart () { onStart () {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.GuildStore, "getGuild", {after: e => {
if (e.returnValue) e.returnValue = this.changeRolesInGuild(e.returnValue, true);
}});
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.PermissionRoleUtils, "getHighestRole", {after: e => { BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.PermissionRoleUtils, "getHighestRole", {after: e => {
if (e.returnValue && changedRoles[e.returnValue.id]) { if (e.returnValue && changedRoles[e.returnValue.id]) {
let data = changedRoles[e.returnValue.id]; let data = changedRoles[e.returnValue.id];
@@ -168,14 +162,15 @@ module.exports = (_ => {
if (e.subType == "useUserRolesItems") { if (e.subType == "useUserRolesItems") {
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "roles"}); let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "roles"});
if (index > -1 && children[index].props && BDFDB.ArrayUtils.is(children[index].props.children)) for (let child of children[index].props.children) { if (index > -1 && children[index].props && BDFDB.ArrayUtils.is(children[index].props.children)) for (let child of children[index].props.children) {
if (child && child.props && typeof child.props.label == "function") { if (child && child.props && typeof child.props.label == "function" && changedRoles[child.props.id]) {
let data = changedRoles[child.props.id];
let renderLabel = child.props.label; let renderLabel = child.props.label;
child.props.label = (...args) => { child.props.label = BDFDB.TimeUtils.suppress((...args) => {
let label = renderLabel(...args); let label = renderLabel(...args);
let onContextMenu = typeof label.props.onContextMenu == "function" ? label.props.onContextMenu : (_ => {}); if (data.color && label.props.children[0] && label.props.children[0].props) label.props.children[0].props.color = BDFDB.ColorUtils.convert(data.color, "hex");
label.props.onContextMenu = event => BDFDB.LibraryModules.ContextMenuUtils.openContextMenu(event, e => BDFDB.ReactUtils.createElement(BDFDB.ModuleUtils.findByName("DeveloperContextMenu"), Object.assign({}, e2, {id: child.props.id}))); if (data.name && label.props.children[1] && label.props.children[1].props && label.props.children[1].props.children) label.props.children[1].props.children = data.name;
return label; return label;
}; }, "Error in renderLabel of UserRolesItems", this);
} }
} }
} }
@@ -223,6 +218,30 @@ module.exports = (_ => {
].flat(10).filter(n => n); ].flat(10).filter(n => n);
} }
processRichRoleMention (e) {
if (e.instance.props.id && changedRoles[e.instance.props.id]) {
e.returnvalue.props.color = changedRoles[e.instance.props.id].color ? BDFDB.ColorUtils.convert(changedRoles[e.instance.props.id].color, "int") : e.returnvalue.props.color;
e.returnvalue.props.children[1] = changedRoles[e.instance.props.id].name || e.returnvalue.props.children[1];
}
}
processRoleMention (e) {
if (e.instance.props.roleId && changedRoles[e.instance.props.roleId]) {
e.instance.props.roleColor = changedRoles[e.instance.props.roleId].color ? BDFDB.ColorUtils.convert(changedRoles[e.instance.props.roleId].color, "int") : e.instance.props.roleColor;
e.instance.props.children = [`@${changedRoles[e.instance.props.roleId].name || e.instance.props.children[1]}`];
if (e.instance.props.content && e.instance.props.content[0]) e.instance.props.content[0].content = `@${changedRoles[e.instance.props.roleId].name || e.instance.props.children[1]}`;
}
}
processAutocompleteRoleResult (e) {
if (e.instance.props.role && changedRoles[e.instance.props.role.id]) {
e.instance.props.role = Object.assign({}, e.instance.props.role);
e.instance.props.role.color = changedRoles[e.instance.props.role.id].color ? BDFDB.ColorUtils.convert(changedRoles[e.instance.props.role.id].color, "int") : e.instance.props.role.color;
e.instance.props.role.colorString = changedRoles[e.instance.props.role.id].color ? BDFDB.ColorUtils.convert(changedRoles[e.instance.props.role.id].color, "hex") : e.instance.props.role.colorString;
e.instance.props.role.name = changedRoles[e.instance.props.role.id].name || e.instance.props.role.name;
}
}
processChannelMembers (e) { processChannelMembers (e) {
e.instance.props.groups = [].concat(e.instance.props.groups); e.instance.props.groups = [].concat(e.instance.props.groups);
for (let i in e.instance.props.groups) if (e.instance.props.groups[i].type == "GROUP") { for (let i in e.instance.props.groups) if (e.instance.props.groups[i].type == "GROUP") {
@@ -243,6 +262,10 @@ module.exports = (_ => {
} }
} }
processUserPopoutBodySection (e) {
if (e.instance.props.guild) e.instance.props.guild = this.changeRolesInGuild(e.instance.props.guild);
}
processUserPopoutBody (e) { processUserPopoutBody (e) {
if (e.instance.props.guild) e.instance.props.guild = this.changeRolesInGuild(e.instance.props.guild); if (e.instance.props.guild) e.instance.props.guild = this.changeRolesInGuild(e.instance.props.guild);
} }
@@ -677,5 +700,5 @@ module.exports = (_ => {
} }
} }
}; };
})(window.BDFDB_Global.PluginUtils.buildPlugin(config)); })(window.BDFDB_Global.PluginUtils.buildPlugin(changeLog));
})(); })();

View File

@@ -1,374 +0,0 @@
/**
* @name Freemoji
* @displayName Freemoji
* @description Send emoji external emoji and animated emoji without Nitro.
* @author Qb, An0
* @authorId 133659541198864384
* @license LGPLv3 - https://www.gnu.org/licenses/lgpl-3.0.txt
* @version 1.7.3
* @invite gj7JFa6mF8
* @source https://github.com/QbDesu/BetterDiscordAddons/blob/potato/Plugins/Freemoji
* @updateUrl https://raw.githubusercontent.com/QbDesu/BetterDiscordAddons/potato/Plugins/Freemoji/Freemoji.plugin.js
*/
/*@cc_on
@if (@_jscript)
var shell = WScript.CreateObject("WScript.Shell");
shell.Popup("It looks like you've mistakenly tried to run me directly. That's not how you install plugins. \n(So don't do that!)", 0, "I'm a plugin for BetterDiscord", 0x30);
@else@*/
module.exports = (() => {
const config = {
info: {
name: 'Freemoji',
authors: [
{
name: 'Qb',
discord_id: '133659541198864384',
github_username: 'QbDesu'
},
{
name: 'An0',
github_username: 'An00nymushun'
}
],
version: '1.7.3',
description: 'Send emoji external emoji and animated emoji without Nitro.',
github: 'https://github.com/QbDesu/BetterDiscordAddons/blob/potato/Plugins/Freemoji',
github_raw: 'https://raw.githubusercontent.com/QbDesu/BetterDiscordAddons/potato/Plugins/Freemoji/Freemoji.plugin.js'
},
changelog: [
{ title: 'Bug Fixes', types: 'fixed', items: ['Stopped clyde from warining your about using unavailable emoji.'] }
],
defaultConfig: [
{
type: 'switch',
id: 'sendDirectly',
name: 'Send Directly',
note: 'Send the emoji link in a message directly instead of putting it in the chat box.',
value: false
},
{
type: 'switch',
id: 'split',
name: 'Automatically Split Emoji Messages',
note: 'Automatically splits messages containing emoji links so there won\'t be links in the middle of your messages.',
value: false
},
{
type: 'slider',
id: 'emojiSize',
name: 'Emoji Size',
note: 'The size of the emoji in pixels. 48 is recommended because it is the size of regular Discord emoji.',
value: 48,
markers: [32, 40, 48, 60, 64, 80, 96],
stickToMarkers: true
},
{
type: 'dropdown',
id: 'removeGrayscale',
name: 'Remove Grayscale Filter',
note: 'Remove the grayscale filter on emoji that would normally not be usable.',
value: 'embedPerms',
options: [
{
label: 'Always',
value: 'always'
},
{
label: 'With Embed Perms',
value: 'embedPerms'
},
{
label: 'Never',
value: 'never'
}
]
},
{
type: 'dropdown',
id: 'missingEmbedPerms',
name: 'Missing Embed Perms Behaviour',
note: 'What should happen if you select an emoji even though you have no embed permissions.',
value: 'showDialog',
options: [
{
label: 'Show Confirmation Dialog',
value: 'showDialog'
},
{
label: 'Insert Anyway',
value: 'insert'
},
{
label: 'Nothing',
value: 'nothing'
}
]
},
{
type: 'dropdown',
id: 'external',
name: 'Allow External Emoji',
note: 'Allow External Emoji for servers that have them disabled.',
value: 'showDialog',
options: [
{
label: 'Don\'t Allow',
value: 'off'
},
{
label: 'Show Confirmation Dialog',
value: 'showDialog'
},
{
label: 'Allow',
value: 'allow'
}
]
}
]
};
return !global.ZeresPluginLibrary ? class {
constructor() { this._config = config; }
load() {
BdApi.showConfirmationModal('Library plugin is needed',
[`The library plugin needed for ${config.info.name} is missing. Please click Download Now to install it.`], {
confirmText: 'Download',
cancelText: 'Cancel',
onConfirm: () => {
require('request').get('https://rauenzi.github.io/BDPluginLibrary/release/0PluginLibrary.plugin.js', async (error, response, body) => {
if (error) return require('electron').shell.openExternal('https://betterdiscord.app/Download?id=9');
await new Promise(r => require('fs').writeFile(require('path').join(BdApi.Plugins.folder, '0PluginLibrary.plugin.js'), body, r));
window.location.reload();
});
}
});
}
start() { }
stop() { }
}
: (([Plugin, Api]) => {
const plugin = (Plugin, Api) => {
const {
Patcher,
WebpackModules,
Toasts,
Logger,
DiscordModules: {
Permissions,
DiscordPermissions,
UserStore,
SelectedChannelStore,
ChannelStore,
DiscordConstants: {
EmojiDisabledReasons,
EmojiIntention
}
}
} = Api;
const Emojis = WebpackModules.findByUniqueProperties(['getDisambiguatedEmojiContext', 'searchWithoutFetchingLatest']);
const EmojiParser = WebpackModules.findByUniqueProperties(['parse', 'parsePreprocessor', 'unparse']);
const EmojiPicker = WebpackModules.findByUniqueProperties(['useEmojiSelectHandler']);
const MessageUtilities = WebpackModules.getByProps("sendMessage");
const EmojiFilter = WebpackModules.getByProps('getEmojiUnavailableReason');
const EmojiPickerListRow = WebpackModules.find(m => m?.default?.displayName == 'EmojiPickerListRow');
const SIZE_REGEX = /([?&]size=)(\d+)/;
const EMOJI_SPLIT_LINK_REGEX = /(https:\/\/cdn\.discordapp\.com\/emojis\/\d+\.(?:png|gif|webp)(?:\?size\=\d+&quality=\w*)?)/
return class Freemoji extends Plugin {
currentUser = null;
replaceEmoji(text, emoji) {
const emojiString = `<${emoji.animated ? "a" : ""}:${emoji.originalName || emoji.name}:${emoji.id}>`;
const emojiURL = this.getEmojiUrl(emoji);
return text.replace(emojiString, emojiURL + " ");
}
patch() {
// make emote pretend locked emoji are unlocked
Patcher.after(Emojis, 'searchWithoutFetchingLatest', (_, args, ret) => {
ret.unlocked = ret.unlocked.concat(ret.locked);
ret.locked.length = [];
return ret;
});
// replace emoji with links in messages
Patcher.after(EmojiParser, 'parse', (_, args, ret) => {
for (const emoji of ret.invalidEmojis) {
ret.content = this.replaceEmoji(ret.content, emoji);
}
ret.invalidEmojis = [];
for (const emoji of ret.validNonShortcutEmojis) {
if (!emoji.available) {
ret.content = this.replaceEmoji(ret.content, emoji);
}
}
if (this.settings.external) {
for (const emoji of ret.validNonShortcutEmojis) {
if (this.getEmojiUnavailableReason(emoji) === EmojiDisabledReasons.DISALLOW_EXTERNAL) {
ret.content = this.replaceEmoji(ret.content, emoji);
}
}
}
return ret;
});
// override emoji picker to allow selecting emotes
Patcher.after(EmojiPicker, 'useEmojiSelectHandler', (_, args, ret) => {
const { onSelectEmoji, closePopout, selectedChannel } = args[0];
const self = this;
return function (data, state) {
if (state.toggleFavorite) return ret.apply(this, arguments);
const emoji = data.emoji;
const isFinalSelection = state.isFinalSelection;
if (self.getEmojiUnavailableReason(emoji, selectedChannel) === EmojiDisabledReasons.DISALLOW_EXTERNAL) {
if (self.settings.external == 'off') return;
if (self.settings.external == 'showDialog') {
BdApi.showConfirmationModal(
"Sending External Emoji",
[`It looks like you are trying to send an an External Emoji in a server that would normally allow it. Do you still want to send it?`], {
confirmText: "Send External Emoji",
cancelText: "Cancel",
onConfirm: () => {
self.selectEmoji({ emoji, isFinalSelection, onSelectEmoji, selectedChannel, closePopout, disabled: true });
}
});
return;
}
self.selectEmoji({ emoji, isFinalSelection, onSelectEmoji, closePopout, selectedChannel, disabled: true });
} else if (!emoji.available) {
self.selectEmoji({ emoji, isFinalSelection, onSelectEmoji, closePopout, selectedChannel, disabled: true });
} else {
self.selectEmoji({ emoji, isFinalSelection, onSelectEmoji, closePopout, selectedChannel, disabled: data.isDisabled });
}
}
});
Patcher.after(EmojiFilter, 'getEmojiUnavailableReason', (_, [{ intention, bypassPatch }], ret) => {
if (intention !== EmojiIntention.CHAT || bypassPatch || !this.settings.external) return;
return ret === EmojiDisabledReasons.DISALLOW_EXTERNAL ? null : ret;
});
Patcher.before(EmojiPickerListRow, 'default', (_, [{ emojiDescriptors }]) => {
if (this.settings.removeGrayscale == 'never') return;
if (this.settings.removeGrayscale != 'always' && !this.hasEmbedPerms()) return;
emojiDescriptors.filter(e => e.isDisabled).forEach(e => { e.isDisabled = false; e.wasDisabled = true; });
});
Patcher.after(EmojiPickerListRow, 'default', (_, [{ emojiDescriptors }]) => {
emojiDescriptors.filter(e => e.wasDisabled).forEach(e => { e.isDisabled = true; delete e.wasDisabled; });
});
BdApi.Plugins.isEnabled("EmoteReplacer") || Patcher.instead(MessageUtilities, 'sendMessage', (thisObj, args, originalFn) => {
if (!this.settings.split || BdApi.Plugins.isEnabled("EmoteReplacer")) return originalFn.apply(thisObj, args);
const [channel, message] = args;
const split = message.content.split(EMOJI_SPLIT_LINK_REGEX).map(s => s.trim()).filter(s => s.length);
if (split.length <= 1) return originalFn.apply(thisObj, args);
const promises = [];
for (let i = 0; i < split.length; i++) {
const text = split[i];
promises.push(new Promise((resolve, reject) => {
window.setTimeout(() => {
originalFn.call(thisObj, channel, { content: text, validNonShortcutEmojis: [] }).then(resolve).catch(reject);
}, i * 100);
}));
}
return Promise.all(promises).then(ret => ret[ret.length - 1]);
});
}
selectEmoji({ emoji, isFinalSelection, onSelectEmoji, closePopout, selectedChannel, disabled }) {
if (disabled) {
const perms = this.hasEmbedPerms(selectedChannel);
if (!perms && this.settings.missingEmbedPerms == 'nothing') return;
if (!perms && this.settings.missingEmbedPerms == 'showDialog') {
BdApi.showConfirmationModal(
"Missing Image Embed Permissions",
[`It looks like you are trying to send an Emoji using Freemoji but you dont have the permissions to send embeded images in this channel. You can choose to send it anyway but it will only show as a link.`], {
confirmText: "Send Anyway",
cancelText: "Cancel",
onConfirm: () => {
if (this.settings.sendDirectly) {
MessageUtilities.sendMessage(selectedChannel.id, { content: this.getEmojiUrl(emoji) });
} else {
onSelectEmoji(emoji, isFinalSelection);
}
}
});
return;
}
if (this.settings.sendDirectly) {
MessageUtilities.sendMessage(SelectedChannelStore.getChannelId(), { content: this.getEmojiUrl(emoji) });
} else {
onSelectEmoji(emoji, isFinalSelection);
}
} else {
onSelectEmoji(emoji, isFinalSelection);
}
if (isFinalSelection) closePopout();
}
getEmojiUnavailableReason(emoji, channel, intention) {
return EmojiFilter.getEmojiUnavailableReason({
channel: channel || ChannelStore.getChannel(SelectedChannelStore.getChannelId()),
emoji,
intention: EmojiIntention.CHAT || intention,
bypassPatch: true
})
}
getEmojiUrl(emoji) {
return emoji.url.includes("size=") ?
emoji.url.replace(SIZE_REGEX, `$1${this.settings.emojiSize}`) :
`${emoji.url}&size=${this.settings.emojiSize}`;
}
hasEmbedPerms(channelParam) {
try {
if (!this.currentUser) this.currentUser = UserStore.getCurrentUser();
const channel = channelParam || ChannelStore.getChannel(SelectedChannelStore.getChannelId());
if (!channel.guild_id) return true;
return Permissions.can({permission: DiscordPermissions.EMBED_LINKS, user: this.currentUser.id, context: channel});
} catch (e) {
Logger.error("Error while detecting embed permissions", e);
return true;
}
}
cleanup() {
Patcher.unpatchAll();
}
onStart() {
try {
this.patch();
} catch (e) {
Toasts.error(`${config.info.name}: An error occured during intialiation: ${e}`);
Logger.error(`Error while patching: ${e}`);
console.error(e);
}
}
onStop() {
this.cleanup();
}
getSettingsPanel() { return this.buildSettingsPanel().getElement(); }
};
};
return plugin(Plugin, Api);
})(global.ZeresPluginLibrary.buildPlugin(config));
})();
/*@end@*/

View File

@@ -48,7 +48,8 @@
"galleryMode": true, "galleryMode": true,
"details": true, "details": true,
"copyImage": true, "copyImage": true,
"saveImage": true "saveImage": true,
"jumpTo": true
}, },
"zoomSettings": { "zoomSettings": {
"lensSize": 1459, "lensSize": 1459,

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,10 @@
"hasShownChangelog": true "hasShownChangelog": true
}, },
"settings": { "settings": {
"exclude": [], "exclude": [
"autoEnable": false "709081938622939166"
],
"autoEnable": false,
"latestUsedVersion": "1.3.3"
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -243,6 +243,13 @@
"mute": false, "mute": false,
"sound": "---", "sound": "---",
"volume": 100 "volume": 100
},
"call_ringing_halloween": {
"category": "---",
"focus": false,
"mute": null,
"sound": "---",
"volume": 100
} }
}, },
"volumes": { "volumes": {

View File

@@ -2,7 +2,7 @@
* @name NotificationSounds * @name NotificationSounds
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 3.7.2 * @version 3.7.5
* @description Allows you to replace the native Sounds with custom Sounds * @description Allows you to replace the native Sounds with custom Sounds
* @invite Jx3TjNS * @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien * @donate https://www.paypal.me/MircoWittrien
@@ -13,20 +13,16 @@
*/ */
module.exports = (_ => { module.exports = (_ => {
const config = { const changeLog = {
"info": {
"name": "NotificationSounds",
"author": "DevilBro",
"version": "3.7.2",
"description": "Allows you to replace the native Sounds with custom Sounds"
}
}; };
return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class { return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class {
getName () {return config.info.name;} constructor (meta) {for (let key in meta) this[key] = meta[key];}
getAuthor () {return config.info.author;} getName () {return this.name;}
getVersion () {return config.info.version;} getAuthor () {return this.author;}
getDescription () {return `The Library Plugin needed for ${config.info.name} is missing. Open the Plugin Settings to download it. \n\n${config.info.description}`;} getVersion () {return this.version;}
getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;}
downloadLibrary () { downloadLibrary () {
require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => {
@@ -39,7 +35,7 @@ module.exports = (_ => {
if (!window.BDFDB_Global || !Array.isArray(window.BDFDB_Global.pluginQueue)) window.BDFDB_Global = Object.assign({}, window.BDFDB_Global, {pluginQueue: []}); if (!window.BDFDB_Global || !Array.isArray(window.BDFDB_Global.pluginQueue)) window.BDFDB_Global = Object.assign({}, window.BDFDB_Global, {pluginQueue: []});
if (!window.BDFDB_Global.downloadModal) { if (!window.BDFDB_Global.downloadModal) {
window.BDFDB_Global.downloadModal = true; window.BDFDB_Global.downloadModal = true;
BdApi.showConfirmationModal("Library Missing", `The Library Plugin needed for ${config.info.name} is missing. Please click "Download Now" to install it.`, { BdApi.showConfirmationModal("Library Missing", `The Library Plugin needed for ${this.name} is missing. Please click "Download Now" to install it.`, {
confirmText: "Download Now", confirmText: "Download Now",
cancelText: "Cancel", cancelText: "Cancel",
onCancel: _ => {delete window.BDFDB_Global.downloadModal;}, onCancel: _ => {delete window.BDFDB_Global.downloadModal;},
@@ -49,13 +45,13 @@ module.exports = (_ => {
} }
}); });
} }
if (!window.BDFDB_Global.pluginQueue.includes(config.info.name)) window.BDFDB_Global.pluginQueue.push(config.info.name); if (!window.BDFDB_Global.pluginQueue.includes(this.name)) window.BDFDB_Global.pluginQueue.push(this.name);
} }
start () {this.load();} start () {this.load();}
stop () {} stop () {}
getSettingsPanel () { getSettingsPanel () {
let template = document.createElement("template"); let template = document.createElement("template");
template.innerHTML = `<div style="color: var(--header-primary); font-size: 16px; font-weight: 300; white-space: pre; line-height: 22px;">The Library Plugin needed for ${config.info.name} is missing.\nPlease click <a style="font-weight: 500;">Download Now</a> to install it.</div>`; template.innerHTML = `<div style="color: var(--header-primary); font-size: 16px; font-weight: 300; white-space: pre; line-height: 22px;">The Library Plugin needed for ${this.name} is missing.\nPlease click <a style="font-weight: 500;">Download Now</a> to install it.</div>`;
template.content.firstElementChild.querySelector("a").addEventListener("click", this.downloadLibrary); template.content.firstElementChild.querySelector("a").addEventListener("click", this.downloadLibrary);
return template.content.firstElementChild; return template.content.firstElementChild;
} }
@@ -66,7 +62,7 @@ module.exports = (_ => {
const removeAllKey = "REMOVE_ALL_BDFDB_DEVILBRO_DO_NOT_COPY"; const removeAllKey = "REMOVE_ALL_BDFDB_DEVILBRO_DO_NOT_COPY";
const defaultDevice = "default"; const defaultDevice = "default";
var currentDevice = defaultDevice, createdAudios = {}, repatchIncoming; var currentDevice = defaultDevice, createdAudios = {};
let types = {}; let types = {};
@@ -137,8 +133,8 @@ module.exports = (_ => {
let audio = new Audio; let audio = new Audio;
audio.src = this._src && this._src.startsWith("data") ? this._src.replace(/ /g, "") : this._src; audio.src = this._src && this._src.startsWith("data") ? this._src.replace(/ /g, "") : this._src;
audio.onloadeddata = _ => { audio.onloadeddata = _ => {
audio.volume = Math.min((BDFDB.LibraryModules.MediaDeviceUtils.getOutputVolume() / 100) * (this._volume / 100) * (volumes.globalVolume / 100), 1); audio.volume = Math.min((BDFDB.LibraryStores.MediaEngineStore.getOutputVolume() / 100) * (this._volume / 100) * (volumes.globalVolume / 100), 1);
BDFDB.LibraryModules.PlatformUtils.embedded && audio.setSinkId(currentDevice || defaultDevice); BDFDB.DiscordUtils.isPlaformEmbedded() && audio.setSinkId(currentDevice || defaultDevice);
callback(audio); callback(audio);
}; };
audio.onerror = _ => errorCallback(new Error("could not play audio")); audio.onerror = _ => errorCallback(new Error("could not play audio"));
@@ -165,12 +161,12 @@ module.exports = (_ => {
const soundKeys = BDFDB.LibraryModules.SoundParser.keys(); const soundKeys = BDFDB.LibraryModules.SoundParser.keys();
for (let key of soundKeys) { for (let key of soundKeys) {
const id = key.replace("./", "").replace(".mp3", ""); const id = key.replace("./", "").replace(".mp3", "");
const name = id == "reconnect" ? "Invited To Speak" : id.replace("ddr-", "HotKeys_").replace("ptt_", "Push2Talk_").split("_").map(BDFDB.LibraryModules.StringUtils.upperCaseFirstChar).join(" ").replace(/1$/g, ""); const name = id == "reconnect" ? "Invited To Speak" : id.replace("ddr-", "HotKeys_").replace("ptt_", "Push2Talk_").split("_").map(BDFDB.StringUtils.upperCaseFirstChar).join(" ").replace(/1$/g, "");
const src = BDFDB.LibraryModules.SoundParser(key); const src = BDFDB.LibraryModules.SoundParser(key);
let soundPackName = id.split("_")[0]; let soundPackName = id.split("_")[0];
if (soundPackName != id && soundKeys.filter(n => n.indexOf(`./${soundPackName}`) > -1).length > 10) { if (soundPackName != id && soundKeys.filter(n => n.indexOf(`./${soundPackName}`) > -1).length > 10) {
soundPackName = BDFDB.LibraryModules.StringUtils.upperCaseFirstChar(soundPackName); soundPackName = BDFDB.StringUtils.upperCaseFirstChar(soundPackName);
if (!defaultAudios[soundPackName]) defaultAudios[soundPackName] = {}; if (!defaultAudios[soundPackName]) defaultAudios[soundPackName] = {};
defaultAudios[soundPackName][name.replace(new RegExp(`${soundPackName} `, "i"), "").replace(/bootup/i, "Discodo")] = src; defaultAudios[soundPackName][name.replace(new RegExp(`${soundPackName} `, "i"), "").replace(/bootup/i, "Discodo")] = src;
} }
@@ -200,12 +196,12 @@ module.exports = (_ => {
} }
onStart () { onStart () {
if (BDFDB.LibraryModules.PlatformUtils.embedded) { if (BDFDB.DiscordUtils.isPlaformEmbedded()) {
let change = _ => { let change = _ => {
if (window.navigator.mediaDevices && window.navigator.mediaDevices.enumerateDevices) { if (window.navigator.mediaDevices && window.navigator.mediaDevices.enumerateDevices) {
window.navigator.mediaDevices.enumerateDevices().then(enumeratedDevices => { window.navigator.mediaDevices.enumerateDevices().then(enumeratedDevices => {
let id = BDFDB.LibraryModules.MediaDeviceUtils.getOutputDeviceId(); let id = BDFDB.LibraryStores.MediaEngineStore.getOutputDeviceId();
let allDevices = BDFDB.LibraryModules.MediaDeviceUtils.getOutputDevices(); let allDevices = BDFDB.LibraryStores.MediaEngineStore.getOutputDevices();
let filteredDevices = enumeratedDevices.filter(d => d.kind == "audiooutput" && d.deviceId != "communications"); let filteredDevices = enumeratedDevices.filter(d => d.kind == "audiooutput" && d.deviceId != "communications");
let deviceIndex = BDFDB.LibraryModules.ArrayUtils(allDevices).sortBy(d => d.index).findIndex(d => d.id == id); let deviceIndex = BDFDB.LibraryModules.ArrayUtils(allDevices).sortBy(d => d.index).findIndex(d => d.id == id);
let deviceViaId = allDevices[id]; let deviceViaId = allDevices[id];
@@ -217,7 +213,7 @@ module.exports = (_ => {
}); });
} }
}; };
BDFDB.StoreChangeUtils.add(this, BDFDB.LibraryModules.MediaDeviceUtils, change); BDFDB.StoreChangeUtils.add(this, BDFDB.LibraryStores.MediaEngineStore, change);
change(); change();
} }
@@ -225,11 +221,11 @@ module.exports = (_ => {
if (BDFDB.ObjectUtils.is(e.methodArguments[0]) && e.methodArguments[0].type == "MESSAGE_CREATE" && e.methodArguments[0].message) { if (BDFDB.ObjectUtils.is(e.methodArguments[0]) && e.methodArguments[0].type == "MESSAGE_CREATE" && e.methodArguments[0].message) {
const message = e.methodArguments[0].message; const message = e.methodArguments[0].message;
const guildId = message.guild_id || null; const guildId = message.guild_id || null;
if (message.author.id != BDFDB.UserUtils.me.id && !BDFDB.LibraryModules.RelationshipStore.isBlocked(message.author.id)) { if (message.author.id != BDFDB.UserUtils.me.id && !BDFDB.LibraryStores.RelationshipStore.isBlocked(message.author.id)) {
const channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id); const channel = BDFDB.LibraryStores.ChannelStore.getChannel(message.channel_id);
const isGroupDM = channel.isGroupDM(); const isGroupDM = channel.isGroupDM();
const muted = BDFDB.LibraryModules.MutedUtils.isGuildOrCategoryOrChannelMuted(guildId, channel.id); const muted = BDFDB.ChannelUtils.isThread(channel) ? BDFDB.LibraryStores.JoinedThreadsStore.isMuted(channel.id) : BDFDB.LibraryStores.UserGuildSettingsStore.isGuildOrCategoryOrChannelMuted(guildId, channel.id);
const focused = document.hasFocus() && BDFDB.LibraryModules.LastChannelStore.getChannelId() == channel.id; const focused = document.hasFocus() && BDFDB.LibraryStores.SelectedChannelStore.getChannelId() == channel.id;
if (!guildId && !muted && !(choices[isGroupDM ? "groupdm" : "dm"].focus && focused)) { if (!guildId && !muted && !(choices[isGroupDM ? "groupdm" : "dm"].focus && focused)) {
this.fireEvent(isGroupDM ? "groupdm" : "dm"); this.fireEvent(isGroupDM ? "groupdm" : "dm");
this.playAudio(isGroupDM ? "groupdm" : "dm"); this.playAudio(isGroupDM ? "groupdm" : "dm");
@@ -249,15 +245,15 @@ module.exports = (_ => {
return; return;
} }
} }
if (message.mention_roles.length && !BDFDB.LibraryModules.MutedUtils.isSuppressRolesEnabled(guildId, channel.id) && (!muted || choices.role.force) && !(choices.role.focus && focused)) { if (message.mention_roles.length && !BDFDB.LibraryStores.UserGuildSettingsStore.isSuppressRolesEnabled(guildId, channel.id) && (!muted || choices.role.force) && !(choices.role.focus && focused)) {
const member = BDFDB.LibraryModules.MemberStore.getMember(guildId, BDFDB.UserUtils.me.id); const member = BDFDB.LibraryStores.GuildMemberStore.getMember(guildId, BDFDB.UserUtils.me.id);
if (member && member.roles.length) for (const roleId of message.mention_roles) if (member.roles.includes(roleId)) { if (member && member.roles.length) for (const roleId of message.mention_roles) if (member.roles.includes(roleId)) {
this.fireEvent("role"); this.fireEvent("role");
this.playAudio("role"); this.playAudio("role");
return; return;
} }
} }
if (message.mention_everyone && !BDFDB.LibraryModules.MutedUtils.isSuppressEveryoneEnabled(guildId, channel.id)) { if (message.mention_everyone && !BDFDB.LibraryStores.UserGuildSettingsStore.isSuppressEveryoneEnabled(guildId, channel.id)) {
if (message.content.indexOf("@everyone") > -1 && (!muted || choices.everyone.force) && !(choices.everyone.focus && focused)) { if (message.content.indexOf("@everyone") > -1 && (!muted || choices.everyone.force) && !(choices.everyone.focus && focused)) {
this.fireEvent("everyone"); this.fireEvent("everyone");
this.playAudio("everyone"); this.playAudio("everyone");
@@ -270,7 +266,7 @@ module.exports = (_ => {
} }
} }
} }
if (BDFDB.LibraryModules.MutedUtils.allowAllMessages(channel) && (!muted || choices.message1.force) && !(choices.message1.focus && focused)) { if (BDFDB.LibraryStores.UserGuildSettingsStore.allowAllMessages(channel) && (!muted || choices.message1.force) && !(choices.message1.focus && focused)) {
this.fireEvent("message1"); this.fireEvent("message1");
this.playAudio("message1"); this.playAudio("message1");
return; return;
@@ -303,7 +299,7 @@ module.exports = (_ => {
} }
else e.callOriginalMethodAfterwards(); else e.callOriginalMethodAfterwards();
}}); }});
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.SoundUtils, "createSound", {after: e => { BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.SoundUtils, ["createSound", "createSoundpackSound"], {after: e => {
let type = e.methodArguments[0]; let type = e.methodArguments[0];
if (type && choices[type]) { if (type && choices[type]) {
let audio = new WebAudioSound(type); let audio = new WebAudioSound(type);
@@ -316,18 +312,6 @@ module.exports = (_ => {
this.loadAudios(); this.loadAudios();
this.loadChoices(); this.loadChoices();
let callListenerModule = BDFDB.ModuleUtils.findByProperties("handleRingUpdate");
if (callListenerModule) {
callListenerModule.terminate();
BDFDB.PatchUtils.patch(this, callListenerModule, "handleRingUpdate", {instead: e => {
if (BDFDB.LibraryModules.CallUtils.getCalls().filter(call => call.ringing.length > 0 && BDFDB.LibraryModules.VoiceUtils.getCurrentClientVoiceChannelId() === call.channelId).length > 0 && !BDFDB.LibraryModules.SoundStateUtils.isSoundDisabled("call_calling") && !BDFDB.LibraryModules.StreamerModeStore.disableSounds) {
createdAudios["call_calling"].loop();
}
else createdAudios["call_calling"].stop();
}});
callListenerModule.initialize();
}
this.forceUpdateAll(); this.forceUpdateAll();
} }
@@ -424,9 +408,9 @@ module.exports = (_ => {
} }
BDFDB.NotificationUtils.toast("Use a valid direct link to a video or audio source, they usually end on something like .mp3, .mp4 or .wav", {type: "danger"}); BDFDB.NotificationUtils.toast("Use a valid direct link to a video or audio source, they usually end on something like .mp3, .mp4 or .wav", {type: "danger"});
}); });
else BDFDB.LibraryRequires.fs.readFile(source, (error, response) => { else BDFDB.LibraryRequires.fs.readFile(source, "", (error, buffer) => {
if (error) BDFDB.NotificationUtils.toast("Could not fetch file. Please make sure the file exists", {type: "danger"}); if (error) BDFDB.NotificationUtils.toast("Could not fetch file. Please make sure the file exists", {type: "danger"});
else return successSavedAudio({category, sound, source: `data:audio/mpeg;base64,${response.toString("base64")}`}); else return successSavedAudio({category, sound, source: `data:audio/mpeg;base64,${Buffer.from(buffer).toString("base64")}`});
}); });
}, },
children: BDFDB.LanguageUtils.LanguageStrings.SAVE children: BDFDB.LanguageUtils.LanguageStrings.SAVE
@@ -493,10 +477,10 @@ module.exports = (_ => {
mini: true, mini: true,
grow: 0, grow: 0,
label: "Mute in", label: "Mute in",
labelChildren: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Status, { labelChildren: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.StatusComponents.Status, {
style: {marginLeft: 6}, style: {marginLeft: 6},
size: 12, size: 12,
status: BDFDB.DiscordConstants.StatusTypes.DND status: BDFDB.LibraryComponents.StatusComponents.Types.DND
}), }),
value: choices[type].mute, value: choices[type].mute,
onChange: value => { onChange: value => {
@@ -676,9 +660,8 @@ module.exports = (_ => {
} }
forceUpdateAll () { forceUpdateAll () {
repatchIncoming = true;
createdAudios["call_calling"] = BDFDB.LibraryModules.SoundUtils.createSound("call_calling");
volumes = BDFDB.DataUtils.get(this, "volumes"); volumes = BDFDB.DataUtils.get(this, "volumes");
if (BDFDB.LibraryStores.SoundpackStore) BDFDB.LibraryStores.SoundpackStore.emitChange();
BDFDB.PatchUtils.forceAllUpdates(this); BDFDB.PatchUtils.forceAllUpdates(this);
BDFDB.DiscordUtils.rerenderAll(); BDFDB.DiscordUtils.rerenderAll();
} }
@@ -718,15 +701,15 @@ module.exports = (_ => {
} }
playAudio (type) { playAudio (type) {
if (this.dontPlayAudio(type) || BDFDB.LibraryModules.StreamerModeStore.disableSounds) return; if (this.dontPlayAudio(type) || BDFDB.LibraryStores.StreamerModeStore.disableSounds) return;
if (createdAudios[type]) createdAudios[type].stop(); if (createdAudios[type]) createdAudios[type].stop();
createdAudios[type] = new WebAudioSound(type); createdAudios[type] = new WebAudioSound(type);
createdAudios[type].play(); createdAudios[type].play();
} }
isSuppressMentionsEnabled (guildId, channelId) { isSuppressMentionsEnabled (guildId, channelId) {
let channelSettings = BDFDB.LibraryModules.MutedUtils.getChannelMessageNotifications(guildId, channelId); let channelSettings = BDFDB.LibraryStores.UserGuildSettingsStore.getChannelMessageNotifications(guildId, channelId);
return channelSettings && (channelSettings == BDFDB.DiscordConstants.UserNotificationSettings.NO_MESSAGES || channelSettings == BDFDB.DiscordConstants.UserNotificationSettings.NULL && BDFDB.LibraryModules.MutedUtils.getMessageNotifications(guildId) == BDFDB.DiscordConstants.UserNotificationSettings.NO_MESSAGES); return channelSettings && (channelSettings == BDFDB.DiscordConstants.UserNotificationSettings.NO_MESSAGES || channelSettings == BDFDB.DiscordConstants.UserNotificationSettings.NULL && BDFDB.LibraryStores.UserGuildSettingsStore.getMessageNotifications(guildId) == BDFDB.DiscordConstants.UserNotificationSettings.NO_MESSAGES);
} }
dontPlayAudio (type) { dontPlayAudio (type) {
@@ -743,5 +726,5 @@ module.exports = (_ => {
return type != "human_man" && type != "robot_man" && type != "discodo" && type != "overlayunlock" && type != "call_ringing_beat" && !(type != "message1" && /\d$/.test(type)); return type != "human_man" && type != "robot_man" && type != "discodo" && type != "overlayunlock" && type != "call_ringing_beat" && !(type != "message1" && /\d$/.test(type));
} }
}; };
})(window.BDFDB_Global.PluginUtils.buildPlugin(config)); })(window.BDFDB_Global.PluginUtils.buildPlugin(changeLog));
})(); })();

View File

@@ -1,6 +1,6 @@
{ {
"currentVersionInfo": { "currentVersionInfo": {
"version": "0.2.2", "version": "0.2.6",
"hasShownChangelog": true "hasShownChangelog": true
} }
} }

View File

@@ -1,10 +1,11 @@
/** /**
* @name PermissionsViewer * @name PermissionsViewer
* @version 0.2.2 * @description Allows you to view a user's permissions. Thanks to Noodlebox for the idea!
* @authorLink https://twitter.com/IAmZerebos * @version 0.2.6
* @author Zerebos
* @authorId 249746236008169473
* @website https://github.com/rauenzi/BetterDiscordAddons/tree/master/Plugins/PermissionsViewer * @website https://github.com/rauenzi/BetterDiscordAddons/tree/master/Plugins/PermissionsViewer
* @source https://raw.githubusercontent.com/rauenzi/BetterDiscordAddons/master/Plugins/PermissionsViewer/PermissionsViewer.plugin.js * @source https://raw.githubusercontent.com/rauenzi/BetterDiscordAddons/master/Plugins/PermissionsViewer/PermissionsViewer.plugin.js
* @updateUrl https://raw.githubusercontent.com/rauenzi/BetterDiscordAddons/master/Plugins/PermissionsViewer/PermissionsViewer.plugin.js
*/ */
/*@cc_on /*@cc_on
@if (@_jscript) @if (@_jscript)
@@ -29,49 +30,212 @@
WScript.Quit(); WScript.Quit();
@else@*/ @else@*/
const config = {
module.exports = (() => { info: {
const config = {info:{name:"PermissionsViewer",authors:[{name:"Zerebos",discord_id:"249746236008169473",github_username:"rauenzi",twitter_username:"ZackRauen"}],version:"0.2.2",description:"Allows you to view a user's permissions. Thanks to Noodlebox for the idea!",github:"https://github.com/rauenzi/BetterDiscordAddons/tree/master/Plugins/PermissionsViewer",github_raw:"https://raw.githubusercontent.com/rauenzi/BetterDiscordAddons/master/Plugins/PermissionsViewer/PermissionsViewer.plugin.js"},changelog:[{title:"Fixes",type:"fixed",items:["Can select other roles in the modal."]}],defaultConfig:[{type:"switch",id:"contextMenus",name:"Context Menus",value:true},{type:"switch",id:"popouts",name:"Popouts",value:true},{type:"radio",id:"displayMode",name:"Modal Display Mode",value:"compact",options:[{name:"Cozy",value:"cozy"},{name:"Compact",value:"compact"}]}],strings:{es:{contextMenuLabel:"Permisos",popoutLabel:"Permisos",modal:{header:"Permisos de ${name}",rolesLabel:"Roles",permissionsLabel:"Permisos",owner:"@propietario"},settings:{popouts:{name:"Mostrar en Popouts",note:"Mostrar los permisos de usuario en popouts como los roles."},contextMenus:{name:"Botón de menú contextual",note:"Añadir un botón para ver permisos en los menús contextuales."}}},pt:{contextMenuLabel:"Permissões",popoutLabel:"Permissões",modal:{header:"Permissões de ${name}",rolesLabel:"Cargos",permissionsLabel:"Permissões",owner:"@dono"},settings:{popouts:{name:"Mostrar em Popouts",note:"Mostrar as permissões em popouts como os cargos."},contextMenus:{name:"Botão do menu de contexto",note:"Adicionar um botão parar ver permissões ao menu de contexto."}}},de:{contextMenuLabel:"Berechtigungen",popoutLabel:"Berechtigungen",modal:{header:"${name}s Berechtigungen",rolesLabel:"Rollen",permissionsLabel:"Berechtigungen",owner:"@eigentümer"},settings:{popouts:{name:"In Popouts anzeigen",note:"Zeigt die Gesamtberechtigungen eines Benutzers in seinem Popup ähnlich den Rollen an."},contextMenus:{name:"Kontextmenü-Schaltfläche",note:"Fügt eine Schaltfläche hinzu, um die Berechtigungen mithilfe von Kontextmenüs anzuzeigen."}}},en:{contextMenuLabel:"Permissions",popoutLabel:"Permissions",modal:{header:"${name}'s Permissions",rolesLabel:"Roles",permissionsLabel:"Permissions",owner:"@owner"},settings:{popouts:{name:"Show In Popouts",note:"Shows a user's total permissions in their popout similar to roles."},contextMenus:{name:"Context Menu Button",note:"Adds a button to view the permissions modal to select context menus."},displayMode:{name:"Modal Display Mode"}}},ru:{contextMenuLabel:"Полномочия",popoutLabel:"Полномочия",modal:{header:"Полномочия ${name}",rolesLabel:"Роли",permissionsLabel:"Полномочия",owner:"Владелец"},settings:{popouts:{name:"Показать во всплывающих окнах",note:"Отображает полномочия пользователя в их всплывающем окне, аналогичном ролям."},contextMenus:{name:"Кнопка контекстного меню",note:"Добавить кнопку для отображения полномочий с помощью контекстных меню."}}}},main:"index.js"}; name: "PermissionsViewer",
authors: [
return !global.ZeresPluginLibrary ? class { {
constructor() {this._config = config;} name: "Zerebos",
getName() {return config.info.name;} discord_id: "249746236008169473",
getAuthor() {return config.info.authors.map(a => a.name).join(", ");} github_username: "rauenzi",
getDescription() {return config.info.description;} twitter_username: "ZackRauen"
getVersion() {return config.info.version;} }
load() { ],
BdApi.showConfirmationModal("Library Missing", `The library plugin needed for ${config.info.name} is missing. Please click Download Now to install it.`, { version: "0.2.6",
confirmText: "Download Now", description: "Allows you to view a user's permissions. Thanks to Noodlebox for the idea!",
cancelText: "Cancel", github: "https://github.com/rauenzi/BetterDiscordAddons/tree/master/Plugins/PermissionsViewer",
onConfirm: () => { github_raw: "https://raw.githubusercontent.com/rauenzi/BetterDiscordAddons/master/Plugins/PermissionsViewer/PermissionsViewer.plugin.js"
require("request").get("https://rauenzi.github.io/BDPluginLibrary/release/0PluginLibrary.plugin.js", async (error, response, body) => { },
if (error) return require("electron").shell.openExternal("https://betterdiscord.net/ghdl?url=https://raw.githubusercontent.com/rauenzi/BDPluginLibrary/master/release/0PluginLibrary.plugin.js"); changelog: [
await new Promise(r => require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0PluginLibrary.plugin.js"), body, r)); {
title: "Fixes",
type: "fixed",
items: [
"Popouts and context menus should all work once again!"
]
}
],
defaultConfig: [
{
type: "switch",
id: "contextMenus",
name: "Context Menus",
value: true
},
{
type: "switch",
id: "popouts",
name: "Popouts",
value: true
},
{
type: "radio",
id: "displayMode",
name: "Modal Display Mode",
value: "compact",
options: [
{
name: "Cozy",
value: "cozy"
},
{
name: "Compact",
value: "compact"
}
]
}
],
strings: {
es: {
contextMenuLabel: "Permisos",
popoutLabel: "Permisos",
modal: {
header: "Permisos de ${name}",
rolesLabel: "Roles",
permissionsLabel: "Permisos",
owner: "@propietario"
},
settings: {
popouts: {
name: "Mostrar en Popouts",
note: "Mostrar los permisos de usuario en popouts como los roles."
},
contextMenus: {
name: "Botón de menú contextual",
note: "Añadir un botón para ver permisos en los menús contextuales."
}
}
},
pt: {
contextMenuLabel: "Permissões",
popoutLabel: "Permissões",
modal: {
header: "Permissões de ${name}",
rolesLabel: "Cargos",
permissionsLabel: "Permissões",
owner: "@dono"
},
settings: {
popouts: {
name: "Mostrar em Popouts",
note: "Mostrar as permissões em popouts como os cargos."
},
contextMenus: {
name: "Botão do menu de contexto",
note: "Adicionar um botão parar ver permissões ao menu de contexto."
}
}
},
de: {
contextMenuLabel: "Berechtigungen",
popoutLabel: "Berechtigungen",
modal: {
header: "${name}s Berechtigungen",
rolesLabel: "Rollen",
permissionsLabel: "Berechtigungen",
owner: "@eigentümer"
},
settings: {
popouts: {
name: "In Popouts anzeigen",
note: "Zeigt die Gesamtberechtigungen eines Benutzers in seinem Popup ähnlich den Rollen an."
},
contextMenus: {
name: "Kontextmenü-Schaltfläche",
note: "Fügt eine Schaltfläche hinzu, um die Berechtigungen mithilfe von Kontextmenüs anzuzeigen."
}
}
},
en: {
contextMenuLabel: "Permissions",
popoutLabel: "Permissions",
modal: {
header: "${name}'s Permissions",
rolesLabel: "Roles",
permissionsLabel: "Permissions",
owner: "@owner"
},
settings: {
popouts: {
name: "Show In Popouts",
note: "Shows a user's total permissions in their popout similar to roles."
},
contextMenus: {
name: "Context Menu Button",
note: "Adds a button to view the permissions modal to select context menus."
},
displayMode: {
name: "Modal Display Mode"
}
}
},
ru: {
contextMenuLabel: "Полномочия",
popoutLabel: "Полномочия",
modal: {
header: "Полномочия ${name}",
rolesLabel: "Роли",
permissionsLabel: "Полномочия",
owner: "Владелец"
},
settings: {
popouts: {
name: "Показать во всплывающих окнах",
note: "Отображает полномочия пользователя в их всплывающем окне, аналогичном ролям."
},
contextMenus: {
name: "Кнопка контекстного меню",
note: "Добавить кнопку для отображения полномочий с помощью контекстных меню."
}
}
}
},
main: "index.js"
};
class Dummy {
constructor() {this._config = config;}
start() {}
stop() {}
}
if (!global.ZeresPluginLibrary) {
BdApi.showConfirmationModal("Library Missing", `The library plugin needed for ${config.name ?? config.info.name} is missing. Please click Download Now to install it.`, {
confirmText: "Download Now",
cancelText: "Cancel",
onConfirm: () => {
require("request").get("https://betterdiscord.app/gh-redirect?id=9", async (err, resp, body) => {
if (err) return require("electron").shell.openExternal("https://betterdiscord.app/Download?id=9");
if (resp.statusCode === 302) {
require("request").get(resp.headers.location, async (error, response, content) => {
if (error) return require("electron").shell.openExternal("https://betterdiscord.app/Download?id=9");
await new Promise(r => require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0PluginLibrary.plugin.js"), content, r));
}); });
} }
else {
await new Promise(r => require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0PluginLibrary.plugin.js"), body, r));
}
}); });
} }
start() {} });
stop() {} }
} : (([Plugin, Api]) => {
const plugin = (Plugin, Api) => { module.exports = !global.ZeresPluginLibrary ? Dummy : (([Plugin, Api]) => {
const {Patcher, DiscordModules, WebpackModules, PluginUtilities, Toasts, DiscordClasses, Utilities, DOMTools, ColorConverter, DCM, Structs, ReactTools} = Api; const plugin = (Plugin, Api) => {
const {ContextMenu, DOM, Utils} = window.BdApi;
const {DiscordModules, WebpackModules, Toasts, DiscordClasses, Utilities, DOMTools, ColorConverter, Structs, ReactTools} = Api;
const GuildStore = DiscordModules.GuildStore; const GuildStore = DiscordModules.GuildStore;
const SelectedGuildStore = DiscordModules.SelectedGuildStore; const SelectedGuildStore = DiscordModules.SelectedGuildStore;
const MemberStore = DiscordModules.GuildMemberStore; const MemberStore = DiscordModules.GuildMemberStore;
const UserStore = DiscordModules.UserStore; const UserStore = DiscordModules.UserStore;
const DiscordPerms = Object.assign({}, DiscordModules.DiscordConstants.Permissions); const DiscordPerms = Object.assign({}, DiscordModules.DiscordPermissions);
const AvatarDefaults = WebpackModules.getByProps("DEFAULT_AVATARS"); const AvatarDefaults = WebpackModules.getByProps("DEFAULT_AVATARS");
const UserPopoutSelectors = Object.assign({}, WebpackModules.getByProps("userPopout"), WebpackModules.getByProps("rolesList")); const ModalClasses = WebpackModules.getByProps("root", "header", "small");
for (const key in UserPopoutSelectors) UserPopoutSelectors[key] = new Structs.Selector(UserPopoutSelectors[key]); const Strings = WebpackModules.getModule(m => m.Messages && m.Messages.COPY_ID).Messages;
const escapeHTML = DOMTools.escapeHTML ? DOMTools.escapeHTML : function(html) { const UserPopoutClasses = Object.assign({}, WebpackModules.getByProps("userPopout"), WebpackModules.getByProps("rolesList"), WebpackModules.getByProps("eyebrow"));
const textNode = document.createTextNode(""); const UserPopoutSelectors = {};
const spanElement = document.createElement("span"); for (const key in UserPopoutClasses) UserPopoutSelectors[key] = new Structs.Selector(UserPopoutClasses[key]);
spanElement.append(textNode); const RoleClasses = Object.assign({}, DiscordClasses.PopoutRoles, WebpackModules.getByProps("rolesList"), WebpackModules.getByProps("roleName", "roleIcon"));
textNode.nodeValue = html;
return spanElement.innerHTML;
};
if (DiscordPerms.STREAM) { if (DiscordPerms.STREAM) {
DiscordPerms.VIDEO = DiscordPerms.STREAM; DiscordPerms.VIDEO = DiscordPerms.STREAM;
@@ -85,7 +249,15 @@ module.exports = (() => {
return class PermissionsViewer extends Plugin { return class PermissionsViewer extends Plugin {
constructor() { constructor() {
super(); super();
this.css = `.member-perms-header { this.css = `.perm-user-avatar {
border-radius: 50%;
width: 16px;
height: 16px;
margin-right: 3px;
}
.member-perms-header {
color: var(--header-secondary);
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
@@ -212,7 +384,6 @@ module.exports = (() => {
} }
#permissions-modal-wrapper #permissions-modal { #permissions-modal-wrapper #permissions-modal {
display: flex;
contain: layout; contain: layout;
flex-direction: column; flex-direction: column;
pointer-events: auto; pointer-events: auto;
@@ -291,7 +462,7 @@ module.exports = (() => {
} }
#permissions-modal-wrapper .perm-side { #permissions-modal-wrapper .perm-side {
width: 250px; width: 273px;
background-color: #36393f; background-color: #36393f;
flex: 0 0 auto; flex: 0 0 auto;
display: flex; display: flex;
@@ -396,6 +567,10 @@ module.exports = (() => {
.theme-light #permissions-modal-wrapper .role-item, .theme-light #permissions-modal-wrapper .role-item,
.theme-light #permissions-modal-wrapper .perm-name { .theme-light #permissions-modal-wrapper .perm-name {
color: #000; color: #000;
}
#permissions-modal-wrapper #permissions-modal {
width: auto;
}`; }`;
this.jumbo = `#permissions-modal-wrapper #permissions-modal { this.jumbo = `#permissions-modal-wrapper #permissions-modal {
height: 840px; height: 840px;
@@ -415,7 +590,7 @@ module.exports = (() => {
width: 50%; width: 50%;
}`; }`;
this.listHTML = `<div id="permissions-popout"> this.listHTML = `<div id="permissions-popout">
<div class="member-perms-header \${bodyTitle}"> <div class="member-perms-header \${bodyTitle} \${eyebrow}">
<div class="member-perms-title">\${label}</div> <div class="member-perms-title">\${label}</div>
<span class="perm-details"> <span class="perm-details">
<svg name="Details" viewBox="0 0 24 24" class="perm-details-button" fill="currentColor"> <svg name="Details" viewBox="0 0 24 24" class="perm-details-button" fill="currentColor">
@@ -425,6 +600,18 @@ module.exports = (() => {
</span> </span>
</div> </div>
<ul class="member-perms \${root} \${rolesList} \${endBodySection}"></ul> <ul class="member-perms \${root} \${rolesList} \${endBodySection}"></ul>
</div>`;
this.skinHTML = `<div class="section-3FmfOT" id="permissions-popout">
<h2 class="member-perms-header defaultColor-24IHKz eyebrow-Ejf06y defaultColor-HXu-5n title-1r9MQ6" data-text-variant="eyebrow">
<div class="member-perms-title">\${label}</div>
<span class="perm-details">
<svg name="Details" viewBox="0 0 24 24" class="perm-details-button" fill="currentColor">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/>
</svg>
</span>
</h2>
<div class="member-perms root-jbEB5E flex-3BkGQD wrap-7NZuTn roles-3zC7MX"></div>
</div>`; </div>`;
this.itemHTML = `<li class="member-perm \${role}"> this.itemHTML = `<li class="member-perm \${role}">
<div class="perm-circle \${roleCircle}"></div> <div class="perm-circle \${roleCircle}"></div>
@@ -432,8 +619,8 @@ module.exports = (() => {
</li>`; </li>`;
this.modalHTML = `<div id="permissions-modal-wrapper"> this.modalHTML = `<div id="permissions-modal-wrapper">
<div class="callout-backdrop \${backdrop}"></div> <div class="callout-backdrop \${backdrop}"></div>
<div class="modal-wrapper \${modal}"> <div class="modal-wrapper">
<div id="permissions-modal" class="\${inner}"> <div id="permissions-modal" class="\${root} \${small}">
<div class="header"><div class="title">\${header}</div></div> <div class="header"><div class="title">\${header}</div></div>
<div class="modal-body"> <div class="modal-body">
<div class="role-side"> <div class="role-side">
@@ -454,7 +641,7 @@ module.exports = (() => {
</div>`; </div>`;
this.modalItem = `<div class="perm-item"><span class="perm-name"></span></div>`; this.modalItem = `<div class="perm-item"><span class="perm-name"></span></div>`;
this.modalButton = `<div class="role-item"><span class="role-name"></span></div>`; this.modalButton = `<div class="role-item"><span class="role-name"></span></div>`;
this.modalButtonUser = `<div class="role-item"><div class="wrapper-2F3Zv8 xsmall-3afG_L"><div class="image-33JSyf xsmall-3afG_L" style="background-image: url('\${avatarUrl}');"></div></div><span class="role-name marginLeft8-1YseBe"></span></div>`; this.modalButtonUser = `<div class="role-item"><div class="wrapper-2F3Zv8 xsmall-3afG_L"><div class="image-33JSyf xsmall-3afG_L perm-user-avatar" style="background-image: url('\${avatarUrl}');"></div></div><span class="role-name marginLeft8-1YseBe"></span></div>`;
this.permAllowedIcon = `<svg height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/></svg>`; this.permAllowedIcon = `<svg height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/></svg>`;
this.permDeniedIcon = `<svg height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8 0-1.85.63-3.55 1.69-4.9L16.9 18.31C15.55 19.37 13.85 20 12 20zm6.31-3.1L7.1 5.69C8.45 4.63 10.15 4 12 4c4.42 0 8 3.58 8 8 0 1.85-.63 3.55-1.69 4.9z"/></svg>`; this.permDeniedIcon = `<svg height="24" viewBox="0 0 24 24" width="24"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8 0-1.85.63-3.55 1.69-4.9L16.9 18.31C15.55 19.37 13.85 20 12 20zm6.31-3.1L7.1 5.69C8.45 4.63 10.15 4 12 4c4.42 0 8 3.58 8 8 0 1.85-.63 3.55-1.69 4.9z"/></svg>`;
@@ -463,13 +650,17 @@ module.exports = (() => {
} }
onStart() { onStart() {
PluginUtilities.addStyle(this.getName(), this.css); DOM.addStyle(this.name, this.css);
this.listHTML = Utilities.formatTString(this.listHTML, DiscordClasses.UserPopout); this.listHTML = Utilities.formatTString(this.listHTML, DiscordClasses.UserPopout);
this.listHTML = Utilities.formatTString(this.listHTML, DiscordClasses.PopoutRoles); this.listHTML = Utilities.formatTString(this.listHTML, RoleClasses);
this.itemHTML = Utilities.formatTString(this.itemHTML, DiscordClasses.PopoutRoles); this.listHTML = Utilities.formatTString(this.listHTML, UserPopoutClasses);
this.skinHTML = Utilities.formatTString(this.skinHTML, DiscordClasses.UserPopout);
this.skinHTML = Utilities.formatTString(this.skinHTML, RoleClasses);
this.skinHTML = Utilities.formatTString(this.skinHTML, UserPopoutClasses);
this.itemHTML = Utilities.formatTString(this.itemHTML, RoleClasses);
this.modalHTML = Utilities.formatTString(this.modalHTML, DiscordClasses.Backdrop); this.modalHTML = Utilities.formatTString(this.modalHTML, DiscordClasses.Backdrop);
this.modalHTML = Utilities.formatTString(this.modalHTML, DiscordClasses.Modals); this.modalHTML = Utilities.formatTString(this.modalHTML, {root: ModalClasses.root, small: ModalClasses.small});
this.promises = {state: {cancelled: false}, cancel() {this.state.cancelled = true;}}; this.promises = {state: {cancelled: false}, cancel() {this.state.cancelled = true;}};
if (this.settings.popouts) this.bindPopouts(); if (this.settings.popouts) this.bindPopouts();
@@ -478,20 +669,20 @@ module.exports = (() => {
} }
onStop() { onStop() {
PluginUtilities.removeStyle(this.getName()); DOM.removeStyle(this.name);
this.promises.cancel(); this.promises.cancel();
this.unbindPopouts(); this.unbindPopouts();
this.unbindContextMenus(); this.unbindContextMenus();
} }
setDisplayMode(mode) { setDisplayMode(mode) {
if (mode === "cozy") PluginUtilities.addStyle(this.getName() + "-jumbo", this.jumbo); if (mode === "cozy") DOM.addStyle(this.name + "-jumbo", this.jumbo);
else PluginUtilities.removeStyle(this.getName() + "-jumbo"); else DOM.removeStyle(this.name + "-jumbo");
} }
async bindPopouts() { patchPopouts(e) {
const popoutMount = (props) => { const popoutMount = (props) => {
const popout = document.querySelector(UserPopoutSelectors.userPopout); const popout = document.querySelector(`[class*="userPopout-"], [class*="userPopoutOuter-"]`);
if (!popout || popout.querySelector("#permissions-popout")) return; if (!popout || popout.querySelector("#permissions-popout")) return;
const user = MemberStore.getMember(props.guildId, props.user.id); const user = MemberStore.getMember(props.guildId, props.user.id);
const guild = GuildStore.getGuild(props.guildId); const guild = GuildStore.getGuild(props.guildId);
@@ -503,9 +694,10 @@ module.exports = (() => {
userRoles.reverse(); userRoles.reverse();
let perms = 0n; let perms = 0n;
const permBlock = DOMTools.createElement(Utilities.formatTString(this.listHTML, {label: this.strings.popoutLabel})); const isSkin = popout.className.includes("userPopoutOuter");
const permBlock = DOMTools.createElement(Utilities.formatTString(isSkin ? this.skinHTML : this.listHTML, {label: this.strings.popoutLabel}));
const memberPerms = permBlock.querySelector(".member-perms"); const memberPerms = permBlock.querySelector(".member-perms");
const strings = DiscordModules.Strings; const strings = Strings;
for (let r = 0; r < userRoles.length; r++) { for (let r = 0; r < userRoles.length; r++) {
const role = userRoles[r]; const role = userRoles[r];
@@ -516,6 +708,7 @@ module.exports = (() => {
const hasPerm = (perms & DiscordPerms[perm]) == DiscordPerms[perm]; const hasPerm = (perms & DiscordPerms[perm]) == DiscordPerms[perm];
if (hasPerm && !memberPerms.querySelector(`[data-name="${permName}"]`)) { if (hasPerm && !memberPerms.querySelector(`[data-name="${permName}"]`)) {
const element = DOMTools.createElement(this.itemHTML); const element = DOMTools.createElement(this.itemHTML);
if (isSkin) element.classList.add("rolePill-2Lo5dd");
let roleColor = guild.roles[role].colorString; let roleColor = guild.roles[role].colorString;
element.querySelector(".name").textContent = permName; element.querySelector(".name").textContent = permName;
element.setAttribute("data-name", permName); element.setAttribute("data-name", permName);
@@ -530,8 +723,10 @@ module.exports = (() => {
permBlock.querySelector(".perm-details").addEventListener("click", () => { permBlock.querySelector(".perm-details").addEventListener("click", () => {
this.showModal(this.createModalUser(name, user, guild)); this.showModal(this.createModalUser(name, user, guild));
}); });
const roleList = popout.querySelector(UserPopoutSelectors.rolesList); let roleList = popout.querySelector(isSkin ? ".roles-3zC7MX" : UserPopoutSelectors.rolesList);
roleList.parentNode.insertBefore(permBlock, roleList.nextSibling); if (isSkin) roleList = roleList.parentElement;
roleList?.parentNode?.insertBefore(permBlock, roleList.nextSibling);
const popoutInstance = ReactTools.getOwnerInstance(popout, {include: ["Popout"]}); const popoutInstance = ReactTools.getOwnerInstance(popout, {include: ["Popout"]});
@@ -539,12 +734,21 @@ module.exports = (() => {
popoutInstance.updateOffsets(); popoutInstance.updateOffsets();
}; };
if (!e.addedNodes.length || !(e.addedNodes[0] instanceof Element)) return;
// console.log(e)
const element = e.addedNodes[0];
const popout = element.querySelector(`[class*="userPopout-"], [class*="userPopoutOuter-"]`) ?? element;
if (!popout || !popout.matches(`[class*="userPopout-"], [class*="userPopoutOuter-"]`)) return;
const props = Utilities.findInTree(ReactTools.getReactInstance(popout), m => m && m.user, {walkable: ["return", "memoizedProps"]});
popoutMount(props);
}
this.cancelUserPopout = Patcher.after(DiscordModules.UserPopout, "type", (_, __, retVal) => popoutMount(retVal.props)); bindPopouts() {
this.observer = this.patchPopouts.bind(this);
} }
unbindPopouts() { unbindPopouts() {
this.cancelUserPopout(); this.observer = undefined;
} }
async bindContextMenus() { async bindContextMenus() {
@@ -557,71 +761,45 @@ module.exports = (() => {
for (const cancel of this.contextMenuPatches) cancel(); for (const cancel of this.contextMenuPatches) cancel();
} }
async patchGuildContextMenu() { patchGuildContextMenu() {
const GuildContextMenu = await DCM.getDiscordMenu("GuildContextMenu"); this.contextMenuPatches.push(ContextMenu.patch("guild-context", (retVal, props) => {
if (this.promises.state.cancelled) return; const newItem = ContextMenu.buildItem({
this.contextMenuPatches.push(Patcher.after(GuildContextMenu, "default", (_, [props], retVal) => {
const original = retVal.props.children[0].props.children;
const newOne = DCM.buildMenuItem({
label: this.strings.contextMenuLabel, label: this.strings.contextMenuLabel,
action: () => { action: () => {
this.showModal(this.createModalGuild(props.guild.name, props.guild)); this.showModal(this.createModalGuild(props.guild.name, props.guild));
} }
}); });
if (Array.isArray(original)) original.splice(1, 0, newOne); retVal.props.children.splice(1, 0, newItem);
else retVal.props.children[0].props.children = [original, newOne];
})); }));
} }
patchChannelContextMenu() { patchChannelContextMenu() {
const patch = (_, [props], retVal) => { this.contextMenuPatches.push(ContextMenu.patch("channel-context", (retVal, props) => {
const original = retVal.props.children[0].props.children; const newItem = ContextMenu.buildItem({
const newOne = DCM.buildMenuItem({
label: this.strings.contextMenuLabel, label: this.strings.contextMenuLabel,
action: () => { action: () => {
const channel = props.channel; if (!Object.keys(props.channel.permissionOverwrites).length) return Toasts.info(`#${props.channel.name} has no permission overrides`);
if (!Object.keys(channel.permissionOverwrites).length) return Toasts.info(`#${channel.name} has no permission overrides`); this.showModal(this.createModalChannel(props.channel.name, props.channel, props.guild));
this.showModal(this.createModalChannel(channel.name, channel, props.guild));
} }
}); });
if (Array.isArray(original)) original.splice(1, 0, newOne); retVal.props.children.splice(1, 0, newItem);
else retVal.props.children[0].props.children = [original, newOne]; }));
};
DCM.getDiscordMenu("ChannelListVoiceChannelContextMenu").then(VoiceChannelContextMenu => {
if (this.promises.state.cancelled) return;
this.contextMenuPatches.push(Patcher.after(VoiceChannelContextMenu, "default", patch));
});
DCM.getDiscordMenu(m => m.displayName === "ChannelListTextChannelContextMenu" && !m.toString().includes("AnalyticsLocations.CONTEXT_MENU")).then(TextChannelContextMenu => {
if (this.promises.state.cancelled) return;
this.contextMenuPatches.push(Patcher.after(TextChannelContextMenu, "default", patch));
});
DCM.getDiscordMenu(m => m.displayName === "ChannelListTextChannelContextMenu" && m.toString().includes("AnalyticsLocations.CONTEXT_MENU")).then(CategoryChannelContextMenu => {
if (this.promises.state.cancelled) return;
this.contextMenuPatches.push(Patcher.after(CategoryChannelContextMenu, "default", patch));
});
} }
async patchUserContextMenu() { patchUserContextMenu() {
const UserContextMenu = await DCM.getDiscordMenu("GuildChannelUserContextMenu"); this.contextMenuPatches.push(ContextMenu.patch("user-context", (retVal, props) => {
if (this.promises.state.cancelled) return; const guild = GuildStore.getGuild(props.guildId);
this.contextMenuPatches.push(Patcher.after(UserContextMenu, "default", (_, [props], retVal) => {
const guildId = SelectedGuildStore.getGuildId();
const guild = GuildStore.getGuild(guildId);
if (!guild) return; if (!guild) return;
const original = retVal.props.children.props.children[1].props.children;
const newOne = DCM.buildMenuItem({ const newItem = ContextMenu.buildItem({
label: this.strings.contextMenuLabel, label: this.strings.contextMenuLabel,
action: () => { action: () => {
const user = MemberStore.getMember(guildId, props.user.id); const user = MemberStore.getMember(props.guildId, props.user.id);
const name = user.nick ? user.nick : UserStore.getUser(user.userId).username; const name = user.nick ? user.nick : props.user.username;
this.showModal(this.createModalUser(name, user, guild)); this.showModal(this.createModalUser(name, user, guild));
} }
}); });
if (Array.isArray(original)) original.splice(1, 0, newOne); retVal?.props?.children[0]?.props?.children.splice(2, 0, newItem);
else retVal.props.children.props.children[1].props.children = [original, newOne];
})); }));
} }
@@ -638,14 +816,14 @@ module.exports = (() => {
} }
createModalUser(name, user, guild) { createModalUser(name, user, guild) {
const userRoles = user.roles.slice(0);
const guildRoles = Object.assign({}, guild.roles); const guildRoles = Object.assign({}, guild.roles);
const userRoles = user.roles.slice(0).filter(r => typeof(guildRoles[r]) !== "undefined");
userRoles.push(guild.id); userRoles.push(guild.id);
userRoles.sort((a, b) => {return guildRoles[b].position - guildRoles[a].position;}); userRoles.sort((a, b) => {return guildRoles[b].position - guildRoles[a].position;});
if (user.userId == guild.ownerId) { if (user.userId == guild.ownerId) {
const ALL_PERMISSIONS = Object.values(DiscordModules.DiscordConstants.Permissions).reduce((all, p) => all | p); const ALL_PERMISSIONS = Object.values(DiscordModules.DiscordPermissions).reduce((all, p) => all | p);
userRoles.push(user.userId); userRoles.push(user.userId);
guildRoles[user.userId] = {name: this.strings.modal.owner, permissions: ALL_PERMISSIONS}; guildRoles[user.userId] = {name: this.strings.modal.owner, permissions: ALL_PERMISSIONS};
} }
@@ -658,22 +836,22 @@ module.exports = (() => {
createModal(title, displayRoles, referenceRoles, isOverride = false) { createModal(title, displayRoles, referenceRoles, isOverride = false) {
if (!referenceRoles) referenceRoles = displayRoles; if (!referenceRoles) referenceRoles = displayRoles;
const modal = DOMTools.createElement(Utilities.formatTString(Utilities.formatTString(this.modalHTML, this.strings.modal), {name: escapeHTML(title)})); const modal = DOMTools.createElement(Utilities.formatTString(Utilities.formatTString(this.modalHTML, this.strings.modal), {name: Utils.escapeHTML(title)}));
modal.querySelector(".callout-backdrop").addEventListener("click", () => { modal.querySelector(".callout-backdrop").addEventListener("click", () => {
modal.classList.add("closing"); modal.classList.add("closing");
setTimeout(() => {modal.remove();}, 300); setTimeout(() => {modal.remove();}, 300);
}); });
const strings = DiscordModules.Strings; const strings = Strings || {};
for (const r in displayRoles) { for (const r in displayRoles) {
const role = Array.isArray(displayRoles) ? displayRoles[r] : r; const role = Array.isArray(displayRoles) ? displayRoles[r] : r;
const user = UserStore.getUser(role) || {avatarURL: AvatarDefaults.DEFAULT_AVATARS[Math.floor(Math.random() * AvatarDefaults.DEFAULT_AVATARS.length)], username: role}; const user = UserStore.getUser(role) || {getAvatarURL: () => AvatarDefaults.DEFAULT_AVATARS[Math.floor(Math.random() * AvatarDefaults.DEFAULT_AVATARS.length)], username: role};
const member = MemberStore.getMember(SelectedGuildStore.getGuildId(), role) || {colorString: ""}; const member = MemberStore.getMember(SelectedGuildStore.getGuildId(), role) || {colorString: ""};
const item = DOMTools.createElement(!isOverride || displayRoles[role].type == 0 ? this.modalButton : Utilities.formatTString(this.modalButtonUser, {avatarUrl: user.avatarURL})); const item = DOMTools.createElement(!isOverride || displayRoles[role].type == 0 ? this.modalButton : Utilities.formatTString(this.modalButtonUser, {avatarUrl: user.getAvatarURL(null, 16, true)})); // getAvatarURL(guildId, size, canAnimate);
if (!isOverride || displayRoles[role].type == 0) item.style.color = referenceRoles[role].colorString; if (!isOverride || displayRoles[role].type == 0) item.style.color = referenceRoles[role].colorString;
else item.style.color = member.colorString; else item.style.color = member.colorString;
if (isOverride) item.querySelector(".role-name").innerHTML = escapeHTML(displayRoles[role].type == 0 ? referenceRoles[role].name : user.username); if (isOverride) item.querySelector(".role-name").innerHTML = Utils.escapeHTML(displayRoles[role].type == 0 ? referenceRoles[role].name : user.username);
else item.querySelector(".role-name").innerHTML = escapeHTML(referenceRoles[role].name); else item.querySelector(".role-name").innerHTML = Utils.escapeHTML(referenceRoles[role].name);
modal.querySelector(".role-scroller").append(item); modal.querySelector(".role-scroller").append(item);
item.addEventListener("click", () => { item.addEventListener("click", () => {
modal.querySelectorAll(".role-item.selected").forEach(e => e.classList.remove("selected")); modal.querySelectorAll(".role-item.selected").forEach(e => e.classList.remove("selected"));
@@ -701,8 +879,8 @@ module.exports = (() => {
} }
}); });
item.addEventListener("contextmenu", (e) => { item.addEventListener("contextmenu", (e) => {
DCM.openContextMenu(e, DCM.buildMenu([ ContextMenu.open(e, ContextMenu.buildMenu([
{label: DiscordModules.Strings.COPY_ID, action: () => {DiscordModules.ElectronModule.copy(role);}} {label: Strings.COPY_ID ?? "Copy Id", action: () => {DiscordModules.ElectronModule.copy(role);}}
])); ]));
}); });
} }
@@ -730,7 +908,6 @@ module.exports = (() => {
}; };
}; };
return plugin(Plugin, Api); return plugin(Plugin, Api);
})(global.ZeresPluginLibrary.buildPlugin(config)); })(global.ZeresPluginLibrary.buildPlugin(config));
})();
/*@end@*/ /*@end@*/

View File

@@ -2,7 +2,7 @@
* @name PinDMs * @name PinDMs
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 1.9.3 * @version 1.9.7
* @description Allows you to pin DMs, making them appear at the top of your DMs/ServerList * @description Allows you to pin DMs, making them appear at the top of your DMs/ServerList
* @invite Jx3TjNS * @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien * @donate https://www.paypal.me/MircoWittrien
@@ -13,20 +13,16 @@
*/ */
module.exports = (_ => { module.exports = (_ => {
const config = { const changeLog = {
"info": {
"name": "PinDMs",
"author": "DevilBro",
"version": "1.9.3",
"description": "Allows you to pin DMs, making them appear at the top of your DMs/ServerList"
}
}; };
return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class { return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class {
getName () {return config.info.name;} constructor (meta) {for (let key in meta) this[key] = meta[key];}
getAuthor () {return config.info.author;} getName () {return this.name;}
getVersion () {return config.info.version;} getAuthor () {return this.author;}
getDescription () {return `The Library Plugin needed for ${config.info.name} is missing. Open the Plugin Settings to download it. \n\n${config.info.description}`;} getVersion () {return this.version;}
getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;}
downloadLibrary () { downloadLibrary () {
require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => {
@@ -39,7 +35,7 @@ module.exports = (_ => {
if (!window.BDFDB_Global || !Array.isArray(window.BDFDB_Global.pluginQueue)) window.BDFDB_Global = Object.assign({}, window.BDFDB_Global, {pluginQueue: []}); if (!window.BDFDB_Global || !Array.isArray(window.BDFDB_Global.pluginQueue)) window.BDFDB_Global = Object.assign({}, window.BDFDB_Global, {pluginQueue: []});
if (!window.BDFDB_Global.downloadModal) { if (!window.BDFDB_Global.downloadModal) {
window.BDFDB_Global.downloadModal = true; window.BDFDB_Global.downloadModal = true;
BdApi.showConfirmationModal("Library Missing", `The Library Plugin needed for ${config.info.name} is missing. Please click "Download Now" to install it.`, { BdApi.showConfirmationModal("Library Missing", `The Library Plugin needed for ${this.name} is missing. Please click "Download Now" to install it.`, {
confirmText: "Download Now", confirmText: "Download Now",
cancelText: "Cancel", cancelText: "Cancel",
onCancel: _ => {delete window.BDFDB_Global.downloadModal;}, onCancel: _ => {delete window.BDFDB_Global.downloadModal;},
@@ -49,13 +45,13 @@ module.exports = (_ => {
} }
}); });
} }
if (!window.BDFDB_Global.pluginQueue.includes(config.info.name)) window.BDFDB_Global.pluginQueue.push(config.info.name); if (!window.BDFDB_Global.pluginQueue.includes(this.name)) window.BDFDB_Global.pluginQueue.push(this.name);
} }
start () {this.load();} start () {this.load();}
stop () {} stop () {}
getSettingsPanel () { getSettingsPanel () {
let template = document.createElement("template"); let template = document.createElement("template");
template.innerHTML = `<div style="color: var(--header-primary); font-size: 16px; font-weight: 300; white-space: pre; line-height: 22px;">The Library Plugin needed for ${config.info.name} is missing.\nPlease click <a style="font-weight: 500;">Download Now</a> to install it.</div>`; template.innerHTML = `<div style="color: var(--header-primary); font-size: 16px; font-weight: 300; white-space: pre; line-height: 22px;">The Library Plugin needed for ${this.name} is missing.\nPlease click <a style="font-weight: 500;">Download Now</a> to install it.</div>`;
template.content.firstElementChild.querySelector("a").addEventListener("click", this.downloadLibrary); template.content.firstElementChild.querySelector("a").addEventListener("click", this.downloadLibrary);
return template.content.firstElementChild; return template.content.firstElementChild;
} }
@@ -83,15 +79,22 @@ module.exports = (_ => {
} }
}; };
this.patchedModules = { this.modulePatches = {
before: { before: [
PrivateChannelsList: "render" "PrivateChannelsList"
}, ],
after: { after: [
PrivateChannelsList: "render", "DirectMessage",
PrivateChannel: ["render", "componentDidMount"], "PrivateChannel",
DirectMessage: ["render", "componentDidMount", "componentWillUnmount"] "PrivateChannelsList"
} ],
componentDidMount: [
"DirectMessage",
"PrivateChannel"
],
componentWillUnmount: [
"DirectMessage"
]
}; };
this.css = ` this.css = `
@@ -159,7 +162,7 @@ module.exports = (_ => {
} }
onStart () { onStart () {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.DirectMessageUnreadStore, "getUnreadPrivateChannelIds", {after: e => { BDFDB.PatchUtils.patch(this, BDFDB.LibraryStores.PrivateChannelReadStateStore, "getUnreadPrivateChannelIds", {after: e => {
let sortedRecents = this.sortAndUpdate("guildList"); let sortedRecents = this.sortAndUpdate("guildList");
if (sortedRecents.length) { if (sortedRecents.length) {
const dms = []; const dms = [];
@@ -254,13 +257,18 @@ module.exports = (_ => {
} }
onUserContextMenu (e) { onUserContextMenu (e) {
if (e.instance.props.channel && !e.instance.props.channel.guild_id && e.subType == "useCloseDMItem") e.returnvalue.unshift(this.createItem(e.instance.props.channel.id)); if (e.instance.props.channel && !e.instance.props.channel.guild_id) {
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "close-dm"});
children.splice(index > -1 ? index : children.length, 0, this.createItem(e.instance.props.channel.id));
}
} }
onChannelContextMenu (e) { onGroupDMContextMenu (e) {
if (e.instance.props.channel && !e.instance.props.channel.guild_id && e.instance.props.channel.isGroupDM() && e.subType == "useChannelMarkAsReadItem") { if (e.instance.props.channel) {
if (e.returnvalue.length > 0) e.returnvalue.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuSeparator, {})); let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "change-icon", group: true});
e.returnvalue.push(this.createItem(e.instance.props.channel.id)); children.splice(index > -1 ? index + 1 : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: this.createItem(e.instance.props.channel.id)
}));
} }
} }
@@ -278,33 +286,25 @@ module.exports = (_ => {
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.context_pinchannel, label: this.labels.context_pinchannel,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "submenu-channelist"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "submenu-channelist"),
children: this.getPredefinedCategory(id) ? BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { children: [
label: this.labels.context_inpredefined,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "in-predefined"),
disabled: true
}) : [
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, { BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: currentCategory ? BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { children: currentCategory ? BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.context_unpinchannel, label: this.labels.context_unpinchannel,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "unpin-channellist"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "unpin-channellist"),
color: BDFDB.LibraryComponents.MenuItems.Colors.DANGER, color: BDFDB.DiscordConstants.MenuItemColors.DANGER,
action: _ => { action: _ => this.removeFromCategory(id, currentCategory, "channelList")
this.removeFromCategory(id, currentCategory, "channelList");
}
}) : BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { }) : BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.context_addtonewcategory, label: this.labels.context_addtonewcategory,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "new-channellist"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "new-channellist"),
color: BDFDB.LibraryComponents.MenuItems.Colors.BRAND, color: BDFDB.DiscordConstants.MenuItemColors.BRAND,
action: _ => { action: _ => this.openCategorySettingsModal({
this.openCategorySettingsModal({ id: this.generateId("channelList"),
id: this.generateID("channelList").toString(), name: `${this.labels.header_pinneddms} #${categories.length + 1}`,
name: `${this.labels.header_pinneddms} #${categories.length + 1}`, dms: [id],
dms: [id], pos: categories.length,
pos: categories.length, collapsed: false,
collapsed: false, color: null
color: null }, "channelList", true)
}, "channelList", true);
}
}) })
}), }),
categories.length ? BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, { categories.length ? BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
@@ -322,7 +322,7 @@ module.exports = (_ => {
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels[pinnedInGuild ? "context_unpinguild" : "context_pinguild"], label: this.labels[pinnedInGuild ? "context_unpinguild" : "context_pinguild"],
id: BDFDB.ContextMenuUtils.createItemId(this.name, pinnedInGuild ? "unpin-serverlist" : "pin-serverlist"), id: BDFDB.ContextMenuUtils.createItemId(this.name, pinnedInGuild ? "unpin-serverlist" : "pin-serverlist"),
color: pinnedInGuild ? BDFDB.LibraryComponents.MenuItems.Colors.DANGER : BDFDB.LibraryComponents.MenuItems.Colors.DEFAULT, color: pinnedInGuild ? BDFDB.DiscordConstants.MenuItemColors.DANGER : BDFDB.DiscordConstants.MenuItemColors.DEFAULT,
action: _ => { action: _ => {
if (!pinnedInGuild) this.addPin(id, "guildList"); if (!pinnedInGuild) this.addPin(id, "guildList");
else this.removePin(id, "guildList"); else this.removePin(id, "guildList");
@@ -334,49 +334,46 @@ module.exports = (_ => {
processPrivateChannelsList (e) { processPrivateChannelsList (e) {
let categories = this.sortAndUpdateCategories("channelList", true); let categories = this.sortAndUpdateCategories("channelList", true);
if (categories.length) { if (!categories.length) return;
e.instance.props.channels = Object.assign({}, e.instance.props.channels); e.instance.props.channels = Object.assign({}, e.instance.props.channels);
e.instance.props.privateChannelIds = [].concat(e.instance.props.privateChannelIds || []); e.instance.props.privateChannelIds = [].concat(e.instance.props.privateChannelIds || []);
e.instance.props.pinnedChannelIds = Object.assign({}, e.instance.props.pinnedChannelIds); e.instance.props.pinnedChannelIds = Object.assign({}, e.instance.props.pinnedChannelIds);
if (!e.returnvalue) { if (!e.returnvalue) {
if (draggedChannel && releasedChannel) { if (draggedChannel && releasedChannel) {
let categoryId = releasedChannel.split("header_")[1]; let categoryId = releasedChannel.split("header_")[1];
let category = categories.find(n => categoryId != undefined ? n.id == categoryId : n.dms.includes(releasedChannel)); let category = categories.find(n => categoryId != undefined ? n.id == categoryId : n.dms.includes(releasedChannel));
if (category) { if (category) {
BDFDB.ArrayUtils.remove(category.dms, draggedChannel, true); BDFDB.ArrayUtils.remove(category.dms, draggedChannel, true);
category.dms.splice(categoryId != undefined ? 0 : category.dms.indexOf(releasedChannel) + 1, 0, draggedChannel); category.dms.splice(categoryId != undefined ? 0 : category.dms.indexOf(releasedChannel) + 1, 0, draggedChannel);
this.savePinnedChannels(Object.assign({}, this.getPinnedChannels("channelList"), {[category.id]: category}), "channelList"); this.savePinnedChannels(Object.assign({}, this.getPinnedChannels("channelList"), {[category.id]: category}), "channelList");
}
draggedChannel = null;
releasedChannel = null;
} }
if (draggedCategory && releasedCategory) { draggedChannel = null;
let maybedDraggedCategory = categories.find(n => n.id == draggedCategory); releasedChannel = null;
let maybedReleasedCategory = categories.find(n => n.id == releasedCategory); }
if (maybedDraggedCategory && maybedReleasedCategory) { if (draggedCategory && releasedCategory) {
BDFDB.ArrayUtils.remove(categories, maybedDraggedCategory, true); let maybedDraggedCategory = categories.find(n => n.id == draggedCategory);
categories.splice(categories.indexOf(maybedReleasedCategory) + 1, 0, maybedDraggedCategory); let maybedReleasedCategory = categories.find(n => n.id == releasedCategory);
let newCategories = {}, newPos = 0; if (maybedDraggedCategory && maybedReleasedCategory) {
for (let category of [].concat(categories).reverse()) if (!category.predefined) newCategories[category.id] = Object.assign(category, {pos: newPos++}); BDFDB.ArrayUtils.remove(categories, maybedDraggedCategory, true);
this.savePinnedChannels(newCategories, "channelList"); categories.splice(categories.indexOf(maybedReleasedCategory) + 1, 0, maybedDraggedCategory);
} let newCategories = {}, newPos = 0;
draggedCategory = null; for (let category of [].concat(categories).reverse()) if (!category.predefined) newCategories[category.id] = Object.assign(category, {pos: newPos++});
releasedCategory = null; this.savePinnedChannels(newCategories, "channelList");
} }
e.instance.props.pinnedChannelIds = {}; draggedCategory = null;
for (let category of [].concat(categories).reverse()) { releasedCategory = null;
e.instance.props.pinnedChannelIds[category.id] = []; }
for (let id of this.sortDMsByTime(this.filterDMs(category.dms, !category.predefined), "channelList").reverse()) { e.instance.props.pinnedChannelIds = {};
BDFDB.ArrayUtils.remove(e.instance.props.privateChannelIds, id, true); for (let category of [].concat(categories).reverse()) {
if (!category.collapsed || e.instance.props.selectedChannelId == id) { e.instance.props.pinnedChannelIds[category.id] = [];
e.instance.props.privateChannelIds.unshift(id); for (let id of this.sortDMsByTime(this.filterDMs(category.dms, !category.predefined), "channelList").reverse()) {
e.instance.props.pinnedChannelIds[category.id].push(id); BDFDB.ArrayUtils.remove(e.instance.props.privateChannelIds, id, true);
} e.instance.props.privateChannelIds.unshift(id);
} e.instance.props.pinnedChannelIds[category.id].push(id);
} }
} }
else this.injectCategories(e.instance, e.returnvalue, categories); }
else {
let pinnedIds = BDFDB.ObjectUtils.toArray(e.instance.props.pinnedChannelIds).reverse(); let pinnedIds = BDFDB.ObjectUtils.toArray(e.instance.props.pinnedChannelIds).reverse();
BDFDB.PatchUtils.unpatch(this, e.instance, "renderDM"); BDFDB.PatchUtils.unpatch(this, e.instance, "renderDM");
BDFDB.PatchUtils.patch(this, e.instance, "renderDM", {before: e2 => { BDFDB.PatchUtils.patch(this, e.instance, "renderDM", {before: e2 => {
@@ -392,9 +389,9 @@ module.exports = (_ => {
index: e2.methodArguments[2] index: e2.methodArguments[2]
}))) : null; }))) : null;
let category = categories[e2.methodArguments[0] - 1]; // WRONG let category = categories[e2.methodArguments[0] - 1];
if (category) { if (category) {
if (!id || (category.collapsed && e.instance.props.selectedChannelId != id) || !this.filterDMs(category.dms, !category.predefined).includes(id) || draggedCategory == category.id || draggedChannel == id) e2.returnValue = null; if (!id || (category.collapsed && e.instance.props.selectedChannelId != id) || !this.filterDMs(category.dms, !category.predefined).includes(id) || draggedCategory == category.id || draggedChannel == id) e2.returnValue = null;
else if (hoveredCategory == category.id && [].concat(category.dms).reverse()[0] == id) e2.returnValue = [ else if (hoveredCategory == category.id && [].concat(category.dms).reverse()[0] == id) e2.returnValue = [
e2.returnValue, e2.returnValue,
BDFDB.ReactUtils.createElement("h2", { BDFDB.ReactUtils.createElement("h2", {
@@ -412,7 +409,8 @@ module.exports = (_ => {
].filter(n => n); ].filter(n => n);
} }
} }
}}, {force: true, noCache: true}); }}, {noCache: true});
this.injectCategories(e.instance, e.returnvalue, categories);
} }
} }
@@ -427,38 +425,38 @@ module.exports = (_ => {
let sectionHeight = returnvalue.props.sectionHeight; let sectionHeight = returnvalue.props.sectionHeight;
let sectionHeightFunc = typeof sectionHeight != "function" ? _ => sectionHeight : sectionHeight; let sectionHeightFunc = typeof sectionHeight != "function" ? _ => sectionHeight : sectionHeight;
returnvalue.props.sectionHeight = (...args) => { returnvalue.props.sectionHeight = BDFDB.TimeUtils.suppress((...args) => {
if (args[0] != 0 && args[0] != returnvalue.props.sections.length - 1) { if (args[0] != 0 && args[0] != returnvalue.props.sections.length - 1) {
let category = categories[args[0] - 1]; let category = categories[args[0] - 1];
if (category) return 40; if (category) return 40;
} }
return sectionHeightFunc(...args); return sectionHeightFunc(...args);
}; }, "Error in sectionHeight of PrivateChannelsList!", this);
let rowHeight = returnvalue.props.rowHeight; let rowHeight = returnvalue.props.rowHeight;
let rowHeightFunc = typeof rowHeight != "function" ? _ => rowHeight : rowHeight; let rowHeightFunc = typeof rowHeight != "function" ? _ => rowHeight : rowHeight;
returnvalue.props.rowHeight = (...args) => { returnvalue.props.rowHeight = BDFDB.TimeUtils.suppress((...args) => {
if (args[0] != 0 && args[0] != returnvalue.props.sections.length - 1) { if (args[0] != 0 && args[0] != returnvalue.props.sections.length - 1) {
let category = categories[args[0] - 1]; let category = categories[args[0] - 1];
if (category && (category.collapsed || category.id == draggedCategory)) return 0; if (category && (category.collapsed || category.id == draggedCategory)) return 0;
} }
return rowHeightFunc(...args); return rowHeightFunc(...args);
}; }, "Error in rowHeight of PrivateChannelsList!", this);
let renderRow = returnvalue.props.renderRow; let renderRow = returnvalue.props.renderRow;
returnvalue.props.renderRow = (...args) => { returnvalue.props.renderRow = BDFDB.TimeUtils.suppress((...args) => {
let row = renderRow(...args); let row = renderRow(...args);
return row && row.key == "no-private-channels" ? null : row; return row && row.key == "no-private-channels" ? null : row;
}; }, "Error in renderRow of PrivateChannelsList!", this);
let renderSection = returnvalue.props.renderSection; let renderSection = returnvalue.props.renderSection;
returnvalue.props.renderSection = (...args) => { returnvalue.props.renderSection = BDFDB.TimeUtils.suppress((...args) => {
if (args[0].section != 0 && args[0].section != returnvalue.props.sections.length - 1) { if (args[0].section != 0 && args[0].section != returnvalue.props.sections.length - 1) {
let category = categories[args[0].section - 1]; let category = categories[args[0].section - 1];
if (category && draggedCategory != category.id) { if (category && draggedCategory != category.id) {
let color = BDFDB.ColorUtils.convert(category.color, "RGBA"); let color = BDFDB.ColorUtils.convert(category.color, "RGBA");
let foundDMs = this.filterDMs(category.dms, !category.predefined); let foundDMs = this.filterDMs(category.dms, !category.predefined);
let unreadAmount = this.settings.general.unreadAmount && BDFDB.ArrayUtils.sum(foundDMs.map(id => BDFDB.LibraryModules.UnreadChannelUtils.getMentionCount(id))); let unreadAmount = this.settings.general.unreadAmount && BDFDB.ArrayUtils.sum(foundDMs.map(id => BDFDB.LibraryStores.ReadStateStore.getMentionCount(id)));
return category.predefined && foundDMs.length < 1 ? null : [ return category.predefined && foundDMs.length < 1 ? null : [
BDFDB.ReactUtils.createElement("h2", { BDFDB.ReactUtils.createElement("h2", {
className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.dmchannelheadercontainer, BDFDB.disCN._pindmspinnedchannelsheadercontainer, category.collapsed && BDFDB.disCN._pindmspinnedchannelsheadercollapsed, color && BDFDB.disCN._pindmspinnedchannelsheadercolored, BDFDB.disCN.namecontainernamecontainer), className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.dmchannelheadercontainer, BDFDB.disCN._pindmspinnedchannelsheadercontainer, category.collapsed && BDFDB.disCN._pindmspinnedchannelsheadercollapsed, color && BDFDB.disCN._pindmspinnedchannelsheadercolored, BDFDB.disCN.namecontainernamecontainer),
@@ -530,14 +528,12 @@ module.exports = (_ => {
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: BDFDB.LanguageUtils.LanguageStrings.CATEGORY_SETTINGS, label: BDFDB.LanguageUtils.LanguageStrings.CATEGORY_SETTINGS,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "category-settings"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "category-settings"),
action: _ => { action: _ => this.openCategorySettingsModal(category, "channelList")
this.openCategorySettingsModal(category, "channelList");
}
}), }),
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: BDFDB.LanguageUtils.LanguageStrings.DELETE_CATEGORY, label: BDFDB.LanguageUtils.LanguageStrings.DELETE_CATEGORY,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "remove-category"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "remove-category"),
color: BDFDB.LibraryComponents.MenuItems.Colors.DANGER, color: BDFDB.DiscordConstants.MenuItemColors.DANGER,
action: _ => { action: _ => {
let newData = this.getPinnedChannels("channelList"); let newData = this.getPinnedChannels("channelList");
delete newData[category.id]; delete newData[category.id];
@@ -590,7 +586,7 @@ module.exports = (_ => {
else return null; else return null;
} }
else return renderSection(...args); else return renderSection(...args);
}; }, "Error in renderSection of PrivateChannelsList!", this);
} }
else if (typeof returnvalue.props.children == "function") { else if (typeof returnvalue.props.children == "function") {
let childrenRender = returnvalue.props.children; let childrenRender = returnvalue.props.children;
@@ -598,7 +594,7 @@ module.exports = (_ => {
let children = childrenRender(...args); let children = childrenRender(...args);
this.injectCategories(instance, children, categories); this.injectCategories(instance, children, categories);
return children; return children;
}, "Error in Children Render of PrivateChannelList!", this); }, "Error in Children Render of PrivateChannelsList!", this);
} }
else if (BDFDB.ArrayUtils.is(returnvalue)) { else if (BDFDB.ArrayUtils.is(returnvalue)) {
for (let child of returnvalue) this.injectCategories(instance, child, categories); for (let child of returnvalue) this.injectCategories(instance, child, categories);
@@ -607,101 +603,97 @@ module.exports = (_ => {
} }
processPrivateChannel (e) { processPrivateChannel (e) {
if (e.instance.props.channel && !this.getPredefinedCategory(e.instance.props.channel.id)) { if (!e.instance.props.channel || this.getPredefinedCategory(e.instance.props.channel.id)) return;
let category = this.getChannelListCategory(e.instance.props.channel.id); let category = this.getChannelListCategory(e.instance.props.channel.id);
if (category) { if (!category) return;
if (e.node) { if (e.node) {
BDFDB.DOMUtils.addClass(e.node, BDFDB.disCN._pindmsdmchannelpinned); BDFDB.DOMUtils.addClass(e.node, BDFDB.disCN._pindmsdmchannelpinned);
e.node.removeEventListener("mousedown", e.node.PinDMsMouseDownListener); e.node.removeEventListener("mousedown", e.node.PinDMsMouseDownListener);
if (!this.settings.recentOrder.channelList) { if (this.settings.recentOrder.channelList) return;
e.node.setAttribute("draggable", false); e.node.setAttribute("draggable", false);
e.node.PinDMsMouseDownListener = event => { e.node.PinDMsMouseDownListener = event => {
if (!this.started) e.node.removeEventListener("mousedown", e.node.PinDMsMouseDownListener); if (!this.started) e.node.removeEventListener("mousedown", e.node.PinDMsMouseDownListener);
else { else {
event = event.nativeEvent || event; event = event.nativeEvent || event;
let mouseMove = event2 => { let mouseMove = event2 => {
if (Math.sqrt((event.pageX - event2.pageX)**2) > 20 || Math.sqrt((event.pageY - event2.pageY)**2) > 20) { if (Math.sqrt((event.pageX - event2.pageX)**2) > 20 || Math.sqrt((event.pageY - event2.pageY)**2) > 20) {
BDFDB.ListenerUtils.stopEvent(event); BDFDB.ListenerUtils.stopEvent(event);
draggedChannel = e.instance.props.channel.id; draggedChannel = e.instance.props.channel.id;
this.updateContainer("channelList"); this.updateContainer("channelList");
let dragPreview = this.createDragPreview(e.node, event2); let dragPreview = this.createDragPreview(e.node, event2);
document.removeEventListener("mousemove", mouseMove); document.removeEventListener("mousemove", mouseMove);
document.removeEventListener("mouseup", mouseUp); document.removeEventListener("mouseup", mouseUp);
let dragging = event3 => { let dragging = event3 => {
this.updateDragPreview(dragPreview, event3); this.updateDragPreview(dragPreview, event3);
let maybeHoveredChannel = null; let maybeHoveredChannel = null;
let categoryNode = BDFDB.DOMUtils.getParent(BDFDB.dotCN._pindmspinnedchannelsheadercontainer, event3.target); let categoryNode = BDFDB.DOMUtils.getParent(BDFDB.dotCN._pindmspinnedchannelsheadercontainer, event3.target);
if (categoryNode) { if (categoryNode) {
let hoveredCategoryId = categoryNode.getAttribute("categoryid"); let hoveredCategoryId = categoryNode.getAttribute("categoryid");
if (hoveredCategoryId && hoveredCategoryId == category.id) maybeHoveredChannel = "header_" + category.id; if (hoveredCategoryId && hoveredCategoryId == category.id) maybeHoveredChannel = "header_" + category.id;
} }
else { else {
let placeholder = BDFDB.DOMUtils.getParent(BDFDB.dotCN._pindmsdmchannelplaceholder, event3.target); let placeholder = BDFDB.DOMUtils.getParent(BDFDB.dotCN._pindmsdmchannelplaceholder, event3.target);
maybeHoveredChannel = (BDFDB.ReactUtils.findValue(BDFDB.DOMUtils.getParent(BDFDB.dotCN._pindmsdmchannelpinned, placeholder ? placeholder.previousSibling : event3.target), "channel", {up: true}) || {}).id; maybeHoveredChannel = (BDFDB.ReactUtils.findValue(BDFDB.DOMUtils.getParent(BDFDB.dotCN._pindmsdmchannelpinned, placeholder ? placeholder.previousSibling : event3.target), "channel", {up: true}) || {}).id;
let maybeHoveredCategory = maybeHoveredChannel && this.getChannelListCategory(maybeHoveredChannel); let maybeHoveredCategory = maybeHoveredChannel && this.getChannelListCategory(maybeHoveredChannel);
if (!maybeHoveredCategory || maybeHoveredCategory.id != category.id) maybeHoveredChannel = null; if (!maybeHoveredCategory || maybeHoveredCategory.id != category.id) maybeHoveredChannel = null;
};
let update = maybeHoveredChannel != hoveredChannel;
if (maybeHoveredChannel) hoveredChannel = maybeHoveredChannel;
else hoveredChannel = null;
if (update) this.updateContainer("channelList");
};
let releasing = event3 => {
BDFDB.DOMUtils.remove(dragPreview);
if (hoveredChannel) releasedChannel = hoveredChannel;
else draggedChannel = null;
hoveredChannel = null;
this.updateContainer("channelList");
document.removeEventListener("mousemove", dragging);
document.removeEventListener("mouseup", releasing);
};
document.addEventListener("mousemove", dragging);
document.addEventListener("mouseup", releasing);
}
}; };
let mouseUp = _ => { let update = maybeHoveredChannel != hoveredChannel;
document.removeEventListener("mousemove", mouseMove); if (maybeHoveredChannel) hoveredChannel = maybeHoveredChannel;
document.removeEventListener("mouseup", mouseUp); else hoveredChannel = null;
}; if (update) this.updateContainer("channelList");
document.addEventListener("mousemove", mouseMove); };
document.addEventListener("mouseup", mouseUp); let releasing = event3 => {
} BDFDB.DOMUtils.remove(dragPreview);
}; if (hoveredChannel) releasedChannel = hoveredChannel;
e.node.addEventListener("mousedown", e.node.PinDMsMouseDownListener); else draggedChannel = null;
} hoveredChannel = null;
this.updateContainer("channelList");
document.removeEventListener("mousemove", dragging);
document.removeEventListener("mouseup", releasing);
};
document.addEventListener("mousemove", dragging);
document.addEventListener("mouseup", releasing);
}
};
let mouseUp = _ => {
document.removeEventListener("mousemove", mouseMove);
document.removeEventListener("mouseup", mouseUp);
};
document.addEventListener("mousemove", mouseMove);
document.addEventListener("mouseup", mouseUp);
} }
if (e.returnvalue) { };
let wrapper = e.returnvalue && e.returnvalue.props.children && e.returnvalue.props.children.props && typeof e.returnvalue.props.children.props.children == "function" ? e.returnvalue.props.children : e.returnvalue; e.node.addEventListener("mousedown", e.node.PinDMsMouseDownListener);
if (typeof wrapper.props.children == "function") { }
let childrenRender = wrapper.props.children; if (e.returnvalue) {
wrapper.props.children = BDFDB.TimeUtils.suppress((...args) => { let process = returnvalue => {
let children = childrenRender(...args); let [children, index] = BDFDB.ReactUtils.findParent(returnvalue, {name: "CloseButton"});
this._processPrivateChannel(e.instance, children, category); if (index > -1) children.splice(index, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
return children; text: BDFDB.LanguageUtils.LanguageStrings.UNPIN,
}, "Error in Children Render of PrivateChannel!", this); children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
} className: BDFDB.disCN._pindmsunpinbutton,
else this._processPrivateChannel(e.instance, wrapper, category); onClick: event => {
} BDFDB.ListenerUtils.stopEvent(event);
} this.removeFromCategory(e.instance.props.channel.id, category, "channelList");
},
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCN._pindmsunpinicon,
name: BDFDB.LibraryComponents.SvgIcon.Names.PIN
})
})
}));
};
let wrapper = e.returnvalue && e.returnvalue.props.children && e.returnvalue.props.children.props && typeof e.returnvalue.props.children.props.children == "function" ? e.returnvalue.props.children : e.returnvalue;
if (typeof wrapper.props.children == "function") {
let childrenRender = wrapper.props.children;
wrapper.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = childrenRender(...args);
process(children);
return children;
}, "Error in Children Render of PrivateChannel!", this);
}
else process(wrapper);
} }
}
_processPrivateChannel (instance, returnvalue, category) {
let [children, index] = BDFDB.ReactUtils.findParent(returnvalue, {name: "CloseButton"});
if (index > -1) children.splice(index, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
text: BDFDB.LanguageUtils.LanguageStrings.UNPIN,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
className: BDFDB.disCN._pindmsunpinbutton,
onClick: event => {
BDFDB.ListenerUtils.stopEvent(event);
this.removeFromCategory(instance.props.channel.id, category, "channelList");
},
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCN._pindmsunpinicon,
name: BDFDB.LibraryComponents.SvgIcon.Names.PIN
})
})
}));
} }
processDirectMessage (e) { processDirectMessage (e) {
@@ -742,15 +734,15 @@ module.exports = (_ => {
else BDFDB.DataUtils.remove(this, "pinned", BDFDB.UserUtils.me.id); else BDFDB.DataUtils.remove(this, "pinned", BDFDB.UserUtils.me.id);
} }
generateID (type) { generateId (type) {
if (!type) return null; if (!type) return null;
let categories = this.getPinnedChannels(type); let categories = this.getPinnedChannels(type);
let id = Math.round(Math.random() * 10000000000000000); let id = Math.round(Math.random() * 10000000000000000);
return categories[id] ? this.generateID() : id; return categories[id] ? this.generateId() : id.toString();
} }
filterDMs (dms, removePredefined) { filterDMs (dms, removePredefined) {
return dms.filter(id => BDFDB.LibraryModules.ChannelStore.getChannel(id) && !(removePredefined && this.getPredefinedCategory(id))); return dms.filter(id => BDFDB.LibraryStores.ChannelStore.getChannel(id) && !(removePredefined && this.getPredefinedCategory(id)));
} }
addToCategory (id, category, type) { addToCategory (id, category, type) {
@@ -778,12 +770,12 @@ module.exports = (_ => {
} }
getPredefinedCategory (id) { getPredefinedCategory (id) {
if (!id) return ""; if (!id || this.getChannelListCategory(id)) return "";
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(id); let channel = BDFDB.LibraryStores.ChannelStore.getChannel(id);
if (!channel) return ""; if (!channel) return "";
else if (this.settings.preCategories.friends.enabled && channel.isDM() && BDFDB.LibraryModules.RelationshipStore.isFriend(channel.recipients[0])) return "friends"; else if (this.settings.preCategories.friends.enabled && channel.isDM() && BDFDB.LibraryStores.RelationshipStore.isFriend(channel.recipients[0])) return "friends";
else if (this.settings.preCategories.blocked.enabled && channel.isDM() && BDFDB.LibraryModules.RelationshipStore.isBlocked(channel.recipients[0])) return "blocked"; else if (this.settings.preCategories.blocked.enabled && channel.isDM() && BDFDB.LibraryStores.RelationshipStore.isBlocked(channel.recipients[0])) return "blocked";
else if (this.settings.preCategories.bots.enabled && channel.isDM() && (BDFDB.LibraryModules.UserStore.getUser(channel.recipients[0]) || {}).bot) return "bots"; else if (this.settings.preCategories.bots.enabled && channel.isDM() && (BDFDB.LibraryStores.UserStore.getUser(channel.recipients[0]) || {}).bot) return "bots";
else if (this.settings.preCategories.groups.enabled && channel.isGroupDM()) return "groups"; else if (this.settings.preCategories.groups.enabled && channel.isGroupDM()) return "groups";
return ""; return "";
} }
@@ -804,7 +796,7 @@ module.exports = (_ => {
if (!BDFDB.equals(data, newData)) this.savePinnedChannels(newData, type); if (!BDFDB.equals(data, newData)) this.savePinnedChannels(newData, type);
if (type == "channelList" && Object.keys(this.settings.preCategories).some(type => this.settings.preCategories[type].enabled)) { if (type == "channelList" && Object.keys(this.settings.preCategories).some(type => this.settings.preCategories[type].enabled)) {
let predefinedDMs = {}; let predefinedDMs = {};
for (let channelId of BDFDB.LibraryModules.DirectMessageStore.getPrivateChannelIds()) { for (let channelId of BDFDB.LibraryStores.PrivateChannelSortStore.getPrivateChannelIds()) {
let category = this.getPredefinedCategory(channelId); let category = this.getPredefinedCategory(channelId);
if (category) { if (category) {
if (!predefinedDMs[category]) predefinedDMs[category] = []; if (!predefinedDMs[category]) predefinedDMs[category] = [];
@@ -825,7 +817,7 @@ module.exports = (_ => {
sortDMsByTime (dms, type) { sortDMsByTime (dms, type) {
if (dms.length > 1 && this.settings.recentOrder[type]) { if (dms.length > 1 && this.settings.recentOrder[type]) {
let timestamps = BDFDB.LibraryModules.DirectMessageStore.getPrivateChannelIds().reduce((newObj, channelId) => (newObj[channelId] = BDFDB.LibraryModules.UnreadChannelUtils.lastMessageId(channelId), newObj), {}); let timestamps = BDFDB.LibraryStores.PrivateChannelSortStore.getPrivateChannelIds().reduce((newObj, channelId) => (newObj[channelId] = BDFDB.LibraryStores.ReadStateStore.lastMessageId(channelId), newObj), {});
return [].concat(dms).sort(function (x, y) { return [].concat(dms).sort(function (x, y) {
const xT = parseFloat(timestamps[x]), yT = parseFloat(timestamps[y]); const xT = parseFloat(timestamps[x]), yT = parseFloat(timestamps[y]);
return xT > yT ? -1 : xT < yT ? 1 : 0; return xT > yT ? -1 : xT < yT ? 1 : 0;
@@ -910,12 +902,12 @@ module.exports = (_ => {
updateContainer (type) { updateContainer (type) {
switch (type) { switch (type) {
case "channelList": case "channelList":
BDFDB.PatchUtils.forceAllUpdates(this, "PrivateChannelsList"); BDFDB.PatchUtils.forceAllUpdates(this, "PrivateChannelsList"); /* DOES NOT WORK */
if (!Object.keys(this.settings.preCategories).every(type => this.settings.preCategories[type].enabled) && BDFDB.ObjectUtils.isEmpty(this.getPinnedChannels(type))) this.forceUpdateAll(); if (!Object.keys(this.settings.preCategories).every(type => this.settings.preCategories[type].enabled) && BDFDB.ObjectUtils.isEmpty(this.getPinnedChannels(type))) this.forceUpdateAll();
break; break;
case "guildList": case "guildList":
BDFDB.GuildUtils.rerenderAll(true); BDFDB.DiscordUtils.rerenderAll(true);
break; break;
} }
} }
@@ -932,7 +924,7 @@ module.exports = (_ => {
sortedDMs = sortedDMs.filter(n => n); sortedDMs = sortedDMs.filter(n => n);
for (let pos in sortedDMs) { for (let pos in sortedDMs) {
newData[sortedDMs[pos]] = parseInt(pos); newData[sortedDMs[pos]] = parseInt(pos);
if (BDFDB.LibraryModules.ChannelStore.getChannel(sortedDMs[pos])) existingDMs.push(sortedDMs[pos]); if (BDFDB.LibraryStores.ChannelStore.getChannel(sortedDMs[pos])) existingDMs.push(sortedDMs[pos]);
} }
if (!BDFDB.equals(data, newData)) this.savePinnedChannels(newData, this); if (!BDFDB.equals(data, newData)) this.savePinnedChannels(newData, this);
return this.sortDMsByTime(existingDMs, type); return this.sortDMsByTime(existingDMs, type);
@@ -966,7 +958,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "Добавяне към нова категория", context_addtonewcategory: "Добавяне към нова категория",
context_disablepredefined: "Деактивирайте предварително определена категория", context_disablepredefined: "Деактивирайте предварително определена категория",
context_inpredefined: "Фиксирано в предварително дефинирана категория",
context_pinchannel: "Фиксиране към списъка с канали", context_pinchannel: "Фиксиране към списъка с канали",
context_pindm: "Закачете директно съобщение", context_pindm: "Закачете директно съобщение",
context_pinguild: "Фиксиране към списъка със сървъри", context_pinguild: "Фиксиране към списъка със сървъри",
@@ -979,7 +970,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "Přidat do nové kategorie", context_addtonewcategory: "Přidat do nové kategorie",
context_disablepredefined: "Deaktivovat předdefinovanou kategorii", context_disablepredefined: "Deaktivovat předdefinovanou kategorii",
context_inpredefined: "Připnuté v předdefinované katrgorii",
context_pinchannel: "Připnout do seznamu kanálů", context_pinchannel: "Připnout do seznamu kanálů",
context_pindm: "Připnout do PZ", context_pindm: "Připnout do PZ",
context_pinguild: "Připnout do seznamu serverů", context_pinguild: "Připnout do seznamu serverů",
@@ -992,7 +982,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "Føj til ny kategori", context_addtonewcategory: "Føj til ny kategori",
context_disablepredefined: "Deaktiver foruddefineret kategori", context_disablepredefined: "Deaktiver foruddefineret kategori",
context_inpredefined: "Fastgjort i en foruddefineret kategori",
context_pinchannel: "Fastgør til kanallisten", context_pinchannel: "Fastgør til kanallisten",
context_pindm: "Pin direkte besked", context_pindm: "Pin direkte besked",
context_pinguild: "Fastgør til serverlisten", context_pinguild: "Fastgør til serverlisten",
@@ -1005,7 +994,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "Zur neuen Kategorie hinzufügen", context_addtonewcategory: "Zur neuen Kategorie hinzufügen",
context_disablepredefined: "Vordefinierte Kategorie deaktivieren", context_disablepredefined: "Vordefinierte Kategorie deaktivieren",
context_inpredefined: "In vordefinierter Kategorie angeheftet",
context_pinchannel: "An Kanalliste anheften", context_pinchannel: "An Kanalliste anheften",
context_pindm: "Direktnachricht anheften", context_pindm: "Direktnachricht anheften",
context_pinguild: "An Serverliste anheften", context_pinguild: "An Serverliste anheften",
@@ -1018,7 +1006,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "Προσθήκη σε νέα κατηγορία", context_addtonewcategory: "Προσθήκη σε νέα κατηγορία",
context_disablepredefined: "Απενεργοποίηση προκαθορισμένης κατηγορίας", context_disablepredefined: "Απενεργοποίηση προκαθορισμένης κατηγορίας",
context_inpredefined: "Καρφιτσώθηκε σε μια προκαθορισμένη κατηγορία",
context_pinchannel: "Καρφίτσωμα στη λίστα καναλιών", context_pinchannel: "Καρφίτσωμα στη λίστα καναλιών",
context_pindm: "Καρφιτσώστε το άμεσο μήνυμα", context_pindm: "Καρφιτσώστε το άμεσο μήνυμα",
context_pinguild: "Καρφίτσωμα στη λίστα διακομιστών", context_pinguild: "Καρφίτσωμα στη λίστα διακομιστών",
@@ -1031,7 +1018,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "Agregar a una nueva categoría", context_addtonewcategory: "Agregar a una nueva categoría",
context_disablepredefined: "Desactivar categoría predefinida", context_disablepredefined: "Desactivar categoría predefinida",
context_inpredefined: "Anclado en una categoría predefinida",
context_pinchannel: "Anclar a la lista de canales", context_pinchannel: "Anclar a la lista de canales",
context_pindm: "Pin de mensaje directo", context_pindm: "Pin de mensaje directo",
context_pinguild: "Anclar a la lista de servidores", context_pinguild: "Anclar a la lista de servidores",
@@ -1044,7 +1030,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "Lisää uuteen luokkaan", context_addtonewcategory: "Lisää uuteen luokkaan",
context_disablepredefined: "Poista ennalta määritetty luokka käytöstä", context_disablepredefined: "Poista ennalta määritetty luokka käytöstä",
context_inpredefined: "Kiinnitetty ennalta määritettyyn luokkaan",
context_pinchannel: "Kiinnitä kanavaluetteloon", context_pinchannel: "Kiinnitä kanavaluetteloon",
context_pindm: "Kiinnitä suora viesti", context_pindm: "Kiinnitä suora viesti",
context_pinguild: "Kiinnitä palvelinluetteloon", context_pinguild: "Kiinnitä palvelinluetteloon",
@@ -1057,7 +1042,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "Ajouter à une nouvelle catégorie", context_addtonewcategory: "Ajouter à une nouvelle catégorie",
context_disablepredefined: "Désactiver la catégorie prédéfinie", context_disablepredefined: "Désactiver la catégorie prédéfinie",
context_inpredefined: "Épinglé dans une catégorie prédéfinie",
context_pinchannel: "Épingler à la liste des salons", context_pinchannel: "Épingler à la liste des salons",
context_pindm: "Épingler le message privé", context_pindm: "Épingler le message privé",
context_pinguild: "Épingler à la liste des serveurs", context_pinguild: "Épingler à la liste des serveurs",
@@ -1070,7 +1054,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "नई श्रेणी में जोड़ें", context_addtonewcategory: "नई श्रेणी में जोड़ें",
context_disablepredefined: "पूर्वनिर्धारित श्रेणी को निष्क्रिय करें", context_disablepredefined: "पूर्वनिर्धारित श्रेणी को निष्क्रिय करें",
context_inpredefined: "एक पूर्वनिर्धारित श्रेणी में पिन किया गया",
context_pinchannel: "चैनल सूची में पिन करें", context_pinchannel: "चैनल सूची में पिन करें",
context_pindm: "पिन डीएम", context_pindm: "पिन डीएम",
context_pinguild: "सर्वर सूची में पिन करें", context_pinguild: "सर्वर सूची में पिन करें",
@@ -1083,7 +1066,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "Dodaj u novu kategoriju", context_addtonewcategory: "Dodaj u novu kategoriju",
context_disablepredefined: "Deaktivirajte unaprijed definiranu kategoriju", context_disablepredefined: "Deaktivirajte unaprijed definiranu kategoriju",
context_inpredefined: "Prikvačeno u unaprijed definiranoj kategoriji",
context_pinchannel: "Prikvači na popis kanala", context_pinchannel: "Prikvači na popis kanala",
context_pindm: "Prikvači izravnu poruku", context_pindm: "Prikvači izravnu poruku",
context_pinguild: "Prikvači na popis poslužitelja", context_pinguild: "Prikvači na popis poslužitelja",
@@ -1096,7 +1078,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "Hozzáadás új kategóriához", context_addtonewcategory: "Hozzáadás új kategóriához",
context_disablepredefined: "Deaktiválja az előre definiált kategóriát", context_disablepredefined: "Deaktiválja az előre definiált kategóriát",
context_inpredefined: "Előre meghatározott kategóriában rögzítve",
context_pinchannel: "Rögzítés a csatornalistához", context_pinchannel: "Rögzítés a csatornalistához",
context_pindm: "Közvetlen üzenet rögzítése", context_pindm: "Közvetlen üzenet rögzítése",
context_pinguild: "Rögzítés a kiszolgáló listához", context_pinguild: "Rögzítés a kiszolgáló listához",
@@ -1109,7 +1090,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "Aggiungi a una nuova categoria", context_addtonewcategory: "Aggiungi a una nuova categoria",
context_disablepredefined: "Disattiva la categoria predefinita", context_disablepredefined: "Disattiva la categoria predefinita",
context_inpredefined: "Bloccato in una categoria predefinita",
context_pinchannel: "Fissa all'elenco dei canali", context_pinchannel: "Fissa all'elenco dei canali",
context_pindm: "Metti il messaggio diretto", context_pindm: "Metti il messaggio diretto",
context_pinguild: "Aggiungi all'elenco dei server", context_pinguild: "Aggiungi all'elenco dei server",
@@ -1122,7 +1102,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "新しいカテゴリに追加", context_addtonewcategory: "新しいカテゴリに追加",
context_disablepredefined: "事前定義されたカテゴリを非アクティブ化", context_disablepredefined: "事前定義されたカテゴリを非アクティブ化",
context_inpredefined: "事前定義されたカテゴリに固定",
context_pinchannel: "チャネルリストに固定", context_pinchannel: "チャネルリストに固定",
context_pindm: "ダイレクトメッセージを固定する", context_pindm: "ダイレクトメッセージを固定する",
context_pinguild: "サーバーリストに固定する", context_pinguild: "サーバーリストに固定する",
@@ -1135,7 +1114,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "새 카테고리에 추가", context_addtonewcategory: "새 카테고리에 추가",
context_disablepredefined: "사전 정의 된 카테고리 비활성화", context_disablepredefined: "사전 정의 된 카테고리 비활성화",
context_inpredefined: "사전 정의 된 카테고리에 고정됨",
context_pinchannel: "채널 목록에 고정", context_pinchannel: "채널 목록에 고정",
context_pindm: "개인 메시지 고정", context_pindm: "개인 메시지 고정",
context_pinguild: "서버 목록에 고정", context_pinguild: "서버 목록에 고정",
@@ -1148,7 +1126,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "Pridėti prie naujos kategorijos", context_addtonewcategory: "Pridėti prie naujos kategorijos",
context_disablepredefined: "Išjunkite iš anksto nustatytą kategoriją", context_disablepredefined: "Išjunkite iš anksto nustatytą kategoriją",
context_inpredefined: "Prisegta iš anksto nustatytoje kategorijoje",
context_pinchannel: "Prisegti prie kanalų sąrašo", context_pinchannel: "Prisegti prie kanalų sąrašo",
context_pindm: "Prisegti tiesioginį pranešimą", context_pindm: "Prisegti tiesioginį pranešimą",
context_pinguild: "Prisegti prie serverio sąrašo", context_pinguild: "Prisegti prie serverio sąrašo",
@@ -1161,7 +1138,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "Toevoegen aan nieuwe categorie", context_addtonewcategory: "Toevoegen aan nieuwe categorie",
context_disablepredefined: "Schakel de voorgedefinieerde categorie uit", context_disablepredefined: "Schakel de voorgedefinieerde categorie uit",
context_inpredefined: "Vastgezet in een vooraf gedefinieerde categorie",
context_pinchannel: "Vastzetten op kanalenlijst", context_pinchannel: "Vastzetten op kanalenlijst",
context_pindm: "Direct bericht vastzetten", context_pindm: "Direct bericht vastzetten",
context_pinguild: "Vastzetten op serverlijst", context_pinguild: "Vastzetten op serverlijst",
@@ -1174,7 +1150,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "Legg til i ny kategori", context_addtonewcategory: "Legg til i ny kategori",
context_disablepredefined: "Deaktiver forhåndsdefinert kategori", context_disablepredefined: "Deaktiver forhåndsdefinert kategori",
context_inpredefined: "Festet i en forhåndsdefinert kategori",
context_pinchannel: "Fest til kanallisten", context_pinchannel: "Fest til kanallisten",
context_pindm: "Fest direkte melding", context_pindm: "Fest direkte melding",
context_pinguild: "Fest til serverlisten", context_pinguild: "Fest til serverlisten",
@@ -1187,7 +1162,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "Dodaj do nowej kategorii", context_addtonewcategory: "Dodaj do nowej kategorii",
context_disablepredefined: "Dezaktywuj predefiniowaną kategorię", context_disablepredefined: "Dezaktywuj predefiniowaną kategorię",
context_inpredefined: "Przypięty w predefiniowanej kategorii",
context_pinchannel: "Przypnij do listy kanałów", context_pinchannel: "Przypnij do listy kanałów",
context_pindm: "Przypnij bezpośrednią wiadomość", context_pindm: "Przypnij bezpośrednią wiadomość",
context_pinguild: "Przypnij do listy serwerów", context_pinguild: "Przypnij do listy serwerów",
@@ -1200,7 +1174,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "Adicionar à nova categoria", context_addtonewcategory: "Adicionar à nova categoria",
context_disablepredefined: "Desativar categoria predefinida", context_disablepredefined: "Desativar categoria predefinida",
context_inpredefined: "Fixado em uma categoria predefinida",
context_pinchannel: "Fixar na lista de canais", context_pinchannel: "Fixar na lista de canais",
context_pindm: "Fixar mensagem direta", context_pindm: "Fixar mensagem direta",
context_pinguild: "Fixar na lista de servidores", context_pinguild: "Fixar na lista de servidores",
@@ -1213,7 +1186,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "Adăugați la o nouă categorie", context_addtonewcategory: "Adăugați la o nouă categorie",
context_disablepredefined: "Dezactivați categoria predefinită", context_disablepredefined: "Dezactivați categoria predefinită",
context_inpredefined: "Fixat într-o categorie predefinită",
context_pinchannel: "Fixați în lista de canale", context_pinchannel: "Fixați în lista de canale",
context_pindm: "Fixați mesajul direct", context_pindm: "Fixați mesajul direct",
context_pinguild: "Fixați pe lista serverului", context_pinguild: "Fixați pe lista serverului",
@@ -1226,7 +1198,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "Добавить в новую категорию", context_addtonewcategory: "Добавить в новую категорию",
context_disablepredefined: "Отключить предопределенную категорию", context_disablepredefined: "Отключить предопределенную категорию",
context_inpredefined: "Закреплено в предопределенной категории",
context_pinchannel: "Закрепить в списке каналов", context_pinchannel: "Закрепить в списке каналов",
context_pindm: "Закрепить прямую переписку", context_pindm: "Закрепить прямую переписку",
context_pinguild: "Закрепить в списке серверов", context_pinguild: "Закрепить в списке серверов",
@@ -1239,7 +1210,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "Lägg till i ny kategori", context_addtonewcategory: "Lägg till i ny kategori",
context_disablepredefined: "Inaktivera fördefinierad kategori", context_disablepredefined: "Inaktivera fördefinierad kategori",
context_inpredefined: "Fästs i en fördefinierad kategori",
context_pinchannel: "Fäst i kanallistan", context_pinchannel: "Fäst i kanallistan",
context_pindm: "Fäst direktmeddelande", context_pindm: "Fäst direktmeddelande",
context_pinguild: "Fäst i serverlistan", context_pinguild: "Fäst i serverlistan",
@@ -1252,7 +1222,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "เพิ่มในหมวดหมู่ใหม่", context_addtonewcategory: "เพิ่มในหมวดหมู่ใหม่",
context_disablepredefined: "ปิดใช้งานหมวดหมู่ที่กำหนดไว้ล่วงหน้า", context_disablepredefined: "ปิดใช้งานหมวดหมู่ที่กำหนดไว้ล่วงหน้า",
context_inpredefined: "ตรึงไว้ในหมวดหมู่ที่กำหนดไว้ล่วงหน้า",
context_pinchannel: "ตรึงในรายการช่อง", context_pinchannel: "ตรึงในรายการช่อง",
context_pindm: "ตรึงข้อความโดยตรง", context_pindm: "ตรึงข้อความโดยตรง",
context_pinguild: "ปักหมุดรายการเซิร์ฟเวอร์", context_pinguild: "ปักหมุดรายการเซิร์ฟเวอร์",
@@ -1265,7 +1234,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "Yeni kategoriye ekle", context_addtonewcategory: "Yeni kategoriye ekle",
context_disablepredefined: "Önceden tanımlanmış kategoriyi devre dışı bırakın", context_disablepredefined: "Önceden tanımlanmış kategoriyi devre dışı bırakın",
context_inpredefined: "Önceden tanımlanmış bir kategoriye sabitlenmiş",
context_pinchannel: "Kanal listesine sabitle", context_pinchannel: "Kanal listesine sabitle",
context_pindm: "Doğrudan mesajı sabitle", context_pindm: "Doğrudan mesajı sabitle",
context_pinguild: "Sunucu listesine sabitle", context_pinguild: "Sunucu listesine sabitle",
@@ -1278,7 +1246,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "Додати до нової категорії", context_addtonewcategory: "Додати до нової категорії",
context_disablepredefined: "Вимкнути заздалегідь визначену категорію", context_disablepredefined: "Вимкнути заздалегідь визначену категорію",
context_inpredefined: "Закріплено в наперед визначеній категорії",
context_pinchannel: "Закріпити в списку каналів", context_pinchannel: "Закріпити в списку каналів",
context_pindm: "Закріпити пряме повідомлення", context_pindm: "Закріпити пряме повідомлення",
context_pinguild: "Закріпити на списку серверів", context_pinguild: "Закріпити на списку серверів",
@@ -1291,7 +1258,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "Thêm vào danh mục mới", context_addtonewcategory: "Thêm vào danh mục mới",
context_disablepredefined: "Hủy kích hoạt danh mục xác định trước", context_disablepredefined: "Hủy kích hoạt danh mục xác định trước",
context_inpredefined: "Được ghim trong một danh mục xác định trước",
context_pinchannel: "Ghim vào danh sách kênh", context_pinchannel: "Ghim vào danh sách kênh",
context_pindm: "Ghim tin nhắn trực tiếp", context_pindm: "Ghim tin nhắn trực tiếp",
context_pinguild: "Ghim vào danh sách máy chủ", context_pinguild: "Ghim vào danh sách máy chủ",
@@ -1304,7 +1270,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "添加到新类别", context_addtonewcategory: "添加到新类别",
context_disablepredefined: "停用预定义类别", context_disablepredefined: "停用预定义类别",
context_inpredefined: "固定在预定义的类别中",
context_pinchannel: "固定到频道列表", context_pinchannel: "固定到频道列表",
context_pindm: "固定直接讯息", context_pindm: "固定直接讯息",
context_pinguild: "固定到服务器列表", context_pinguild: "固定到服务器列表",
@@ -1317,7 +1282,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "添加到新類別", context_addtonewcategory: "添加到新類別",
context_disablepredefined: "停用預定義類別", context_disablepredefined: "停用預定義類別",
context_inpredefined: "固定在預定義的類別中",
context_pinchannel: "固定到頻道列表", context_pinchannel: "固定到頻道列表",
context_pindm: "固定直接訊息", context_pindm: "固定直接訊息",
context_pinguild: "固定到服務器列表", context_pinguild: "固定到服務器列表",
@@ -1330,7 +1294,6 @@ module.exports = (_ => {
return { return {
context_addtonewcategory: "Add to new Category", context_addtonewcategory: "Add to new Category",
context_disablepredefined: "Deactivate predefined Category", context_disablepredefined: "Deactivate predefined Category",
context_inpredefined: "Pinned in a predefined Category",
context_pinchannel: "Pin to Channel List", context_pinchannel: "Pin to Channel List",
context_pindm: "Pin DM", context_pindm: "Pin DM",
context_pinguild: "Pin to Server List", context_pinguild: "Pin to Server List",
@@ -1342,5 +1305,5 @@ module.exports = (_ => {
} }
} }
}; };
})(window.BDFDB_Global.PluginUtils.buildPlugin(config)); })(window.BDFDB_Global.PluginUtils.buildPlugin(changeLog));
})(); })();

View File

@@ -1,6 +1,6 @@
{ {
"all": { "all": {
"cached": "2 7 8 9 11 14 15 17 28 29 30 31 59 60 61 62 63 64 65 66 67 68 69 70 71 73 74 75 76 77 78 80 81 82 83 84 85 86 87 88 89 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 116 120 122 126 127 131 132 133 134 137 138 139 146 157 158 159 160 162 164 171 173 176 179 181 182 183 184 185 186 188 189 190 192 193 195 196 197 200 201 220 228 234 236 237 238 240 245 247 253 262 272 274 278 284 287 291 292 293 295 301 306 312 314 317 318 323 331 336 337 338 340 344 349 350 351 352 353 354 356 361 364 366 368 370 377 379 381 382 383 390 395 398 401 404 407 420 421 429 438 441 442 476 479 489 509 518 519 520 521 523 525 535 538 539 547 554 557 566 577 579 589 592 593 598 599 606 608 611 614 620 621 627 638 644 645 670 671 686 692 693 694", "cached": "2 7 8 9 11 14 15 17 28 29 30 59 60 61 62 63 64 65 66 67 68 70 71 73 74 75 76 77 80 81 82 83 85 86 87 88 89 91 92 93 94 95 96 97 98 99 100 101 102 104 105 106 108 109 110 111 116 120 122 126 127 131 132 133 134 137 138 139 146 157 158 159 160 162 164 171 173 176 179 181 182 183 184 185 186 188 189 190 193 195 196 197 200 201 220 228 234 237 238 240 245 247 253 262 272 274 278 284 287 291 292 293 295 301 306 312 314 317 318 323 331 336 337 338 340 344 349 350 351 352 353 354 356 364 366 368 377 379 381 382 383 390 395 401 404 407 420 421 429 438 442 476 479 489 509 518 519 520 523 525 535 538 539 547 554 566 577 579 589 592 593 598 599 606 608 611 614 620 621 627 638 644 645 669 670 671 679 686 692 693 694 699 708 760 762 772",
"filters": { "filters": {
"updated": true, "updated": true,
"outdated": true, "outdated": true,

537
.config/BetterDiscord/plugins/PluginRepo.plugin.js Executable file → Normal file
View File

@@ -2,7 +2,7 @@
* @name PluginRepo * @name PluginRepo
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 2.3.5 * @version 2.4.0
* @description Allows you to download all Plugins from BD's Website within Discord * @description Allows you to download all Plugins from BD's Website within Discord
* @invite Jx3TjNS * @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien * @donate https://www.paypal.me/MircoWittrien
@@ -13,20 +13,16 @@
*/ */
module.exports = (_ => { module.exports = (_ => {
const config = { const changeLog = {
"info": {
"name": "PluginRepo",
"author": "DevilBro",
"version": "2.3.5",
"description": "Allows you to download all Plugins from BD's Website within Discord"
}
}; };
return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class { return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class {
getName () {return config.info.name;} constructor (meta) {for (let key in meta) this[key] = meta[key];}
getAuthor () {return config.info.author;} getName () {return this.name;}
getVersion () {return config.info.version;} getAuthor () {return this.author;}
getDescription () {return `The Library Plugin needed for ${config.info.name} is missing. Open the Plugin Settings to download it. \n\n${config.info.description}`;} getVersion () {return this.version;}
getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;}
downloadLibrary () { downloadLibrary () {
require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => {
@@ -39,7 +35,7 @@ module.exports = (_ => {
if (!window.BDFDB_Global || !Array.isArray(window.BDFDB_Global.pluginQueue)) window.BDFDB_Global = Object.assign({}, window.BDFDB_Global, {pluginQueue: []}); if (!window.BDFDB_Global || !Array.isArray(window.BDFDB_Global.pluginQueue)) window.BDFDB_Global = Object.assign({}, window.BDFDB_Global, {pluginQueue: []});
if (!window.BDFDB_Global.downloadModal) { if (!window.BDFDB_Global.downloadModal) {
window.BDFDB_Global.downloadModal = true; window.BDFDB_Global.downloadModal = true;
BdApi.showConfirmationModal("Library Missing", `The Library Plugin needed for ${config.info.name} is missing. Please click "Download Now" to install it.`, { BdApi.showConfirmationModal("Library Missing", `The Library Plugin needed for ${this.name} is missing. Please click "Download Now" to install it.`, {
confirmText: "Download Now", confirmText: "Download Now",
cancelText: "Cancel", cancelText: "Cancel",
onCancel: _ => {delete window.BDFDB_Global.downloadModal;}, onCancel: _ => {delete window.BDFDB_Global.downloadModal;},
@@ -49,20 +45,20 @@ module.exports = (_ => {
} }
}); });
} }
if (!window.BDFDB_Global.pluginQueue.includes(config.info.name)) window.BDFDB_Global.pluginQueue.push(config.info.name); if (!window.BDFDB_Global.pluginQueue.includes(this.name)) window.BDFDB_Global.pluginQueue.push(this.name);
} }
start () {this.load();} start () {this.load();}
stop () {} stop () {}
getSettingsPanel () { getSettingsPanel () {
let template = document.createElement("template"); let template = document.createElement("template");
template.innerHTML = `<div style="color: var(--header-primary); font-size: 16px; font-weight: 300; white-space: pre; line-height: 22px;">The Library Plugin needed for ${config.info.name} is missing.\nPlease click <a style="font-weight: 500;">Download Now</a> to install it.</div>`; template.innerHTML = `<div style="color: var(--header-primary); font-size: 16px; font-weight: 300; white-space: pre; line-height: 22px;">The Library Plugin needed for ${this.name} is missing.\nPlease click <a style="font-weight: 500;">Download Now</a> to install it.</div>`;
template.content.firstElementChild.querySelector("a").addEventListener("click", this.downloadLibrary); template.content.firstElementChild.querySelector("a").addEventListener("click", this.downloadLibrary);
return template.content.firstElementChild; return template.content.firstElementChild;
} }
} : (([Plugin, BDFDB]) => { } : (([Plugin, BDFDB]) => {
var _this; var _this;
var list, header; var list;
var loading, cachedPlugins, grabbedPlugins, updateInterval; var loading, cachedPlugins, grabbedPlugins, updateInterval;
var searchString, searchTimeout, forcedSort, forcedOrder, showOnlyOutdated; var searchString, searchTimeout, forcedSort, forcedOrder, showOnlyOutdated;
@@ -153,113 +149,187 @@ module.exports = (_ => {
render() { render() {
if (!this.props.tab) this.props.tab = "Plugins"; if (!this.props.tab) this.props.tab = "Plugins";
this.props.entries = (!loading.is && grabbedPlugins.length ? this.filterPlugins() : []).map(plugin => BDFDB.ReactUtils.createElement(RepoCardComponent, { const entries = (!loading.is && grabbedPlugins.length ? this.filterPlugins() : []);
data: plugin
})).filter(n => n);
BDFDB.TimeUtils.timeout(_ => { return BDFDB.ReactUtils.createElement("div", {
if (!loading.is && header && this.props.entries.length != header.props.amount) { className: BDFDB.disCN._repo,
header.props.amount = this.props.entries.length; children: [
BDFDB.ReactUtils.forceUpdate(header); BDFDB.ReactUtils.createElement("div", {
} className: BDFDB.disCNS._repolistheader + BDFDB.disCN.settingswindowcontentcolumndefault,
});
return [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ModalComponents.ModalTabContent, {
tab: "Plugins",
open: this.props.tab == "Plugins",
render: false,
children: loading.is ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
direction: BDFDB.LibraryComponents.Flex.Direction.VERTICAL,
justify: BDFDB.LibraryComponents.Flex.Justify.CENTER,
style: {marginTop: "50%"},
children: [ children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Spinner, { BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
type: BDFDB.LibraryComponents.Spinner.Type.WANDERING_CUBES className: BDFDB.disCN.marginbottom4,
align: BDFDB.LibraryComponents.Flex.Align.CENTER,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
grow: 1,
shrink: 0,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormTitle, {
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H1,
className: BDFDB.disCN.marginreset,
children: `Plugin Repo — ${loading.is ? 0 : entries.length || 0}/${loading.is ? 0 : grabbedPlugins.length}`
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SearchBar, {
autoFocus: true,
query: searchString,
onChange: value => {
if (loading.is) return;
BDFDB.TimeUtils.clear(searchTimeout);
searchTimeout = BDFDB.TimeUtils.timeout(_ => {
searchString = value.replace(/[<|>]/g, "");
BDFDB.ReactUtils.forceUpdate(this);
}, 1000);
},
onClear: _ => {
if (loading.is) return;
searchString = "";
BDFDB.ReactUtils.forceUpdate(this);
}
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Button, {
size: BDFDB.LibraryComponents.Button.Sizes.TINY,
children: BDFDB.LanguageUtils.LibraryStrings.check_for_updates,
onClick: _ => {
if (loading.is) return;
loading = {is: false, timeout: null, amount: 0};
_this.loadPlugins();
}
})
]
}), }),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextElement, { BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
className: BDFDB.disCN.margintop20, className: BDFDB.disCNS.tabbarcontainer + BDFDB.disCN.tabbarcontainerbottom,
style: {textAlign: "center"}, align: BDFDB.LibraryComponents.Flex.Align.CENTER,
children: `${BDFDB.LanguageUtils.LibraryStringsFormat("loading", "Plugin Repo")} - ${BDFDB.LanguageUtils.LibraryStrings.please_wait}` children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TabBar, {
className: BDFDB.disCN.tabbar,
itemClassName: BDFDB.disCN.tabbaritem,
type: BDFDB.LibraryComponents.TabBar.Types.TOP,
selectedItem: this.props.tab,
items: [{value: "Plugins"}, {value: BDFDB.LanguageUtils.LanguageStrings.SETTINGS}],
onItemSelect: value => {
this.props.tab = value;
BDFDB.ReactUtils.forceUpdate(this);
}
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.QuickSelect, {
label: BDFDB.LanguageUtils.LibraryStrings.sort_by + ":",
value: {
label: sortKeys[this.props.sortKey],
value: this.props.sortKey
},
options: Object.keys(sortKeys).map(key => ({
label: sortKeys[key],
value: key
})),
onChange: key => {
this.props.sortKey = key;
BDFDB.ReactUtils.forceUpdate(this);
}
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.QuickSelect, {
label: BDFDB.LanguageUtils.LibraryStrings.order + ":",
value: {
label: BDFDB.LanguageUtils.LibraryStrings[orderKeys[this.props.orderKey]],
value: this.props.orderKey
},
options: Object.keys(orderKeys).map(key => ({
label: BDFDB.LanguageUtils.LibraryStrings[orderKeys[key]],
value: key
})),
onChange: key => {
this.props.orderKey = key;
BDFDB.ReactUtils.forceUpdate(this);
}
})
})
]
})
]
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Scrollers.Auto, {
className: BDFDB.disCNS._repolistscroller + BDFDB.disCN.settingswindowcontentcolumndefault,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ModalComponents.ModalTabContent, {
tab: "Plugins",
open: this.props.tab == "Plugins",
render: false,
children: loading.is ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
direction: BDFDB.LibraryComponents.Flex.Direction.VERTICAL,
justify: BDFDB.LibraryComponents.Flex.Justify.CENTER,
style: {marginTop: "50%"},
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SpinnerComponents.Spinner, {
type: BDFDB.LibraryComponents.SpinnerComponents.Types.WANDERING_CUBES
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextElement, {
className: BDFDB.disCN.margintop20,
style: {textAlign: "center"},
children: `${BDFDB.LanguageUtils.LibraryStringsFormat("loading", "Plugin Repo")} - ${BDFDB.LanguageUtils.LibraryStrings.please_wait}`
})
]
}) : BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.discoverycards,
children: entries.map(plugin => BDFDB.ReactUtils.createElement(RepoCardComponent, {
data: plugin
})).filter(n => n)
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ModalComponents.ModalTabContent, {
tab: BDFDB.LanguageUtils.LanguageStrings.SETTINGS,
open: this.props.tab == BDFDB.LanguageUtils.LanguageStrings.SETTINGS,
render: false,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelList, {
title: "Show following Plugins",
children: Object.keys(_this.defaults.filters).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
type: "Switch",
plugin: _this,
keys: ["filters", key],
label: _this.defaults.filters[key].description,
value: _this.settings.filters[key],
onChange: value => {
this.props[key] = _this.settings.filters[key] = value;
BDFDB.ReactUtils.forceUpdate(this);
}
}))
}),
Object.keys(_this.defaults.general).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
type: "Switch",
plugin: _this,
keys: ["general", key],
label: _this.defaults.general[key].description,
value: _this.settings.general[key],
onChange: value => {
_this.settings.general[key] = value;
BDFDB.ReactUtils.forceUpdate(this);
}
}))
].flat(10).filter(n => n)
}) })
] ]
}) : BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.discoverycards,
children: this.props.entries
}) })
}), ]
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ModalComponents.ModalTabContent, { });
tab: BDFDB.LanguageUtils.LanguageStrings.SETTINGS,
open: this.props.tab == BDFDB.LanguageUtils.LanguageStrings.SETTINGS,
render: false,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelList, {
title: "Show following Plugins",
children: Object.keys(_this.defaults.filters).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
type: "Switch",
plugin: _this,
keys: ["filters", key],
label: _this.defaults.filters[key].description,
value: _this.settings.filters[key],
onChange: value => {
this.props[key] = _this.settings.filters[key] = value;
BDFDB.ReactUtils.forceUpdate(this);
}
}))
}),
Object.keys(_this.defaults.general).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
type: "Switch",
plugin: _this,
keys: ["general", key],
label: _this.defaults.general[key].description,
value: _this.settings.general[key],
onChange: value => {
_this.settings.general[key] = value;
BDFDB.ReactUtils.forceUpdate(this);
}
}))
].flat(10).filter(n => n)
})
];
} }
}; };
const RepoCardComponent = class PluginCard extends BdApi.React.Component { const RepoCardComponent = class PluginCard extends BdApi.React.Component {
render() { render() {
if (this.props.data.thumbnailUrl && !this.props.data.thumbnailChecked) {
if (!window.Buffer) this.props.data.thumbnailChecked = true;
else BDFDB.LibraryRequires.request(this.props.data.thumbnailUrl, {encoding: null}, (error, response, body) => {
if (response && response.headers["content-type"] && response.headers["content-type"] == "image/gif") {
const throwAwayImg = new Image(), instance = this;
throwAwayImg.onload = function() {
const canvas = document.createElement("canvas");
canvas.getContext("2d").drawImage(throwAwayImg, 0, 0, canvas.width = this.width, canvas.height = this.height);
try {
const oldUrl = instance.props.data.thumbnailUrl;
instance.props.data.thumbnailUrl = canvas.toDataURL("image/png");
instance.props.data.thumbnailGifUrl = oldUrl;
instance.props.data.thumbnailChecked = true;
BDFDB.ReactUtils.forceUpdate(instance);
}
catch (err) {
instance.props.data.thumbnailChecked = true;
BDFDB.ReactUtils.forceUpdate(instance);
}
};
throwAwayImg.onerror = function() {
instance.props.data.thumbnailChecked = true;
BDFDB.ReactUtils.forceUpdate(instance);
};
throwAwayImg.src = "data:" + response.headers["content-type"] + ";base64," + (new Buffer(body).toString("base64"));
}
else {
this.props.data.thumbnailChecked = true;
BDFDB.ReactUtils.forceUpdate(this);
}
});
}
return BDFDB.ReactUtils.createElement("div", { return BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.discoverycard, className: BDFDB.disCN.discoverycard,
onMouseEnter: _ => {
this.props.hovered = true;
BDFDB.ReactUtils.forceUpdate(this);
},
children: [ children: [
BDFDB.ReactUtils.createElement("div", { BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.discoverycardheader, className: BDFDB.disCN.discoverycardheader,
@@ -267,34 +337,29 @@ module.exports = (_ => {
BDFDB.ReactUtils.createElement("div", { BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.discoverycardcoverwrapper, className: BDFDB.disCN.discoverycardcoverwrapper,
children: [ children: [
this.props.data.thumbnailUrl && this.props.data.thumbnailChecked && BDFDB.ReactUtils.createElement("img", { this.props.data.thumbnailUrl && this.props.hovered && BDFDB.ReactUtils.createElement("img", {
className: BDFDB.disCN.discoverycardcover, className: BDFDB.disCN.discoverycardcover,
src: this.props.data.thumbnailUrl, src: this.props.data.thumbnailUrl,
loading: "lazy",
onMouseEnter: this.props.data.thumbnailGifUrl && (e => e.target.src = this.props.data.thumbnailGifUrl),
onMouseLeave: this.props.data.thumbnailGifUrl && (e => e.target.src = this.props.data.thumbnailUrl),
onClick: _ => { onClick: _ => {
const url = this.props.data.thumbnailGifUrl || this.props.data.thumbnailUrl; const url = this.props.data.thumbnailUrl;
const img = document.createElement("img"); const img = document.createElement("img");
img.addEventListener("load", function() { img.addEventListener("load", function() {
BDFDB.LibraryModules.ModalUtils.openModal(modalData => { BDFDB.LibraryModules.ModalUtils.openModal(modalData => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ModalComponents.ModalRoot, Object.assign({
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ModalComponents.ModalRoot, Object.assign({ className: BDFDB.disCN.imagemodal
className: BDFDB.disCN.imagemodal }, modalData, {
}, modalData, { size: BDFDB.LibraryComponents.ModalComponents.ModalSize.DYNAMIC,
size: BDFDB.LibraryComponents.ModalComponents.ModalSize.DYNAMIC, "aria-label": BDFDB.LanguageUtils.LanguageStrings.IMAGE,
"aria-label": BDFDB.LanguageUtils.LanguageStrings.IMAGE, children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ImageModal, {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ImageModal, { animated: false,
animated: false, src: url,
src: url, original: url,
original: url, width: this.width,
width: this.width, height: this.height,
height: this.height, className: BDFDB.disCN.imagemodalimage,
className: BDFDB.disCN.imagemodalimage, shouldAnimate: true,
shouldAnimate: true, renderLinkComponent: props => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Anchor, props)
renderLinkComponent: props => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Anchor, props) })
}) }), true));
}), true);
});
}); });
img.src = url; img.src = url;
} }
@@ -310,32 +375,16 @@ module.exports = (_ => {
}) })
] ]
}), }),
BDFDB.ReactUtils.createElement(class extends BDFDB.ReactUtils.Component { BDFDB.ReactUtils.createElement("div", {
render() { className: BDFDB.disCN.discoverycardiconwrapper,
return BDFDB.ReactUtils.createElement("div", { children: BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.discoverycardiconwrapper, className: BDFDB.disCN.discoverycardicon,
children: this.props.data.author && this.props.data.author.discord_avatar_hash && this.props.data.author.discord_snowflake && !this.props.data.author.discord_avatar_failed ? BDFDB.ReactUtils.createElement("img", { children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.discoverycardicon, !this.props.data.author.discord_avatar_loaded && BDFDB.disCN.discoverycardiconloading), nativeClass: true,
src: `https://cdn.discordapp.com/avatars/${this.props.data.author.discord_snowflake}/${this.props.data.author.discord_avatar_hash}.webp?size=128`, iconSVG: `<svg width="100%" height="100%" viewBox="0 0 24 24"><path fill="currentColor" d="${BDFDB.ArrayUtils.is(this.props.data.tags) && this.props.data.tags.includes("library") ? "m 7.3125,2.625 c -0.3238672,0 -0.5859375,0.2620703 -0.5859375,0.5859375 V 14.929687 c 0,0.323868 0.2620703,0.585938 0.5859375,0.585938 2.710313,0 3.840547,1.498711 4.101563,1.914062 V 3.9905599 C 10.603047,3.3127865 9.3007813,2.625 7.3125,2.625 Z M 4.96875,3.796875 c -0.3238672,0 -0.5859375,0.2620703 -0.5859375,0.5859375 V 17.273437 c 0,0.323868 0.2620703,0.585938 0.5859375,0.585938 h 5.30599 C 9.9465755,17.461602 9.0865625,16.6875 7.3125,16.6875 c -0.9692969,0 -1.7578125,-0.788516 -1.7578125,-1.757813 V 3.796875 Z m 9.375,0 c -0.662031,0 -1.266641,0.2287891 -1.757812,0.6005859 V 18.445312 c 0,-0.323281 0.262656,-0.585937 0.585937,-0.585937 h 5.859375 c 0.323868,0 0.585937,-0.26207 0.585937,-0.585938 V 4.3828125 c 0,-0.3238672 -0.262069,-0.5859375 -0.585937,-0.5859375 z M 2.5859375,4.96875 C 2.2620703,4.96875 2,5.2308203 2,5.5546875 V 19.617187 c 0,0.323868 0.2620703,0.585938 0.5859375,0.585938 H 9.171224 c 0.2420313,0.68207 0.892995,1.171875 1.656901,1.171875 h 2.34375 c 0.763906,0 1.414831,-0.489805 1.656901,-1.171875 h 6.585286 C 21.73793,20.203125 22,19.941055 22,19.617187 V 5.5546875 C 22,5.2308203 21.73793,4.96875 21.414062,4.96875 h -0.585937 v 12.304687 c 0,0.969297 -0.827578,1.757813 -1.796875,1.757813 H 13.656901 C 13.41487,19.71332 12.763907,20.203125 12,20.203125 c -0.763906,0 -1.414831,-0.489805 -1.656901,-1.171875 H 4.96875 c -0.9692968,0 -1.796875,-0.788516 -1.796875,-1.757813 V 4.96875 Z" : "m 11.470703,0.625 c -1.314284,0 -2.3808593,1.0666594 -2.3808592,2.3808594 V 4.4335938 H 5.2792969 c -1.0476168,0 -1.8945313,0.85855 -1.8945313,1.90625 v 3.6191406 h 1.4179688 c 1.41905,0 2.5722656,1.1512126 2.5722656,2.5703126 0,1.4191 -1.1532156,2.572266 -2.5722656,2.572265 H 3.375 v 3.619141 c 0,1.0477 0.8566801,1.904297 1.9042969,1.904297 h 3.6191406 v -1.427734 c 0,-1.4189 1.1532235,-2.572266 2.5722655,-2.572266 1.41905,0 2.570313,1.153366 2.570313,2.572266 V 20.625 h 3.61914 c 1.047626,0 1.90625,-0.856597 1.90625,-1.904297 v -3.810547 h 1.427735 c 1.314292,0 2.380859,-1.066559 2.380859,-2.380859 0,-1.3143 -1.066567,-2.38086 -2.380859,-2.380859 H 19.566406 V 6.3398438 c 0,-1.0477002 -0.858624,-1.90625 -1.90625,-1.90625 H 13.851562 V 3.0058594 c 0,-1.3142 -1.066568,-2.3808594 -2.380859,-2.3808594 z"}"/></svg>`
loading: "lazy", })
onLoad: _ => { })
this.props.data.author.discord_avatar_loaded = true; })
BDFDB.ReactUtils.forceUpdate(this);
},
onError: _ => {
this.props.data.author.discord_avatar_failed = true;
BDFDB.ReactUtils.forceUpdate(this);
}
}) : BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.discoverycardicon,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
nativeClass: true,
iconSVG: `<svg width="100%" height="100%" viewBox="0 0 24 24"><path fill="currentColor" d="${BDFDB.ArrayUtils.is(this.props.data.tags) && this.props.data.tags.includes("library") ? "m 7.3125,2.625 c -0.3238672,0 -0.5859375,0.2620703 -0.5859375,0.5859375 V 14.929687 c 0,0.323868 0.2620703,0.585938 0.5859375,0.585938 2.710313,0 3.840547,1.498711 4.101563,1.914062 V 3.9905599 C 10.603047,3.3127865 9.3007813,2.625 7.3125,2.625 Z M 4.96875,3.796875 c -0.3238672,0 -0.5859375,0.2620703 -0.5859375,0.5859375 V 17.273437 c 0,0.323868 0.2620703,0.585938 0.5859375,0.585938 h 5.30599 C 9.9465755,17.461602 9.0865625,16.6875 7.3125,16.6875 c -0.9692969,0 -1.7578125,-0.788516 -1.7578125,-1.757813 V 3.796875 Z m 9.375,0 c -0.662031,0 -1.266641,0.2287891 -1.757812,0.6005859 V 18.445312 c 0,-0.323281 0.262656,-0.585937 0.585937,-0.585937 h 5.859375 c 0.323868,0 0.585937,-0.26207 0.585937,-0.585938 V 4.3828125 c 0,-0.3238672 -0.262069,-0.5859375 -0.585937,-0.5859375 z M 2.5859375,4.96875 C 2.2620703,4.96875 2,5.2308203 2,5.5546875 V 19.617187 c 0,0.323868 0.2620703,0.585938 0.5859375,0.585938 H 9.171224 c 0.2420313,0.68207 0.892995,1.171875 1.656901,1.171875 h 2.34375 c 0.763906,0 1.414831,-0.489805 1.656901,-1.171875 h 6.585286 C 21.73793,20.203125 22,19.941055 22,19.617187 V 5.5546875 C 22,5.2308203 21.73793,4.96875 21.414062,4.96875 h -0.585937 v 12.304687 c 0,0.969297 -0.827578,1.757813 -1.796875,1.757813 H 13.656901 C 13.41487,19.71332 12.763907,20.203125 12,20.203125 c -0.763906,0 -1.414831,-0.489805 -1.656901,-1.171875 H 4.96875 c -0.9692968,0 -1.796875,-0.788516 -1.796875,-1.757813 V 4.96875 Z" : "m 11.470703,0.625 c -1.314284,0 -2.3808593,1.0666594 -2.3808592,2.3808594 V 4.4335938 H 5.2792969 c -1.0476168,0 -1.8945313,0.85855 -1.8945313,1.90625 v 3.6191406 h 1.4179688 c 1.41905,0 2.5722656,1.1512126 2.5722656,2.5703126 0,1.4191 -1.1532156,2.572266 -2.5722656,2.572265 H 3.375 v 3.619141 c 0,1.0477 0.8566801,1.904297 1.9042969,1.904297 h 3.6191406 v -1.427734 c 0,-1.4189 1.1532235,-2.572266 2.5722655,-2.572266 1.41905,0 2.570313,1.153366 2.570313,2.572266 V 20.625 h 3.61914 c 1.047626,0 1.90625,-0.856597 1.90625,-1.904297 v -3.810547 h 1.427735 c 1.314292,0 2.380859,-1.066559 2.380859,-2.380859 0,-1.3143 -1.066567,-2.38086 -2.380859,-2.380859 H 19.566406 V 6.3398438 c 0,-1.0477002 -0.858624,-1.90625 -1.90625,-1.90625 H 13.851562 V 3.0058594 c 0,-1.3142 -1.066568,-2.3808594 -2.380859,-2.3808594 z"}"/></svg>`
})
})
});
}
}, this.props)
] ]
}), }),
BDFDB.ReactUtils.createElement("div", { BDFDB.ReactUtils.createElement("div", {
@@ -463,15 +512,11 @@ module.exports = (_ => {
onDelete: _ => { onDelete: _ => {
if (this.props.deleting) return; if (this.props.deleting) return;
this.props.deleting = true; this.props.deleting = true;
BDFDB.LibraryRequires.fs.unlink(BDFDB.LibraryRequires.path.join(BDFDB.BDUtils.getPluginsFolder(), this.props.data.rawSourceUrl.split("/").pop()), error => { BDFDB.LibraryRequires.fs.unlinkSync(BDFDB.LibraryRequires.path.join(BDFDB.BDUtils.getPluginsFolder(), this.props.data.rawSourceUrl.split("/").pop()));
delete this.props.deleting; delete this.props.deleting;
if (error) BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LibraryStringsFormat("delete_fail", `Plugin "${this.props.data.name}"`), {type: "danger"}); BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LibraryStringsFormat("delete_success", `Plugin "${this.props.data.name}"`));
else { this.props.data.state = pluginStates.DOWNLOADABLE;
BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LibraryStringsFormat("delete_success", `Plugin "${this.props.data.name}"`)); BDFDB.ReactUtils.forceUpdate(this);
this.props.data.state = pluginStates.DOWNLOADABLE;
BDFDB.ReactUtils.forceUpdate(this);
}
});
} }
}) })
] ]
@@ -521,116 +566,6 @@ module.exports = (_ => {
}); });
} }
}; };
const RepoListHeaderComponent = class PluginListHeader extends BdApi.React.Component {
componentDidMount() {
header = this;
}
render() {
if (!this.props.tab) this.props.tab = "Plugins";
return BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN._repolistheader,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
className: BDFDB.disCN.marginbottom4,
align: BDFDB.LibraryComponents.Flex.Align.CENTER,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
grow: 1,
shrink: 0,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormTitle, {
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H2,
className: BDFDB.disCN.marginreset,
children: `Plugin Repo — ${loading.is ? 0 : this.props.amount || 0}/${loading.is ? 0 : grabbedPlugins.length}`
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SearchBar, {
autoFocus: true,
query: searchString,
onChange: (value, instance) => {
if (loading.is) return;
BDFDB.TimeUtils.clear(searchTimeout);
searchTimeout = BDFDB.TimeUtils.timeout(_ => {
searchString = value.replace(/[<|>]/g, "");
BDFDB.ReactUtils.forceUpdate(this, list);
}, 1000);
},
onClear: instance => {
if (loading.is) return;
searchString = "";
BDFDB.ReactUtils.forceUpdate(this, list);
}
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Button, {
size: BDFDB.LibraryComponents.Button.Sizes.TINY,
children: BDFDB.LanguageUtils.LibraryStrings.check_for_updates,
onClick: _ => {
if (loading.is) return;
loading = {is: false, timeout: null, amount: 0};
_this.loadPlugins();
}
})
]
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
className: BDFDB.disCNS.tabbarcontainer + BDFDB.disCN.tabbarcontainerbottom,
align: BDFDB.LibraryComponents.Flex.Align.CENTER,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TabBar, {
className: BDFDB.disCN.tabbar,
itemClassName: BDFDB.disCN.tabbaritem,
type: BDFDB.LibraryComponents.TabBar.Types.TOP,
selectedItem: this.props.tab,
items: [{value: "Plugins"}, {value: BDFDB.LanguageUtils.LanguageStrings.SETTINGS}],
onItemSelect: value => {
this.props.tab = list.props.tab = value;
BDFDB.ReactUtils.forceUpdate(list);
}
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.QuickSelect, {
label: BDFDB.LanguageUtils.LibraryStrings.sort_by + ":",
value: {
label: sortKeys[this.props.sortKey],
value: this.props.sortKey
},
options: Object.keys(sortKeys).map(key => ({
label: sortKeys[key],
value: key
})),
onChange: key => {
this.props.sortKey = list.props.sortKey = key;
BDFDB.ReactUtils.forceUpdate(this, list);
}
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.QuickSelect, {
label: BDFDB.LanguageUtils.LibraryStrings.order + ":",
value: {
label: BDFDB.LanguageUtils.LibraryStrings[orderKeys[this.props.orderKey]],
value: this.props.orderKey
},
options: Object.keys(orderKeys).map(key => ({
label: BDFDB.LanguageUtils.LibraryStrings[orderKeys[key]],
value: key
})),
onChange: key => {
this.props.orderKey = list.props.orderKey = key;
BDFDB.ReactUtils.forceUpdate(this, list);
}
})
})
]
})
]
});
}
};
return class PluginRepo extends Plugin { return class PluginRepo extends Plugin {
onLoad () { onLoad () {
@@ -656,13 +591,14 @@ module.exports = (_ => {
} }
}; };
this.patchedModules = { this.modulePatches = {
before: { before: [
SettingsView: ["render", "componentWillUnmount"] "SettingsView",
}, "StandardSidebarView"
after: { ],
StandardSidebarView: "render" componentWillUnmount: [
} "SettingsView"
]
}; };
} }
@@ -713,13 +649,14 @@ module.exports = (_ => {
processSettingsView (e) { processSettingsView (e) {
if (e.node) searchString = ""; if (e.node) searchString = "";
else { else if (e.component.prototype && !BDFDB.PatchUtils.isPatched(this, e.component.prototype, "getPredicateSections")) {
if (!BDFDB.PatchUtils.isPatched(this, e.component, "getPredicateSections")) BDFDB.PatchUtils.patch(this, e.component, "getPredicateSections", {after: e2 => { BDFDB.PatchUtils.patch(this, e.component.prototype, "getPredicateSections", {after: e2 => {
if (BDFDB.ArrayUtils.is(e2.returnValue) && e2.returnValue.findIndex(n => n.section && (n.section.toLowerCase() == "changelog" || n.section == BDFDB.DiscordConstants.UserSettingsSections.CHANGE_LOG || n.section.toLowerCase() == "logout" || n.section == BDFDB.DiscordConstants.UserSettingsSections.LOGOUT))) { if (BDFDB.ArrayUtils.is(e2.returnValue) && e2.returnValue.findIndex(n => n.section && (n.section.toLowerCase() == "changelog" || n.section == BDFDB.DiscordConstants.UserSettingsSections.CHANGE_LOG || n.section.toLowerCase() == "logout" || n.section == BDFDB.DiscordConstants.UserSettingsSections.LOGOUT))) {
e2.returnValue = e2.returnValue.filter(n => n.section != "pluginrepo"); e2.returnValue = e2.returnValue.filter(n => n.section != "pluginrepo");
let index = e2.returnValue.indexOf(e2.returnValue.find(n => n.section == "themes") || e2.returnValue.find(n => n.section == BDFDB.DiscordConstants.UserSettingsSections.DEVELOPER_OPTIONS) || e2.returnValue.find(n => n.section == BDFDB.DiscordConstants.UserSettingsSections.HYPESQUAD_ONLINE)); let index = e2.returnValue.indexOf(e2.returnValue.find(n => n.section == "themes") || e2.returnValue.find(n => n.section == BDFDB.DiscordConstants.UserSettingsSections.DEVELOPER_OPTIONS) || e2.returnValue.find(n => n.section == BDFDB.DiscordConstants.UserSettingsSections.HYPESQUAD_ONLINE));
if (index > -1) { if (index > -1) {
e2.returnValue.splice(index + 1, 0, { e2.returnValue.splice(index + 1, 0, {
className: "pluginrepo-tab",
section: "pluginrepo", section: "pluginrepo",
label: "Plugin Repo", label: "Plugin Repo",
element: _ => { element: _ => {
@@ -741,20 +678,7 @@ module.exports = (_ => {
} }
processStandardSidebarView (e) { processStandardSidebarView (e) {
if (e.instance.props.section == "pluginrepo") { if (e.instance.props.section == "pluginrepo") e.instance.props.contentType = "custom";
let content = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.settingswindowcontentregion]]});
if (content) content.props.className = BDFDB.DOMUtils.formatClassName(BDFDB.disCN._repolistwrapper, content.props.className);
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {props: [["className", BDFDB.disCN.settingswindowcontentregionscroller]]});
if (index > -1) {
let options = {};
options.sortKey = forcedSort || Object.keys(sortKeys)[0];
options.orderKey = forcedOrder || Object.keys(orderKeys)[0];
children[index] = [
BDFDB.ReactUtils.createElement(RepoListHeaderComponent, options, true),
children[index]
];
}
}
} }
loadPlugins () { loadPlugins () {
@@ -833,9 +757,10 @@ module.exports = (_ => {
delete plugin.thumbnail_url; delete plugin.thumbnail_url;
BDFDB.LibraryRequires.request(plugin.rawSourceUrl, (error, response, body) => { BDFDB.LibraryRequires.request(plugin.rawSourceUrl, (error, response, body) => {
if (body && body.indexOf("404: Not Found") != 0 && response.statusCode == 200) { if (body && body.indexOf("404: Not Found") != 0 && response.statusCode == 200) {
plugin.name = BDFDB.LibraryModules.StringUtils.upperCaseFirstChar((/@name\s+([^\t^\r^\n]+)|\/\/\**META.*["']name["']\s*:\s*["'](.+?)["']/i.exec(body) || []).filter(n => n)[1] || plugin.name || ""); const META = body.split("*/")[0];
plugin.authorname = (/@author\s+(.+)|\/\/\**META.*["']author["']\s*:\s*["'](.+?)["']/i.exec(body) || []).filter(n => n)[1] || plugin.author.display_name || plugin.author; plugin.name = BDFDB.StringUtils.upperCaseFirstChar((/@name\s+([^\t^\r^\n]+)|\/\/\**META.*["']name["']\s*:\s*["'](.+?)["']/i.exec(META) || []).filter(n => n)[1] || plugin.name || "");
const version = (/@version\s+(.+)|\/\/\**META.*["']version["']\s*:\s*["'](.+?)["']/i.exec(body) || []).filter(n => n)[1]; plugin.authorname = (/@author\s+(.+)|\/\/\**META.*["']author["']\s*:\s*["'](.+?)["']/i.exec(META) || []).filter(n => n)[1] || plugin.author.display_name || plugin.author;
const version = (/@version\s+(.+)|\/\/\**META.*["']version["']\s*:\s*["'](.+?)["']/i.exec(META) || []).filter(n => n)[1];
if (version) { if (version) {
plugin.version = version; plugin.version = version;
const installedPlugin = this.getInstalledPlugin(plugin); const installedPlugin = this.getInstalledPlugin(plugin);
@@ -880,7 +805,7 @@ module.exports = (_ => {
}); });
BDFDB.PluginUtils.addLoadingIcon(loadingIcon); BDFDB.PluginUtils.addLoadingIcon(loadingIcon);
BDFDB.ReactUtils.forceUpdate(list, header); BDFDB.ReactUtils.forceUpdate(list);
for (let i = 0; i <= 20; i++) checkPlugin(); for (let i = 0; i <= 20; i++) checkPlugin();
} }
@@ -1124,5 +1049,5 @@ module.exports = (_ => {
} }
} }
}; };
})(window.BDFDB_Global.PluginUtils.buildPlugin(config)); })(window.BDFDB_Global.PluginUtils.buildPlugin(changeLog));
})(); })();

View File

@@ -1,6 +1,6 @@
{ {
"currentVersionInfo": { "currentVersionInfo": {
"version": "2.0.4", "version": "2.0.9",
"hasShownChangelog": true "hasShownChangelog": true
} }
} }

View File

@@ -1,9 +0,0 @@
/**
* @name No_Double_Back
*/
const {ipcRenderer} = require('electron')
module.exports = class noDoubleBack {
load() { this.DISCORD_NAVIGATE_BACK = ipcRenderer._events.DISCORD_NAVIGATE_BACK}
start() { ipcRenderer.removeListener('DISCORD_NAVIGATE_BACK', ipcRenderer._events.DISCORD_NAVIGATE_BACK) }
stop() { ipcRenderer.addListener('DISCORD_NAVIGATE_BACK', this.DISCORD_NAVIGATE_BACK) }
}

View File

@@ -15,23 +15,30 @@ set $mod Mod4
# is used in the bar {} block below. # is used in the bar {} block below.
font pango:Inconsolata Bold 11 font pango:Inconsolata Bold 11
exec_always --no-startup-id xset s off
exec_always --no-startup-id xset -dpms
# This font is widely installed, provides lots of unicode glyphs, right-to-left # This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango). # text rendering and scalability on retina/hidpi displays (thanks to pango).
#font pango:DejaVu Sans Mono 8 #font pango:DejaVu Sans Mono 8
client.focused #89a1e2 #89a1e2 #25283f #fe9bce #fe9bce client.focused #fe9bce #89a1e2 #25283f #fe9bce #fe9bce
#client.focused_inactive #fe9bce #fe9bce #fe9bce #fe9bce #fe9bce client.focused_inactive #25283f #89a1e2 #25283f #fe9bce #25283f
client.unfocused #25283f #25283f #545d89 #25283f #25283f client.focused_tab_title #25283f #89a1e2 #25283f #fe9bce #25283f
client.unfocused #25283f #25283f #545d89 #fe9bce #25283f
client.background #25283f client.background #25283f
default_border pixel 1 default_border pixel 1
default_floating_border pixel 1 default_floating_border pixel 1
for_window [all] border pixel 1
gaps inner 15 gaps inner 15
exec_always --no-startup-id feh --bg-fill /home/poslop/Pictures/bg/pcbg.jpg exec_always --no-startup-id feh --bg-fill /home/poslop/Pictures/bg/pcbg.jpg
exec_always --no-startup-id numlockx on exec_always --no-startup-id numlockx on
# exec_always --no-startup-id xinput set-prop pointer:'Logitech G305' 'libinput Accel Speed' -0.3
exec --no-startup-id picom & exec --no-startup-id picom &
exec_always --no-startup-id $HOME/.config/polybar/launch.sh exec_always --no-startup-id $HOME/.config/polybar/launch.sh
@@ -67,8 +74,8 @@ bindsym $mod+v exec --no-startup-id rofi -modi "clipboard:greenclip print" -show
# Brightness # Brightness
bindsym XF86MonBrightnessDown exec --no-startup-id light -U 5 bindsym XF86MonBrightnessDown exec --no-startup-id backlight_control -10
bindsym XF86MonBrightnessUp exec --no-startup-id light -A 5 bindsym XF86MonBrightnessUp exec --no-startup-id backlight_control +10
# Use Mouse+$mod to drag floating windows to their wanted position # Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod floating_modifier $mod

View File

@@ -6,3 +6,23 @@ BackgroundNormal=#25283f
[General] [General]
TerminalApplication=alacritty TerminalApplication=alacritty
[KFileDialog Settings]
Allow Expansion=false
Automatically select filename extension=true
Breadcrumb Navigation=true
Decoration position=2
LocationCombo Completionmode=5
PathCombo Completionmode=5
Show Bookmarks=false
Show Full Path=false
Show Inline Previews=true
Show Preview=false
Show Speedbar=true
Show hidden files=false
Sort by=Name
Sort directories first=true
Sort hidden files last=false
Sort reversed=false
Speedbar Width=219
View Style=DetailTree

View File

@@ -1 +1 @@
{"gtk2_hidpi": false, "OPTION_GTK3_CURRENT_VERSION_ONLY": false, "OPTION_EXPORT_CINNAMON_THEME": false, "default_path": "/home/poslop/.themes"} {"gtk2_hidpi": true, "OPTION_GTK3_CURRENT_VERSION_ONLY": false, "OPTION_EXPORT_CINNAMON_THEME": false, "default_path": "/home/poslop/.themes"}

View File

@@ -209,7 +209,7 @@ format-prefix-foreground = ${colors.primary}
[module/backlight] [module/backlight]
type = internal/backlight type = internal/backlight
; $ ls -1 /sys/class/backlight/ ; $ ls -1 /sys/class/backlight/
card = intel_backlight card = amdgpu_bl0
use-actual-brightness = true use-actual-brightness = true

View File

@@ -1,9 +1,9 @@
[Appearance] [Appearance]
color_scheme_path=/usr/share/qt5ct/colors/airy.conf color_scheme_path=/home/poslop/.config/qt5ct/colors/oomox-rice.conf
custom_palette=false custom_palette=true
icon_theme=oomox-rice icon_theme=oomox-rice
standard_dialogs=default standard_dialogs=gtk3
style=gtk2 style=Windows
[Fonts] [Fonts]
fixed=@Variant(\0\0\0@\0\0\0\x16\0I\0n\0\x63\0o\0n\0s\0o\0l\0\x61\0t\0\x61@(\0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0K\x10) fixed=@Variant(\0\0\0@\0\0\0\x16\0I\0n\0\x63\0o\0n\0s\0o\0l\0\x61\0t\0\x61@(\0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0K\x10)
@@ -24,8 +24,11 @@ toolbutton_style=4
underline_shortcut=1 underline_shortcut=1
wheel_scroll_lines=3 wheel_scroll_lines=3
[PaletteEditor]
geometry="@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\x5\0\0\0\x1*\0\0\ax\0\0\x3<\0\0\x5\x1\0\0\x1+\0\0\aw\0\0\x3;\0\0\0\0\0\0\0\0\a\x80\0\0\x5\x1\0\0\x1+\0\0\aw\0\0\x3;)"
[SettingsWindow] [SettingsWindow]
geometry="@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\0\xe\0\0\0=\0\0\aq\0\0\x2+\0\0\0\xf\0\0\0>\0\0\ap\0\0\x2*\0\0\0\0\0\0\0\0\a\x80\0\0\0\xf\0\0\0>\0\0\ap\0\0\x2*)" geometry="@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\x5\a\0\0\0=\0\0\aq\0\0\x4)\0\0\x5\b\0\0\0>\0\0\ap\0\0\x4(\0\0\0\0\0\0\0\0\a\x80\0\0\x5\b\0\0\0>\0\0\ap\0\0\x4()"
[Troubleshooting] [Troubleshooting]
force_raster_widgets=1 force_raster_widgets=1

View File

@@ -1,3 +1,5 @@
export QT_QPA_PLATFORMTHEME=qt5ct export QT_QPA_PLATFORMTHEME=qt5ct
#export QT_STYLE_OVERRIDE=gtk2
export GTK_THEME=oomox-rice export GTK_THEME=oomox-rice
#export QT_STYLE_OVERRIDE=gtk2
export QSYS_ROOTDIR="/home/poslop/.cache/yay/quartus-free/pkg/quartus-free-quartus/opt/intelFPGA/21.1/quartus/sopc_builder/bin"

4
.zshrc
View File

@@ -103,3 +103,7 @@ export PATH=$PATH:/home/poslop/.spicetify
alias bctl=bluetoothctl alias bctl=bluetoothctl
alias dots='/usr/bin/git --git-dir=$HOME/.git --work-tree=$HOME' alias dots='/usr/bin/git --git-dir=$HOME/.git --work-tree=$HOME'
export wf='94:DB:56:1A:FB:7F'
export wh='94:DB:56:F7:8A:40'
export QSYS_ROOTDIR="/home/poslop/.cache/yay/quartus-free/pkg/quartus-free-quartus/opt/intelFPGA/21.1/quartus/sopc_builder/bin"