This commit is contained in:
jwall@VAPPRCSN015.vap.local 2011-11-02 13:50:08 -04:00
parent 2770805167
commit 894bb171b1
6 changed files with 496 additions and 607 deletions

View File

@ -1,86 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="shortcut icon" type="image/ico" href="http://walljm.com/favicon.ico">
<script type="text/javascript" src="ajaxbible_files/nicetitles.js"></script>
<meta name="author" content="Jason Wall">
<meta name="PBO.auth" content="8bff0c5d7a8f61d1e5dfa6c58da67c2b">
<meta name="geo.country" content="US">
<meta name="dc.language" content="en">
<meta name="dc.title" content="walljm.com || AJAX Bible || King James Version with Strong's Dictionary and Cross References">
<meta name="description" content="An AJAX implimentation of The King James Version Bible with Strong's Dictionary integrated.">
<meta name="keywords" content="AJAX, KJV, King James Version, Strong's Dictionary, Strongs">
<meta name="blogchalk" content="United States, Missouri, Saint Louis, English, Jason, Male, 21-25, photography, poetry">
<meta name="copyright" content="All content copyrighted to Jason Wall, and available by permission of the owner.">
<title>About The Bible with Strong's Numbers and Cross References (AJAX Enabled) by Walljm.com</title>
<style>@import "ajaxbible_files/bible.css";</style>
</head>
<body>
<div id="header"><div class="wrap">
<div id="title">powered by <a xstyle="text-decoration: none; color: white;" href="http://walljm.com/">walljm.com</a></div>
<div id="header-links"><a href="./">home</a> | <a href="http://www.dynamicbible.com/bible.1.5.zip">download</a> | <a href="about.html">about</a> | <a href="help.html">help</a> | <a href="mailto:jason@walljm.com">contact</a></div>
</div></div>
<div id="main">
<div class="post block">
<h1>About the King James Bible <span>with Strong's Numbers and Cross References (AJAX Enabled)</span></h1>
<h3>Thanks</h3>
<p>Several people have helped me with the AJAX Bible and I would like to take some time to thanks them.
<ul>
<li /> <a href='http://jeremy.marzhillstudios.com/'>Jeremy Wall</a>, my brother, wrote the perl script that used the expat parser to generate the index I use for word search. His script parsed the bible in 2 minutes. Hoo. Rah.
<li /> <a href='http://www.danielbergey.com/'>Daniel Bergey</a> graciously donated his time and expertise and styled the AJAX Bible.
<li /> The Zephania Bible Project which supplied all my raw xml data. You can see the links below for specific files and resources I used.
</ul>
</p>
<h3>Notes:</h3>
<p>
<ul>
<li>The AJAX Bible works fine in Firefox, IE6, and Safari. I can't garuntee any other browser will
work. If the browser impliments the DOM and the xmlhttp function the same
as Firefox, It should work. </li>
<li>The word search index has a list of excluded words that made the index overly large. Here they are, for reference: and, of, not, for, shall, it, that, the, than, then, they, unto, them, in, he, this, thou, and to.</li>
<li>The AJAX Bible is implimented completely without databases, relying on xml
files for its data. I did it this way so that it could be run from your
desktop without the need for a webserver. You can download the AJAX
Bible in its current form <a href="./bible.zip">here</a>.
Unzip and run the index.html file in your browser. :) </li>
</ul>
</p>
<h3>Things to Do:</h3>
<p>
<ul>
<li> Add Textus Receptus Greek NT
<li> Replace Strongs cross refs with Websters Lexicon.
</ul>
</p>
<h3>Useful Resources</h3>
<p>
<ul>
<li><a href="http://walljm.com/misc/greek_strongs.zip">Strongs Greek Dictionary split up into groups of 100</a>, originally created by Jens Grabner.
</li><li><a href="http://walljm.com/misc/heb_strongs.zip">Strongs Hebrew Dictionary split up into groups of 100</a>, originally created by Jens Grabner.
</li><li><a href="http://walljm.com/misc/bible_refs_of_strongs_numbers.zip">Bible References for each Strongs Greek and Hebrew Number</a>, parsed by myself using the KJV Bible with Strongs Numbers provided by the Zephania XML Bible Markup Language Project.
</li><li><a href="http://walljm.com/misc/kjv_by_book.zip">King James Bible in XML, split up into files by book</a>, from the <a href="http://sourceforge.net/project/showfiles.php?group_id=89078">Zefania XML Bible Markup Language Project</a>
</li><li><a href="http://walljm.com/misc/kjv_by_chapter.zip">King James Bible in XML, split up into files by chapter,</a> from the <a href="http://sourceforge.net/project/showfiles.php?group_id=89078">Zefania XML Bible Markup Language Project</a>
</li><li><a href="http://walljm.com/bible/bible_parsing_ref.js">The Javascript Bible Reference Parsing Object</a> I built to support this page.
</li><li><a href="http://www.walljm.com/strongs/index.html">AJAX implimentation of Strongs Greek Dictionary indexed by Strongs Number.</a> In case you need to look up a word by the number instead of going through the Bible interface.
</li><li><a href="http://www.walljm.com/soap/strongs.php">The soap implementation of the above Strongs Definition lookup service</a>
</li></ul>
</p>
<h3>License</h3>
<p>
The Ajax Bible uses a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/2.5/">Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License</a>.<!--/Creative Commons License-->
<!-- <rdf:RDF xmlns="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<Work rdf:about="">
<license rdf:resource="http://creativecommons.org/licenses/by-nc-sa/2.5/" />
<dc:type rdf:resource="http://purl.org/dc/dcmitype/InteractiveResource" />
</Work>
<License rdf:about="http://creativecommons.org/licenses/by-nc-sa/2.5/"><permits rdf:resource="http://web.resource.org/cc/Reproduction"/><permits rdf:resource="http://web.resource.org/cc/Distribution"/><requires rdf:resource="http://web.resource.org/cc/Notice"/><requires rdf:resource="http://web.resource.org/cc/Attribution"/><prohibits rdf:resource="http://web.resource.org/cc/CommercialUse"/><permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/><requires rdf:resource="http://web.resource.org/cc/ShareAlike"/></License>
</rdf:RDF> -->
</p>
</div>
</div>
<div style="display: none;" class="nicetitle" id="nicetitlecontainer"></div></body></html>

