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