File: pldoc.js

package info (click to toggle)
swi-prolog 5.10.1-1%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 76,436 kB
  • ctags: 45,143
  • sloc: ansic: 290,417; perl: 215,108; sh: 5,411; java: 5,136; makefile: 5,021; cpp: 2,168; yacc: 843; xml: 77; sed: 12
file content (58 lines) | stat: -rw-r--r-- 1,142 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
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
/*  $Id$

    This file is  part  of  the   SWI-Prolog  PlDoc  package  for online
documentation browsing. It defines JavaScript to  issue HTTP requests on
the Prolog server that do not create a new page.

Author:  Jan Wielemaker & Michiel Hildebrand
Copying: Public domain
*/

var req;

function Initialize()
{ if ( req && req.readyState != 0 )
    req.abort();

  try
  { req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch ( e )
  { try
    { req = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch(oc)
    { req=null;
    }
  }

  if ( !req && typeof XMLHttpRequest != "undefined" )
  { req = new XMLHttpRequest();
  }
}


function Process()
{ if ( req.readyState == 4 )
  { if ( req.status == 200 )
    { if ( req.responseText=="" )
      { //HideDiv("suggestionbox");
      } else
      { //document.getElementById("suggestionbox").innerHTML = req.responseText;
	//ShowDiv("suggestionbox");
      }
    }
  }
}


function HTTPrequest(url)
{ Initialize();

  if ( req != null )
  { req.onreadystatechange = Process;
    req.open("GET", url, true);
    req.send(null);
  } else
  { alert("Could not initialize HTTP request")
  }
}