--- autologinj.user.js	Fri Nov 11 18:24:44 2005
+++ public_html/software/autologinj.user.js	Fri Jul 21 14:08:28 2006
@@ -12,11 +12,12 @@
 
   Author: Jesse Ruderman - http://www.squarefree.com/
   
-  Version: 1.3
+  Version: 1.3+tris
     1.0 - first version
     1.1 - fix some JS strict warnings
     1.2 - bonk the first submit button, not the last submit button (fixes e.g. delicious)
     1.3 - skip if password field's value is "Password" (fixes e.g. ddrfreak)
+    1.3+tris - add rudimentary rate-limit (by Tristan Horn)
 
   Competing scripts and extensions:
    * http://labs.beffa.org/greasemonkey/AutoLogin.user.js
@@ -24,7 +25,9 @@
 
 */
 
-
+var globalKey = "AutoLoginJ call counter";
+var maxCallCount = 3;           // this many calls are okay...
+var maxCallInterval = 3000;     // ...in this many milliseconds.
 
 function submitFirstPasswordForm()
 {
@@ -64,7 +67,7 @@
           break;
         }
 
-      if (submitButton) {
+      if (submitButton && GM_getValue(globalKey, 0) < maxCallCount) {
         // Give a visual indication that we're submitting the login form automatically.
         submitButton.focus();
         submitButton.style.MozOutline = "2px solid purple";
@@ -72,6 +75,9 @@
         // Submit the form by calling click() on the submit button.
         submitButton.click();
   
+        // Increment the call counter.
+        GM_setValue(globalKey, GM_getValue(globalKey, 0) + 1);
+
         // Break out of both loops.
         return; 
       }
@@ -89,3 +95,6 @@
   false
 );
 
+// Reset the call counter to zero after maxCallInterval milliseconds.
+// (not really ideal)
+window.setTimeout(function() { GM_setValue(globalKey, 0); }, maxCallInterval);
