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).
Commit
b9a1beda9e2587cf06de96d47207329e444c1b6a
Parent
ab9b49820edec8a…
2 files changed
+4
+6
-2
+4
| --- src/setup.c | ||
| +++ src/setup.c | ||
| @@ -1075,10 +1075,14 @@ | ||
| 1075 | 1075 | @ every historical check-in, which can use a lot of CPU and bandwidth |
| 1076 | 1076 | @ even for relatively small projects.</p> |
| 1077 | 1077 | @ |
| 1078 | 1078 | @ <p>Additional parameters that control this behavior:</p> |
| 1079 | 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> | |
| 1080 | 1084 | onoff_attribute("Require mouse movement before enabling hyperlinks", |
| 1081 | 1085 | "auto-hyperlink-mouseover", "ahmo", 0, 0); |
| 1082 | 1086 | @ <br> |
| 1083 | 1087 | entry_attribute("Delay before enabling hyperlinks (milliseconds)", 5, |
| 1084 | 1088 | "auto-hyperlink-delay", "ah-delay", "10", 0); |
| 1085 | 1089 |
| --- 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 @@ | ||
| 182 | 182 | @ var isOperaMini = Object.prototype.toString.call(window.operamini) |
| 183 | 183 | @ === "[object OperaMini]"; |
| 184 | 184 | @ if( isOperaMini ){ |
| 185 | 185 | @ setTimeout("setAllHrefs();",%d(nDelay)); |
| 186 | 186 | @ } |
| 187 | + }else if( db_get_boolean("auto-hyperlink-ishuman",0) && g.isHuman ){ | |
| 188 | + /* Active hyperlinks after a delay */ | |
| 189 | + @ setTimeout("setAllHrefs();",%d(nDelay)); | |
| 187 | 190 | }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 */ | |
| 189 | 193 | @ document.getElementsByTagName("body")[0].onmousemove=function(){ |
| 190 | 194 | @ setTimeout("setAllHrefs();",%d(nDelay)); |
| 191 | 195 | @ this.onmousemove = null; |
| 192 | 196 | @ } |
| 193 | 197 | }else{ |
| 194 | - /* Active hyperlinks right away */ | |
| 198 | + /* Active hyperlinks after a delay */ | |
| 195 | 199 | @ setTimeout("setAllHrefs();",%d(nDelay)); |
| 196 | 200 | } |
| 197 | 201 | @ </script> |
| 198 | 202 | } |
| 199 | 203 | |
| 200 | 204 |
| --- 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 |