Gmail Delete Highlight

Highlights the "Delete this message" link under gmail's "more" menu.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name        Gmail Delete Highlight
// @namespace   pauls
// @include     https://mail.google.com/*
// @require     https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js
// @description Highlights the "Delete this message" link under gmail's "more" menu.
// @version     4
// @grant       none
// ==/UserScript==

$.noConflict
function triggerMostButtons (jNode) {
    triggerMouseEvent (jNode[0], "mouseover");
    triggerMouseEvent (jNode[0], "mousedown");
    triggerMouseEvent (jNode[0], "mouseup");
    triggerMouseEvent (jNode[0], "click");
}
function triggerMouseEvent (node, eventType) {
    var clickEvent = document.createEvent('MouseEvents');
    clickEvent.initEvent (eventType, true, true);
    node.dispatchEvent (clickEvent);
}
$(document).keydown(function(e) {
    if(e.keyCode == 68){
        if(jQuery("div:contains('Send')div[tabindex=1]").length==0){    
           triggerMostButtons(jQuery(document.querySelectorAll("div[tabindex]:hover")).last().find("img[role=menu]"))
           deleteMenu = jQuery("[role=menuitem]:contains('Delete this message')")
           triggerMostButtons(deleteMenu)
           triggerMostButtons(deleteMenu)
        }
    }
});