Working again

This commit is contained in:
Alexei Stukov 2018-08-07 08:32:14 +03:00 committed by GitHub
parent 7b99b7d7f1
commit 0d81028a3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 18 deletions

View File

@ -2,35 +2,29 @@
var dblClickEdit = function () {};
dblClickEdit.prototype.handler = function(e) {
const message = e.target.closest('[class^=messageCozy]');
if (!message) return;
const btn = message.querySelector('[class^=buttonContainer] [class^=button-]');
if (!btn) return;
btn.click();
for (let btn of [...document.querySelectorAll(`[role=menu] [type=button]`)]) { if (btn.innerText && btn.innerText.includes('Edit')) btn.click(); }
};
dblClickEdit.prototype.onMessage = function () {
};
dblClickEdit.prototype.onSwitch = function () {
};
dblClickEdit.prototype.start = function () {
$(document).on("dblclick.dce", function(e) {
var target = $(e.target);
if(target.parents(".message-1PNnaP").length > 0) {
var msg = target.parents(".message-1PNnaP").first();
var opt = msg.find(".button-3Jq0g9");
opt.click();
$.each($(".popout-3sVMXz .button-38aScr"), (index, value) => {
var option = $(value);
if(option.text() === "Edit") {
option.click();
}
});
}
});
document.addEventListener('dblclick', this.handler);
};
dblClickEdit.prototype.load = function () {};
dblClickEdit.prototype.unload = function () {
$(document).off("dblclick.dce");
document.removeEventListener('dblclick', this.handler);
};
dblClickEdit.prototype.stop = function () {
$(document).off("dblclick.dce");
document.removeEventListener('dblclick', this.handler);
};
dblClickEdit.prototype.getSettingsPanel = function () {
return "";