This commit is contained in:
Mirco Wittrien 2020-04-19 14:48:46 +02:00
parent 901da4a408
commit 98a1fd1f86
2 changed files with 12 additions and 10 deletions

View File

@ -7982,14 +7982,14 @@
CHECKMARK: {
defaultProps: {
width: 18,
height: 18,
height: 18
},
icon: `<svg name="Checkmark" aria-hidden="false" width="%%width" height="%%height" viewBox="0 0 18 18"><g fill="none" fill-rule="evenodd"><polyline stroke="%%color" stroke-width="2" points="3.5 9.5 7 13 15 5"></polyline></g></svg>`
},
CLOSE: {
defaultProps: {
width: 12,
height: 12,
height: 12
},
icon: `<svg name="Close" aria-hidden="false" width="%%width" height="%%height" viewBox="0 0 12 12"><g fill="none" fill-rule="evenodd" aria-hidden="true"><path d="M0 0h12v12H0"></path><path class="fill" fill="%%color" d="M9.5 3.205L8.795 2.5 6 5.295 3.205 2.5l-.705.705L5.295 6 2.5 8.795l.705.705L6 6.705 8.795 9.5l.705-.705L6.705 6"></path></g></svg>`
},

View File

@ -1,12 +1,12 @@
//META{"name":"DisplayLargeMessages","authorId":"278543574059057154","invite":"Jx3TjNS","donate":"https://www.paypal.me/MircoWittrien","patreon":"https://www.patreon.com/MircoWittrien","website":"https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/DisplayLargeMessages","source":"https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/DisplayLargeMessages/DisplayLargeMessages.plugin.js"}*//
var DisplayLargeMessages = (_ => {
var encodedMessages, requestedMessages, updateTimeout, messagesInstance;
var encodedMessages, requestedMessages, updateTimeout;
return class DisplayLargeMessages {
getName () {return "DisplayLargeMessages";}
getVersion () {return "1.0.1";}
getVersion () {return "1.0.2";}
getAuthor () {return "DevilBro";}
@ -157,7 +157,6 @@ var DisplayLargeMessages = (_ => {
}
processMessages (e) {
messagesInstance = e.instance;
let settings = BDFDB.DataUtils.get(this, "settings");
let amounts = BDFDB.DataUtils.get(this, "amounts");
for (let i in e.instance.props.messages._array) {
@ -170,7 +169,7 @@ var DisplayLargeMessages = (_ => {
}));
message.attachments = message.attachments.filter(n => n.filename != "message.txt");
e.instance.props.messages._array[i] = message;
let stream = e.instance.props.channelStream.find(n => n.groupId == message.id);
let stream = e.instance.props.channelStream.find(n => n.content && n.content.id == message.id);
if (stream) stream.content = message;
}
}
@ -184,7 +183,7 @@ var DisplayLargeMessages = (_ => {
};
BDFDB.TimeUtils.clear(updateTimeout);
updateTimeout = BDFDB.TimeUtils.timeout(_ => {
BDFDB.ReactUtils.forceUpdate(messagesInstance);
BDFDB.ReactUtils.forceUpdate(e.instance);
}, 1000);
});
}
@ -203,17 +202,20 @@ var DisplayLargeMessages = (_ => {
target: "_blank",
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCN._displaylargemessagesinjectbutton,
name: BDFDB.LibraryComponents.SvgIcon.Names.RAW_TEXT
name: BDFDB.LibraryComponents.SvgIcon.Names.RAW_TEXT,
width: 20,
height: 20
}),
onClick: event => {
BDFDB.ListenerUtils.stopEvent(event);
let message = BDFDB.ReactUtils.findValue(event.target, "message", {up: true});
let target = event.target;
let message = BDFDB.ReactUtils.findValue(target, "message", {up: true});
if (message) BDFDB.LibraryRequires.request(e.instance.props.url, (error, response, body) => {
encodedMessages[message.id] = {
content: message.content || "",
attachment: body || ""
};
BDFDB.ReactUtils.forceUpdate(messagesInstance);
BDFDB.ReactUtils.forceUpdate(BDFDB.ReactUtils.findOwner(target, {name: "Messages", up: true}));
});
}
})