View File

@ -52,6 +52,7 @@ h3 {
#main {
margin: 0 3px 0 3px;
}
#searchresultswrap {
font: 11px verdana;
width: 20%;
@ -68,23 +69,44 @@ h3 {
border-top: 2px solid #999;
border-left: 2px solid #999;
}
#searchresults {
xmargin-right: 10px;
padding: 10px;
overflow: auto;
overflow:scroll;
height: 700px;
border-right: 2px solid #999;
border-bottom: 2px solid #999;
border-left: 2px solid #999;
}
#searchresults ul {
margin-left: 0;
padding-left: 0px;
}
#searchresults ul {
padding-left: 15px;
list-style: circle;
margin: 0;
padding: 0;
list-style-type: none;
list-style-position: inside;
}
#searchresults ul li
{
margin: 0 0 3px 0;
}
#searchresults ul a
{
width: 100%;
height: 30px;
display: block;
line-height: 30px;
background-color: #ddd;
padding: 3px;
text-align:center;
font-size: 21px;
font-family: Georgia, Serif;
text-decoration: none;
color: Maroon;
}
#searchresults ul a:hover
{
background-color: #fff;
}
#resultwrap {
width: 80%;
float: left;
@ -105,6 +127,7 @@ h3 {
xbackground: #eef;
padding: 10px 10px;
}
#result {
font: 13px georgia;
margin: 0 0 12px 12px;

View File

