Skip to content

Instantly share code, notes, and snippets.

@nkmathew
Last active January 26, 2018 10:06
Show Gist options
  • Save nkmathew/15501728a6a77fee7ba4 to your computer and use it in GitHub Desktop.
Save nkmathew/15501728a6a77fee7ba4 to your computer and use it in GitHub Desktop.
Greasemonkey script for deleting read Gmail messages in basic HTML view
// ==UserScript==
// @name GMail Delete Button
// @namespace http://nkmathew.github.io
// @description Adds a button that deletes all read emails in gmail(when in basic HTML view)
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
// @include https://mail.google.com/mail/u/0/h/*
// @version 0.1
// @grant none
// @run-at document-end
// ==/UserScript==
/**
* Simply ticks the checkboxes of read messages and clicks the delete button
*/
unreadEmails = $('tr[bgcolor="#E8EEF7"] td input[name="t"]');
$('<input name="nvp_a_tr" value="Delete Read Emails" class="gmail-delete-button" type="submit">').insertAfter($('input[name="nvp_a_tr"]'));
$('.gmail-delete-button').click(function() {
unreadEmails.prop('checked', true);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment