From dff293947ca6d297164949b6777be1774a567855 Mon Sep 17 00:00:00 2001
From: Patrick Tang <36460266+patricksptang@users.noreply.github.com>
Date: Fri, 8 Mar 2024 00:33:38 -0800
Subject: [PATCH] remove conflict of lexicon ul and links to Strong
---
.../webapp/js/backbone/views/view_sidebar.js | 38 +++++++++++--------
1 file changed, 22 insertions(+), 16 deletions(-)
diff --git a/step-web/src/main/webapp/js/backbone/views/view_sidebar.js b/step-web/src/main/webapp/js/backbone/views/view_sidebar.js
index a2237fb5f2..8bcf04fee8 100644
--- a/step-web/src/main/webapp/js/backbone/views/view_sidebar.js
+++ b/step-web/src/main/webapp/js/backbone/views/view_sidebar.js
@@ -315,7 +315,7 @@ var SidebarView = Backbone.View.extend({
);
},
- _addLinkAndAppend: function (panel, textToAdd, currentWordLangCode, bibleVersion) {
+ _addLinkAndAppend: function (panel, textToAdd, currentWordLangCode, bibleVersion, changeBreakToList) {
// Find all ref tag and change
// panel.append(' PASSAGE2 ');
// '[' . PASSAGE2 . ']';
@@ -355,7 +355,21 @@ var SidebarView = Backbone.View.extend({
}
textToAdd2 += remainingText;
}
- remainingText = textToAdd2;
+ if (changeBreakToList) {
+ var partsBetweenBreak = textToAdd2.split("
");
+ var orderList = $("
");
+ for (var kk = 0; kk < partsBetweenBreak.length; kk ++) {
+ var listElmt = $("- ");
+ this._addLinkToStrongWord(listElmt, partsBetweenBreak[kk]);
+ orderList.append(listElmt);
+ }
+ panel.append(orderList);
+ }
+ else
+ this._addLinkToStrongWord(panel, remainingText);
+ },
+
+ _addLinkToStrongWord: function(htmlObj, remainingText) {
var matchExpression = new RegExp(/[GH]\d{4,5}[a-zA-Z]?/g);
var matchResult = remainingText.match(matchExpression);
if (matchResult != null) {
@@ -368,14 +382,14 @@ var SidebarView = Backbone.View.extend({
currentStrongNumber = currentWordLangCode + currentMatch;
if ((currentStrongNumber.length == 6) && (currentStrongNumber.substr(1,1) == "0") && (!isNaN(currentStrongNumber.substr(2,5)))) // G0nnnn -> Gnnnn or H0nnnn -> Hnnnn
currentStrongNumber = currentStrongNumber.substr(0,1) + currentStrongNumber.substr(2);
- panel.append(remainingText.substr(0, pos)); // text before the 4 character code
- panel.append($('')
+ htmlObj.append(remainingText.substr(0, pos)); // text before the 4 character code
+ htmlObj.append($('')
.append(currentMatch)
.data("strongNumber", currentStrongNumber));
remainingText = remainingText.substr(pos + matchLength);
}
}
- panel.append(remainingText).append("
");
+ htmlObj.append(remainingText).append("
");
},
_addChineseDefinitions: function (panel, mainWord, currentUserLang, bibleVersion, addLinkAndAppendFunction) {
@@ -757,7 +771,7 @@ var SidebarView = Backbone.View.extend({
foundNumOfStem = lines[i].substring(0, pos);
else if ((foundNumOfStem !== "") && (lines[i].indexOf(foundNumOfStem) == 0))
highlightLinesOnSameStem = true;
- left = pos * 8;
+ left = (pos - 1) * 8;
}
if (foundStem || highlightLinesOnSameStem) {
lines[i] = "" + lines[i] + "";
@@ -799,18 +813,10 @@ var SidebarView = Backbone.View.extend({
result1 += parts[jj]
}
result1 = result1.replace(/
/gi, "
").replace(/
\s*
/gi, "
").replace(/
\s*
/gi, "
");
- var result2 = "";
- var partsBetweenBreak = result1.split("
");
- for (var kk = 0; kk < partsBetweenBreak.length; kk ++) {
- result2 += "- " + partsBetweenBreak[kk] + "
";
- }
- result2 += "
";
- console.log("med1:" + mainWord.mediumDef);
- mainWord.mediumDef = result2;
- console.log("med2:" + mainWord.mediumDef);
+ mainWord.mediumDef = result1;
}
}
- this._addLinkAndAppend(panel, mainWord.mediumDef, currentWordLanguageCode, bibleVersion);
+ this._addLinkAndAppend(panel, mainWord.mediumDef, currentWordLanguageCode, bibleVersion, true);
}
//longer definitions
if (mainWord.lsjDefs) {