@ -1,75 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!link rel="stylesheet" href="ajaxbible_files/bible.css" type="text/css">
<link rel="shortcut icon" type="image/ico" href="http://walljm.com/favicon.ico">
<script type="text/javascript" src="ajaxbible_files/nicetitles.js"></script>
<meta name="author" content="Jason Wall">
<meta name="PBO.auth" content="8bff0c5d7a8f61d1e5dfa6c58da67c2b">
<meta name="geo.country" content="US">
<meta name="dc.language" content="en">
<meta name="dc.title" content="walljm.com || AJAX Bible || King James Version with Strong's Dictionary and Cross References">
<meta name="description" content="An AJAX implimentation of The King James Version Bible with Strong's Dictionary integrated.">
<meta name="keywords" content="AJAX, KJV, King James Version, Strong's Dictionary, Strongs">
<meta name="blogchalk" content="United States, Missouri, Saint Louis, English, Jason, Male, 21-25, photography, poetry">
<meta name="copyright" content="All content copyrighted to Jason Wall, and available by permission of the owner.">
<title>Help with The Bible with Strong's Numbers and Cross References (AJAX Enabled) by Walljm.com</title>
<style>@import "ajaxbible_files/bible.css";</style>
</head>
<body>
<div id="header"><div class="wrap">
<div id="title">powered by <a xstyle="text-decoration: none; color: white;" href="http://walljm.com/">walljm.com</a></div>
<div id="header-links"><a href="./">home</a> | <a href="http://www.dynamicbible.com/bible.1.5.zip">download</a> | <a href="./about.html">about</a> | <a href="./help.html">help</a> | <a href="mailto:jason@walljm.com">contact</a></div>
</div></div>
<div id="main">
<div class="post block">
<h1>Help with the King James Bible <span>with Strong's Numbers and Cross References (AJAX Enabled)</span></h1>
<h3>How To Search</h3>
<p>
The search function does not behave like most typical search engines. You can't use quotes or punctuation, and it won't recognize boolean
operators as such (it will treat them as search terms if they aren't on the ignore list wich is [and, of, not, for, shall, it, that, the, than, then, they, unto, them, in, he, this, thou, and to.]).
The search terms should be seperated by a space. The results will return a reference for every verse that has all the search terms in it,
without regard to the order they are found.
</p>
<h3>How To Lookup a Strongs Number</h3>
<p>The engine will recognize strongs numbers if found in the format (H|G)XXXX, i.e. G1 or H32. The "G" stands for Greek, and the "H" for Hebrew.
This notation is how the numbers will appear in the strongs definitions, and are hyperlinked for easy lookup.
</p>
<h3>How To Lookup a Reference</h3>
<p>References will be recognized by the engine as long as there is a number along with a word. If the book doesn't exist or the abbreviation you used
is not recognized, nothing will be returned.<br />
<h3>How to Lookup a Reference, a Search term, and a Strongs Number all at once</h3>
<p>
Try seperating your queries with a semi-colon, like so "John 3:16; John 11:32; Jesus Wept; H1234;"
</p>
Acceptable forms of notation are shown below:
</p>
<ul>
<li /><a href='http://www.dynamicbible.com/?John 3'>John 3</a> (to display just a chapter)
<li /><a href='http://www.dynamicbible.com/?John 3:16'>John 3:16</a> (to display just a verse)
<li /><a href='http://www.dynamicbible.com/?John 3:17-18'>John 3:17-18</a> (to display a passage)
<li /><a href='http://www.dynamicbible.com/?John 3:16-*'>John 3:16-*</a> (to display all the verses from that verse till the end of the chapter)
<li /><a href='http://www.dynamicbible.com/?John 3:16; Gen 1'>John 3:16; Gen 1</a> (to display more than one passage)
<li /><a href='http://www.dynamicbible.com/?John 3:16; John 11:32; Jesus Wept; H1234;'>John 3:16; John 11:32; Jesus Wept; H1234;</a> (to display more than one passage, search for a term, and lookup a strongs number)
</ul>
<p>
Most common forms of abbreviation are recognized. Numbers that prefix a book can be noted like so: 1, I, First, 2, II, or Second, and are case insensitive.
</p>
<h3>License</h3>
<p> The Ajax Bible uses a <!--Creative Commons License--> <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/2.5/">Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License</a>.<!--/Creative Commons License-->
<!-- <rdf:RDF xmlns="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<Work rdf:about="">
<license rdf:resource="http://creativecommons.org/licenses/by-nc-sa/2.5/" />
<dc:type rdf:resource="http://purl.org/dc/dcmitype/InteractiveResource" />
</Work>
<License rdf:about="http://creativecommons.org/licenses/by-nc-sa/2.5/"><permits rdf:resource="http://web.resource.org/cc/Reproduction"/><permits rdf:resource="http://web.resource.org/cc/Distribution"/><requires rdf:resource="http://web.resource.org/cc/Notice"/><requires rdf:resource="http://web.resource.org/cc/Attribution"/><prohibits rdf:resource="http://web.resource.org/cc/CommercialUse"/><permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/><requires rdf:resource="http://web.resource.org/cc/ShareAlike"/></License>
</rdf:RDF> -->
</p>
</div>
</div>
</div>
<div style="display: none;" class="nicetitle" id="nicetitlecontainer"></div></body></html>

View File

@ -1,6 +1,72 @@
function SortNumeric(x, y)
{
return x - y
}
String.prototype.trim = function()
{
return this.replace(/^\s+|\s+$/g, "");
}
String.prototype.ltrim = function()
{
return this.replace(/^\s+/, "");
}
String.prototype.rtrim = function()
{
return this.replace(/\s+$/, "");
}
function Traverse(node, testament)
{
var treeText = "";
if (node != null)
{
if (node.hasChildNodes())
{
if (node.nodeName == "strongs")
{
// you need to test if this is the OT or NT and set the attribute accordingly.
var t = "";
if (testament == "old")
{
t= "H";
}
if (testament == "new")
{
t="G";
}
treeText += "<a href='javascript:void();' class='hiddenlink' title='Strongs #: " + node.getAttribute("number") + "'><span class='searchvalue' style='display:none'>" + t + node.getAttribute("number") + "</span>" + Traverse(node.childNodes.item(0), testament) + "</a>";
} else
{
treeText += '<' + node.nodeName + '>';
for (var i = 0; i < node.childNodes.length; i++)
{
treeText += Traverse(node.childNodes.item(i), testament);
}
treeText += '</' + node.nodeName + '>';
}
} else
{
if (node.nodeValue != null)
{
if (node.nodeValue.search(/^(\,|\.|\:|\?|\;|\!)/) != -1)
{
treeText += node.nodeValue;
} else
{
treeText += " " + node.nodeValue;
}
}
}
}
return treeText;
}
//
// This function is what gets executed by the search box.
//
function Search(sv)
{
var qs = sv.split(";");
@ -36,9 +102,10 @@ function Search(sv)
var passage = "";
if (q.trim() != "")
{
var myReference = new Reference(q.trim());
getVersesByRef(myReference.book, myReference.chapter, myReference.startverse, myReference.endverse);
passage += myReference.bookname + " " + myReference.chapter + ":" + myReference.startverse + "-" + myReference.endverse;
var myref = new Reference(q.trim());
var r = Bible.GetPassage(myref.book, myref.chapter, myref.startverse, myref.endverse);
Bible.DisplayPassage(r.vs, myref.book, myref.chapter, myref.startverse, myref.endverse, r.testament);
}
}
}
@ -49,18 +116,97 @@ function Search(sv)
return false;
}
var RMAC = {
}
var Bible = {
DisplayPassage: function(vs, b, ch, sv, ev, testament)
{
var r = "";
for (var i = 0; i < vs.length; i++)
{
var v = vs[i];
r += "<b>" + $(v).attr("number") + ".</b> ";
for (var j = 0; j < v.childNodes.length; j++)
{
r += Traverse(v.childNodes[j], testament);
}
r += "<br />";
}
var t = $("<div class='passage result'><a href='javascript:void();' class='removeresult' style='border: 0;'><img style='border: 0px;' src='images/delete.png' width='48' height='48' /></a><span class='resultbody'>" + "<h2>" + bookName(b) + " " + ch + ":" + sv + "-" + ev + "</h2>" + r + "</span><br clear='all' /></div>");
t.find(".hiddenlink").click(function(e)
{
Util.HandleHiddenLink(e);
});
t.find(".removeresult").click(function(e)
{
Util.RemoveResult(e);
});
$("#result").append(t);
},
GetPassage: function(b, ch, sv, ev)
{
var xml; // the verses from the chapter.
var vs = new Array(); // the verses requested.
var r = {};
var url = "xml/" + b + "-" + ch + ".xml"
$.ajax({
async: false,
type: "GET",
url: url,
dataType: "xml",
success: function(d, t, x)
{
xml = d;
},
error: function(request, status, error)
{
Utility.handleError(error, request);
}
});
// get the verses requested.
if (ev == "*")
{
vs = $(xml).find("verse");
}
else
{
for (var i = sv; i <= ev; i++)
{
vs.unshift($(xml).find('verse[number="' + i + '"]')[0])
}
}
r.vs = vs;
r.testament = $(xml).find("book").attr("testament");
return r;
}
}
var Util = {
HandleLink: function(e)
{
Search($(e.target).text());
},
HandleHiddenLink: function(e)
{
Search($(e.target).find(".searchvalue").text());
},
RemoveResult: function(e)
{
$(e.target).parent().parent().remove();
}
}
var Strongs = {
GetStrongs: function(sn, dict)
{
@ -124,7 +270,7 @@ var Strongs = {
cr.each(function(i)
{
crtxt += $(this).find("t").text() + ":";
crtxt += $(this).find("t").text() + ": ";
$(this).find("r").each(function(j)
{
@ -132,9 +278,8 @@ var Strongs = {
crtxt += "<a href='javascript:void();' class='link'>" + bookName(ref[0]) + " " + ref[1] + ":" + ref[2] + "</a>, ";
});
crtxt = crtxt.substr(0, crtxt.length - 2);
crtxt += " ; ";
crtxt += "<br />";
});
crtxt = crtxt.substr(0, crtxt.length - 2);
crtxt += "</div>";
// put together the display.
@ -155,22 +300,23 @@ var Strongs = {
}
}
var RMAC = {
}
var Bible = {
}
var Words = {
DisplayResults: function(r)
ConvertResultsToArray: function(r)
{
var txt = "Query: <a href='javascript:void();' class='link'>" + query + "'</a><ul>";
var results = new Array();
$(r).each(function()
{
results.push([$(this).attr("b"), $(this).attr("ch"), $(this).attr("v")]);
});
return results;
},
DisplayResults: function(results, q)
{
var txt = "<h4>Query: <a href='javascript:void();' class='link'>" + q + "</a></h4><ul>";
for (var i = 0; i < results.length; i++)
{
var r = results[i];
txt += "<li /><a href='javascript:void();' class='link'>" + bookName(r[0]) + " " + r[1] + ":" + r[2] + "</a>";
txt += "<li /><a href='javascript:void();' class='link' alt='" + bookName(r[0]) + " " + r[1] + ":" + r[2] + "'>" + bookName(r[0]) + " " + r[1] + ":" + r[2] + "</a>";
}
txt += "</ul>";
@ -181,8 +327,8 @@ var Words = {
Util.HandleLink(e);
});
$("#searchresults").append(t);
$("#searchresults").html(t);
$("#searchTotal").html(results.length);
return false;
},
FindReferences: function(q)
@ -190,7 +336,7 @@ var Words = {
q = q.toLowerCase();
var qs = q.split(" ");
var refs;
var words = this.buildIndexArray().sort();
var words = this.BuildIndexArray().sort();
var results = new Array();
// Loop through each query term.
@ -206,14 +352,15 @@ var Words = {
{
if (q >= words[w])
{
results.unshift(this.GetSearchReferences("index/i" + words[w] + ".xml", q));
results.unshift(this.ConvertResultsToArray(this.GetSearchReferences("index/i" + words[w] + ".xml", q)));
break;
}
} else
{
if (q >= words[w] && q < words[w + 1])
{
results.unshift(this.GetSearchReferences("index/i" + words[w] + ".xml", q));
results.unshift(this.ConvertResultsToArray(this.GetSearchReferences("index/i" + words[w] + ".xml", q)));
break;
}
}
@ -224,10 +371,10 @@ var Words = {
// that is shared by all of them. IF not, we can just return those refs.
if (results.length == 1)
{
this.DisplayResults(results[0], query);
this.DisplayResults(results[0], q);
} else
{
this.DisplayResults(this.findSharedSet(results), query);
this.DisplayResults(this.FindSharedSet(results), q);
}
return false;
@ -252,11 +399,11 @@ var Words = {
});
// find the right word
var refs = $(r).find('item[name="' + query + '"]').find("ref");
var refs = $(r).find('item[word="' + query + '"]').children();
return refs;
},
buildIndexArray: function()
BuildIndexArray: function()
{
var words = new Array();
words.unshift('abhorring');
@ -755,9 +902,9 @@ var Words = {
words.unshift('zoba');
return words;
},
findSharedSet: function(results)
FindSharedSet: function(results)
{
// findSharedSet takes an array of reference arrays, and figures out which references are shared
// FindSharedSet takes an array of reference arrays, and figures out which references are shared
// by all arrays/sets, then returns a single array of references.
for (var j in results)
@ -782,7 +929,7 @@ var Words = {
// for each additional result, get the shared set
for (var i = 1; i < results.length; i++)
{
result = ReturnSharedSet(results[i], result);
result = this.ReturnSharedSet(results[i], result);
}
// convert the references back into book, chapter and verse.
@ -794,10 +941,6 @@ var Words = {
return result;
},
SortNumeric: function(x, y)
{
return x - y
},
ReturnSharedSet: function(x, y)
{
/// <summary>
@ -843,4 +986,4 @@ var Words = {
// are identical.
return x;
}
}
}

View File

@ -1,404 +0,0 @@
//
// This code was written by Jason Wall. Feel free to use, and if you can, include a link back to www.walljm.com
// Jason@walljm.com // www.walljm.com
//
String.prototype.trim = function()
{
return this.replace(/^\s+|\s+$/g, "");
}
String.prototype.ltrim = function()
{
return this.replace(/^\s+/, "");
}
String.prototype.rtrim = function()
{
return this.replace(/\s+$/, "");
}
function delVerse(v)
{
var title = v.parentNode;
var verse = title.nextSibling;
var passages = title.parentNode;
passages.removeChild(title);
passages.removeChild(verse);
createPassagePermalink();
}
var qBookname;
var qBook;
var qChapter;
var qVsStart;
var qVsEnd;
var myTestament;
var testament;
function loadVerse()
{
// if file has querystring, get it.
url = location.href;
if (url.search(/\?/) != -1)
{
q = url.split('?');
if (q[1])
{
if (q[1].search(/\=/) != -1)
{
var pairs = q[1].split('=');
getQuery(unescape(pairs[1]));
}
else
{
getQuery(unescape(q[1]));
}
}
}
}
function clearSearch()
{
document.getElementById('ref').value = "";
document.getElementById('result').innerHTML = "";
document.getElementById('passage').innerHTML = "";
}
function nextBook()
{
var refs = document.getElementById('ref').value.split(";");
var passage = "";
document.getElementById('result').innerHTML = "";
for (var i = 0; i < refs.length; i++)
{
var ref = refs[i];
if (ref.trim() != "")
{
var myReference = new Reference(ref.trim());
if (myReference.book < 66)
{
getVersesByRef(myReference.book + 1, 1, 1, "*");
passage += bookName(myReference.book + 1) + " 1";
if (i + 1 < refs.length)
{
passage += "; ";
}
} else
{
alert("You're already at the last book of the Bible. ;)");
getVersesByRef(myReference.book, 1, 1, "*");
passage += bookName(myReference.book) + " 1";
if (i + 1 < refs.length)
{
passage += "; ";
}
}
}
}
document.getElementById('ref').value = passage;
}
function prevBook()
{
var refs = document.getElementById('ref').value.split(";");
var passage = "";
document.getElementById('result').innerHTML = "";
for (var i = 0; i < refs.length; i++)
{
var ref = refs[i];
if (ref.trim() != "")
{
var myReference = new Reference(ref.trim());
if (myReference.book > 1)
{
getVersesByRef(myReference.book - 1, 1, 1, "*");
passage += bookName(myReference.book - 1) + " 1";
if (i + 1 < refs.length)
{
passage += "; ";
}
} else
{
alert("You're already at the last book of the Bible. ;)");
getVersesByRef(myReference.book, 1, 1, "*");
passage += bookName(myReference.book) + " 1";
if (i + 1 < refs.length)
{
passage += "; ";
}
}
}
}
document.getElementById('ref').value = passage;
}
function showChapter()
{
var refs = document.getElementById('ref').value.split(";");
var passage = "";
document.getElementById('result').innerHTML = "";
for (var i = 0; i < refs.length; i++)
{
var ref = refs[i];
if (ref.trim() != "")
{
var myReference = new Reference(ref.trim());
getVersesByRef(myReference.book, myReference.chapter, 1, "*");
passage += myReference.bookname + " " + myReference.chapter;
if (i + 1 < refs.length)
{
passage += "; ";
}
}
}
document.getElementById('ref').value = passage;
}
function nextChapter()
{
var refs = document.getElementById('ref').value.split(";");
var passage = "";
document.getElementById('result').innerHTML = "";
for (var i = 0; i < refs.length; i++)
{
var ref = refs[i];
if (ref.trim() != "")
{
var myReference = new Reference(ref.trim());
if (myReference.chapter < myReference.lastchapter)
{
getVersesByRef(myReference.book, myReference.chapter + 1, 1, "*");
passage += myReference.bookname + " " + (myReference.chapter + 1);
if (i + 1 < refs.length)
{
passage += "; ";
}
} else
{
alert("You're already at the last chapter in the book. ;)");
getVersesByRef(myReference.book, myReference.chapter, 1, "*");
passage += myReference.bookname + " " + (myReference.chapter);
if (i + 1 < refs.length)
{
passage += "; ";
}
}
}
}
document.getElementById('ref').value = passage;
}
function prevChapter()
{
var refs = document.getElementById('ref').value.split(";");
var passage = "";
document.getElementById('result').innerHTML = "";
for (var i = 0; i < refs.length; i++)
{
var ref = refs[i];
if (ref.trim() != "")
{
var myReference = new Reference(ref.trim());
if (myReference.chapter > 1)
{
getVersesByRef(myReference.book, myReference.chapter - 1, 1, "*");
passage += myReference.bookname + " " + (myReference.chapter - 1);
if (i + 1 < refs.length)
{
passage += "; ";
}
} else
{
alert("You're already at the first chapter in the book. ;)");
getVersesByRef(myReference.book, myReference.chapter, 1, "*");
passage += myReference.bookname + " " + (myReference.chapter);
if (i + 1 < refs.length)
{
passage += "; ";
}
}
}
}
document.getElementById('ref').value = passage;
}
function getQuery()
{
var query = $("#ref").val();
var qs = query.split(";");
clearSearch();
for (var x in qs)
{
var q = qs[x].trim();
if (q != "")
{
// its a search term.
if (q.search(/[0-9]/i) == -1)
{
find(q);
}
// its a strongs lookup
else if (q.search(/(H|G)[0-9]/i) != -1)
{
var dict = q.substring(0, 1);
if (dict.search(/h/i) != -1) { dict = "heb"; } else { dict = "grk"; }
q = q.substring(1, q.length);
getStrongs(q, dict);
}
// its a verse reference.
else
{
var passage = "";
if (q.trim() != "")
{
var myReference = new Reference(q.trim());
getVersesByRef(myReference.book, myReference.chapter, myReference.startverse, myReference.endverse);
passage += myReference.bookname + " " + myReference.chapter + ":" + myReference.startverse + "-" + myReference.endverse;
}
}
}
}
}
function getVersesByRef(book, chapter, startverse, endverse)
{
var myReference = new Reference(bookName(book) + " " + chapter);
var bookname = myReference.bookname;
var longbookname = myReference.longbookname;
qBookname = bookname
qBook = book;
qChapter = chapter;
qVsStart = startverse;
qVsEnd = endverse;
document.getElementById('ref').value += bookname + " " + chapter + ":" + startverse + "-" + endverse + "; ";
processReqChange(loadXMLDocSync("xml/" + book + "-" + chapter + ".xml"));
createPassagePermalink();
}
function createPassagePermalink()
{
var r = document.getElementById("result");
var titles = r.getElementsByTagName("h2");
var p = document.getElementById('passage');
p.innerHTML = "";
var t = "";
for (var i = 0; i < titles.length; i++)
{
var title = titles[i].childNodes[2].innerHTML;
t += title + "; ";
}
p.innerHTML += "<a style='border: none; text-decoration: none;' href='./?" + t + "' title='" + t + "'><img style='border: 0px;' src='images/shape_square_link.png' /></a>";
}
function myTraverse(node)
{
var treeText = "";
if (node != null)
{
if (node.hasChildNodes())
{
if (node.nodeName == "strongs")
{
// you need to test if this is the OT or NT and set the attribute accordingly.
if (testament == "old")
{
treeText += " <a href='./?H" + node.getAttribute("number") + "' onclick='getStrongs(";
treeText += node.getAttribute("number") + ", \"heb\"";
}
if (testament == "new")
{
treeText += " <a href=\"./?G" + node.getAttribute("number") + "\" onclick='getStrongs(\"";
treeText += node.getAttribute("number") + "\", \"grk\"";
}
treeText += "); return false;' title='Strongs #: " + node.getAttribute("number") + "'>" + myTraverse(node.childNodes.item(0)) + "</a>";
} else
{
treeText += '<' + node.nodeName + '>';
for (var i = 0; i < node.childNodes.length; i++)
{
treeText += myTraverse(node.childNodes.item(i));
}
treeText += '</' + node.nodeName + '>';
}
} else
{
if (node.nodeValue != null)
{
if (node.nodeValue.search(/^(\,|\.|\:|\?|\;|\!)/) != -1)
{
treeText += node.nodeValue;
} else
{
treeText += " " + node.nodeValue;
}
}
}
}
return treeText;
}
function processReqChange(xmlObj)
{
// ...processing statements go here...
var oDict = xmlObj.documentElement;
var Books = oDict.getElementsByTagName("book");
testament = Books.item(0).getAttribute("testament");
var Chapters = oDict.getElementsByTagName("chapter");
var result = document.getElementById('result');
var resultText = "";
for (i = 0; i < Chapters.length; i++)
{
var Chapter = Chapters.item(i);
if (Chapter.getAttribute("number") == qChapter)
{
var Verses = Chapter.childNodes
for (j = 0; j < Verses.length; j++)
{
var Verse = Verses.item(j);
if (Verse.nodeName == "verse")
{
if ((Verse.getAttribute("number") >= qVsStart && Verse.getAttribute("number") <= qVsEnd) || (Verse.getAttribute("number") >= qVsStart && qVsEnd == "*"))
{
var vNodes = Verse.childNodes;
resultText += "<b>" + Verse.getAttribute("number") + ".</b> ";
for (m = 0; m < vNodes.length; m++)
{
vNode = vNodes.item(m);
if (vNode.nodeName == "#text")
{
if (vNode.nodeValue.search(/^(\,|\.|\:|\?|\;|\!)/) != -1)
{
resultText += vNode.nodeValue;
} else
{
resultText += " " + vNode.nodeValue;
}
}
if (vNode.nodeName == "em")
{
resultText += myTraverse(vNode);
}
if (vNode.nodeName == "strongs")
{
// you need to test if this is the OT or NT and set the attribute accordingly.
if (testament == "old")
{
resultText += " <a href='./?H" + vNode.getAttribute("number") + "' onclick='getStrongs(\"";
resultText += vNode.getAttribute("number") + "\", \"heb\"";
}
if (testament == "new")
{
resultText += " <a href='./?G" + vNode.getAttribute("number") + "' onclick='getStrongs(\"";
resultText += vNode.getAttribute("number") + "\", \"grk\"";
}
resultText += "); return false;' title='Strongs #: " + vNode.getAttribute("number") + "'>" + myTraverse(vNode.childNodes.item(0)) + "</a>";
}
}
resultText += "<br />";
}
}
}
result.innerHTML = "<h2 class='passages'><a style='border: 0px; text-decoration: none;' class='delverse' href='#' onclick='delVerse(this); return false;'><img style='border: 0px;' src='images/delverse.gif' width='16' height='16' /></a> | " + "<a href='./?" + qBookname + " " + qChapter + ":" + qVsStart + "-" + qVsEnd + "' title='" + qBookname + " " + qChapter + ":" + qVsStart + "-" + qVsEnd + "'>" + qBookname + " " + qChapter + ":" + qVsStart + "-" + qVsEnd + "</a></h2><div>" + resultText + "</div>" + result.innerHTML;
}
}
}

288
xml/crgrk33.xml Normal file

File diff suppressed because one or more lines are too long