Gmail - Remove "Empty Trash Now" link

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

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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);