Gmail2 RedDelete

By diego.devita Last update Oct 8, 2008 — Installed 781 times.

There are 2 previous versions of this script.

// Gmail2 RedDelete
// version 0.3b
// 2008-10-08
// by Diego De Vita
// based on Bruno Caimar's idea.
//
// ==UserScript==
// @name          Gmail2 RedDelete
// @description   change the style of the delete button on your gmail account
// @include       http://mail.google.com/*
// @include       https://mail.google.com/*
// ==/UserScript==

var label = 'Delete';
var interval = 1000;

var canvasDocument;

function initState(){		
		canvas=document.getElementById('canvas_frame');		
		if(canvas!=null){						
			canvasDocument=canvas.contentDocument;									
			return true;
		}
		return false;
}

function changeStyle(n){
	n.style.background = 'red';
	n.style.color = 'white';
	n.style.fontWeight = 'bold';
}

function modButtons() {
	buttons = canvasDocument.getElementsByTagName('button');				
	for(i=0;i<buttons.length;i++){
		if (buttons[i].innerHTML.indexOf(label) != -1) changeStyle(buttons[i]);			
	}
}								

function onLoadHandler(){
	if (initState()==true) setInterval(modButtons,interval);
}

window.addEventListener('load',onLoadHandler,true);