Chapter 6 — Gmail and Greasemonkey 107
if (0==id) {
spacer=insert_container.firstChild.nextSibling.nextSibling.clo
neNode(false);
insert_point=insert_container.firstChild.nextSibling.nextSibli
ng.nextSibling;
}
if (1==id)
spacer=window.document.createElement(‘span’); //no space
really needed here
} else if
(window.document.location.search.match(/search=sent/)) {
//inside the sent page we go yet different places with
different spacers
if (0==id) {
//spacer=insert_container.firstChild.nextSibling.nextSibling.c
loneNode(false);
//insert_point=insert_container.firstChild.nextSibling.nextSib
ling.nextSibling;
spacer=window.document.createTextNode(‘ ‘);
insert_point=insert_container.firstChild.nextSibling.nextSibli
ng;
}
if (1==id)
spacer=window.document.createElement(‘span’); //no space
really needed here
}
//put them in
insert_container.insertBefore(spacer, insert_point);
insert_container.insertBefore(delete_button, spacer);
}
function _gd_place_delete_buttons() {
if (!window || !window.document || !window.document.body)
return;
var top_menu=_gd_element(‘tamu’); if (top_menu)
_gd_insert_button(top_menu.parentNode, 0);
var bot_menu=_gd_element(‘bamu’); if (bot_menu)
_gd_insert_button(bot_menu.parentNode, 1);
var mtp_menu=_gd_element(‘ctamu’); if (mtp_menu)
_gd_insert_button(mtp_menu.parentNode, 2);
var mbt_menu=_gd_element(‘cbamu’); if (mbt_menu)
_gd_insert_button(mbt_menu.parentNode, 3);
Continued