mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-25 00:09:54 -04:00
BugFix: End Verse getting corrupted during display in certain cases.
* Give Reference a toString() method. * Pass a whole reference into DisplayPassage. * Use the toString() method to display that reference in our passage text.
This commit is contained in:
parent
0741b50b4c
commit
89b3a3619b
@ -528,6 +528,7 @@ function maybeParseRangeSep(ref, r, errAcc) {
|
||||
return "";
|
||||
});
|
||||
}
|
||||
|
||||
function Reference(ref)
|
||||
{
|
||||
r = {
|
||||
@ -645,3 +646,14 @@ function bookName(booknum) {
|
||||
|
||||
return book[booknum];
|
||||
}
|
||||
|
||||
Reference.prototype.toString = function() {
|
||||
var ref = this.bookname.concat(" ").
|
||||
concat(this.startchapter).concat(":").
|
||||
concat(this.startverse);
|
||||
if (this.startchapter == this.endchapter) {
|
||||
return ref.concat("-").concat(this.endverse);
|
||||
}
|
||||
return ref.concat("-").concat(this.endchapter)
|
||||
.concat(":").concat(this.endverse);
|
||||
};
|
||||
|
13
js/common.js
13
js/common.js
@ -98,7 +98,7 @@ function Search(sv) {
|
||||
var myref = new Reference(q.trim());
|
||||
var r = Bible.GetPassage(myref.book, myref.startchapter, myref.endchapter, myref.startverse, myref.endverse);
|
||||
|
||||
Bible.DisplayPassage(r.cs, myref.book, myref.startchapter, myref.endchapter, myref.startverse, myref.endverse, r.testament);
|
||||
Bible.DisplayPassage(r.cs, myref, r.testament);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -218,18 +218,15 @@ var Util = {
|
||||
};
|
||||
|
||||
var Bible = {
|
||||
DisplayPassage: function(cs, b, sch, ech, sv, ev, testament) {
|
||||
DisplayPassage: function(cs, ref, testament) {
|
||||
console.log(ref.toSource());
|
||||
try {
|
||||
var r = "";
|
||||
// make the end verse pretty.
|
||||
var tvs = cs[cs.length - 1].vss.length;
|
||||
|
||||
if (ev == "*" || ev > tvs) {
|
||||
ev = tvs;
|
||||
}
|
||||
|
||||
for (var j = 0; j < cs.length; j++) {
|
||||
if (sch < ech) {
|
||||
if (Number(ref.startchapter) < Number(ref.endchapter)) {
|
||||
r += "<b>Chapter: " + cs[j].ch + "</b><br />";
|
||||
}
|
||||
var vss = cs[j].vss;
|
||||
@ -254,7 +251,7 @@ var Bible = {
|
||||
r += "<br />";
|
||||
}
|
||||
}
|
||||
var t = $("<div class='passage 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'>" + "<h2>" + bookName(b) + " " + sch + ":" + sv + "-" + ech + ":" + ev + "</h2>" + r + "</span><br clear='all' /></div>");
|
||||
var t = $("<div class='passage 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'>" + "<h2>" + ref.toString() + "</h2>" + r + "</span><br clear='all' /></div>");
|
||||
|
||||
t.find(".hiddenlink").click(function(e) {
|
||||
Util.HandleHiddenLink(e);
|
||||
|
Loading…
x
Reference in New Issue
Block a user