Skip to content
This repository has been archived by the owner on Jun 27, 2021. It is now read-only.

Commit

Permalink
Master to Beta changes
Browse files Browse the repository at this point in the history
Merge master changes to beta
  • Loading branch information
MasicoreLord committed Feb 5, 2021
2 parents fa388d3 + c7b2c35 commit e2ac95c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion plugins/avatar_links.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ module.exports = new Plugin({
// Make sure it's already in the DOM
await new Promise(r => {setTimeout(r, 5)});
const theMenu = document.querySelector('.'+cm.menu);
const reactData = theMenu.__reactInternalInstance$;

const reactData = theMenu[Object.keys(theMenu).find(key => key.startsWith("__reactInternalInstance") || key.startsWith("__reactFiber"))];

let label = "";
let url = "";
Expand Down
9 changes: 5 additions & 4 deletions plugins/direct_download.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,21 @@ module.exports = new Plugin({
this._contClass = EDApi.findModule('embedWrapper').container;
ttM = EDApi.findModule('tooltipPointer');
iteM = EDApi.findModule('hideInteraction');
document.addEventListener('contextmenu', this.listener);
Dispatcher = EDApi.findModule("dispatch");
Dispatcher.subscribe("CONTEXT_MENU_OPEN", this.listener);
},
listener(e) {
if (document.getElementsByClassName(this._cmClass).length == 0) setTimeout(() => module.exports.onContextMenu(e), 0);
else this.onContextMenu(e);
},
onContextMenu(e) {
e = e.contextMenu;
const messageGroup = e.target.closest('.'+this._contClass);
const parentElem = e.target.parentElement;
const guildWrapper = EDApi.findModule('childWrapper').wrapper;
const memberAvatar = EDApi.findModule('nameAndDecorators').avatar;

if (e.target.localName != 'a' && e.target.localName != 'img' && e.target.localName != 'video' && !messageGroup && !e.target.className.includes(guildWrapper) && !parentElem.className.includes(memberAvatar) && !e.target.className.includes('avatar-')) return;

let saveLabel = 'Download',
url = e.target.poster || e.target.style.backgroundImage.substring(e.target.style.backgroundImage.indexOf(`'`) + 1, e.target.style.backgroundImage.lastIndexOf(`'`)) || e.target.href || e.target.src;

Expand Down Expand Up @@ -127,6 +128,6 @@ module.exports = new Plugin({
setTimeout(() => addMenuItem(url, saveLabel, fileName, fileExtension), 5);
},
unload: function() {
document.removeEventListener('contextmenu', this.listener);
Dispatcher.unsubscribe("CONTEXT_MENU_OPEN", this.listener);
}
});
2 changes: 1 addition & 1 deletion plugins/ed_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ module.exports = new Plugin({

return e(Button, {size: Button.Sizes.SMALL, color: Button.Colors.GREEN, style: {margin: '0 5px', display: 'inline-block'}, onClick: e => {
setString("Opening...");
const sucess = require("electron").shell.openItem(
const sucess = require("electron").shell.openPath(
e.shiftKey ?
process.env.injDir :
require("path").join(process.env.injDir, "plugins")
Expand Down
2 changes: 1 addition & 1 deletion plugins/hidden_channels.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = new Plugin({
ai = EDApi.findModule('actionIcon');

const getUser = EDApi.findModule('getCurrentUser').getCurrentUser;
const getAllChannels = EDApi.findModule('getChannels').getChannels;
const getAllChannels = EDApi.findModule('getGuildChannels').getGuildChannels;
const can = EDApi.findModule('computePermissions').can;

g_dc = EDApi.findModule('getDefaultChannel');
Expand Down

0 comments on commit e2ac95c

Please sign in to comment.