41b1a2b603d2d1103b1cce9989a7f92aa76df840 hiram Thu Oct 29 13:54:31 2020 -0700 mouseOver function now enabled by hg.conf variable refs #21980 diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index 772e4c5..9602be2 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -3782,32 +3782,32 @@ } } // Need to update vis box (in case this is reached via back-button) if (imageV2.backSupport && fullImageReload) { // Update abbr so that rows can be resorted properly var abbr = $(newTr).attr('abbr'); if (abbr) { $(tr).attr('abbr', abbr); } if (newJsonRec) vis.update(id, vis.enumOrder[newJsonRec.visibility]); } -// // uncomment to enable the mouseOver system 2020-10 - Hiram -// mouseOver.updateMouseOver(id); + // hg.conf will turn this on 2020-10 - Hiram + if (window.mouseOverEnabled) { mouseOver.updateMouseOver(id); } return true; } } return false; }, updateImgForAllIds: function (response, oldJson, newJson) { // update all rows in imgTbl based upon navigateInPlace response. var imgTbl = $('#imgTbl'); // We update rows one at a time // (b/c updating the whole imgTbl at one time doesn't work in IE). var id; for (id in newJson.trackDb) { var newJsonRec = newJson.trackDb[id]; @@ -4616,33 +4616,32 @@ // add a 'mousemove' and 'mouseout' event listener to each track // display object var objectName = "td_data_" + trackName; var objectId = document.getElementById(objectName); if (! objectId) { return; } // not sure why objects are not found // there should be a more simple jQuery function to bind these events objectId.addEventListener('mousemove', mouseOver.mouseInTrackImage); objectId.addEventListener('mouseout', mouseOver.popUpDisappear); // would be nice to know when the window is scrolling in the browser so // the text box could disappear. These do not appear to work. // Beware, onscroll event is continuous while scrolling. // objectId.addEventListener('onscroll', popUpDisappear); // window.addEventListener('onscroll', popUpDisappear); var itemCount = 0; // just for monitoring purposes // save incoming x1,x2,v data into the mouseOver.spans[trackName][] array -// arr[trackName].forEach(function(box) { for (var span in arr[trackName]) { - mouseOver.spans[trackName].push(span); + mouseOver.spans[trackName].push(arr[trackName][span]); ++itemCount; } mouseOver.tracks[trackName] = itemCount; // merely for debugging watch } }, // receiveData: function (arr) // ========================================================================= // fetchMapData() sends JSON request, callback to receiveData() upon return // ========================================================================= fetchMapData: function (url) { var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (4 === this.readyState && 200 === this.status) { var mapData = JSON.parse(this.responseText); @@ -4721,32 +4720,32 @@ $('.submitOnEnter').keydown(trackSearch.searchKeydown); findTracks.normalize(); findTracks.updateMdbHelp(0); } } }; /////////////// //// READY //// /////////////// $(document).ready(function() { imageV2.moveTiming(); - // uncomment to enable mouseOver 2020-10 (also one line in updateImgForId) -// mouseOver.addListener(); + // hg.conf will turn this on 2020-10 - Hiram + if (window.mouseOverEnabled) { mouseOver.addListener(); } // on Safari the back button doesn't call the ready function. Reload the page if // the back button was pressed. $(window).bind("pageshow", function(event) { if (event.originalEvent.persisted) { window.location.reload() ; } }); // The page may be reached via browser history (back button) // If so, then this code should detect if the image has been changed via js/ajax // and will reload the image if necessary. // NOTE: this is needed for IE but other browsers can detect the dirty page much earlier if (!imageV2.backSupport) { if (imageV2.isDirtyPage()) {