This commit is contained in:
walljm 2013-04-16 12:22:36 -04:00
parent 7ade3b70a5
commit 185579e1df

View File

@ -2,17 +2,17 @@ function SortNumeric(x, y) {
return x - y;
}
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, "");
};
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, "");
};
String.prototype.ltrim = function() {
return this.replace(/^\s+/, "");
};
String.prototype.ltrim = function() {
return this.replace(/^\s+/, "");
};
String.prototype.rtrim = function() {
return this.replace(/\s+$/, "");
};
String.prototype.rtrim = function() {
return this.replace(/\s+$/, "");
};
function Traverse(node, testament) {
try {
@ -238,10 +238,16 @@ var Bible = {
for (var w = 0; w < v.w.length; w++) {
if (v.w[w].s != undefined) {
var strongs_pre = "";
if (testament == "old") { strongs_pre = "H"; }
if (testament == "new") {strongs_pre = "G"; }
if (testament == "old") {
strongs_pre = "H";
}
if (testament == "new") {
strongs_pre = "G";
}
var sp = "";
if (v.w[w].t.substr(v.w[w].t.length-1) == " ") { sp = " "; }
if (v.w[w].t.substr(v.w[w].t.length-1) == " ") {
sp = " ";
}
r += "<a href='javascript:void();' class='hiddenlink' title='Strongs #: " + v.w[w].s + "'><span class='searchvalue' style='display:none'>" + strongs_pre + v.w[w].s + "</span>" + v.w[w].t.trim() + "</a>"+sp;
} else {
r += v.w[w].t;
@ -593,7 +599,11 @@ var Words = {
if (results.length == 1) {
this.DisplayResults(results[0], qry);
} else {
this.DisplayResults(this.FindSharedSet(results), qry);
var shared = this.FindSharedSet(results);
if (shared == null) {
shared = [];
}
this.DisplayResults(shared, qry);
}
return false;
@ -625,8 +635,11 @@ var Words = {
var refs = $.grep(r, function(o,i) {
return o.word == query;
});
return refs[0].refs;
if (refs.length > 0) {
return refs[0].refs;
} else {
return null;
}
} catch (err) {
Util.HandleError(err);
}
@ -890,18 +903,21 @@ var Words = {
for (var j in results) {
var refs = results[j];
for (var i = 0; i < refs.length; i++) {
var r = refs[i].split(":");
// convert references to single integers.
// Book * 100000, Chapter * 1000, Verse remains same, add all together.
var ref = parseInt(r[0]) * 100000000;
ref = ref + parseInt(r[1]) * 10000;
ref = ref + parseInt(r[2]);
results[j][i] = ref;
if (refs != null) {
for (var i = 0; i < refs.length; i++) {
var r = refs[i].split(":");
// convert references to single integers.
// Book * 100000, Chapter * 1000, Verse remains same, add all together.
var ref = parseInt(r[0]) * 100000000;
ref = ref + parseInt(r[1]) * 10000;
ref = ref + parseInt(r[2]);
results[j][i] = ref;
}
} else {
return null;
}
}
// get the first result
var result = results[0];
@ -969,6 +985,6 @@ var Words = {
} catch (err) {
Util.HandleError(err);
}
return null;
return null;
}
};