bug fixes, added error checking, UI tweaks.

This commit is contained in:
jwall@VAPPRCSN015.vap.local 2011-11-03 11:22:11 -04:00
parent 9dbd223271
commit a3b48d7eb4
3 changed files with 1018 additions and 939 deletions

View File

@ -1,30 +1,29 @@
body {
background: #fff; /* #dde */
margin: 0;
font: 11px verdana;
}
.post {
/* might we need to align this center and everything else left in order to get the query box centered in IE? */
font-family: verdana;
}
em {font-style: normal;}
#query {
background: #ddd;
color: #666;
margin: 0 auto 40px auto;
padding: 9px;
font: 14px verdana;
font-size: 14px;
font-weight: bold;
text-align: center;
width: 75%;
border: 2px solid #999;
}
#query #searchvalue
{
color: darkgray;
color: #777;
width: 100%;
height: 50px;
height: 70px;
margin-left: 6px;
font-size: 18px;
font-family: georgia;
}
h1 {
color: navy;
@ -41,26 +40,17 @@ h1 span {
color: #999;
}
h3 {
font: 12px verdana;
font: 18px verdana;
font-weight: bold;
xborder-bottom: 1px solid darkgray;
background: #ccc;
padding: 5px 10px;
padding: 5px 5px 0 5px;
margin: 0;
}
#main {
margin: 0 3px 0 3px;
}
#searchresultswrap {
font: 11px verdana;
font: 18px verdana;
width: 30%;
float: left;
border: 0px solid #ccc;
border-left-width: 0;
margin-right: 1px;
background: #eee;
}
#searchresultswrap h3 {
margin: 0;
@ -68,16 +58,19 @@ h3 {
border-right: 2px solid #999;
border-top: 2px solid #999;
border-left: 2px solid #999;
margin-right: 12px;
}
#searchresults {
xmargin-right: 10px;
padding: 10px;
padding: 0 10px 10px 10px;
overflow:scroll;
height: 700px;
height: 800px;
border-right: 2px solid #999;
border-bottom: 2px solid #999;
border-left: 2px solid #999;
margin-right: 12px;
background: #eee;
}
#searchresults ul {
margin: 0;
@ -107,38 +100,31 @@ h3 {
{
background-color: #fff;
}
#resultwrap {
width: 70%;
float: left;
background: white;
font: 18px georgia;
color: #000;
}
#resultwrap h3 {
margin: 0;
font: 18px georgia;
background: white;
font-weight: bold;
padding: 0 10px;
}
#resultwrap center { /* nav */
xmargin: 10px 20px;
font: 10px verdana;
display: block;
xbackground: #eef;
padding: 10px 10px;
}
#result {
font: 21px georgia;
margin: 0 0 12px 12px;
padding: 0 12px 0 0;
line-height: 200%;
}
#result a {
color: Maroon;
text-decoration: none;
border-bottom: 1px dotted darkgray;
_border-bottom: 1px solid lightgray; /* IE */
color: #000;
}
#result a:hover {
border-bottom: 1px solid blue;

View File

