Update PersonalPins.plugin.js

This commit is contained in:
Mirco Wittrien 2019-02-03 19:02:15 +01:00
parent 16d1222afc
commit 39d7b2d3da
1 changed files with 24 additions and 18 deletions

View File

@ -5,11 +5,15 @@ class PersonalPins {
getDescription () {return "Similar to normal pins. Lets you save messages as notes for yourself.";}
getVersion () {return "1.7.4";}
getVersion () {return "1.7.5";}
getAuthor () {return "DevilBro";}
initConstructor () {
this.changelog = {
"improved":[["Copy Button","Pressing the copy button in a note that contains files will now add the filelinks to the copied text"]]
};
this.labels = {};
this.patchModules = {
@ -453,12 +457,14 @@ class PersonalPins {
});
message.querySelector(BDFDB.dotCN.messagespopoutjumpbutton + ".copy").addEventListener("click", e => {
let clipboard = require("electron").clipboard;
if (noteData.content) clipboard.write({text: noteData.content});
if (noteData.content) {
let text = noteData.content;
for (let file of message.querySelectorAll(BDFDB.dotCN.filenamelink)) text += ("\n" + file.href);
clipboard.write({text});
}
else {
let image = message.querySelector(BDFDB.dotCNS.imagewrapper + "img");
if (image) {
// stolen from Image2Clipboard
require("request")({url: image.src, encoding: null}, (error, response, buffer) => {
if (image) require("request")({url: image.src, encoding: null}, (error, response, buffer) => {
if (buffer) {
let platform = require("process").platform;
if (platform === "win32" || platform === "darwin") {
@ -473,7 +479,6 @@ class PersonalPins {
}
});
}
}
});
}
@ -501,6 +506,7 @@ class PersonalPins {
pins[guild_id] = pins[guild_id] || {}
pins[guild_id][channel.id] = pins[guild_id][channel.id] || {}
if (!pins[guild_id][channel.id][message.id + "_" + pos]) {
for (let spoiler of messagediv.querySelectorAll(BDFDB.dotCN.spoilerhidden)) spoiler.click();
let channelname = channel.name;
if (!channelname && channel.recipients.length > 0) {
for (let dmuser_id of channel.recipients) {