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 { body {
background: #fff; /* #dde */ background: #fff; /* #dde */
margin: 0; margin: 0;
font: 11px verdana; font-family: verdana;
}
.post {
/* might we need to align this center and everything else left in order to get the query box centered in IE? */
} }
em {font-style: normal;} em {font-style: normal;}
#query { #query {
background: #ddd; background: #ddd;
color: #666; color: #666;
margin: 0 auto 40px auto;
padding: 9px; padding: 9px;
font: 14px verdana; font-size: 14px;
font-weight: bold; font-weight: bold;
text-align: center; text-align: center;
width: 75%;
border: 2px solid #999; border: 2px solid #999;
} }
#query #searchvalue #query #searchvalue
{ {
color: darkgray; color: #777;
width: 100%; width: 100%;
height: 50px; height: 70px;
margin-left: 6px; margin-left: 6px;
font-size: 18px; font-size: 18px;
font-family: georgia;
} }
h1 { h1 {
color: navy; color: navy;
@ -41,26 +40,17 @@ h1 span {
color: #999; color: #999;
} }
h3 { h3 {
font: 12px verdana; font: 18px verdana;
font-weight: bold; font-weight: bold;
xborder-bottom: 1px solid darkgray;
background: #ccc; background: #ccc;
padding: 5px 10px; padding: 5px 5px 0 5px;
margin: 0; margin: 0;
} }
#main {
margin: 0 3px 0 3px;
}
#searchresultswrap { #searchresultswrap {
font: 11px verdana; font: 18px verdana;
width: 30%; width: 30%;
float: left; float: left;
border: 0px solid #ccc;
border-left-width: 0;
margin-right: 1px;
background: #eee;
} }
#searchresultswrap h3 { #searchresultswrap h3 {
margin: 0; margin: 0;
@ -68,16 +58,19 @@ h3 {
border-right: 2px solid #999; border-right: 2px solid #999;
border-top: 2px solid #999; border-top: 2px solid #999;
border-left: 2px solid #999; border-left: 2px solid #999;
margin-right: 12px;
} }
#searchresults { #searchresults {
xmargin-right: 10px; xmargin-right: 10px;
padding: 10px; padding: 0 10px 10px 10px;
overflow:scroll; overflow:scroll;
height: 700px; height: 800px;
border-right: 2px solid #999; border-right: 2px solid #999;
border-bottom: 2px solid #999; border-bottom: 2px solid #999;
border-left: 2px solid #999; border-left: 2px solid #999;
margin-right: 12px;
background: #eee;
} }
#searchresults ul { #searchresults ul {
margin: 0; margin: 0;
@ -107,38 +100,31 @@ h3 {
{ {
background-color: #fff; background-color: #fff;
} }
#resultwrap { #resultwrap {
width: 70%; width: 70%;
float: left; float: left;
background: white; font: 18px georgia;
color: #000;
} }
#resultwrap h3 { #resultwrap h3 {
margin: 0; margin: 0;
font: 18px georgia;
background: white; background: white;
font-weight: bold; font-weight: bold;
padding: 0 10px; padding: 0 10px;
} }
#resultwrap center { /* nav */
xmargin: 10px 20px;
font: 10px verdana;
display: block;
xbackground: #eef;
padding: 10px 10px;
}
#result { #result {
font: 21px georgia;
margin: 0 0 12px 12px; margin: 0 0 12px 12px;
padding: 0 12px 0 0; padding: 0 12px 0 0;
line-height: 200%; line-height: 200%;
} }
#result a { #result a {
color: Maroon;
text-decoration: none; text-decoration: none;
border-bottom: 1px dotted darkgray; border-bottom: 1px dotted darkgray;
_border-bottom: 1px solid lightgray; /* IE */ _border-bottom: 1px solid lightgray; /* IE */
color: #000;
} }
#result a:hover { #result a:hover {
border-bottom: 1px solid blue; 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"> <!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> <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 http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="author" content="Jason Wall" /> <meta name="author" content="Jason Wall" />
<meta name="PBO.auth" content="8bff0c5d7a8f61d1e5dfa6c58da67c2b" /> <meta name="PBO.auth" content="8bff0c5d7a8f61d1e5dfa6c58da67c2b" />
@ -18,7 +17,7 @@
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() $(document).ready(function()
{ {
$(".search").submit(function() $("#searchform").submit(function()
{ {
Search($("#searchvalue").val()); Search($("#searchvalue").val());
return false; return false;
@ -31,33 +30,25 @@
</style> </style>
</head> </head>
<body> <body>
<div id="main"> <table style="width: 100%; padding: 12px;">
<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%">
<tr> <tr>
<td> <td style="width: 400px;"><h1>King James Bible <span>with Strong's Numbers and Cross References</span></h1></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 id="query" align="center">
</td> <table style="width: 100%;">
<td style="width: 100px;"> <tr><form id="searchform">
<input value="Search" type="submit" style="height: 52px; width: 90px;" /> <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> </td>
</tr> </tr>
</table> </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="resultwrap">
<div id="result"></div> <div id="result"></div>
<br />
<br />
</div>
</div> </div>
<div id="searchresultswrap" class="rounded">
<h3>Search Results: <span id="searchTotal"></span></h3>
<div id="searchresults"></div>
</div> </div>
</body> </body>
</html> </html>

View File

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