Skip to content

Commit

Permalink
Fix ESV with morphology
Browse files Browse the repository at this point in the history
  • Loading branch information
patricksptang committed Aug 28, 2024
1 parent 93c51d5 commit 37631ac
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion step-web/src/main/webapp/js/backbone/step_router.js
Original file line number Diff line number Diff line change
Expand Up @@ -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") &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand All @@ -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];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down
6 changes: 3 additions & 3 deletions step-web/src/main/webapp/js/color_code_grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand Down

0 comments on commit 37631ac

Please sign in to comment.