]> gitweb.michael.orlitzky.com - charm-bypass.git/blobdiff - index.html.in
index.html.in: center the security code even harder
[charm-bypass.git] / index.html.in
index f6d7cceeae17a5c23024d489400225f880e686cd..44b31c5bea1c4ea32051b55007962c151c5069f0 100644 (file)
         ct.setAttribute("x", parseFloat(ct.getAttribute("x")) + hdelta);
       }
 
+      function center_code_repeatedly() {
+        /* Lets us call center_code five times on page load. Why we
+         * need to do this is an interesting (i.e. stupid) topic for
+         * conversation. */
+        center_code();
+        center_code();
+        center_code();
+        center_code();
+        center_code();
+      }
 
       /*****************************************/
       /* Next, set up the ticket date and time */
       /* Set the security code text when the page has loaded */
       window.addEventListener("load", set_code);
 
-      /* Center the security code text when the page has loaded;
-       * in particular, after we set it */
-      window.addEventListener("load", center_code);
+      /* Center the security code text when the page has loaded; in
+       * particular, after we set it. And then center it again. And
+       * again and again and again. Why? I'm glad you asked. Because
+       * it doesn't actually get centered the first time; it's off by
+       * a few pixels. But then if we center it _again_, it moves a
+       * little closer to the true center. Do that enough times and
+       * any errors become unnoticeable. */
+      window.addEventListener("load", center_code_repeatedly);
 
       /* Re-center the security code when the window is resized,
        * and in particular after the ticket is re-centered */