Skip to content

Commit

Permalink
Make mouseover of verse number work on touch device
Browse files Browse the repository at this point in the history
  • Loading branch information
patricksptang committed Feb 18, 2024
1 parent 566913f commit cbe3943
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions step-web/src/main/webapp/js/step.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -1796,19 +1796,29 @@ step.util = {
return features + " ";
},
enhanceVerseNumbers: function (passageId, passageContent, version, isSearch) {
var verseNumTimer;
$(".verseNumber", passageContent).closest("a").hover(function () {
var isVerseVocab = step.passages.findWhere({ passageId: passageId }).get("isVerseVocab");
if (isVerseVocab || isVerseVocab == null) {
if (typeof verseNumTimer !== "undefined") // clear previous timeout
clearTimeout(verseNumTimer);
verseNumTimer = setTimeout(step.util.ui._addSubjectAndRelatedWordsPopup, 500, passageId, $(this), version, isSearch);
// step.util.ui._addSubjectAndRelatedWordsPopup(passageId, $(this), version, isSearch);
}
}, function() {
if (typeof verseNumTimer !== "undefined")
clearTimeout(verseNumTimer);
});
if (step.touchDevice) {
$(".verseNumber", passageContent).closest("a").mouseenter(function () {
var isVerseVocab = step.passages.findWhere({ passageId: passageId }).get("isVerseVocab");
if (isVerseVocab || isVerseVocab == null) {
step.util.ui._addSubjectAndRelatedWordsPopup(passageId, $(this), version, isSearch);
}
});
}
else {
var verseNumTimer;
$(".verseNumber", passageContent).closest("a").hover(function () {
var isVerseVocab = step.passages.findWhere({ passageId: passageId }).get("isVerseVocab");
if (isVerseVocab || isVerseVocab == null) {
if (typeof verseNumTimer !== "undefined") // clear previous timeout
clearTimeout(verseNumTimer);
verseNumTimer = setTimeout(step.util.ui._addSubjectAndRelatedWordsPopup, 500, passageId, $(this), version, isSearch);

}
}, function() {
if (typeof verseNumTimer !== "undefined")
clearTimeout(verseNumTimer);
});
}
},

_addSubjectAndRelatedWordsPopup: function (passageId, element, version, isSearch) {
Expand Down

0 comments on commit cbe3943

Please sign in to comment.