Gmail Delete Button

2005-04-03 13:05 - Greasemonkey User Scripts

Obsolete!

Gmail officially includes a delete button! It was a wild ride and I enjoyed it, but it's come to an end. Thanks for hanging on with me, everyone.

Apparently, the official button is only in the USA (english?) version. So those of you using other languages, you can continue to use the script, but there aren't any more updates coming.

Whether you use the extension or user script version, uninstalling is your job! =)


If you miss the keyboard shortcut, you will probably like the Gmail Macros user script.

I've written quite a few other greasemonkey scripts that you might find useful.


I'm having fun writing greasemonkey user scripts! For the uninitiated, greasemonkey is a Firefox extension that lets one modify a web page with javascript in powerful ways. This means that to install the user script, you must first install the greasemonkey extension, and then the script into it. The script recieves new features first, and sometimes only, and there are a lot of other fantastic user scripts to do amazing things like this, so I suggest you use greasemonkey!

Install:

Do not install both at once, that will almost certainly cause issues.

Warning: this is of course not official gmail code. I offer no warranty express or implied on this script. Use it at your own risk.

Changes in latest update:

Check the comments in the source code of the user script for past update history.

Compatibility: The newest version of the extension is compatible with Firefox 1.5. The newest user script is also, as long as you use version 0.6.4 of Greasemonkey. It may be found for download at the Greasemonkey blog.

Screenshot

Screenshot of the button

Comments:

Comment Archive
2005-10-05 10:16 - arantius

I have just released version 3.0 of Gmail Delete Button. All old comments remain in the archive.

In the future: Please do not use the comment form on this page as a discussion forum, or a way to contact me. If you have a problem or suggestion with the script, please use my contact form to send me a message. If you have a comment that you feel the public should see, though, by all means post it here!

As a reminder, though: Yes, version 3.0 is not compatible with beta versions of Firefox. Please do not request that this changes. If you are running a beta version of Firefox, install an old version as linked above. This script will be updated to be compatible when the new version of Firefox is available.

gmail DELETE button
2005-10-11 15:33 - jdwaters
THANK YOU a million times over.
I just can't believe the geeks a Google won't add a stupid Delete button. Even better, let me customize my own little toolbar.

To me, a simple Delete button is standard equipment. Glad to see I'm not the only one in the world that thinks this way.
localization
2005-10-12 14:29 - vanbregt
Would there be localization in the future? I use Gmail in Dutch and "Delete" should say "Verwijder". If it won't it's no problem at all.... It still works great.
Delete button is ot created with sessionSaver
2005-10-14 04:42 - Crirus
If the tab window is saved, on reload of FF, delete button is not created, only on refresh will appear

Cristian
Move button to the right?
2005-10-18 11:22 - bkuri
Hello,

Is there a way to move the "delete" button to the right of the "archive" button? I'm already used to having that button there, and I've already deleted more than a couple of messages by accident...

Keep up the great work, though!
Preferences!
2005-10-18 11:47 - arantius

As the notes at the top of the page you can see that new in version 3.1 is configurability of the button. You may choose the text color, and the position! This is for the user script only at this point, but with the user script installed and gmail open, click tools, user script commands, gmail delete button position. You'll want to put in 'right'.

Firefox 1.5RC1 & GreaseMonkey 0.6.2
2005-11-02 01:25 - StormeRider
Work fine with 3.3. :)
Yay!
2005-11-14 15:36 - tanyaiscrazy
Works like a charm! Thank you so much for coming up with this! It's awesome!
Keyboard Shortcuts
2005-11-25 13:44 - arantius

My apologies to the users who had problems with the keyboard shortcuts. I had attempted to hook into Gmail's own keyboard shortcut functionality for the best compatibility and functionality. (I envisioned the shortcut turning off when you set Gmail's own shortcuts off by virtue of this.)

Well, I did hook in to their system, but in the wrong place, and some users saw the shortcut triggering as messages were composed. I have re-implemented the keyboard shortcut in a simpler manner, and it is more stable, in version 3.4.3.

Extend to "Trash this message"?
2005-11-26 06:37 - George V. Reilly
This fills a much-needed void (heh).

This button is great for deleting an entire conversation. However, if I want to delete a message in the middle of a threaded conversation, I have to click "More options", then move the mouse to click "Trash this message". Can you extend this?
Error when composing.
2005-12-10 16:09 - ielliott
I have shortucts turned off in GMail. When I go to Compose Mail, and start typing, whenever I type the leter 'd' - it pops up an error:

BUG! Could find button. Please alert the author.

Yes, it says "Could" not "Couldn't".

Any thoughts?
RE: Error when composing.
2005-12-10 16:18 - ielliott
Sorry about that guys.

