Created dynamic pages to load BeBook and Userguide. Will be added to default bookmarks.html

This commit is contained in:
Matt Madia
2009-07-08 19:03:41 +00:00
parent 3c93c5cd01
commit cc560eec89
6 changed files with 176 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<html>
<head>
<title>Opening the welcome page...</title>
<script type="text/javascript">
function fileExists(filename) {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
} catch (e) {
alert("Permission to read file was denied.");
}
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(
Components.interfaces.nsILocalFile);
file.initWithPath(filename);
return file.exists();
}
window.onload = function() {
var url = "http://www.haiku-os.org/legacy-docs/bebook/";
var localWelcome = "/boot/system/documentation/bebook/index.html";
if (fileExists(localWelcome))
url = "file://" + localWelcome;
window.open(url, "_self");
}
</script>
</head>
<body>
Opening the welcome page...
</body>
</html>

View File

@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="robots" content="all" />
<title>Welcome to Haiku!</title>
<link rel="stylesheet" type="text/css" href="../Haiku-doc.css" />
<script type="text/javascript">
var xmlhttp;
var offLineWelcomePage = 'file:///boot/system/documentation/bebook/index.html';
var onLineWelcomePage = 'http://www.haiku-os.org/legacy-docs/bebook/';
function redirect()
{
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=state_Change;
try
{
xmlhttp.open("GET",offLineWelcomePage);
xmlhttp.send(null);
}
catch(err)
{
window.location = onLineWelcomePage;
}
}
function state_Change()
{
if (xmlhttp.readyState==4)
{// 4 = "loaded"
if (xmlhttp.status==200 ||xmlhttp.status==0)
{// 200 = "OK"; loading from file:// so no http status set! hence status == 0.
if(xmlhttp.responseText.length != 0)
window.location = offLineWelcomePage;
else
window.location = onLineWelcomePage;
}
else
{
alert("Problem retrieving data:" + xmlhttp.statusText);
}
}
}
</script>
</head>
<body onload="redirect()">
</body>
</html>

View File

@@ -0,0 +1,32 @@
<html>
<head>
<title>Opening the welcome page...</title>
<script type="text/javascript">
function fileExists(filename) {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
} catch (e) {
alert("Permission to read file was denied.");
}
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(
Components.interfaces.nsILocalFile);
file.initWithPath(filename);
return file.exists();
}
window.onload = function() {
var url = "http://svn.berlios.de/svnroot/repos/haiku/haiku/trunk/docs/userguide/en/contents.html";
var localWelcome = "/boot/system/documentation/userguide/en/contents.html";
if (fileExists(localWelcome))
url = "file://" + localWelcome;
window.open(url, "_self");
}
</script>
</head>
<body>
Opening the welcome page...
</body>
</html>

View File

@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="robots" content="all" />
<title>Welcome to Haiku!</title>
<link rel="stylesheet" type="text/css" href="../Haiku-doc.css" />
<script type="text/javascript">
var xmlhttp;
var offLineWelcomePage = 'file:///boot/system/documentation/userguide/en/contents.html';
var onLineWelcomePage = 'http://svn.berlios.de/svnroot/repos/haiku/haiku/trunk/docs/userguide/en/contents.html';
function redirect()
{
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=state_Change;
try
{
xmlhttp.open("GET",offLineWelcomePage);
xmlhttp.send(null);
}
catch(err)
{
window.location = onLineWelcomePage;
}
}
function state_Change()
{
if (xmlhttp.readyState==4)
{// 4 = "loaded"
if (xmlhttp.status==200 ||xmlhttp.status==0)
{// 200 = "OK"; loading from file:// so no http status set! hence status == 0.
if(xmlhttp.responseText.length != 0)
window.location = offLineWelcomePage;
else
window.location = onLineWelcomePage;
}
else
{
alert("Problem retrieving data:" + xmlhttp.statusText);
}
}
}
</script>
</head>
<body onload="redirect()">
</body>
</html>