Hi all,

I've written a greasemonkey script for Gmail that adds something I find useful for my subscriptions to mailing lists. It selects conversations that have been replied to - either they have a number in brackets at the end of the From bit or the subject starts with Re:. There are separate links for each type.

I've put the script here in case you want to install it and see what I mean.

Problem 1: If I click on either link, the conversations are correctly selected. However, it often takes an extra click on the link to make the options in the dropdown become active.

Problem 2: Gmail refreshes itself every so often. Either when this happens or when you do something like delete a conversation or mark it as read, the links disappear. The script doesn't reapply itself. How can I make it more persistent?

This is the script:
function _sc_aL() {
  var _sc_cL = document.createElement('span');
  _sc_rL = _sc_cL.cloneNode(true);
  _sc_cL.id = '_sc_cL';
  _sc_rL.id = '_sc_rL';
  var _sc_d = document.getElementsByTagName('div');
  for (var i = 0; i < _sc_d.length; i++) {
    var _sc_cD = _sc_d[i];
    var _sc_iC = String(_sc_cD.className);
    if (_sc_iC.match('tbcs')) {
      _sc_cD.appendChild(document.createTextNode(', '));
      var _sc_ccL = _sc_cL.cloneNode(true);
      _sc_cD.appendChild(document.createTextNode(', '));
      var _sc_crL = _sc_rL.cloneNode(true);
      document.getElementById('_sc_cL').addEventListener('click', function(){_sc_sC('c')}, true);
      document.getElementById('_sc_rL').addEventListener('click', function(){_sc_sC('r')}, true);

function _sc_sC(_sc_w) {
  var _sc_rows = document.getElementsByTagName('tr');
  for (var i = 0; i < _sc_rows.length; i++) {
    var _sc_row = _sc_rows[i];
    var _sc_rI = String(_sc_row.id);
    if (_sc_rI.match(/w_\d{1,3}/) && (_sc_w == 'c' && _sc_row.innerHTML.match(/\(\d+\)/)) || (_sc_w == 'r' && _sc_row.innerHTML.match(/re:/i))) {
      _sc_row.firstChild.firstChild.checked = true;
      var _sc_box = document.getElementsByTagName('select')[0];
      for (j = 0; j < _sc_box.options.length; j++) {
        if (_sc_box.options[j].disabled) {
          _sc_box.options[j].disabled = false;
      _sc_row.className = 'rr sr';