221 lines
6.6 KiB
Plaintext
221 lines
6.6 KiB
Plaintext
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<title>JMRI Help System: JMRI Local</title>
|
|
<meta name="author" content="Dave Sand">
|
|
<meta name="keywords" content="JMRI Help Index">
|
|
<!--=====================================================================-->
|
|
<!--This file is automatically generated by Ant from JmriHelp_enTOC.xml-->
|
|
<!--Do not edit it directly-->
|
|
<!--=====================================================================-->
|
|
|
|
<script type="text/javascript" src="search.json"></script>
|
|
|
|
<script>
|
|
|
|
var use_internet = false;
|
|
|
|
function openLink(link) {
|
|
|
|
if (link.includes("/manual/")) {
|
|
if (!use_internet) {
|
|
if (window.confirm("Manual help pages are not installed.\nIf internet is available, use jmri.org?")) {
|
|
use_internet = true;
|
|
}
|
|
}
|
|
if (use_internet) {
|
|
link = "https://jmri.org/help/en/manual/" + link;
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
|
|
document.getElementById("page").src = link;
|
|
}
|
|
|
|
function onLoad() {
|
|
var url = window.location.href;
|
|
var i = url.indexOf('#');
|
|
if (i > 0) {
|
|
// Loaded via JMRI, the page url is in the url fragment
|
|
var urlFragment = url.slice(i+1);
|
|
var link = urlFragment.replace(/\./g, '/')
|
|
|
|
// The page url might include a fragment after the first underscore
|
|
var frag = '';
|
|
var j = link.indexOf('_');
|
|
if (j > 0) {
|
|
var fragParts = [link.slice(0,j), link.slice(j+1)];
|
|
link = fragParts[0];
|
|
frag = '#' + fragParts[1];
|
|
}
|
|
|
|
var newURL = '../' + link + '.shtml' + frag;
|
|
openLink(newURL);
|
|
} else {
|
|
// Directly loaded by the browser
|
|
openLink('../index.shtml');
|
|
}
|
|
}
|
|
|
|
function selectTOC() {
|
|
document.getElementById("indexID").classList.add("hide");
|
|
document.getElementById("searchID").classList.add("hide");
|
|
document.getElementById("tocID").classList.remove("hide");
|
|
}
|
|
|
|
function selectIndex() {
|
|
document.getElementById("tocID").classList.add("hide");
|
|
document.getElementById("searchID").classList.add("hide");
|
|
document.getElementById("indexID").classList.remove("hide");
|
|
}
|
|
|
|
function selectSearch() {
|
|
// Get the search argument
|
|
var searchTerm = window.prompt('-- Enter search term --\n\
|
|
Format: full-word | starts-with* | *ends-with');
|
|
if (!searchTerm) {
|
|
// console.log("Nothing returned")
|
|
return;
|
|
}
|
|
|
|
// Get the search type based on asterisks
|
|
var type = 'fullword';
|
|
if (searchTerm.indexOf('*') == 0) {
|
|
type = 'endswith';
|
|
searchTerm = searchTerm.substring(1);
|
|
}
|
|
if (searchTerm.indexOf('*') == searchTerm.length - 1) {
|
|
if (type == 'fullword') {
|
|
type = 'startswith';
|
|
} else {
|
|
alert('Word fragment searches, *xxxx*, are not supported');
|
|
return;
|
|
}
|
|
searchTerm = searchTerm.substring(0, searchTerm.length - 1);
|
|
}
|
|
|
|
var numChars = searchTerm.length;
|
|
if (numChars < 3) {
|
|
alert('The search term, ' + searchTerm + ', has to be at least three characters long');
|
|
return;
|
|
}
|
|
|
|
// Build the json content
|
|
window.searchIndexData = JSON.parse(searchIndexWholeWord);
|
|
switch (type) {
|
|
case 'startswith':
|
|
window.searchIndexData = JSON.parse(searchIndexBeginning);
|
|
break;
|
|
case 'endswith':
|
|
window.searchIndexData = JSON.parse(searchIndexEnd);
|
|
break;
|
|
}
|
|
var wordMap = window.searchIndexData.words[numChars];
|
|
var fileIDs = wordMap[searchTerm];
|
|
|
|
if (typeof fileIDs === 'undefined') {
|
|
alert("The search term \""+searchTerm+"\" is not found");
|
|
return;
|
|
}
|
|
|
|
// Remove previous results, if any
|
|
var searchResult = document.getElementById("searchResult");
|
|
while (searchResult.firstChild) {
|
|
searchResult.removeChild(searchResult.lastChild);
|
|
}
|
|
|
|
// Get the iframe
|
|
let target = document.getElementById("page");
|
|
|
|
// Build the result list
|
|
for (i=0; i < fileIDs.length; i++) {
|
|
if (fileIDs[i] != -1) {
|
|
let fileName = window.searchIndexData.files[fileIDs[i]][0];
|
|
let title = window.searchIndexData.files[fileIDs[i]][1];
|
|
|
|
var liTag = document.createElement("li");
|
|
var aTag = document.createElement("a");
|
|
aTag.onclick = function(){ target.src = "../../../" + fileName; window.scrollTo(0,0); return false; };
|
|
var text = document.createTextNode(title);
|
|
aTag.appendChild(text);
|
|
liTag.appendChild(aTag);
|
|
searchResult.appendChild(liTag);
|
|
}
|
|
}
|
|
|
|
// Switch to the result list
|
|
document.getElementById("tocID").classList.add("hide");
|
|
document.getElementById("indexID").classList.add("hide");
|
|
document.getElementById("searchID").classList.remove("hide");
|
|
}
|
|
|
|
function searchHelp() {
|
|
var text = 'Search options:\n\
|
|
A single word\n\
|
|
The beginnging of a word followed by an asterisk, for example loco*\n\
|
|
The end of a word preceded by an asterisk, for example *net';
|
|
alert(text);
|
|
}
|
|
|
|
</script>
|
|
|
|
<style>
|
|
h2, p {
|
|
text-align: center;
|
|
}
|
|
|
|
.hide {
|
|
display: none;
|
|
}
|
|
|
|
a {
|
|
text-decoration: underline;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.float-container {
|
|
border: 3px solid #fff;
|
|
padding: 20px;
|
|
}
|
|
|
|
.help-list {
|
|
width: 30%;
|
|
float: left;
|
|
padding: 20px;
|
|
border: 2px solid black;
|
|
height: 600px;
|
|
overflow: auto;
|
|
}
|
|
|
|
.help-page {
|
|
width: 60%;
|
|
float: left;
|
|
padding: 20px;
|
|
border: 2px solid black;
|
|
}
|
|
|
|
.clear {
|
|
clear: both;
|
|
}
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body onload="onLoad()">
|
|
<div class="help-container">
|
|
<div>
|
|
<h2>JmriHelp</h2>
|
|
<p>
|
|
<button onclick="selectTOC()">Table of Contents</button>
|
|
<button onclick="selectIndex()">Index</button>
|
|
<button onclick="selectSearch()">Search...</button>
|
|
<label onclick="searchHelp()">?</label>
|
|
</p>
|
|
</div>
|
|
|
|
<div id="tocID" class="help-list">
|
|
<h3>Table of Contents</h3>
|
|
<ul>
|