I realized I can fix the problem by going to Tools > User Script Commands > GMail Delete Button HotKey and deleting the "d" out of there.
fantastic!
2005-12-13 13:57 - lee
nice one. thanks.
No delete button on Firefox 1.5
2005-12-20 07:36 - Never
Since I upgraded to Firefox 1.5 I don't have the handy delete button anymore. I guess it can be some incompatibility with other FF extensions, but I cannot figure it out. Do you have any clue? Thanks for the neat work!
No delete button on Firefox 1.5
2005-12-20 18:39 - ServiceCompupters
Please insure that you have the latest version of greasemonkey & of Gmail Delete Button. Older versions are not compatible with Firefox 1.5. To upgrade, select Tools | Extensions from the menu & click on each extension & click the upgrade button.
An additional option idea
2005-12-31 10:47 - citizenkahn
The feature is great. Yahoo mail has a delete button which has the behavior of going to the next message after being hit when in a message. Do you think that would be a reasonable feature for this?
partial solution?
2006-01-10 15:19 - eric
Please let me know if I am correct on this:

From what I understand of gmail's technology infrastructure this is only a partial solution.

When mail comes into gmail it is stored in a centralized database; a link to that message is put in your inbox. this way if 100 people on gmail get the same exact email it is only stored once, but 100 pointers to the message exist in people's email boxes.

This tool might allow you to "delete" it from your inbox but from what I can see (I could be wrong) it only removes the pointer from your inbox to the actual stored message. The message itself is never deleted. right?



Looks like gmail added this functionality today
2006-01-17 16:12 - nhlinux
I noticed that the delete button stopped working today... then I noticed that there were 2 delete buttons. Looks like gmail now has a delete button. Yippie!

Thanks for the work Anthony!
Did we win?
2006-01-17 16:19 - arantius

I was about to exclaim, "We won!" In a gush of usability triumph. But I don't see it. When I fire up IE (No greasemonkey script to fool me there!) I don't see a delete button in my primary or secondary for-testing account.

Do you perhaps have the extension installed as well as the user script? Maybe another version of the script?

I'm interested in hearing if anyone else does get a delete button without any script/extension providing it.

hmmmm....
2006-01-18 09:21 - nhlinux
The only other gmail related extension that I have is 'Gmail Manager (0.4.2)'. I do not have the GreaseMonkey extension, so that does not appear to be it. I decided to fire up IE, and sure enough, I have a Delete button in IE (to the left of the pull down menu) too!

Maybe I am just 'special' ;-)
Yay!
2006-01-18 18:21 - Leo
I just noticed I couldn't use it anymore, and then saw the second button (and the lack of "delete" option in the drop-down menu).
Needless to say, I came here right away to thank you for having made this an extension. It really saved many seconds of my life!
Thanks a lot! Hope you make some other button, maybe Gmail will add it too ;) (a "mark as read" button! lol, half-joking)
Cheers!
G Mail Delete button
2006-01-19 16:33 - rleonetti
Since Google added theirs, I now have two buttons, one of which does not work. How do I undo the script originally added?
Uninstall?
2006-01-19 17:06 - arantius

If you installed the extension, uninstall it the same way you uninstall any extension.

If you installed the user script in greasemonkey, the same way you uninstall any greasemonkey script. (Tools, Manage User Scripts, select it, Uninstall).

New button
2006-01-19 21:36 - epsilon
Just wanted to thanks for the wonderful extension you made, that gave us the delete functionality while google didn't have it yet. Noticed it today when I tried to click the delete, and nothing happened.

Thanks again for your past work! :)
So...thank you!
2006-01-20 07:32 - Michal
I haven't noticed the new Delete button by Google until I tried to use the old one (and it didn't work anymore). So now that Google added the button, I uninstalled the extension from Firefox, as it's not necessary anymore.

P.S.: I liked your Delete button better. Thank you for your work.
Google has added a Delete button
2006-01-20 13:48 - anyhja
Check out it out! Google has added a delete button to their gmail service.
New Gmail delete with no keyboard shortcut
2006-01-20 16:42 - byteshack
The new addition by Google does not include a keyboard shortcut to delete. I would find that extremely useful! Let us know if you decide that it is worth you time :)
Love the keyboard shortcut from your Gmail Delete
2006-01-20 16:56 - waccow
I also love the keyboard shortcut from your Gmail Delete.
I can't believe Google's Delete button doesn't have that shortcut.
Do let us know if you gonna add the delete shortcut. If not, I might get my hands dirty.
Dont Stop. Gmail is missing lots of stuff
2006-01-20 22:02 - user
Hi Anthony Lieuallen ...dont stop! We need greasemonkey script with lots of other ideas.
1) "attach
Individual Message Delete button
2006-01-21 01:17 - dbolton
How about creating a delete button for individual messages (as opposed to the entire conversation)
delete shortcut
2006-01-23 08:13 - booyaa
Gmail lacks a shortcut key to delete a message, you were smarter than they. How hard would it be to lose the button and add/keep the shortcut key working?
delete shortcut
2006-01-23 08:14 - booyaa
Gmail lacks a shortcut key to delete a message, you were smarter than they. How hard would it be to lose the button and add/keep the shortcut key working?
How 2 remove it again
2006-02-14 14:48 - manama
U know that gmail finally added delete button, so now we have 2 delete buttons that one of them doesn't work. So how can I remove it?
patch for new google interface which added delete button.
2006-02-19 10:12 - rextsai
Hi, your script is very useful, please keep maintain the project. Because google did not added a shortcut for delete. I modified the script for aviod display two delete button, and fixed shortcut when the interafce have a delete button already.


