From 37631acb311222c27962ef4d71e287f6404c610f Mon Sep 17 00:00:00 2001 From: Patrick Tang Date: Wed, 28 Aug 2024 06:03:53 -0700 Subject: [PATCH] Fix ESV with morphology --- step-web/src/main/webapp/js/backbone/step_router.js | 2 +- .../main/webapp/js/backbone/views/view_display_passage.js | 4 ++-- .../main/webapp/js/backbone/views/view_display_search.js | 2 +- step-web/src/main/webapp/js/color_code_grammar.js | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/step-web/src/main/webapp/js/backbone/step_router.js b/step-web/src/main/webapp/js/backbone/step_router.js index 0ee071f23b..d87865dcef 100644 --- a/step-web/src/main/webapp/js/backbone/step_router.js +++ b/step-web/src/main/webapp/js/backbone/step_router.js @@ -83,7 +83,7 @@ var StepRouter = Backbone.Router.extend({ if (!step.util.isBlank(options)) { if ((options.indexOf("M") > -1) || (options.indexOf("C") > -1)) { var versions = urlStub.split("version="); - var hasMorphology = false; + var hasMorphology = (versions.length == 1) ? true : false; // No version so it is ESV. for (var i = 1; i < versions.length; i++) { // skip the first element is q= or things before version= var curVersion = versions[i].split(URL_SEPARATOR)[0].split("&")[0]; if ((typeof step.keyedVersions[curVersion] === "object") && diff --git a/step-web/src/main/webapp/js/backbone/views/view_display_passage.js b/step-web/src/main/webapp/js/backbone/views/view_display_passage.js index 798f0c5b3e..936461c752 100644 --- a/step-web/src/main/webapp/js/backbone/views/view_display_passage.js +++ b/step-web/src/main/webapp/js/backbone/views/view_display_passage.js @@ -49,7 +49,7 @@ var PassageDisplayView = DisplayView.extend({ if (cv[C_colorCodeGrammarAvailableAndSelected]) { if (hasTOS) { pch = document.getElementsByClassName('passageContentHolder'); - var r = cf.addClassForTHOT(pch[0].outerHTML); + var r = cf.addClassForTHOT(pch[0].outerHTML, bibleVersions); pch[0].outerHTML = r[0]; otCSSOnThisPage = r[1]; } @@ -63,7 +63,7 @@ var PassageDisplayView = DisplayView.extend({ else { if (cv[C_colorCodeGrammarAvailableAndSelected]) { if (hasTOS) { - var r = cf.addClassForTHOT(this.model.attributes.value); + var r = cf.addClassForTHOT(this.model.attributes.value, bibleVersions); this.model.attributes.value = r[0]; otCSSOnThisPage = r[1]; } diff --git a/step-web/src/main/webapp/js/backbone/views/view_display_search.js b/step-web/src/main/webapp/js/backbone/views/view_display_search.js index a26b6dccbe..0dedfbb4ce 100644 --- a/step-web/src/main/webapp/js/backbone/views/view_display_search.js +++ b/step-web/src/main/webapp/js/backbone/views/view_display_search.js @@ -85,7 +85,7 @@ var SearchDisplayView = DisplayView.extend({ if (cv[C_colorCodeGrammarAvailableAndSelected]) { if (hasTOS) { - var r = cf.addClassForTHOT(results[0].outerHTML); + var r = cf.addClassForTHOT(results[0].outerHTML, bibleVersions); $(results[0]).html(r[0]); otCSSOnThisPage = r[1]; } diff --git a/step-web/src/main/webapp/js/color_code_grammar.js b/step-web/src/main/webapp/js/color_code_grammar.js index 0641f56b98..2ddf1145be 100644 --- a/step-web/src/main/webapp/js/color_code_grammar.js +++ b/step-web/src/main/webapp/js/color_code_grammar.js @@ -1520,7 +1520,7 @@ var cf = { return result.replace(/\s\s+/, ' ').replace(/^\s/, '').replace(/\s$/, ''); }, // Do not shorten name, called by Javascript functions outside of color_code_grammar and color_code_config - addClassForTHOT: function (passageHTML) { + addClassForTHOT: function (passageHTML, bibleVersions) { var result = '', pLength = passageHTML.length, currentPos = 0, lastCopyPos = 0; var otCSSOnThisPage = ''; while (currentPos < pLength) { @@ -1539,8 +1539,8 @@ var cf = { currentPos += 6; isOSHM = true; } - else - continue; + else if (bibleVersions.indexOf("ESV") > -1) // ESV has not "TOS:" in morph code + currentPos += 1; var endingQuotePos = passageHTML.indexOf(charAfterMorph, currentPos); if ((endingQuotePos > -1) && (endingQuotePos - currentPos < 60)) { var morphCode = passageHTML.substring(currentPos, endingQuotePos);