Fossil SCM
Simplification to the JS used as part of anti-robot defenses.
Commit
08535b229e39e4648418f00a70e2f2cd5cea1485d239da68ca75a953ee8f7d2d
Parent
c7c1c4e8b9e49c5…
1 file changed
+4
-5
+4
-5
| --- src/href.js | ||
| +++ src/href.js | ||
| @@ -16,11 +16,10 @@ | ||
| 16 | 16 | ** milliseconds delay prior to populating href= and action=. If the |
| 17 | 17 | ** mouseover boolean is true, then the href= rewrite is further delayed |
| 18 | 18 | ** until the first mousedown event that occurs after the timer expires. |
| 19 | 19 | */ |
| 20 | 20 | var antiRobot = 0; |
| 21 | -var antiRobotBody = document.getElementsByTagName("body")[0]; | |
| 22 | 21 | function antiRobotGo(){ |
| 23 | 22 | if( antiRobot!=3 ) return; |
| 24 | 23 | antiRobot = 7; |
| 25 | 24 | var anchors = document.getElementsByTagName("a"); |
| 26 | 25 | for(var i=0; i<anchors.length; i++){ |
| @@ -36,19 +35,19 @@ | ||
| 36 | 35 | function antiRobotDefense(){ |
| 37 | 36 | var x = document.getElementById("href-data"); |
| 38 | 37 | var jx = x.textContent || x.innerText; |
| 39 | 38 | var g = JSON.parse(jx); |
| 40 | 39 | if( g.mouseover ){ |
| 41 | - antiRobotBody.onmousedown=function(){ | |
| 40 | + document.body.onmousedown=function(){ | |
| 42 | 41 | antiRobot |= 2; |
| 43 | 42 | antiRobotGo(); |
| 44 | - antiRobotBody.onmousedown=null; | |
| 43 | + document.body.onmousedown=null; | |
| 45 | 44 | } |
| 46 | - antiRobotBody.onmousemove=function(){ | |
| 45 | + document.body.onmousemove=function(){ | |
| 47 | 46 | antiRobot |= 2; |
| 48 | 47 | antiRobotGo(); |
| 49 | - antiRobotBody.onmousemove=null; | |
| 48 | + document.body.onmousemove=null; | |
| 50 | 49 | } |
| 51 | 50 | }else{ |
| 52 | 51 | antiRobot |= 2; |
| 53 | 52 | } |
| 54 | 53 | if( g.delay>0 ){ |
| 55 | 54 |
| --- src/href.js | |
| +++ src/href.js | |
| @@ -16,11 +16,10 @@ | |
| 16 | ** milliseconds delay prior to populating href= and action=. If the |
| 17 | ** mouseover boolean is true, then the href= rewrite is further delayed |
| 18 | ** until the first mousedown event that occurs after the timer expires. |
| 19 | */ |
| 20 | var antiRobot = 0; |
| 21 | var antiRobotBody = document.getElementsByTagName("body")[0]; |
| 22 | function antiRobotGo(){ |
| 23 | if( antiRobot!=3 ) return; |
| 24 | antiRobot = 7; |
| 25 | var anchors = document.getElementsByTagName("a"); |
| 26 | for(var i=0; i<anchors.length; i++){ |
| @@ -36,19 +35,19 @@ | |
| 36 | function antiRobotDefense(){ |
| 37 | var x = document.getElementById("href-data"); |
| 38 | var jx = x.textContent || x.innerText; |
| 39 | var g = JSON.parse(jx); |
| 40 | if( g.mouseover ){ |
| 41 | antiRobotBody.onmousedown=function(){ |
| 42 | antiRobot |= 2; |
| 43 | antiRobotGo(); |
| 44 | antiRobotBody.onmousedown=null; |
| 45 | } |
| 46 | antiRobotBody.onmousemove=function(){ |
| 47 | antiRobot |= 2; |
| 48 | antiRobotGo(); |
| 49 | antiRobotBody.onmousemove=null; |
| 50 | } |
| 51 | }else{ |
| 52 | antiRobot |= 2; |
| 53 | } |
| 54 | if( g.delay>0 ){ |
| 55 |
| --- src/href.js | |
| +++ src/href.js | |
| @@ -16,11 +16,10 @@ | |
| 16 | ** milliseconds delay prior to populating href= and action=. If the |
| 17 | ** mouseover boolean is true, then the href= rewrite is further delayed |
| 18 | ** until the first mousedown event that occurs after the timer expires. |
| 19 | */ |
| 20 | var antiRobot = 0; |
| 21 | function antiRobotGo(){ |
| 22 | if( antiRobot!=3 ) return; |
| 23 | antiRobot = 7; |
| 24 | var anchors = document.getElementsByTagName("a"); |
| 25 | for(var i=0; i<anchors.length; i++){ |
| @@ -36,19 +35,19 @@ | |
| 35 | function antiRobotDefense(){ |
| 36 | var x = document.getElementById("href-data"); |
| 37 | var jx = x.textContent || x.innerText; |
| 38 | var g = JSON.parse(jx); |
| 39 | if( g.mouseover ){ |
| 40 | document.body.onmousedown=function(){ |
| 41 | antiRobot |= 2; |
| 42 | antiRobotGo(); |
| 43 | document.body.onmousedown=null; |
| 44 | } |
| 45 | document.body.onmousemove=function(){ |
| 46 | antiRobot |= 2; |
| 47 | antiRobotGo(); |
| 48 | document.body.onmousemove=null; |
| 49 | } |
| 50 | }else{ |
| 51 | antiRobot |= 2; |
| 52 | } |
| 53 | if( g.delay>0 ){ |
| 54 |