--- gmail-delete-button-3.4.user.js 2006-02-19 15:17:05.000000000 +0800
+++ gmail-delete-button-3.4-rex.user.js 2006-02-19 20:39:46.000000000 +0800
@@ -54,10 +54,15 @@

function _gdb_watch_key(e) {
var el=e.target;
- var button=e.target.ownerDocument.getElementById('_gdb_');
+ var button = e.target.ownerDocument.getElementById('ac_tr');

- //check if there is a delete button showing now
- if (!button) return;
+ // check if there is a delete button showing now
+ if (!button) {
+ button = e.target.ownerDocument.getElementById('_gdb_');
+ }
+ if (!button) {
+ return;
+ }

//check if we pressed the right key
if (String.fromCharCode(e.which) != GM_getValue('key', 'd')) return;
@@ -76,11 +81,13 @@
//find container
var action='tr';
var cont=button;
- while (null!=cont && 'TABLE'!=cont.tagName) cont=cont.parentNode;
- if (!cont) return;
+ while (null!=cont && 'TABLE'!=cont.tagName)
+ cont=cont.parentNode;
+ if (!cont)
+ return;

//find action box in container
- var box=cont.getElementsByTagName('select')[0];
+ var box = cont.getElementsByTagName('select')[0];
box=box.wrappedJSObject || box;
box.onfocus();
var action_index=-1;
@@ -90,15 +97,35 @@
break;
}
}
- if (-1==action_index) return;
+ if (action_index != -1) {
+ //trigger action via box
+ box.selectedIndex=action_index;
+ box.onchange();
+ }
+ if(button.id == "ac_tr") {
+ fakeMouseEvent(button, "click");
+ }
+}
+
+function fakeMouseEvent(node, eventType) {
+ var event = node.ownerDocument.createEvent("MouseEvents");
+
+ event.initMouseEvent(eventType,
+ true, // can bubble
+ true, // cancellable
+ node.ownerDocument.defaultView,
+ 1, // clicks
+ 50, 50, // screen coordinates
+ 50, 50, // client coordinates
+ false, false, false, false, // control/alt/shift/meta
+ 0, // button,
+ node);

- //trigger action via box
- box.selectedIndex=action_index;
- box.onchange();
+ node.dispatchEvent(event);
}

if ('undefined'==typeof GM_registerMenuCommand) {
- //we're an extension, no GM apis
+ //we are an extension, no GM apis
function GM_getValue(a,b) {return b;}
} else {
//we're a user script
@@ -243,13 +270,14 @@
//noop, just catch errors
}
}
-} else if (window.document.location.href.match(/search=(drafts|trash|spam)/)) {
- //hide the button where it doesn't belong via CSS
- //we get a little flicker, but such is life
- GM_addStyle('#_gdb_hold { display: none; }');
+} else if (window.document.location.href.match(/search=(inbox|query|drafts|trash|spam|cat)/)) {
+ // hide the button where it doesn't belong via CSS
+ // we get a little flicker, but such is life
+ GM_addStyle('#_gdb_hold { display: none; }');
+ GM_addStyle('#_gdb_ { display: none; }');
} else {
- window.addEventListener('click', _gdb_watch_click, true);
- window.addEventListener('keypress', _gdb_watch_key, true);
+ window.addEventListener('click', _gdb_watch_click, true);
}
+window.addEventListener('keypress', _gdb_watch_key, true);

})();

http://people.debian.org.tw/~chihchun/2006/02/19/gmail-delete-shortcut/
Delete Button
2006-08-07 22:32 - JamesJames

I know It's a little too late, but I was thinking about this the other day. Thanks for your efforts! Keep up the good work on your future endeavors.

James http://www.webascender.com/

Post a comment:

Username
Password
  If you do not have an account to log in to yet, register your own account. You will not enter any personal info and need not supply an email address.
Subject:
Comment:

You may use Markdown syntax in the comment, but no HTML. Hints:

  • An empty line between text will create a paragraph boundary.
  • Use angle braces around a plain URL to auto-link it: <http://www.example.com/>.
  • Use this format to create a link with different text showing: [An Example](http://www.example.com/).
  • Use backticks (``), not leading spaces to enclose a code block.

If you are attempting to contact me, ask me a question, etc, please send me a message through the contact form rather than posting a comment here. Thank you. (If you post a comment anyway when it should be a message to me, I'll probably just delete your comment. I don't like clutter.)