Gmail - Remove "Empty Trash Now" link

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==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);