-
-
Save phit/030d8185bcc95d28203e801e5b9f9be6 to your computer and use it in GitHub Desktop.
//META{"name":"dblClickEdit"}*// | |
var dblClickEdit = function () {}; | |
dblClickEdit.prototype.start = function () { | |
document.addEventListener("dblclick", dblClickEventListener); | |
}; | |
dblClickEdit.prototype.load = function () {}; | |
dblClickEdit.prototype.unload = function () { | |
document.removeEventListener("dblclick", dblClickEventListener); | |
}; | |
dblClickEdit.prototype.stop = function () { | |
document.removeEventListener("dblclick", dblClickEventListener); | |
}; | |
dblClickEdit.prototype.getName = function () { | |
return "Double click edit"; | |
}; | |
dblClickEdit.prototype.getDescription = function () { | |
return "Double click messages to edit them"; | |
}; | |
dblClickEdit.prototype.getVersion = function () { | |
return "1.1.0"; | |
}; | |
dblClickEdit.prototype.getAuthor = function () { | |
return "phit"; | |
}; | |
function dblClickEventListener(e) { | |
var parents = getParents(e.target, "message_d5deea") | |
if (parents.length > 0) { | |
var msg = parents[parents.length - 1]; | |
var opt = msg.querySelectorAll(".button_ef319f"); | |
for (i = 0; i < opt.length; i++) { | |
if (opt[i].getAttribute('aria-label') == 'Edit') { | |
opt[i].click(); | |
break; | |
} | |
} | |
} | |
} | |
function getParents(el, untilClass) { | |
var parents = []; | |
var p = el.parentNode; | |
var iter = 0; | |
while (iter < 5 && p !== undefined && p.classList !== undefined && !p.classList.contains(untilClass)) { | |
var o = p; | |
if (p.classList.contains(untilClass)) { | |
parents.push(o); | |
} | |
p = o.parentNode; | |
iter++; | |
} | |
if (p.classList.contains(untilClass)) { | |
var o = p; | |
parents.push(o); | |
} | |
return parents; | |
} |
save to file and throw into the betterdiscord plugins folder
I actually came accross this, lookinng for a double click to reply plugin, but looking at the code, just replacing 'Edit' with 'Reply' would get what I want. Tried it and it worked, doesn't let you reply to your own messages though.
@Arjun-Anubis hold shift when doubleclicking and it will actually work with replying to yourself
For clarification to those looking for a Double Click to Reply plugin, it worked for me to just change the 'Edit' on line 36 to 'Reply'.
Tbh I'd love if this plugin had a settings menu and you could choose whether double-clicking edits or replies, but I don't know enough code to do that.
Getting this notification like 5 months later, but yes shift while double clicking works! Thanks!
Seems like it broke
@Vexadros I just updated it for the latest discord changes!
@phit Wow that was fast, thank you.
how i install it ?