Fossil SCM

Fix the previous checkin to actually compute the work value. This slows it down by a tiny fraction of a second but it's still effectively instant. This calculation can be moved up a level into the C code to turn this back into an instant operation, but leaving it on the client seems like a reasonable choice.

stephan 2025-08-17 12:29 robotck-instant
Commit c27cfa9f6077e1a79c9d33a8e1470d89627b0e8b753cd3761735caf8d96a7109
1 file changed +9
--- src/robot.c
+++ src/robot.c
@@ -98,15 +98,24 @@
9898
@ <h1 id="x1">Checking to see if you are a robot<span id="x2"></span></h1>
9999
@ <form method="GET" id="x6">
100100
@ <p id="x3" style="visibility:hidden;">\
101101
@ Press <input type="submit" id="x5" value="Ok" focus> to continue</p>
102102
cgi_query_parameters_to_hidden();
103
+ k = 800 + h2%99;
104
+ h2 = (k*k + k)/2;
103105
@ <input id="x4" type="hidden" name="proof" value="0">
104106
@ </form>
105107
@ <script nonce='%s(style_nonce())'>
106108
@ window.addEventListener('load',function(ev){
107109
@ const E = (x)=>document.getElementById(x);
110
+ @ let h = %u(h1-h2);
111
+ @ let a = %u(k);
112
+ @ const x4 = E("x4");
113
+ @ for( ; a>0; --a ) {
114
+ @ h += a;
115
+ @ }
116
+ @ x4.value = h;
108117
@ const gcs = window.getComputedStyle(document.body);
109118
@ if( gcs.zIndex==='0' ) {
110119
@ E("x3").style.visibility="visible";
111120
@ E("x2").textContent="";
112121
@ E("x1").textContent="All clear";
113122
--- src/robot.c
+++ src/robot.c
@@ -98,15 +98,24 @@
98 @ <h1 id="x1">Checking to see if you are a robot<span id="x2"></span></h1>
99 @ <form method="GET" id="x6">
100 @ <p id="x3" style="visibility:hidden;">\
101 @ Press <input type="submit" id="x5" value="Ok" focus> to continue</p>
102 cgi_query_parameters_to_hidden();
 
 
103 @ <input id="x4" type="hidden" name="proof" value="0">
104 @ </form>
105 @ <script nonce='%s(style_nonce())'>
106 @ window.addEventListener('load',function(ev){
107 @ const E = (x)=>document.getElementById(x);
 
 
 
 
 
 
 
108 @ const gcs = window.getComputedStyle(document.body);
109 @ if( gcs.zIndex==='0' ) {
110 @ E("x3").style.visibility="visible";
111 @ E("x2").textContent="";
112 @ E("x1").textContent="All clear";
113
--- src/robot.c
+++ src/robot.c
@@ -98,15 +98,24 @@
98 @ <h1 id="x1">Checking to see if you are a robot<span id="x2"></span></h1>
99 @ <form method="GET" id="x6">
100 @ <p id="x3" style="visibility:hidden;">\
101 @ Press <input type="submit" id="x5" value="Ok" focus> to continue</p>
102 cgi_query_parameters_to_hidden();
103 k = 800 + h2%99;
104 h2 = (k*k + k)/2;
105 @ <input id="x4" type="hidden" name="proof" value="0">
106 @ </form>
107 @ <script nonce='%s(style_nonce())'>
108 @ window.addEventListener('load',function(ev){
109 @ const E = (x)=>document.getElementById(x);
110 @ let h = %u(h1-h2);
111 @ let a = %u(k);
112 @ const x4 = E("x4");
113 @ for( ; a>0; --a ) {
114 @ h += a;
115 @ }
116 @ x4.value = h;
117 @ const gcs = window.getComputedStyle(document.body);
118 @ if( gcs.zIndex==='0' ) {
119 @ E("x3").style.visibility="visible";
120 @ E("x2").textContent="";
121 @ E("x1").textContent="All clear";
122

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button