View Single Post
Old 01-04-2013, 12:09 AM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,579
Thanks: 62
Thanked 4,063 Times in 4,032 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Quote:
(it becomes disabled when it saves and is only enabled once changes are made to the page)
That code isn't shown here. I assume it's independent of the grease monkey stuff?

That code doesn't look too ugly, to me (well, except that your code indentations isn't pretty <grin/>).

I think you could get away with doing it like this, though:
Code:
<script>
(
  function() 
  {
      var button = document.getElementById("store");

      button.onclick = function(){ alert("saved"); } // optional

      function clickIt()
      {
          if ( ! button.disabled) { button.click( ); }
      }
      setInterval(clickIt,10000);
  }
)();
</script>
After all, how long is a save going to take? Surely not more than 9.9 seconds?

So why bother with clearing and setting the timeout over and over again?
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote