81a8a460976bafc57a2df88a99e47431e2258245 kate Fri Jul 31 11:50:52 2020 -0700 Add hg.conf variable 'browser.recTrackSetsDetectChangge' to control whether recommended track sets features attempts to detect changes in the session. refs #25601 diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index 308f8d6..fb45c16 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -772,46 +772,30 @@ return postTheForm($(thisForm).attr('name'),cart.addUpdatesToUrl(obj.href)); } return true; } }; ///////////////////////// //// cart updating ///// /////////////////////// var cart = { // Controls queuing and ultimately updating cart variables vis ajax or submit. Queued vars // are held in an object with unique keys preventing duplicate updates and ensuring last update // takes precedence. WARNING: be careful creating an object with variables on the fly: // cart.setVarsObj({track: vis}) is invalid but cart.setVarsObj({'knownGene': vis}) is ok! - updateSessionPanel: function() - { - // change color of text - $('span.gbSessionChangeIndicator').addClass('gbSessionChanged'); - - // change mouseover on the panel. A bit fragile here inserting text in the mouseover specified in - // hgTracks.js, so depends on match with text there, and should present same message as C code - // (Perhaps this could be added as a script tag, so not duplicated) - var txt = $('span.gbSessionLabelPanel').attr('title'); - if (txt && !txt.match(/with changes/)) { - $('span.gbSessionLabelPanel').attr('title', txt.replace( - "track set", - "track set, with changes (added or removed tracks) you have requested")); - } - }, - updateQueue: {}, updatesWaiting: function () { // returns TRUE if updates are waiting. return objNotEmpty(cart.updateQueue); }, addUpdatesToUrl: function (url) { // adds any outstanding cart updates to the url, then clears the queue if (cart.updatesWaiting()) { //console.log('cart.addUpdatesToUrl: '+objKeyCount(cart.updateQueue)+' vars'); var updates = cart.varsToUrlData(); // clears the queue if (!url || url.length === 0) return updates; @@ -878,30 +862,49 @@ // Could update in background, however, failing to hit "refresh" is user choice // first in queue, schedule background update if (objKeyCount(cart.updateQueue) === 1) { // By unbind/bind, we assure that there is only one instance bound $(window).unbind('beforeunload', cart.beforeUnload); $(window).bind( 'beforeunload', cart.beforeUnload); } } } }, addVarsToQueue: function (names,values) { // creates a string of updates to save for ajax batch or a submit cart.queueVarsObj(arysToObj(names,values)); + }, + + updateSessionPanel: function() + { + if (typeof recTrackSetsDetectChanges === 'undefined' || recTrackSetsDetectChanges === null) + return; + + // change color of text + $('span.gbSessionChangeIndicator').addClass('gbSessionChanged'); + + // change mouseover on the panel. A bit fragile here inserting text in the mouseover specified in + // hgTracks.js, so depends on match with text there, and should present same message as C code + // (Perhaps this could be added as a script tag, so not duplicated) + var txt = $('span.gbSessionLabelPanel').attr('title'); + if (txt && !txt.match(/with changes/)) { + $('span.gbSessionLabelPanel').attr('title', txt.replace( + "track set", + "track set, with changes (added or removed tracks) you have requested")); + } } }; /////////////////////////////////////////////// //// visibility (mixed with group toggle) ///// /////////////////////////////////////////////// var vis = { // map cgi enum visibility codes to strings enumOrder: new Array("hide", "dense", "full", "pack", "squish"), update: function (track, visibility) { // Updates visibility state in hgTracks.trackDb and any visible elements on the page. // returns true if we modify at least one select in the group list var rec = hgTracks.trackDb[track];