Fossil SCM

Add a new "auto-hyperlink" setting option that enables hyperlinks after a delay only if request is from a human (as deduced from the UserAgent string).

drh 2014-10-25 01:01 trunk
Commit b9a1beda9e2587cf06de96d47207329e444c1b6a
2 files changed +4 +6 -2
--- src/setup.c
+++ src/setup.c
@@ -1075,10 +1075,14 @@
10751075
@ every historical check-in, which can use a lot of CPU and bandwidth
10761076
@ even for relatively small projects.</p>
10771077
@
10781078
@ <p>Additional parameters that control this behavior:</p>
10791079
@ <blockquote>
1080
+ onoff_attribute("Enable hyperlinks for humans (as deduced from the UserAgent "
1081
+ " HTTP header string)",
1082
+ "auto-hyperlink-ishuman", "ahis", 0, 0);
1083
+ @ <br>
10801084
onoff_attribute("Require mouse movement before enabling hyperlinks",
10811085
"auto-hyperlink-mouseover", "ahmo", 0, 0);
10821086
@ <br>
10831087
entry_attribute("Delay before enabling hyperlinks (milliseconds)", 5,
10841088
"auto-hyperlink-delay", "ah-delay", "10", 0);
10851089
--- src/setup.c
+++ src/setup.c
@@ -1075,10 +1075,14 @@
1075 @ every historical check-in, which can use a lot of CPU and bandwidth
1076 @ even for relatively small projects.</p>
1077 @
1078 @ <p>Additional parameters that control this behavior:</p>
1079 @ <blockquote>
 
 
 
 
1080 onoff_attribute("Require mouse movement before enabling hyperlinks",
1081 "auto-hyperlink-mouseover", "ahmo", 0, 0);
1082 @ <br>
1083 entry_attribute("Delay before enabling hyperlinks (milliseconds)", 5,
1084 "auto-hyperlink-delay", "ah-delay", "10", 0);
1085
--- src/setup.c
+++ src/setup.c
@@ -1075,10 +1075,14 @@
1075 @ every historical check-in, which can use a lot of CPU and bandwidth
1076 @ even for relatively small projects.</p>
1077 @
1078 @ <p>Additional parameters that control this behavior:</p>
1079 @ <blockquote>
1080 onoff_attribute("Enable hyperlinks for humans (as deduced from the UserAgent "
1081 " HTTP header string)",
1082 "auto-hyperlink-ishuman", "ahis", 0, 0);
1083 @ <br>
1084 onoff_attribute("Require mouse movement before enabling hyperlinks",
1085 "auto-hyperlink-mouseover", "ahmo", 0, 0);
1086 @ <br>
1087 entry_attribute("Delay before enabling hyperlinks (milliseconds)", 5,
1088 "auto-hyperlink-delay", "ah-delay", "10", 0);
1089
+6 -2
--- src/style.c
+++ src/style.c
@@ -182,18 +182,22 @@
182182
@ var isOperaMini = Object.prototype.toString.call(window.operamini)
183183
@ === "[object OperaMini]";
184184
@ if( isOperaMini ){
185185
@ setTimeout("setAllHrefs();",%d(nDelay));
186186
@ }
187
+ }else if( db_get_boolean("auto-hyperlink-ishuman",0) && g.isHuman ){
188
+ /* Active hyperlinks after a delay */
189
+ @ setTimeout("setAllHrefs();",%d(nDelay));
187190
}else if( db_get_boolean("auto-hyperlink-mouseover",0) ){
188
- /* Require mouse movement prior to activating hyperlinks */
191
+ /* Require mouse movement before starting the teim that will
192
+ ** activating hyperlinks */
189193
@ document.getElementsByTagName("body")[0].onmousemove=function(){
190194
@ setTimeout("setAllHrefs();",%d(nDelay));
191195
@ this.onmousemove = null;
192196
@ }
193197
}else{
194
- /* Active hyperlinks right away */
198
+ /* Active hyperlinks after a delay */
195199
@ setTimeout("setAllHrefs();",%d(nDelay));
196200
}
197201
@ </script>
198202
}
199203
200204
--- src/style.c
+++ src/style.c
@@ -182,18 +182,22 @@
182 @ var isOperaMini = Object.prototype.toString.call(window.operamini)
183 @ === "[object OperaMini]";
184 @ if( isOperaMini ){
185 @ setTimeout("setAllHrefs();",%d(nDelay));
186 @ }
 
 
 
187 }else if( db_get_boolean("auto-hyperlink-mouseover",0) ){
188 /* Require mouse movement prior to activating hyperlinks */
 
189 @ document.getElementsByTagName("body")[0].onmousemove=function(){
190 @ setTimeout("setAllHrefs();",%d(nDelay));
191 @ this.onmousemove = null;
192 @ }
193 }else{
194 /* Active hyperlinks right away */
195 @ setTimeout("setAllHrefs();",%d(nDelay));
196 }
197 @ </script>
198 }
199
200
--- src/style.c
+++ src/style.c
@@ -182,18 +182,22 @@
182 @ var isOperaMini = Object.prototype.toString.call(window.operamini)
183 @ === "[object OperaMini]";
184 @ if( isOperaMini ){
185 @ setTimeout("setAllHrefs();",%d(nDelay));
186 @ }
187 }else if( db_get_boolean("auto-hyperlink-ishuman",0) && g.isHuman ){
188 /* Active hyperlinks after a delay */
189 @ setTimeout("setAllHrefs();",%d(nDelay));
190 }else if( db_get_boolean("auto-hyperlink-mouseover",0) ){
191 /* Require mouse movement before starting the teim that will
192 ** activating hyperlinks */
193 @ document.getElementsByTagName("body")[0].onmousemove=function(){
194 @ setTimeout("setAllHrefs();",%d(nDelay));
195 @ this.onmousemove = null;
196 @ }
197 }else{
198 /* Active hyperlinks after a delay */
199 @ setTimeout("setAllHrefs();",%d(nDelay));
200 }
201 @ </script>
202 }
203
204

Keyboard Shortcuts

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