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 6dd61b9b3b..143e6a6868 100644 --- a/step-web/src/main/webapp/js/backbone/step_router.js +++ b/step-web/src/main/webapp/js/backbone/step_router.js @@ -22,7 +22,7 @@ var StepRouter = Backbone.Router.extend({ this.navigate(url, { trigger: false, replace: true}); }, - navigatePreserveVersions: function (partial, stripCommentaries, skipPage, skipQFilter) { + navigatePreserveVersions: function (partial, stripCommentaries, skipPage, skipQFilter, startNewPageForPhone) { //get versions of current active passage //add versions from current active passage var activePassage = step.util.activePassage(); @@ -51,7 +51,10 @@ var StepRouter = Backbone.Router.extend({ skipPage = (skipPage) ? true : false; skipQFilter = (skipQFilter) ? true : false; if ((allVersions !== "") && (searchParameters !== "")) searchParameters = allVersions + "|" + searchParameters; - this.navigateSearch(searchParameters, skipQFilter, skipPage); + if (step.touchDevice && !step.touchWideDevice && startNewPageForPhone) + window.open("/?q=" + searchParameters.split(" ")[0], "_blank"); + else + this.navigateSearch(searchParameters, skipQFilter, skipPage); }, navigateSearch: function (args, skipQFilter, skipPage) { var activePassageId = step.util.activePassageId(); @@ -200,7 +203,7 @@ var StepRouter = Backbone.Router.extend({ } }); }, - handleRenderModel: function (passageModel, partRendered, queryArgs) { + handleRenderModel: function (passageModel, partRendered, queryArgs, doNotScroll) { passageModel.save({ args: queryArgs != null ? decodeURIComponent(queryArgs) : "", urlFragment: Backbone.history.getFragment() @@ -224,8 +227,8 @@ var StepRouter = Backbone.Router.extend({ } else { this.handleSearchResults(passageModel, partRendered); } - this._renderSummary(passageModel); + step.util.hideNavBarOnPhones(doNotScroll); }, _renderSummary: function (passageModel) { @@ -321,7 +324,13 @@ var StepRouter = Backbone.Router.extend({ $("#nextChapterWordle").hide(); $("#newLineWordle").show(); $("#nextChapterInputLine").show(); - self.handleRenderModel(passageModel, false, query); + var doNotScroll = false; + if ( ((typeof pageNumber === "string") && (!isNaN(pageNumber))) || + (typeof pageNumber === "number") ) { + if (parseInt(pageNumber) > 1) + doNotScroll = true; + } + self.handleRenderModel(passageModel, false, query, doNotScroll); }, passageId: activePassageId, level: 'error' diff --git a/step-web/src/main/webapp/js/backbone/views/view_display.js b/step-web/src/main/webapp/js/backbone/views/view_display.js index 83fa874cf6..153d5b3060 100644 --- a/step-web/src/main/webapp/js/backbone/views/view_display.js +++ b/step-web/src/main/webapp/js/backbone/views/view_display.js @@ -147,23 +147,6 @@ var DisplayView = Backbone.View.extend({ //reset the 'clear' values interlinearBlocks.not(".verseStart").css("clear", "none"); - /*var previousElementOffset = undefined; - - for (var i = 0; i < interlinearBlocks.length; i++) { - var element = interlinearBlocks.eq(i); - var elementOffset = element.offset(); - - //skip the first element - if (previousElementOffset) { - //check that previous element is either left or higher up - var currentPadding = 0; - if (previousElementOffset.top < elementOffset.top) { - element.css("clear", "left"); - } - elementOffset = element.offset(); - } - previousElementOffset = elementOffset; - }*/ }, /** * Estimates the height of each block in an interlinear like way 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 3eaeb9155c..09ce3ebb15 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 @@ -32,15 +32,17 @@ var PassageDisplayView = DisplayView.extend({ cv[C_colorCodeGrammarAvailableAndSelected] = (options.indexOf("C") > -1) && (availableOptions.indexOf("C") > -1); if ((cv[C_colorCodeGrammarAvailableAndSelected]) && (typeof c4 === "undefined")) cf.initCanvasAndCssForClrCodeGrammar(); //c4 is currentClrCodeConfig. It is called to c4 to save space var passageHtml, ntCSSOnThisPage = '', otCSSOnThisPage = '', pch, hasTOS = false, hasNTMorph = false; - var bibleVersions = this.model.attributes.masterVersion.toUpperCase() + "," + this.model.attributes.extraVersions.toUpperCase(); - if ((bibleVersions.indexOf('THOT') > -1)) { + var reference = this.model.get("osisId"); + var version = this.model.get("masterVersion"); + var extraVersions = this.model.get("extraVersions"); + var bibleVersions = version.toUpperCase() + "," + extraVersions.toUpperCase(); + // check if OT or NT 12/13/2023 PT + // console.log("place to add NT OT check: "+reference+ " " +bibleVersions); + if ((bibleVersions.indexOf('ESV_MORPH') > -1) || (bibleVersions.indexOf('THOT') > -1)) { if (cv[C_otMorph] == null) { - var notIE = !(false || !!document.documentMode); - // If browser is not IE, use "cache: true". If IE, use "cache: false" - // This is required because of an IE and Jquery issue. jQuery.ajax({ dataType: "script", - cache: notIE, + cache: true, url: "js/tos_morph.js", error: function (jqXHR, exception) { console.log('load tos_morph.js Failed: ' + exception); @@ -49,7 +51,7 @@ var PassageDisplayView = DisplayView.extend({ } hasTOS = true; } - if ((bibleVersions.indexOf('KJV') > -1) || (bibleVersions.indexOf('SBLG') > -1) || (bibleVersions.indexOf('CUN') > -1)) hasNTMorph = true; + if ((bibleVersions.indexOf('ESV_MORPH') > -1) || (bibleVersions.indexOf('KJV') > -1) || (bibleVersions.indexOf('SBLG') > -1) || (bibleVersions.indexOf('CUN') > -1)) hasNTMorph = true; if (this.partRendered) { if (cv[C_colorCodeGrammarAvailableAndSelected]) { if (hasTOS) { @@ -78,9 +80,6 @@ var PassageDisplayView = DisplayView.extend({ } var passageId = this.model.get("passageId"); var interlinearMode = this.model.get("interlinearMode"); - var extraVersions = this.model.get("extraVersions"); - var reference = this.model.get("osisId"); - var version = this.model.get("masterVersion"); var languages = this.model.get("languageCode"); var passageContainer = this.$el.closest(".passageContainer"); if (this._isPassageValid(passageHtml, reference)) { @@ -88,7 +87,7 @@ var PassageDisplayView = DisplayView.extend({ this._warnIfNoStrongs(version); this._warnIfFirstTimeCompare(interlinearMode); this._warnIfInterlinearFirstTime(interlinearMode); - this._warnFirstTimeColourCoding(); + this._warnFirstTimeColorCoding(); this._warnCommentaryLookupVersion(version, extraVersions); this.doFonts(passageHtml, options, interlinearMode, languages); this.doSwapInterlinearLink(passageHtml); @@ -108,16 +107,17 @@ var PassageDisplayView = DisplayView.extend({ if (!this.partRendered) { step.util.ui.emptyOffDomAndPopulate(this.$el, passageHtml); } - $(this.$el).find(".passageContentHolder").scroll(function(){ + var monitorElement = (step.touchDevice && !step.touchWideDevice) ? $(document) : $(this.$el).find(".passageContentHolder"); + monitorElement.scroll(function(){ $(".versePopup").hide(); if ($(this).find(".resultsLabel").text() !== "") // This is search result return; var allVerseNumbers = $(this).find(".verseNumber"); - var thisTop = $(this).offset().top; + var thisTop = (step.touchDevice && !step.touchWideDevice) ? $(window).scrollTop() + 21 : $(this).offset().top; for (var i = 0; i < allVerseNumbers.length; i++) { var curVerse = allVerseNumbers[i]; if ($(curVerse).offset().top > thisTop) { - var refButton = $(this).parent().parent().find("button.select-reference"); + var refButton = (step.touchDevice && !step.touchWideDevice) ? $("button.select-reference") : $(this).parent().parent().find("button.select-reference"); var newText = curVerse.innerHTML; var isInterLinear = $(this).find('.interlinear').length > 0; if ( ((isInterLinear) && (newText.indexOf(":") > -1)) || @@ -130,7 +130,10 @@ var PassageDisplayView = DisplayView.extend({ if (curVerseParts.length > 1) newText = curVerseParts[1]; } - newText = origText[0].trim() + ":" + newText; + if (origText[0].trim() === "") + newText = "Ref"; + else + newText = origText[0].trim() + ":" + newText; } $(refButton).text(newText); break; @@ -140,7 +143,7 @@ var PassageDisplayView = DisplayView.extend({ //needs to happen after appending to DOM - this.updateColor(); + this.updateSTEPColor(); this._doChromeHack(passageHtml, interlinearMode, options); this.doInterlinearVerseNumbers(passageHtml, interlinearMode, options); @@ -252,7 +255,7 @@ var PassageDisplayView = DisplayView.extend({ }); } }, - _warnFirstTimeColourCoding: function () { + _warnFirstTimeColorCoding: function () { var options = this.model.get("options") || ""; if (options.indexOf("D") != -1) { step.util.raiseOneTimeOnly("display_divide_hebrew_explanation", "info"); @@ -463,30 +466,31 @@ var PassageDisplayView = DisplayView.extend({ } }, - keepNotesInSync: function (passageContent) { - var currentHeight = passageContent.height(); - passageContent.find(".notesPane").height(currentHeight); - $(passageContent).on('scroll', function () { - //find top verse - 1. - var allVerses = $(".verse", passageContent); - var lastVerse = undefined; - for (var ii = 0; ii < allVerses.length; ii++) { - var currentVerse = $(allVerses[ii]); - var versePosition = currentVerse.position().top; - if (top >= 0) { - break; - } - lastVerse = currentVerse; - } - - if (lastVerse == undefined) { - passageContent.find(".notesPane").scrollTop(0); - } - else { - - } - }); - }, + // Does not seem to be in used. 11/30/2023 PT + // keepNotesInSync: function (passageContent) { + // var currentHeight = passageContent.height(); + // passageContent.find(".notesPane").height(currentHeight); + // $(passageContent).on('scroll', function () { + // //find top verse - 1. + // var allVerses = $(".verse", passageContent); + // var lastVerse = undefined; + // for (var ii = 0; ii < allVerses.length; ii++) { + // var currentVerse = $(allVerses[ii]); + // var versePosition = currentVerse.position().top; + // if (top >= 0) { + // break; + // } + // lastVerse = currentVerse; + // } + + // if (lastVerse == undefined) { + // passageContent.find(".notesPane").scrollTop(0); + // } + // else { + + // } + // }); + // }, /** * Creates a QTIP for a particular xref @@ -528,12 +532,10 @@ var PassageDisplayView = DisplayView.extend({ } } } - $.getSafe(BIBLE_GET_BIBLE_TEXT + chosenVersion + "/" + encodeURIComponent(xref), function (data) { var text2Display = data.value; - if (data.value.length > 1200) { - text2Display = $(data.value).text().substring(0,1000) + " ..."; - } + if (data.value.length > 1100) + text2Display = $(data.value).text().substring(0,900) + " ..."; api.set('content.title.text', data.longName); api.set('content.text', text2Display); api.set('content.osisId', data.osisId) @@ -676,7 +678,7 @@ var PassageDisplayView = DisplayView.extend({ step.util.ui.addStrongHandlers(passageId, passageContent) }, - updateColor: function () { + updateSTEPColor: function () { this.updateSpecificColor("clrHighlight", "#17758F"); this.updateSpecificColor("clrHighlightBg", "#17758F"); this.updateSpecificColor("clrText", "#5d5d5d"); 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 0e438df177..38b38752bd 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 @@ -74,14 +74,11 @@ var SearchDisplayView = DisplayView.extend({ if ((cv[C_colorCodeGrammarAvailableAndSelected]) && (typeof c4 === "undefined")) cf.initCanvasAndCssForClrCodeGrammar(); //c4 is currentClrCodeConfig. It is called to c4 to save space var passageHtml, ntCSSOnThisPage = '', otCSSOnThisPage = '', hasTOS = false, hasNTMorph = false; var bibleVersions = this.model.attributes.masterVersion.toUpperCase() + "," + this.model.attributes.extraVersions.toUpperCase(); - if ((bibleVersions.indexOf('THOT') > -1)) { + if ((bibleVersions.indexOf('ESV_MORPH') > -1) || (bibleVersions.indexOf('THOT') > -1)) { if (cv[C_otMorph] == null) { - var notIE = !(false || !!document.documentMode); - // If browser is not IE, use "cache: true". If IE, use "cache: false" - // This is required because of an IE and Jquery issue. jQuery.ajax({ dataType: "script", - cache: notIE, + cache: true, url: "js/tos_morph.js", error: function (jqXHR, exception) { console.log('load tos_morph.js Failed: ' + exception); @@ -90,7 +87,7 @@ var SearchDisplayView = DisplayView.extend({ } hasTOS = true; } - if ((bibleVersions.indexOf('KJV') > -1) || (bibleVersions.indexOf('SBLG') > -1) || (bibleVersions.indexOf('CUN') > -1)) hasNTMorph = true; + if ((bibleVersions.indexOf('ESV_MORPH') > -1) || (bibleVersions.indexOf('KJV') > -1) || (bibleVersions.indexOf('SBLG') > -1) || (bibleVersions.indexOf('CUN') > -1)) hasNTMorph = true; results = this.options.partRendered ? this.$el.find("> span") : this.renderSearch(append, this.$el.find(".searchResults")); @@ -190,6 +187,8 @@ var SearchDisplayView = DisplayView.extend({ } this._doChromeHack(this.$el, this.model.get("interlinearMode"), this.model.get("options")); + if (step.touchDevice && !step.touchWideDevice) + $(".copyrightInfo").removeClass("copyrightInfo").addClass("crInfoX"); }, _getErrorMessage: function () { var errorMessage = $(""); @@ -243,8 +242,11 @@ var SearchDisplayView = DisplayView.extend({ * @returns {*} */ getScrollableArea: function () { + if (step.touchDevice && !step.touchWideDevice) + return $(document); return this.$el.closest(".passageContent").find("> span"); - }, getMoreResults: function () { + }, + getMoreResults: function () { var self = this; //never load new pages @@ -258,20 +260,18 @@ var SearchDisplayView = DisplayView.extend({ var scrollableArea = this.getScrollableArea(); - //visible height var clientHeight = scrollableArea.prop("clientHeight"); + if (typeof clientHeight !== "number") + clientHeight = $(window).height(); - //how far down we are - var scrollTop = scrollableArea.prop("scrollTop"); - - //total scrollable height - var scrollHeight = scrollableArea.prop("scrollHeight"); - - var leftToScroll = scrollHeight - scrollTop - clientHeight; - - var scrollDownProportion = scrollableArea.scrollTop() / scrollableArea.prop("scrollHeight"); - if (scrollDownProportion > 0.7 || scrollDownProportion == scrollableArea.height() || leftToScroll < 800) { + var numOfSearchRows = $(".searchResultRow").length; + if (numOfSearchRows == 0) + return; + var thirtyPercentRowsPerPage = (numOfSearchRows / this.pageNumber) * .3; + var checkRow = Math.floor(numOfSearchRows - thirtyPercentRowsPerPage); + var posOf70PercentRowInLastPage = $($(".searchResultRow")[checkRow])[0].getBoundingClientRect().top; + if (posOf70PercentRowInLastPage < clientHeight) { var currentPageNumber = this.pageNumber; var newPageNumber = parseInt(currentPageNumber) + 1; var pageSize = this.model.get("pageSize"); diff --git a/step-web/src/main/webapp/js/backbone/views/view_display_subject.js b/step-web/src/main/webapp/js/backbone/views/view_display_subject.js index 3d886e430e..9fbf319969 100644 --- a/step-web/src/main/webapp/js/backbone/views/view_display_subject.js +++ b/step-web/src/main/webapp/js/backbone/views/view_display_subject.js @@ -37,7 +37,8 @@ var SubjectDisplayView = SearchDisplayView.extend({ * @private */ _doSimpleSubjectSearchResults: function (searchResults) { - var results = $("").addClass("subjectSection searchResults simpleSubjectSearch"); + var cssForTouchDevice = (step.touchDevice && !step.touchWideDevice) ? " style='overflow-y:hidden;height:auto' " : ""; + var results = $("").addClass("subjectSection searchResults simpleSubjectSearch"); var headingsSearch = searchResults[0].headingsSearch; var headingsResults = headingsSearch.results; @@ -54,7 +55,6 @@ var SubjectDisplayView = SearchDisplayView.extend({ * @private */ _doSpecificSearchRequirements: function (query, results) { - var self = this; var passageId = this.model.get("passageId"); var searchType = this.model.get("searchType"); @@ -90,8 +90,8 @@ var SubjectDisplayView = SearchDisplayView.extend({ }, _doNaveSearchResults: function (searchResults) { - var self = this; - var results = $("").addClass("searchResults"); + var cssForTouchDevice = (step.touchDevice && !step.touchWideDevice) ? " style='overflow-y:hidden;height:auto' " : ""; + var results = $("").addClass("searchResults"); var lastHeader = ""; if (!searchResults || searchResults.length == 0) { diff --git a/step-web/src/main/webapp/js/backbone/views/view_display_text.js b/step-web/src/main/webapp/js/backbone/views/view_display_text.js index e1635ec1be..9c625870dc 100644 --- a/step-web/src/main/webapp/js/backbone/views/view_display_text.js +++ b/step-web/src/main/webapp/js/backbone/views/view_display_text.js @@ -2,8 +2,8 @@ var TextDisplayView = SearchDisplayView.extend({ titleFragment : __s.search_text, renderSearch: function (append, existingResults) { console.log("Rendering text search results"); - - var results = $(""); + var cssForTouchDevice = (step.touchDevice && !step.touchWideDevice) ? " style='overflow-y:hidden;height:auto' " : ""; + var results = $(""); var searchResults = this.model.get("results"); var sortOrder = this.model.get("order"); diff --git a/step-web/src/main/webapp/js/backbone/views/view_examples.js b/step-web/src/main/webapp/js/backbone/views/view_examples.js index abbeddde1e..f0324f7389 100644 --- a/step-web/src/main/webapp/js/backbone/views/view_examples.js +++ b/step-web/src/main/webapp/js/backbone/views/view_examples.js @@ -258,8 +258,24 @@ var ExamplesView = Backbone.View.extend({ this.render(); }, render: function () { - if ($('#welcomeExamples').length == 0) { - this.$el.append(this.exampleTemplate); + if (($('#welcomeExamples').length == 0) || (step.touchDevice && !step.touchWideDevice)) { + if (step.touchDevice && !step.touchWideDevice) { + step.util.showLongAlert("", "" + __s.welcome_to_step + "", [ this.exampleTemplate() ]); + $(".closeColumn").click(function (ev) { + step.util.closeModal("showLongAlertModal"); + }); + var contextOfOriginalExecution = this; + $(".accordion-heading").click(function (ev) { + contextOfOriginalExecution.onClickHeading(ev, contextOfOriginalExecution); + }); + $(".plusminus").click(function (ev) { + contextOfOriginalExecution.onClickHeading(ev, contextOfOriginalExecution); + }); + $(".modal-body").find(".closeColumn").hide(); + $(".modal-body").find("h3").hide(); + } + else + this.$el.append(this.exampleTemplate); this.initAccordions(); var options = step.passages.findWhere({ passageId: step.util.activePassageId()}).get("selectedOptions") || []; var availableOptions = step.passages.findWhere({ passageId: step.util.activePassageId()}).get("options") || []; @@ -272,7 +288,7 @@ var ExamplesView = Backbone.View.extend({ else $("#keyboard_shortcut").show(); }, initAccordions: function () { - var count = this.$el.find(".accordion-row").length - 1; // Don't need to highlight keyboard shortcut + var count = $(".accordion-row").length - 1; // Don't need to highlight keyboard shortcut var hasStoredState = false; var timesDisplayedKey = "accordionTimesDisplayed"; var timesDisplayed = step.util.localStorageGetItem(timesDisplayedKey); @@ -295,7 +311,7 @@ var ExamplesView = Backbone.View.extend({ }, toggleAccordion: function (index, accordionCount) { var query = ".accordion-row[data-row=" + index + "]"; - var $accordionRow = this.$el.find(query); + var $accordionRow = $(query); var $accordionBody = $accordionRow.find(".accordion-body"); var storageKey = "displayQuickTryoutAccordion" + index; var displayFlag = false; @@ -318,14 +334,17 @@ var ExamplesView = Backbone.View.extend({ step.util.localStorageSetItem(storageKey, "false"); } }, - onClickHeading: function (event) { + onClickHeading: function (event, contextOfOriginalExecution) { event.stopImmediatePropagation(); event.stopPropagation(); //prevent the bubbling up var target = $(event.target); var accordionRow = target.parent(); if ($(accordionRow).find('.accordion-heading').length == 0) accordionRow = $(accordionRow).parent(); var index = accordionRow.attr("data-row"); - this.toggleAccordion(index); + if (contextOfOriginalExecution) + contextOfOriginalExecution.toggleAccordion(index); + else + this.toggleAccordion(index); }, onClickClose: function () { step.util.showOrHideTutorial(true); diff --git a/step-web/src/main/webapp/js/backbone/views/view_feedback.js b/step-web/src/main/webapp/js/backbone/views/view_feedback.js index 53867dd722..7d1e0cebc4 100644 --- a/step-web/src/main/webapp/js/backbone/views/view_feedback.js +++ b/step-web/src/main/webapp/js/backbone/views/view_feedback.js @@ -75,6 +75,7 @@ var FeedbackView = Backbone.View.extend({ self.feedbackForm.find("#feedbackEmail").val(step.settings.get("userFeedbackEmail") || "" ); self.feedbackForm.find("#feedbackDescription").val(""); self.feedbackForm.find("#feedbackSummary").val(""); + step.util.blockBackgroundScrolling("raiseSupport"); }); $(".sendFeedback").click(function (ev) { diff --git a/step-web/src/main/webapp/js/backbone/views/view_help_menu.js b/step-web/src/main/webapp/js/backbone/views/view_help_menu.js index a0bb506bdc..04affb5319 100644 --- a/step-web/src/main/webapp/js/backbone/views/view_help_menu.js +++ b/step-web/src/main/webapp/js/backbone/views/view_help_menu.js @@ -70,6 +70,7 @@ var ViewHelpMenuOptions = Backbone.View.extend({ '' + //end dialog '' + '')()).modal("show"); + step.util.blockBackgroundScrolling("aboutModal"); }, resetEverything: function () { window.localStorage.clear(); diff --git a/step-web/src/main/webapp/js/backbone/views/view_history.js b/step-web/src/main/webapp/js/backbone/views/view_history.js index fe185f4874..aae8da6df7 100644 --- a/step-web/src/main/webapp/js/backbone/views/view_history.js +++ b/step-web/src/main/webapp/js/backbone/views/view_history.js @@ -1,13 +1,12 @@ var ViewHistory = Backbone.View.extend({ MAX_HISTORY: 250, itemTemplate: _.template('
  • ">' + - '' + - '" title="<%= item.get("favourite") ? __s.passage_tools_delete_bookmark : __s.passage_tools_bookmark %>">' + - '">' + - '' + - '' + - '<%= step.util.ui.renderArgs(item.get("searchTokens"), null, "span") %>' + + '' + + '<%= step.util.ui.renderArgs(item.get("searchTokens"), null, "span") %>' + '' + + '' + + '" title="<%= item.get("favourite") ? __s.passage_tools_delete_bookmark : __s.passage_tools_bookmark %>" style="float:right">' + + '">' + '
  • '), fullList: _.template( '

    <%= __s.bookmarks_pinned %>

      ' + @@ -28,20 +27,24 @@ var ViewHistory = Backbone.View.extend({ var bookmarkId = item.data("item"); step.bookmarks.findWhere({id: bookmarkId }).destroy(); item.remove(); - }, starBookmarkHandler: function (self) { + }, + starBookmarkHandler: function (self) { var item = $(self).closest("li"); var bookmarkId = item.data("item"); var model = step.bookmarks.findWhere({id: bookmarkId }); model.save({ favourite: !model.get("favourite") }); step.bookmarks.sort(); this.render(); - }, openBookmarkHandler: function (self) { + }, + openBookmarkHandler: function (self) { var item = $(self).closest("li"); var bookmarkId = item.data("item"); var model = step.bookmarks.findWhere({id: bookmarkId }); step.router.doMasterSearch(decodeURIComponent(model.get("args")), model.get("options") || "", // in case it is not defined, provide empty string model.get("display") || ""); // in case it is not defined, provide empty string + if (step.touchDevice && !step.touchWideDevice) + step.util.closeModal("showLongAlertModal"); }, render: function () { var self = this; if(this.list) { @@ -50,16 +53,19 @@ var ViewHistory = Backbone.View.extend({ } //force re-add this._getList(); - - this.$el.find(".removeBookmark").click(function () { + var currentElement = (step.touchDevice && !step.touchWideDevice) ? + $(".modal-body") : this.$el; + currentElement.find(".argSumSpan").click(function() { + self.openBookmarkHandler(this); + }); + currentElement.find(".removeBookmark").click(function () { self.removeBookmarkHandler(this); }); - this.$el.find(".starBookmark").click(function() { + currentElement.find(".starBookmark").click(function() { self.starBookmarkHandler(this); }); - this.$el.find(".openBookmark").click(function() { - self.openBookmarkHandler(this); - }); + + }, refresh: function () { @@ -78,9 +84,6 @@ var ViewHistory = Backbone.View.extend({ newItem.find(".starBookmark").click(function() { self.starBookmarkHandler(this); }); - newItem.find(".openBookmark").click(function() { - self.openBookmarkHandler(this); - }); //count the number of bookmark items, and if too large, then get rid of them. var bookmarks = this.$el.find(".historyItem").not(":has([data-favourite='true'])"); @@ -131,7 +134,12 @@ var ViewHistory = Backbone.View.extend({ return this.list; } this.list = $(this.fullList({ bookmarks: step.bookmarks, view: this })); - this.$el.append(this.list); + if (step.touchDevice && !step.touchWideDevice) { + step.util.showLongAlert("", "Bookmarks", [ this.list ]); + step.sidebar = null; + } + else + this.$el.append(this.list); return this.list; } }); diff --git a/step-web/src/main/webapp/js/backbone/views/view_main_search.js b/step-web/src/main/webapp/js/backbone/views/view_main_search.js index 0e7b1beb62..629987dab9 100644 --- a/step-web/src/main/webapp/js/backbone/views/view_main_search.js +++ b/step-web/src/main/webapp/js/backbone/views/view_main_search.js @@ -80,11 +80,6 @@ var MainSearchView = Backbone.View.extend({ var n = min - input.length; var message = sprintf(__s.x_more_characters, n); var labels = $("").addClass("searchLabel") - //.append($("").attr("data-toggle", "modal").attr("data-target", "#bibleVersions").append(__s.all_versions).attr("title", __s.all_versions) - // .on("click", function () { - // view.pickBible(); - // })) - //.append(" | ") .append($("").append(__s.search_advanced).on('click', function () { view.openAdvancedSearch(); })); @@ -491,7 +486,8 @@ var MainSearchView = Backbone.View.extend({ var data = this.masterSearch.select2("data"); var initials = []; for (var i = 0; i < data.length; i++) { - initials.push(data[i].item.shortInitials); + if ((typeof data[i].item === "object") && (typeof data[i].item.shortInitials === "string")) + initials.push(data[i].item.shortInitials); } return initials; }, @@ -518,22 +514,22 @@ var MainSearchView = Backbone.View.extend({ //find the element var versions = this.masterSearch.select2("data"); for (var i = versions.length - 1; i > -1; i--) { - if (versions[i].item.initials == data.value.initials || versions.shortInitials == data.value.initials) { + if ((typeof versions[i].item === "object") && + (versions[i].item.initials === data.value.initials || versions[i].item.shortInitials === data.value.initials) ) { versions.splice(i, 1); } } this._setData(versions); }, - _trackSearch: function (options) { - if (!options) { - return; - } - - - }, + // Seems like it does not do anything PT 11/30/2023 + // _trackSearch: function (options) { + // if (!options) { + // return; + // } + // }, search: function () { var options = this.masterSearch.select2("data"); - this._trackSearch(options); + // this._trackSearch(options); var args = ""; var refArgs = ""; var searchArgs = ""; diff --git a/step-web/src/main/webapp/js/backbone/views/view_menu_passage.js b/step-web/src/main/webapp/js/backbone/views/view_menu_passage.js index c6d42d7ee0..f37c58ec1e 100644 --- a/step-web/src/main/webapp/js/backbone/views/view_menu_passage.js +++ b/step-web/src/main/webapp/js/backbone/views/view_menu_passage.js @@ -1,7 +1,11 @@ var PassageMenuView = Backbone.View.extend({ + infoIcon: '' + '' + '', + infoIconMobile: '' + + '' + + '', events: { "click a[name]": "updateModel", "click .previousChapter": "goToPreviousChapter", @@ -67,7 +71,10 @@ var PassageMenuView = Backbone.View.extend({ this.warnings = $(step.util.getPassageContainer(this.model.get("passageId"))).find(".infoIcon"); if (this.warnings.length == 0) { - this.warnings = $(_.template(this.infoIcon)()); + if (step.touchDevice && !step.touchWideDevice) + this.warnings = $(_.template(this.infoIconMobile)()); + else + this.warnings = $(_.template(this.infoIcon)()); this.$el.parent().append(this.warnings); } @@ -94,7 +101,8 @@ var PassageMenuView = Backbone.View.extend({ .removeClass("text-muted text-info text-danger text-warning").addClass("text-info") .find(".glyphicon").removeClass('glyphicon-exclamation-sign glyphicon-warning-sign glyphicon-info-sign').addClass("glyphicon-info-sign"); } - }, raiseMessage: function (opts) { + }, + raiseMessage: function (opts) { var self = this; var titleSoFar = this.warnings.attr("data-content") || ""; if (titleSoFar != "") { @@ -119,6 +127,8 @@ var PassageMenuView = Backbone.View.extend({ this.warnings.show(); if (opts.silent != true) { this.warnings.popover('show'); + if (step.touchDevice && !step.touchWideDevice) + $(".popover.fade.top.in").css("position","fixed"); this.warnings.next(".popover").on('click', function () { self.warnings.popover("hide"); self.handleInfoHide(); @@ -126,13 +136,14 @@ var PassageMenuView = Backbone.View.extend({ } else { this.warnings.on("shown.bs.popover", function () { + if (step.touchDevice && !step.touchWideDevice) + $(".popover.fade.top.in").css("position","fixed"); self.warnings.next(".popover").on('click', function () { self.warnings.popover("hide"); self.handleInfoHide(); }) }); } - }, handleInfoHide: function () { this.warnings.removeClass("text-info text-warning text-danger"); @@ -164,10 +175,11 @@ var PassageMenuView = Backbone.View.extend({ // If the device is mobile, and the user has swiped at least 3x (so they know // how it works), then don't display the prev/next arrows anymore. // Calling activePassageId can crash so just use passageID 0 - var swipeStatus = step.passages.findWhere({ passageId: 0}).get("isSwipeLeftRight"); + var swipeStatus = step.passages.findWhere({ passageId: 0}).get("isSwipeLeftRight"); if (swipeStatus == undefined) swipeStatus = true; - if (step.touchDevice && swipeCount >= 3 && swipeStatus) + + if (step.touchDevice && swipeCount > 6 && swipeStatus) $(".nextPreviousChapterGroup").css("display", "none"); else { $(".nextPreviousChapterGroup").css("display", "block"); @@ -175,6 +187,7 @@ var PassageMenuView = Backbone.View.extend({ if (this._isDisplayOptionsDropdown(openDropdown)) { this._updateColumnOptions(); } + var isPassage = this.model.get("searchType") == 'PASSAGE'; var previousNext = this.$el.find(".nextPreviousChapterGroup"); previousNext.toggle(true); @@ -189,29 +202,22 @@ var PassageMenuView = Backbone.View.extend({ // Introduce the swipe feature on a mobile device. Note, wait until // STEP's usage count > 1 so that the initial introJsStep has already // played, and hopefully the user knows what the arrows are for. - if (step.touchDevice) { - var ua = navigator.userAgent.toLowerCase(); - if ((ua.indexOf("iphone") > -1) || (ua.indexOf("ipad") > -1) || (ua.indexOf("macintosh") > -1)) // Only for Android. On iPad introJS will cause the bible, reference and search buttons to be gone - return; var swipeIntro = step.util.localStorageGetItem("swipeIntro"); - if (swipeIntro == null) swipeIntro = 0; - if (swipeIntro == 0) { + if (swipeIntro != 1) { var stepUsage = step.util.localStorageGetItem("step.usageCount"); if (stepUsage == null) stepUsage = 0; - if (stepUsage >= 1) { + else if (stepUsage > 0) { var introJsSteps = [{ - element: document.getElementsByClassName('previousChapter')[0], - intro: "Swipe left for next chapter, right for previous chapter. Once you have used the swipe feature three times, the arrows will hide." + intro: __s.swipe_lr // do not specify an element because it will hide the buttons to select Bible, passage and to search }]; introJs().setOptions({ steps: introJsSteps }).start(); + step.util.localStorageSetItem("swipeIntro", 1); } - step.util.localStorageSetItem("swipeIntro", 1); } } - }, _updateDropdownContents: function (targetTrigger) { if (this._isDisplayOptionsDropdown(targetTrigger)) { @@ -237,7 +243,7 @@ var PassageMenuView = Backbone.View.extend({ var masterVersion = step.keyedVersions[this.model.get("masterVersion")]; this._updateDisplayModeOptions(masterVersion); this._updateDisplayOptions(); - this._updateSearchOptions(); + // this._updateSearchOptions(); }, /** * Obtains the options available in the masterVersion. @@ -288,9 +294,9 @@ var PassageMenuView = Backbone.View.extend({ }); }, - _updateSearchOptions: function () { + // _updateSearchOptions: function () { - }, + // }, _updateDisplayModeOptions: function (masterVersion) { //set the current display mode. this.displayModeContainer.find(".glyphicon").removeClass("active"); @@ -535,7 +541,7 @@ var PassageMenuView = Backbone.View.extend({ dropdown.append(li); dropdown.append(_.template(this.fontButtons)()) .find(".largerFontSize").click(this.changeFontSizeInThisPanel); - if (step.touchDevice) { + if (step.touchDevice && (step.util.activePassageId() == 0)) { var currentSwipeLRSetting = self.model.get("isSwipeLeftRight"); if (currentSwipeLRSetting == undefined) { this.model.save({isSwipeLeftRight: true}); @@ -566,7 +572,6 @@ var PassageMenuView = Backbone.View.extend({ * @private */ _createItemsInDropdown: function (dropdown, items) { -//
      var selectedOptions = this.model.get("selectedOptions") || ""; for (var i = 0; i < items.length; i++) { if (items[i].group) { @@ -603,7 +608,6 @@ var PassageMenuView = Backbone.View.extend({ } }, _createPassageOptions: function (dropdown) { -// var selectedOptions = this.model.get("selectedOptions") || ""; this._createItemsInDropdown(dropdown, this.items); var self = this; @@ -655,9 +659,9 @@ var PassageMenuView = Backbone.View.extend({ .append("" + text + "") .append(step.util.ui.selectMark("pull-right")); }, - _updateAvailableOptions: function () { - console.log("updating options"); - }, + // _updateAvailableOptions: function () { + // console.log("updating options"); + // }, _updateOptions: function () { //update the model var selectedOptions = this.displayOptions.find("[data-selected='true']"); @@ -724,12 +728,6 @@ var PassageMenuView = Backbone.View.extend({ } } }, - // decreaseFontSize: function (ev) { - // ev.stopPropagation(); - // step.util.activePassageId(this.model.get("passageId")); - // step.util.changeFontSize(this.$el, -1); - // return false; - // }, changeFontSizeInThisPanel: function (ev) { ev.stopPropagation(); step.util.showFontSettings(this.model.get("passageId")); @@ -829,15 +827,7 @@ var PassageMenuView = Backbone.View.extend({ showDots: function(activePassage) { var passageContent = activePassage.find(".passageContent"); passageContent.empty(); -// activePassage.find(".heading").remove(); -// var verseElements = activePassage.find(".verse"); -// if (verseElements.length == 0) - // verseElements = activePassage.find(".interlinear"); - // for (var i = verseElements.length - 1; i > 0; i--) { - // $(verseElements[i]).remove(); - // } var randomDots = "..... .... .... ....... ... .... ... ........ .... ... ... .... ... .....
      .... .. .... ... .... ........ .... ... .... ........ ... .... ... .....
      ... ..... .. .... ..... .... ..... ........ .... ...... .... ... .....
      .... .. .... ... .... ........ .... ... .... ...... ... .... ... .....
      ...... .... ... ..... .... ..... ..... ..... .... ... .... ... .....
      ...... .... ... ..... .... ..... ..... ..... ... . ... .... ... .....
      .... .. .... ... .... ........ .... ... .... ...... ... .... ... .....
      ... ..... .... .... ..... .... ..... ........ .... ... ... .... ... .....
      .... .. .... ... .... ........ .... ... .... ... ... ... .... ... .....
      ...... .... ... ..... .... ..... ..... ..... .. ... .... ... ....." + randomDots + "
      " + randomDots); passageContent.html(randomDots + "
      " + randomDots + "
      " + randomDots); }, removeSearchArgs: function(args) { @@ -911,32 +901,26 @@ var PassageMenuView = Backbone.View.extend({ try { if (document.getElementsByClassName("mainPanel")[0].style.paddingTop == "0px") { document.getElementById("stepnavbar").style.display = "block"; - document.getElementsByClassName("resizePanel")[0].title = "Increase size of panel"; + $('.resizePanel').attr('title', 'Increase size of panel'); + document.getElementsByClassName("resizePanel")[0].title = ""; document.getElementsByClassName("mainPanel")[0].style.paddingTop="50px"; - document.getElementsByClassName("glyphicon-resize-full")[0].style.display = "inline"; - document.getElementsByClassName("glyphicon-resize-small")[0].style.display = "none"; + $('.glyphicon-resize-full').css("display","inline"); + $('.glyphicon-resize-small').css("display","none"); } else { document.getElementById("stepnavbar").style.display = "none"; - document.getElementsByClassName("resizePanel")[0].title = "Decrease size of panel"; + $('.resizePanel').attr('title', 'Decrease size of panel'); document.getElementsByClassName("mainPanel")[0].style.paddingTop="0px"; - document.getElementsByClassName("glyphicon-resize-full")[0].style.display = "none"; - document.getElementsByClassName("glyphicon-resize-small")[0].style.display = "inline"; + $('.glyphicon-resize-full').css("display","none"); + $('.glyphicon-resize-small').css("display","inline"); } - document.getElementsByClassName("resizePanel")[0].style.backgroundColor = "white"; + $('.resizePanel').css("background-color","var(--clrBackground)"); } catch(e) { } }, updateVisibleCloseButton: function () { var shouldShow = $(".column").not(".examplesColumn").length > 1; this.$el.find(".closeColumn").toggleClass("disabled", !shouldShow); -// if (!shouldShow) { -// make sure it's not the last button -// this.$el.find(".closeColumn").insertBefore(this.$el.find(".openNewPanel")); -// } else { -// ensure last element -// this.$el.find(".openNewPanel").insertBefore(this.$el.find(".closeColumn")); -// } } }); diff --git a/step-web/src/main/webapp/js/backbone/views/view_pick_bible.js b/step-web/src/main/webapp/js/backbone/views/view_pick_bible.js index 68c8dbb8f2..0b1366725d 100644 --- a/step-web/src/main/webapp/js/backbone/views/view_pick_bible.js +++ b/step-web/src/main/webapp/js/backbone/views/view_pick_bible.js @@ -153,6 +153,7 @@ var PickBibleView = Backbone.View.extend({ this.$el.find(this._getSelectedTab()).addClass("active"); this.bibleVersions = this.$el.find("#bibleVersions").modal({ show: true}); + step.util.blockBackgroundScrolling("bibleVersions"); // this.$el.find("input[type='text']").focus(); this.$el.find(".btn").click(this.handleLanguageButton); this.$el.find(".closeModal").click(this.closeModal); diff --git a/step-web/src/main/webapp/js/backbone/views/view_quick_lexicon.js b/step-web/src/main/webapp/js/backbone/views/view_quick_lexicon.js index 09173203d9..5cc8213e92 100644 --- a/step-web/src/main/webapp/js/backbone/views/view_quick_lexicon.js +++ b/step-web/src/main/webapp/js/backbone/views/view_quick_lexicon.js @@ -1,5 +1,5 @@ var QuickLexicon = Backbone.View.extend({ - templateHeader: '
      ' + + templateHeader: '
      ' + '
      ' + '', templateFooter: '
      ', @@ -63,7 +63,10 @@ var QuickLexicon = Backbone.View.extend({ this.render(); }, - processQuickInfo: function (origData, self, strongsNotToDisplay, multipleStrongTextFromSearchModal) { + processQuickInfo: function (origData, parameters) { + var self = parameters[0]; + var strongsNotToDisplay = parameters[1]; + var multipleStrongTextFromSearchModal = parameters[2]; $("#quickLexicon").remove(); var morphOnly = false; var data = JSON.parse(JSON.stringify(origData)); @@ -202,21 +205,33 @@ var QuickLexicon = Backbone.View.extend({ strongsToUse = step.util.fixStrongNumForVocabInfo(strongsToUse, false); strongsNotToDisplay = step.util.fixStrongNumForVocabInfo(strongsNotToDisplay, false); } - var vocabMorphFromJson = step.util.getVocabMorphInfoFromJson(strongsToUse, this.morph, this.version); var multipleStrongText = (typeof self.options.txtForMultiStrong === "string") ? self.options.txtForMultiStrong : ""; - if (vocabMorphFromJson.vocabInfos.length > 0) { - self.processQuickInfo(vocabMorphFromJson, self, strongsNotToDisplay, multipleStrongText); - return; - } - return $.getSafe(MODULE_GET_QUICK_INFO, [this.version, this.reference, strongsToUse, this.morph, step.userLanguageCode], function (data) { - self.processQuickInfo(data, self, strongsNotToDisplay, multipleStrongText); + var callBack1Param = [ self, strongsNotToDisplay, multipleStrongText ]; + var callBack2Param = [ this.version, this.reference, strongsToUse, this.morph, step.userLanguageCode, self, strongsNotToDisplay, multipleStrongText, self.processQuickInfo ]; + step.util.getVocabMorphInfoFromJson(strongsToUse, this.morph, this.version, self.processQuickInfo, callBack1Param, + self.loadDefinitionFromRestAPI, callBack2Param); + }, + loadDefinitionFromRestAPI: function ( paramArray ) { + var version = paramArray[0]; + var reference = paramArray[1]; + var strongsToUse = paramArray[2]; + var morph = paramArray[3]; + var userLanguageCode = paramArray[4]; + var callerSelf = paramArray[5]; + var strongsNotToDisplay = paramArray[6]; + var multipleStrongText = paramArray[7]; + var callBackProcessQuickInfo = paramArray[8]; + $.getSafe(MODULE_GET_QUICK_INFO, [version, reference, strongsToUse, morph, userLanguageCode], function (data) { + callBackProcessQuickInfo(data, [ callerSelf, strongsNotToDisplay, multipleStrongText ]); }).error(function() { if (changeBaseURL()) - $.getSafe(MODULE_GET_QUICK_INFO, [this.version, this.reference, strongsToUse, this.morph, step.userLanguageCode], function (data) { - self.processQuickInfo(data, self, strongsNotToDisplay, multipleStrongText); + $.getSafe(MODULE_GET_QUICK_INFO, [version, reference, strongsToUse, morph, userLanguageCode], function (data) { + callBackProcessQuickInfo(data, [ callerSelf, strongsNotToDisplay, multipleStrongText ]); }) }); - }, /** + return false; + }, + /** * Updates the text and shows it * @param strongNumbers */ @@ -288,7 +303,13 @@ var QuickLexicon = Backbone.View.extend({ lexicon.click(function () { var strongToUse = (typeof self.augStrong === "string") ? self.augStrong : self.strong; step.util.ui.showDef({ strong: strongToUse, morph: self.morph }); + // lexicon.remove(); + }); + } + else if (!step.touchDevice) { + lexicon.mouseover(function() { lexicon.remove(); + step.util.keepQuickLexiconOpen = false; }); } @@ -297,7 +318,8 @@ var QuickLexicon = Backbone.View.extend({ step.util.keepQuickLexiconOpen = false; }); - this.passageContainer.find(".passageContent > .passageContentHolder, .passageContent > span").one('scroll', function() { + var monitorElement = (step.touchDevice && !step.touchWideDevice) ? $(document) : this.passageContainer.find(".passageContent > .passageContentHolder, .passageContent > span"); + monitorElement.one('scroll', function() { lexicon.remove(); }) step.touchForQuickLexiconTime = 0; diff --git a/step-web/src/main/webapp/js/backbone/views/view_restore.js b/step-web/src/main/webapp/js/backbone/views/view_restore.js index c53cc5db44..c7bb6b100b 100644 --- a/step-web/src/main/webapp/js/backbone/views/view_restore.js +++ b/step-web/src/main/webapp/js/backbone/views/view_restore.js @@ -84,7 +84,7 @@ var RestorePassageView = Backbone.View.extend({ if (el.prop('checked')) { //restore column step.util.createNewColumn(false, model); - step.router.handleRenderModel(model, null, null, -1); + step.router.handleRenderModel(model, null, null); } else { //never notify, no point step.passages.remove(model, {silent: true}); 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 39751548d8..a537544e92 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 @@ -41,7 +41,6 @@ var SidebarView = Backbone.View.extend({ else if (data == '#help') { mode = 'help'; } - this.model.save({ mode: mode }); @@ -49,7 +48,8 @@ var SidebarView = Backbone.View.extend({ activate: function () { var self = this; //make sidebar visible - this.openSidebar(); + if (!step.touchDevice || step.touchWideDevice) + this.openSidebar(); //show the correct tab this.$el.find("[data-target='#" + this.model.get("mode") + "']").tab("show"); @@ -84,19 +84,9 @@ var SidebarView = Backbone.View.extend({ console.log("MODULE_GET_INFO undefined H0001"); return; } - var vocabMorphFromJson = step.util.getVocabMorphInfoFromJson(strong, morph, version); - if (vocabMorphFromJson.vocabInfos.length > 0) { - self.createDefinition(vocabMorphFromJson, ref, allVersions); - return; - } - $.getSafe(MODULE_GET_INFO, [version, ref, strong, morph, step.userLanguageCode], function (data) { - self.createDefinition(data, ref, allVersions); - }).error(function() { - if (changeBaseURL()) - $.getSafe(MODULE_GET_INFO, [version, ref, strong, morph, step.userLanguageCode], function (data) { - self.createDefinition(data, ref, allVersions); - }) - }); + callBackCreateDefParams = [ ref, allVersions ]; + callBackLoadDefFromAPIParams = [ version, ref, strong, morph, allVersions, self.createDefinition]; + step.util.getVocabMorphInfoFromJson(strong, morph, version, self.createDefinition, callBackCreateDefParams, self.loadDefinitionFromRestAPI, callBackLoadDefFromAPIParams); } else if (this.model.get("mode") == 'analysis') { self.createAnalysis(); @@ -114,6 +104,24 @@ var SidebarView = Backbone.View.extend({ if ((cv[C_numOfAnimationsAlreadyPerformedOnSamePage] !== undefined) && (cv[C_numOfAnimationsAlreadyPerformedOnSamePage] !== null)) cv[C_numOfAnimationsAlreadyPerformedOnSamePage] = 0; }, + loadDefinitionFromRestAPI: function (parameters) { + var version = parameters[0]; + var ref = parameters[1]; + var strong = parameters[2]; + var morph = parameters[3]; + var allVersions = parameters[4]; + var callBackCreateDef = parameters[5]; + $.getSafe(MODULE_GET_INFO, [version, ref, strong, morph, step.userLanguageCode], function (data) { + callBackCreateDef(data, [ ref, allVersions ]); + //return false; + }).error(function() { + if (changeBaseURL()) + $.getSafe(MODULE_GET_INFO, [version, ref, strong, morph, step.userLanguageCode], function (data) { + callBackCreateDef(data, [ ref, allVersions ]); + }) + }); + //return false; + }, _createBaseTabs: function () { var tabContent = $("
      "); var heightToSet = $('.passageContainer.active').height(); @@ -152,24 +160,31 @@ var SidebarView = Backbone.View.extend({ else { this.analysisView.refresh(); } + if (step.touchDevice && !step.touchWideDevice) { + this.closeSidebar() + step.sidebar = null; + } }, createHelp: function () { this.helpView = new ExamplesView({el: this.help}); }, - createDefinition: function (data, ref, allVersions) { + createDefinition: function (data, parameters) { + var ref = parameters[0]; + var allVersions = parameters[1]; var displayLexicalRelatedWords = (($(".detailLex:visible").length > 0) || (step.util.localStorageGetItem("sidebar.detailLex") === "true")); //get definition tab this.lexicon.detach(); this.lexicon.empty(); - $('#quickLexicon').remove(); - var alternativeEntries = $("
      "); - this.lexicon.append(alternativeEntries); - this.lexicon.append($("

      ").append(__s.lexicon_vocab)); - - if (data.vocabInfos.length == 0) { + // var alternativeEntries = $("
      "); // does not seem to be used. PT 12/2/2023 + // this.lexicon.append(alternativeEntries); + var headerType = "h4"; + if (!step.touchDevice || step.touchWideDevice) { + this.lexicon.append("

      "); + headerType = "h2"; + } + if (data.vocabInfos.length == 0) return; - } var urlLang = $.getUrlVar("lang"); if (urlLang == null) urlLang = ""; else urlLang = urlLang.toLowerCase(); @@ -183,12 +198,10 @@ var SidebarView = Backbone.View.extend({ else isOTorNT = "NT"; } + var panelBodies = []; if (data.vocabInfos.length > 1) { //multiple entries var panelGroup = $('
      '); - var openDef = _.min(data.vocabInfos, function (def) { - return def.count; - }); for (var i = 0; i < data.vocabInfos.length; i++) { var item = data.vocabInfos[i]; var isHebrew = data.vocabInfos[i].strongNumber.substring(0,1) === 'H'; @@ -198,15 +211,12 @@ var SidebarView = Backbone.View.extend({ else if (currentUserLang =="zh") currentGloss += " " + item._zh_Gloss; else if (currentUserLang =="zh_tw") currentGloss += " " + item._zh_tw_Gloss; else if (currentUserLang =="km") currentGloss += " " + item._km_Gloss; - var panelTitle = currentGloss + " (" + item.stepTransliteration + " - " + '' + item.accentedUnicode + ")"; - var panelContentContainer = $('
      ').attr("id", panelId); + var panelTitle = "" + currentGloss + " (" + item.stepTransliteration + " - " + '' + item.accentedUnicode + ")"; + var isIn = (i == 0) ? " in" : ""; // expand (show) the first one to the users + var panelContentContainer = $('
      ').attr("id", panelId); var panelBody = $('
      '); - panelContentContainer.append(panelBody); - - if (openDef == data.vocabInfos[i]) { - panelContentContainer.addClass("in"); - } - + if (!step.touchDevice || step.touchWideDevice) + panelContentContainer.append(panelBody); this._createBriefWordPanel(panelBody, item, currentUserLang, allVersions); // need to handle multiple morphInfo (array) if ((lastMorphCode != '') && (data.morphInfos.length == 0)) { @@ -215,11 +225,11 @@ var SidebarView = Backbone.View.extend({ if (i < data.morphInfos.length) { this._createBriefMorphInfo(panelBody, data.morphInfos[i]); } - this._createWordPanel(panelBody, item, currentUserLang, allVersions, isOTorNT); + this._createWordPanel(panelBody, item, currentUserLang, allVersions, isOTorNT, headerType); if (i < data.morphInfos.length) { - this._createMorphInfo(panelBody, data.morphInfos[i]); + this._createMorphInfo(panelBody, data.morphInfos[i], headerType); } - + panelBodies.push(panelBody); var panelHeading = ''; @@ -227,28 +237,41 @@ var SidebarView = Backbone.View.extend({ panelGroup.append(panel); } this.lexicon.append(panelGroup); - } else { - this._createBriefWordPanel(this.lexicon, data.vocabInfos[0], currentUserLang, allVersions); + var panelBody = $('
      '); + this._createBriefWordPanel(panelBody, data.vocabInfos[0], currentUserLang, allVersions); // need to handle multiple morphInfo (array) if ((lastMorphCode != '') && (data.morphInfos.length == 0)) { data.morphInfos = cf.getTOSMorphologyInfo(lastMorphCode); } if (data.morphInfos.length > 0) { - this._createBriefMorphInfo(this.lexicon, data.morphInfos[0]); + this._createBriefMorphInfo(panelBody, data.morphInfos[0]); } - this._createWordPanel(this.lexicon, data.vocabInfos[0], currentUserLang, allVersions, isOTorNT); + this._createWordPanel(panelBody, data.vocabInfos[0], currentUserLang, allVersions, isOTorNT, headerType); if (data.morphInfos.length > 0) { - this._createMorphInfo(this.lexicon, data.morphInfos[0]); + this._createMorphInfo(panelBody, data.morphInfos[0], headerType); } + if ((step.touchDevice) && (!step.touchWideDevice)) + panelBodies.push(panelBody); + else + this.lexicon.append(panelBody); + } + if (step.touchDevice && !step.touchWideDevice) { + step.util.showLongAlert(this.lexicon.html(), "" + __s.lexicon_vocab + "", panelBodies); + this.closeSidebar(); + step.sidebar = null; } - this.tabContainer.append(this.lexicon); + else { + this.lexicon.find("h1").text(__s.lexicon_vocab); + this.tabContainer.append(this.lexicon); + } + if (displayLexicalRelatedWords) { $(".detailLex").show(); $("#detailLexSelect").removeClass("glyphicon-triangle-right").addClass("glyphicon-triangle-bottom"); } - this._isItALocation(data.vocabInfos[0], ref); + this._isItALocation(data.vocabInfos[0], ref); }, _createBriefWordPanel: function (panel, mainWord, currentUserLang) { var userLangGloss = ""; @@ -378,6 +401,7 @@ var SidebarView = Backbone.View.extend({ var args = "strong=" + encodeURIComponent(strongNumber) + refURLStr; step.util.activePassage().save({ strongHighlights: strongNumber }, {silent: true}); step.router.navigatePreserveVersions(args, false, true); + step.util.closeModal("showLongAlertModal"); })); } ul.append(li); @@ -407,7 +431,7 @@ var SidebarView = Backbone.View.extend({ var statsOccursMsg = step.util.formatFrequency({versionCountOT: totalOT, versionCountNT: totalNT}, frequency, hasBothTestaments); var isHebrew = detailLex[1].substring(0,1) === 'H'; var vocabTitle = detailLex[2] + " (" + detailLex[5] + " - " + '' + detailLex[4] + ")" - panel.append($("").attr("onclick", "javascript:void(0)"). + panel.append($("").attr("onclick", "javascript:void(0)"). data("strongNumber", detailLex[1]). data("vocabTitle", vocabTitle). append(''). @@ -416,12 +440,14 @@ var SidebarView = Backbone.View.extend({ var args = "strong=" + encodeURIComponent(strongNumber); step.util.activePassage().save({strongHighlights: strongNumber}, {silent: true}); step.router.navigatePreserveVersions(args, false, true); + step.util.closeModal("showLongAlertModal"); return false; }). hover(function (ev) { + if (step.touchDevice) return; var strong = $(this).data("strongNumber"); var wordInfo = $(this).data("vocabTitle"); - fetch("https://www.stepbible.org/rest/search/masterSearch/version-ESV|" + + fetch("https://www.stepbible.org/rest/search/masterSearch/version=ESV|" + "strong=" + strong + "/HNVUG///" + strong + "///en?lang=en") .then(function(response) { @@ -431,6 +457,7 @@ var SidebarView = Backbone.View.extend({ step.util.ui.showListOfVersesInQLexArea(data, ev.pageY, wordInfo, $('#columHolder')); }); }, function () { // mouse pointer ends hover (leave) + if (step.touchDevice) return; $("#quickLexicon").remove(); }) ); @@ -491,6 +518,7 @@ var SidebarView = Backbone.View.extend({ } if (allStrongs.length > 1) currentSearch = searchJoins + ")|" + currentSearch; step.router.navigatePreserveVersions(currentSearch, false, true, true); + step.util.closeModal("showLongAlertModal"); return false; }). hover(function() { @@ -529,11 +557,13 @@ var SidebarView = Backbone.View.extend({ var args = "strong=" + encodeURIComponent(strongNumber); step.util.activePassage().save({strongHighlights: strongNumber}, {silent: true}); step.router.navigatePreserveVersions(args, false, true); - return false; + step.util.closeModal("showLongAlertModal"); + return false; }).hover(function (ev) { + if (step.touchDevice) return; var strong = $(this).data("strongNumber"); var wordInfo = $(this).data("vocabTitle"); - fetch("https://www.stepbible.org/rest/search/masterSearch/version-ESV|" + + fetch("https://www.stepbible.org/rest/search/masterSearch/version=ESV|" + "strong=" + strong + "/HNVUG///" + strong + "///en?lang=en") .then(function(response) { @@ -543,6 +573,7 @@ var SidebarView = Backbone.View.extend({ step.util.ui.showListOfVersesInQLexArea(data, ev.pageY, wordInfo, $('#columHolder')); }); }, function () { // mouse pointer ends hover (leave) + if (step.touchDevice) return; $("#quickLexicon").remove(); }) ); @@ -614,7 +645,7 @@ var SidebarView = Backbone.View.extend({ this._lookUpGeoInfo(mainWord, bookName, stepLink); }, - _createWordPanel: function (panel, mainWord, currentUserLang, allVersions, isOTorNT) { + _createWordPanel: function (panel, mainWord, currentUserLang, allVersions, isOTorNT, headerType) { var currentWordLanguageCode = mainWord.strongNumber[0]; var bibleVersion = this.model.get("version") || "ESV"; if (typeof mainWord.shortDef === "string") { @@ -637,7 +668,7 @@ var SidebarView = Backbone.View.extend({ // false; var spanishDef = mainWord._es_Definition; if (spanishDef) { - panel.append($("

      ").append(__s.es_lexicon_meaning)); + panel.append($("<" + headerType + ">").append(__s.es_lexicon_meaning)); this._addLinkAndAppend(panel, spanishDef, currentWordLanguageCode, bibleVersion); } } @@ -648,7 +679,7 @@ var SidebarView = Backbone.View.extend({ if ((currentUserLang == "zh_tw") && (mainWord._zh_tw_Definition != undefined)) chineseDef = mainWord._zh_tw_Definition; else if (mainWord._zh_Definition != undefined) chineseDef = mainWord._zh_Definition; if (chineseDef) { - panel.append($("

      ").append(__s.zh_lexicon_meaning_fhl)); + panel.append($("<" + headerType + ">").append(__s.zh_lexicon_meaning_fhl)); this._addLinkAndAppend(panel, chineseDef, currentWordLanguageCode, bibleVersion); } var useSecondZhLexicon = step.passages.findWhere({ passageId: step.util.activePassageId()}).get("isSecondZhLexicon"); @@ -658,14 +689,14 @@ var SidebarView = Backbone.View.extend({ else if (currentUserLang == "vi") { var vietnameseDef = mainWord._vi_Definition; if (vietnameseDef) { - panel.append($("

      ").append("Từ điển Hy Lạp-Việt")); + panel.append($("<" + headerType + ">").append("Từ điển Hy Lạp-Việt")); this._addLinkAndAppend(panel, vietnameseDef, currentWordLanguageCode, bibleVersion); } } else if (currentUserLang == "km") { var khmerDef = mainWord._km_Definition; if (khmerDef) { - panel.append($("

      ").append("និយមន័យ")); + panel.append($("<" + headerType + ">").append("និយមន័យ")); this._addLinkAndAppend(panel, khmerDef, currentWordLanguageCode, bibleVersion); } } @@ -676,19 +707,19 @@ var SidebarView = Backbone.View.extend({ message = "based on abridged Brown-Driver-Briggs"; else if (isOTorNT === "NT") message = "based on Teknia Greek"; - panel.append($("

      ").append(__s.lexicon_meaning)); + panel.append($("<" + headerType + " title='" + message + "'>").append(__s.lexicon_meaning)); this._addLinkAndAppend(panel, mainWord.mediumDef, currentWordLanguageCode, bibleVersion); } //longer definitions if (mainWord.lsjDefs) { - panel.append($("

      ").append(currentWordLanguageCode.toLowerCase() === 'g' ? __s.lexicon_lsj_definition : __s.lexicon_bdb_definition)); + panel.append($("<" + headerType + " title='based on Liddell-Scott-Jones Greek Lexicon, 9th ed'>").append(currentWordLanguageCode.toLowerCase() === 'g' ? __s.lexicon_lsj_definition : __s.lexicon_bdb_definition)); panel.append('' + mainWord.lsjDefs + ''); } } relatedNosToDisplay = this._relatedNosNotDisplayed(mainWord.relatedNos, detailLex); if (relatedNosToDisplay.length > 0) { - panel.append($("

      ").append(__s.lexicon_related_words)); + panel.append($("<" + headerType + ">").append(__s.lexicon_related_words)); var ul = $('

      ').modal("show"); + step.util.blockBackgroundScrolling('grammarClrModal'); }, correctPassageNotInBible: function (userChoice, queryString) { $("#showLongAlertModal").click(); @@ -2189,6 +2205,8 @@ step.util = { $('textarea#enterYourPassage').focus().val(step.tempKeyInput); step.tempKeyInput = ""; } + else + step.util.blockBackgroundScrolling("passageSelectionModal"); }, copyModal: function () { @@ -2229,6 +2247,7 @@ step.util = { '
      ' + '

      '; $(_.template(modalHTML)()).modal("show"); + step.util.blockBackgroundScrolling("copyModal"); }, searchSelectionModal: function () { @@ -2332,6 +2351,7 @@ step.util = { '

      ' + '
      ' + '
      ')()).modal("show"); + step.util.blockBackgroundScrolling("searchSelectionModal"); $('textarea#userTextInput').focus(); }, showVideoModal: function (videoFile, seconds, width) { @@ -2369,6 +2389,7 @@ step.util = { '
      ' + '
      ' )()).modal("show"); + step.util.blockBackgroundScrolling("videoModal"); }, showSummary: function (reference) { element = document.getElementById('showBookOrChapterSummaryModal'); @@ -2378,10 +2399,10 @@ step.util = { var osisID = tmpArray[0]; // get the string before the "." character var longBookName = osisID; var posOfBook = step.util.bookOrderInBible(osisID); - var arrayOfTyplicalBooksChapters = JSON.parse(__s.list_of_bibles_books); + var arrayOfTyplicalBooksAndChapters = JSON.parse(__s.list_of_bibles_books); if ((posOfBook > -1) && - (typeof arrayOfTyplicalBooksChapters !== "undefined")) - longBookName = arrayOfTyplicalBooksChapters[posOfBook][0]; + (typeof arrayOfTyplicalBooksAndChapters !== "undefined")) + longBookName = arrayOfTyplicalBooksAndChapters[posOfBook][0]; var chapterNum = (tmpArray.length > 1) ? parseInt(tmpArray[1].split(":")[0].split("-")[0].split(";")[0]) : 1; if (typeof chapterNum !== "number") chapterNum = 1; var bibleSummary = @@ -2471,7 +2492,6 @@ step.util = { '' + '
      '; - $.ajaxSetup({async: false}); $.getJSON("html/json/" + osisID.toLowerCase() + ".json", function(summary) { var bookSummary = '
      Book summary of ' + longBookName + '
      ' + @@ -2537,15 +2557,22 @@ step.util = { '' + '' )()).modal("show"); + step.util.blockBackgroundScrolling('showBookOrChapterSummaryModal'); }); - $.ajaxSetup({async: true}); }, - showLongAlert: function (message, headerText) { - element = document.getElementById('showLongAlertModal'); - if (element) element.parentNode.removeChild(element); - $(".modal-backdrop.in").remove(); + blockBackgroundScrolling: function(idName) { + if (step.touchDevice && !step.touchWideDevice) { + $("body").css("overflow-y","hidden"); // do not let body (web page) scroll + $('#' + idName).on('hidden.bs.modal', function (e) { + $("body").css("overflow-y","auto"); // if modal is hidden, let body scroll + }); + } + }, + showLongAlert: function (message, headerText, panelBodies) { + step.util.closeModal("showLongAlertModal"); + var extraStyling = (panelBodies == null) ? '' : 'style="padding:25px" '; $(_.template( - '