X-Git-Url: https://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=index.html.in;h=0ad89dcba4aff71cb3a465d906213e52bbad471d;hb=bbefb85286d0451c79a16eaef496460a67796b81;hp=f6d7cceeae17a5c23024d489400225f880e686cd;hpb=49074c5f3f869c3d6724271cf13cae6973fe5861;p=charm-bypass.git diff --git a/index.html.in b/index.html.in index f6d7cce..0ad89dc 100644 --- a/index.html.in +++ b/index.html.in @@ -306,6 +306,11 @@ ct.setAttribute("x", parseFloat(ct.getAttribute("x")) + hdelta); } + function center_code_wrapper() { + /* Lets us call center_code twice on page load. Why we need to + * do this is an interesting (i.e. stupid) conversation. */ + center_code(); + } /*****************************************/ /* Next, set up the ticket date and time */ @@ -378,8 +383,15 @@ window.addEventListener("load", set_code); /* Center the security code text when the page has loaded; - * in particular, after we set it */ + * in particular, after we set it. And then center it 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_, I guess we're so close to begin with + * that any errors aren't noticeable. Anyway, just running it + * twice in a row avoids a major headache. We need the wrapper + * because the spec says that duplicate handlers are discarded. */ window.addEventListener("load", center_code); + window.addEventListener("load", center_code_wrapper); /* Re-center the security code when the window is resized, * and in particular after the ticket is re-centered */