Fossil SCM

Wrap the robot_restrict() JS check in an onload handler so that it won't run until the external resources (namely style.css) are loaded.

stephan 2025-08-17 19:38 trunk
Commit e5991efb681a88edb74a399d7bd6b92d7f8479a2e934136631e13d6eb24f9147
1 file changed +2
--- src/robot.c
+++ src/robot.c
@@ -102,10 +102,11 @@
102102
@ <span id="x7" style="visibility:hidden;">You appear to be a robot.</span></p>
103103
cgi_query_parameters_to_hidden();
104104
@ <input id="x4" type="hidden" name="proof" value="0">
105105
@ </form>
106106
@ <script nonce='%s(style_nonce())'>
107
+ @ window.addEventListener('load',function(){
107108
@ function aaa(x){return document.getElementById(x);}
108109
@ function bbb(h,a){\
109110
@ aaa("x4").value=h;\
110111
@ if((a%%75)==0){\
111112
@ aaa("x2").textContent=aaa("x2").textContent+".";\
@@ -126,10 +127,11 @@
126127
@ }\
127128
@ }
128129
k = 400 + h2%299;
129130
h2 = (k*k + k)/2;
130131
@ setTimeout(function(){bbb(%u(h1-h2),%u(k));},10);
132
+ @ }, false);
131133
@ </script>
132134
style_finish_page();
133135
return 1;
134136
}
135137
136138
--- src/robot.c
+++ src/robot.c
@@ -102,10 +102,11 @@
102 @ <span id="x7" style="visibility:hidden;">You appear to be a robot.</span></p>
103 cgi_query_parameters_to_hidden();
104 @ <input id="x4" type="hidden" name="proof" value="0">
105 @ </form>
106 @ <script nonce='%s(style_nonce())'>
 
107 @ function aaa(x){return document.getElementById(x);}
108 @ function bbb(h,a){\
109 @ aaa("x4").value=h;\
110 @ if((a%%75)==0){\
111 @ aaa("x2").textContent=aaa("x2").textContent+".";\
@@ -126,10 +127,11 @@
126 @ }\
127 @ }
128 k = 400 + h2%299;
129 h2 = (k*k + k)/2;
130 @ setTimeout(function(){bbb(%u(h1-h2),%u(k));},10);
 
131 @ </script>
132 style_finish_page();
133 return 1;
134 }
135
136
--- src/robot.c
+++ src/robot.c
@@ -102,10 +102,11 @@
102 @ <span id="x7" style="visibility:hidden;">You appear to be a robot.</span></p>
103 cgi_query_parameters_to_hidden();
104 @ <input id="x4" type="hidden" name="proof" value="0">
105 @ </form>
106 @ <script nonce='%s(style_nonce())'>
107 @ window.addEventListener('load',function(){
108 @ function aaa(x){return document.getElementById(x);}
109 @ function bbb(h,a){\
110 @ aaa("x4").value=h;\
111 @ if((a%%75)==0){\
112 @ aaa("x2").textContent=aaa("x2").textContent+".";\
@@ -126,10 +127,11 @@
127 @ }\
128 @ }
129 k = 400 + h2%299;
130 h2 = (k*k + k)/2;
131 @ setTimeout(function(){bbb(%u(h1-h2),%u(k));},10);
132 @ }, false);
133 @ </script>
134 style_finish_page();
135 return 1;
136 }
137
138

Keyboard Shortcuts

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