Improve the Gmail interface with the most requested feature that Google doesn't want you to have.
Many netizens have gotten a Gmail account and been wowed with the interface, but noticed one critical missing piece: there is no easy way to delete a message. Deletion in the standard Gmail interface requires opening the drop-down actions box and selecting the last item, which is cumbersome for a frequent activity.
This hack alters the user interface of Gmail to include an extra button that lets the user delete any message with one simple click.
This script is split into five parts.
_gd_gmail_delete function performs the actual message deletion. It simply searches for a
<select> element within its parent container and then finds the appropriate action within that menu. If it is found, the script triggers the
onchange handler of the select box, which launches the standard Gmail code to delete the selected messages.
_gd_make_dom_button function is notable because it supports multiple languages. There is only one word that the script adds, but this function attempts to autodetect the language in the Gmail interface, and sets the Delete button caption to the proper translation. It also attaches the
_gd_gmail_delete function as the
onclick event handler for the button.
_gd_insert_button function does the real magic in this script. It calls the
_gd_make_dom_button function to create a new element to be injected into the page, does a little ...