This commit is contained in:
Alexei Stukov 2018-08-07 09:47:59 +03:00 committed by GitHub
parent 222c2347fd
commit 4707671795
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -3,12 +3,16 @@
var dblClickEdit = function () {}; var dblClickEdit = function () {};
dblClickEdit.prototype.handler = function(e) { dblClickEdit.prototype.handler = function(e) {
const message = e.target.closest('[class^=messageCozy]'); const message = e.target.closest('[class^=messageCozy]') || e.target.closest('[class^=messageCompact]');
if (!message) return; if (!message) return;
const btn = message.querySelector('[class^=buttonContainer] [class^=button-]'); const btn = message.querySelector('[class^=buttonContainer] [class^=button-]');
if (!btn) return; if (!btn) return;
btn.click(); btn.click();
for (let btn of [...document.querySelectorAll(`[role=menu] [type=button]`)]) { if (btn.innerText && btn.innerText.includes('Edit')) btn.click(); } const popup = document.querySelector('[class^=container][role=menu]');
if (!popup) return;
const rii = popup[Object.keys(popup).find(k => k.startsWith('__reactInternal'))];
if (!rii || !rii.memoizedProps || !rii.memoizedProps.children || !rii.memoizedProps.children[1] || !rii.memoizedProps.children[1].props || !rii.memoizedProps.children[1].props.onClick) return;
rii.memoizedProps.children[1].props.onClick();
}; };
dblClickEdit.prototype.onMessage = function () { dblClickEdit.prototype.onMessage = function () {
@ -37,7 +41,7 @@ dblClickEdit.prototype.getDescription = function () {
return "Double click messages to edit them"; return "Double click messages to edit them";
}; };
dblClickEdit.prototype.getVersion = function () { dblClickEdit.prototype.getVersion = function () {
return "0.2.0"; return "0.2.1";
}; };
dblClickEdit.prototype.getAuthor = function () { dblClickEdit.prototype.getAuthor = function () {
return "Jiiks"; return "Jiiks";