Gmail - Remove "Empty Trash Now" link

Removes the "Empty Trash Now" link when in the Trash

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.

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

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

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

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

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

// ==UserScript==
// @name        Gmail - Remove "Empty Trash Now" link
// @namespace   gmail_remove_empy_trash_now_link
// @description Removes the "Empty Trash Now" link when in the Trash
// @version     0.1
// @author	Tim Berneman
// @copyright	Tim Berneman (c) 2015
// @include     /https?:\/\/mail.google.com\/mail\/u\/0\/#trash/
// @grant       none
// @require     http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.js
// @run-at      document-start
//
// License: http://creativecommons.org/licenses/by-nc-sa/3.0/
//
// CHANGELOG:
// v0.1 - initial release
//
// ==/UserScript==

// THESE DO NOT WORK FOR THIS SCRIPT!
//
// window.addEventListener ("load", pageFullyLoaded);
// document.addEventListener ("DOMContentLoaded", DOM_ContentReady);
// $(document).ready(function() {} );
//
// I suspect Gmail is loading this particular code through AJAX and thus the above statements do not work.
//
// To circumvent this, I wait 3 seconds then call the function to hide the div. (Kludgy, I know, but it works!)

function yourFunction() {

  if ( jQuery("div.ya") == null ) {
    setTimeout(function() { yourFunction(); }, 1000);
  } else {
    jQuery('span:contains("Empty Trash now")').parent().hide();
  }

}
setTimeout(function() { yourFunction(); }, 3000);