@ -1,6 +1,5 @@
<!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>
<link rel="shortcut icon" type="image/ico" href="http://walljm.com/favicon.ico" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="author" content="Jason Wall" />
<meta name="PBO.auth" content="8bff0c5d7a8f61d1e5dfa6c58da67c2b" />
@ -18,7 +17,7 @@
<script type="text/javascript">
$(document).ready(function()
{
$(".search").submit(function()
$("#searchform").submit(function()
{
Search($("#searchvalue").val());
return false;
@ -31,33 +30,25 @@
</style>
</head>
<body>
<div id="main">
<div class="post">
<h1>King James Bible <span>with Strong's Numbers and Cross References</span></h1>
<form class="search">
<div id="query" align="center" class="biggerrounded">
<table style="width: 100%">
<table style="width: 100%; padding: 12px;">
<tr>
<td>
<input id="searchvalue" type="search" results="10" onfocus="if (this.value=='Reference or search words') {this.value='';this.style.color='black';}" xonblur="if(this.value=='') {this.value='Reference or search words';this.style.color='darkgray';}" value="Reference or search words" />
</td>
<td style="width: 100px;">
<input value="Search" type="submit" style="height: 52px; width: 90px;" />
<td style="width: 400px;"><h1>King James Bible <span>with Strong's Numbers and Cross References</span></h1></td>
<td id="query" align="center">
<table style="width: 100%;">
<tr><form id="searchform">
<td><input id="searchvalue" type="search" results="10" onfocus="if (this.value=='Reference or search words') {this.value='';this.style.color='black';}" xonblur="if(this.value=='') {this.value='Reference or search words';this.style.color='darkgray';}" value="Reference or search words" /></td>
<td style="width: 100px;"><input value="Search" type="submit" style="height: 72px; width: 90px;" id="searchbtn" /></td>
</form></tr>
</table>
</td>
</tr>
</table>
</div>
</form>
<div id="searchresultswrap" class="rounded">
<h3>Search Results <span id="searchTotal"></span></h3>
<div id="searchresults"></div>
</div>
<div id="resultwrap">
<div id="result"></div>
<br />
<br />
</div>
</div>
<div id="searchresultswrap" class="rounded">
<h3>Search Results: <span id="searchTotal"></span></h3>
<div id="searchresults"></div>
</div>
</body>
</html>

View File

@ -18,6 +18,8 @@ String.prototype.rtrim = function()
function Traverse(node, testament)
{
try
{
var treeText = "";
if (node != null)
{
@ -29,11 +31,11 @@ function Traverse(node, testament)
var t = "";
if (testament == "old")
{
t= "H";
t = "H";
}
if (testament == "new")
{
t="G";
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
@ -60,15 +62,17 @@ function Traverse(node, testament)
}
}
return treeText;
}
catch (err)
{
Util.HandleError(err);
}
}
//
// This function is what gets executed by the search box.
//
function Search(sv)
{
try
{
var qs = sv.split(";");
for (var x in qs)
@ -109,15 +113,22 @@ function Search(sv)
}
}
}
}
}
catch (err)
{
Util.HandleError(err);
}
return false;
}
var Bible = {
DisplayPassage: function(vs, b, ch, sv, ev, testament)
{
try
{
var r = "";
@ -147,8 +158,15 @@ var Bible = {
Util.RemoveResult(e);
});
$("#result").append(t);
}
catch (err)
{
Util.HandleError(err);
}
},
GetPassage: function(b, ch, sv, ev)
{
try
{
var xml; // the verses from the chapter.
var vs = new Array(); // the verses requested.
@ -166,7 +184,7 @@ var Bible = {
},
error: function(request, status, error)
{
Utility.handleError(error, request);
Util.HandleError(error, request);
}
});
@ -185,6 +203,12 @@ var Bible = {
r.vs = vs;
r.testament = $(xml).find("book").attr("testament");
return r;
}
catch (err)
{
Util.HandleError(err);
}
}
}
@ -200,11 +224,20 @@ var Util = {
RemoveResult: function(e)
{
$(e.target).parent().parent().remove();
},
HandleError: function(e)
{
// for now we're going to put the error in the main result div.
var t = $("<div class='strongsdef 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'>"+e+"</span><br clear='all' /></div>");
return false;
}
}
var Strongs = {
GetStrongs: function(sn, dict)
{
try
{
var self = this;
var results = {};
@ -223,7 +256,7 @@ var Strongs = {
},
error: function(request, status, error)
{
Utility.handleError(error, request);
Util.HandleError(error, request);
}
});
@ -238,10 +271,12 @@ var Strongs = {
},
error: function(request, status, error)
{
Utility.handleError(error, request);
Util.HandleError(error, request);
}
});
if (dict == "grk")
{
url = "xml/rs" + parseInt((sn - 1) / 1000) + ".xml";
// rmac is a two get process.
$.ajax({
@ -255,7 +290,7 @@ var Strongs = {
},
error: function(request, status, error)
{
Utility.handleError(error, request);
Util.HandleError(error, request);
}
});
@ -273,14 +308,21 @@ var Strongs = {
},
error: function(request, status, error)
{
Utility.handleError(error, request);
Util.HandleError(error, request);
}
});
}
return results;
}
catch (err)
{
Util.HandleError(err);
}
},
DisplayStrongs: function(r)
{
try
{
// first deal with strongs data.
var entry = $(r.strongs).find("item#" + r.prefix + r.sn);
@ -313,13 +355,17 @@ var Strongs = {
});
crtxt += "</div>";
// ...processing statements go here...
var rtxt = "<b>Robinsons Morphological Analysis Code: " + r.rmaccode + "</b><br />"; ;
var rtxt = "";
if (r.prefix == "G")
{
rtxt += "<b>Robinsons Morphological Analysis Code: " + r.rmaccode + "</b><br />"; ;
$(r.rmac).find('item[id="' + r.rmaccode.toUpperCase() + '"]').find("description").each(function()
{
rtxt += $(this).text() + "<br />";
});
}
// put together the display.
// ok. we have to do this because click events seem to be cumulative with jquery.
@ -336,10 +382,17 @@ var Strongs = {
$("#result").append(t);
return false;
}
catch (err)
{
Util.HandleError(err);
}
}
}
var Words = {
ConvertResultsToArray: function(r)
{
try
{
var results = new Array();
$(r).each(function()
@ -347,8 +400,15 @@ var Words = {
results.push([$(this).attr("b"), $(this).attr("ch"), $(this).attr("v")]);
});
return results;
}
catch (err)
{
Util.HandleError(err);
}
},
DisplayResults: function(results, q)
{
try
{
var txt = "<h4>Query: <a href='javascript:void();' class='link'>" + q + "</a></h4><ul>";
for (var i = 0; i < results.length; i++)
@ -368,8 +428,15 @@ var Words = {
$("#searchresults").html(t);
$("#searchTotal").html(results.length);
return false;
}
catch (err)
{
Util.HandleError(err);
}
},
FindReferences: function(q)
{
try
{
q = q.toLowerCase();
var qs = q.split(" ");
@ -416,9 +483,18 @@ var Words = {
}
return false;
}
catch (err)
{
Util.HandleError(err);
}
},
GetSearchReferences: function(url, query)
{ // getSearchRefs takes a url and uses ajax to retrieve the references and returns an array of references.
{
try
{
// getSearchRefs takes a url and uses ajax to retrieve the references and returns an array of references.
var r;
$.ajax({
@ -432,7 +508,7 @@ var Words = {
},
error: function(request, status, error)
{
Utility.handleError(error, request);
Util.HandleError(error, request);
}
});
@ -440,8 +516,15 @@ var Words = {
var refs = $(r).find('item[word="' + query + '"]').children();
return refs;
}
catch (err)
{
Util.HandleError(err);
}
},
BuildIndexArray: function()
{
try
{
var words = new Array();
words.unshift('abhorring');
@ -939,8 +1022,15 @@ var Words = {
words.unshift('ziklag');
words.unshift('zoba');
return words;
}
catch (err)
{
Util.HandleError(err);
}
},
FindSharedSet: function(results)
{
try
{
// 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.
@ -978,8 +1068,15 @@ var Words = {
}
return result;
}
catch (err)
{
Util.HandleError(err);
}
},
ReturnSharedSet: function(x, y)
{
try
{
/// <summary>
/// Takes two javascript arrays and returns an array
@ -1024,4 +1121,9 @@ var Words = {
// are identical.
return x;
}
catch (err)
{
Util.HandleError(err);
}
}
}