finished 2.0 code.

This commit is contained in:
jwall@VAPPRCSN015.vap.local 2011-11-02 15:38:29 -04:00
parent 894bb171b1
commit 2c3032d617
3 changed files with 45 additions and 61 deletions

View File

@ -160,6 +160,7 @@ h3 {
.result .resultbody
{
display: block;
padding-left: 55px;
}
#main .block {

View File

@ -116,10 +116,6 @@ function Search(sv)
return false;
}
var RMAC = {
}
var Bible = {
DisplayPassage: function(vs, b, ch, sv, ev, testament)
{
@ -246,6 +242,41 @@ var Strongs = {
}
});
url = "xml/rs" + parseInt((sn - 1) / 1000) + ".xml";
// rmac is a two get process.
$.ajax({
async: false,
type: "GET",
url: url,
dataType: "xml",
success: function(d, t, x)
{
results.rmac = d;
},
error: function(request, status, error)
{
Utility.handleError(error, request);
}
});
// deal with RMAC
results.rmaccode = $(results.rmac).find('strongs[id="' + sn + '"]').attr("rmac");
url = "xml/r-" + results.rmaccode.substring(0, 1) + ".xml";
$.ajax({
async: false,
type: "GET",
url: url,
dataType: "xml",
success: function(d, t, x)
{
results.rmac = d;
},
error: function(request, status, error)
{
Utility.handleError(error, request);
}
});
return results;
},
@ -256,7 +287,7 @@ var Strongs = {
var title = $(entry).find("title").text();
var trans = $(entry).find("transliteration").text();
var pron = $(entry).find("pronunciation").text();
var desc = $(entry).find("description").text();
var desc = Traverse($(entry).find("description")[0]);
var re = /([hg][0-9]{1,4})/gi;
@ -282,10 +313,17 @@ var Strongs = {
});
crtxt += "</div>";
// ...processing statements go here...
var 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.
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'><b>" + trans + " (" + r.sn + ")</b> - " + pron + " - " + title + " - " + desc + "</span>" + crtxt + "<br clear='all' /></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'><b>" + trans + " (" + r.sn + ")</b> - " + pron + " - " + title + " - " + desc + "<br />" + rtxt + crtxt + "</span><br clear='all' /></div>");
t.find(".link").click(function(e)
{

View File

@ -1,55 +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
//
function getRmac(sn) {
url = "xml/rs" + parseInt((sn-1)/1000) + ".xml";
loadXMLDoc(url, processRSindex, sn);
}
function processRSindex(xmlObj, strongsNum) {
// ...processing statements go here...
var oDict = xmlObj.documentElement;
var entries = oDict.getElementsByTagName("strongs");
for (i=0; i<entries.length; i++) {
var id = entries.item(i).getAttribute("id");
if (id == strongsNum) {
var rmac = entries.item(i).getAttribute("rmac");
url = "xml/r-" + rmac.substring(0, 1) + ".xml";
var rmacA= new Array(2)
rmacA[0]="Strongs # " + strongsNum + "<br />";
rmacA[1]=rmac;
loadXMLDoc(url, processRmac, rmacA);
return true;
}
}
}
function processRmac(xmlObj, rmacA) {
// ...processing statements go here...
var oDict = xmlObj.documentElement;
var entries = oDict.getElementsByTagName("item");
rmac = rmacA[1].toUpperCase();
var r = document.getElementById('resultRmac');
r.innerHTML += rmacA[0];
for (i=0; i<entries.length; i++) {
var id = entries.item(i).getAttribute("id");
if (id.toUpperCase() == rmac) {
var descs = entries.item(i).getElementsByTagName("description");
r.innerHTML += "Code: " + rmac + "<br />";
for (j=0; j<descs.length; j++) {
r.innerHTML += descs.item(j).childNodes.item(0).nodeValue + "<br />";
}
break;
}
}
r.innerHTML += "<br />";
}