Fossil

Check-in [e7d67b76]
Login

Check-in [e7d67b76]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:New javascript for href.js such that any mousemove or mousedown event at any time is sufficient to trigger the mouse activity condition for activation of hyperlinks. This works better on FF and chrome, but with safari, the visited/unvisited link color is determined by the initial value of href= and is not adjusted when href= changes, so visited/unvisited colors are not being updated on safari.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e7d67b7640414f6e66e8d4b582dcb383270ea3b42e46a6805f7942ab3025b5ff
User & Date: drh 2022-02-12 13:29:25
Context
2022-02-12
13:55
Do not require mouse events for auto-hyperlink if the UserAgent string includes "Android". Describe the Safari visited/unvisited link limitation on the auto-hyperlink setting. ... (check-in: cef15ed3 user: drh tags: trunk)
13:29
New javascript for href.js such that any mousemove or mousedown event at any time is sufficient to trigger the mouse activity condition for activation of hyperlinks. This works better on FF and chrome, but with safari, the visited/unvisited link color is determined by the initial value of href= and is not adjusted when href= changes, so visited/unvisited colors are not being updated on safari. ... (check-in: e7d67b76 user: drh tags: trunk)
01:01
Modify the /honeypot to explain the situation to human readers who might accidentally reach it, and offer them a links to the login page to prove their humanness. ... (check-in: 533c2c71 user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/href.js.

13
14
15
16
17
18
19
20

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45


46







47






48


49

50
51
**     {"delay":MILLISECONDS, "mouseover":BOOLEAN}
**
** The <script> must have an id='href-data'.  DELAY is the number 
** milliseconds delay prior to populating href= and action=.  If the
** mouseover boolean is true, then the href= rewrite is further delayed
** until the first mousedown event that occurs after the timer expires.
*/
var antiRobotOnce = 0;

function antiRobotSetAllHrefs(){
  if( antiRobotOnce ) return;
  antiRobotOnce = 1;
  var anchors = document.getElementsByTagName("a");
  for(var i=0; i<anchors.length; i++){
    var j = anchors[i];
    if(j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
  }
  var forms = document.getElementsByTagName("form");
  for(var i=0; i<forms.length; i++){
    var j = forms[i];
    if(j.hasAttribute("data-action")) j.action=j.getAttribute("data-action");
  }
}
function antiRobotSetMouseEventHandler(){
  document.getElementsByTagName("body")[0].onmousedown=function(){
    antiRobotSetAllHrefs();
    document.getElementsByTagName("body")[0].onmousedown=null;
  }
}
function antiRobotDefense(){
  var x = document.getElementById("href-data");
  var jx = x.textContent || x.innerText;
  var g = JSON.parse(jx);
  if( g.mouseover ){


    setTimeout(antiRobotSetMouseEventHandler, g.delay);







  }else{






    setTimeout(antiRobotSetAllHrefs, g.delay);


  }

}
antiRobotDefense();







|
>
|
|
|











<
<
<
<
<
<





>
>
|
>
>
>
>
>
>
>

>
>
>
>
>
>
|
>
>

>


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35






36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
**     {"delay":MILLISECONDS, "mouseover":BOOLEAN}
**
** The <script> must have an id='href-data'.  DELAY is the number 
** milliseconds delay prior to populating href= and action=.  If the
** mouseover boolean is true, then the href= rewrite is further delayed
** until the first mousedown event that occurs after the timer expires.
*/
var antiRobot = 0;
var antiRobotBody = document.getElementsByTagName("body")[0];
function antiRobotGo(){
  if( antiRobot!=3 ) return;
  antiRobot = 7;
  var anchors = document.getElementsByTagName("a");
  for(var i=0; i<anchors.length; i++){
    var j = anchors[i];
    if(j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
  }
  var forms = document.getElementsByTagName("form");
  for(var i=0; i<forms.length; i++){
    var j = forms[i];
    if(j.hasAttribute("data-action")) j.action=j.getAttribute("data-action");
  }
}






function antiRobotDefense(){
  var x = document.getElementById("href-data");
  var jx = x.textContent || x.innerText;
  var g = JSON.parse(jx);
  if( g.mouseover ){
    antiRobotBody.onmousedown=function(){
      antiRobot |= 2;
      antiRobotGo();
      antiRobotBody.onmousedown=null;
    }
    antiRobotBody.onmousemove=function(){
      antiRobot |= 2;
      antiRobotGo();
      antiRobotBody.onmousemove=null;
    }
  }else{
    antiRobot |= 2;
  }
  if( g.delay>0 ){
    setTimeout(function(){
      antiRobot |= 1;
      antiRobotGo();
    }, g.delay)
  }else{
    antiRobot |= 1;
  }
  antiRobotGo();
}
antiRobotDefense();