25f258c7fdfbdf417a917fcd00fff78d698def9b chmalee Fri Aug 30 12:01:24 2024 -0700 Big run through of changes to accomodate jquery 3.7.1 upgrade. Most of the changes are replacing the event methods with a change to .on(event, function(..)). A couple more changes are removing calls to jquery.type(). Also fixes various plugins and styles diff --git src/hg/js/hui.js src/hg/js/hui.js index 066bd9f..e256136 100644 --- src/hg/js/hui.js +++ src/hg/js/hui.js @@ -82,31 +82,31 @@ obj.lastIndex = obj.selectedIndex; } function matSelectViewForSubTracks(obj,view) { waitOnFunction( _matSelectViewForSubTracks, obj,view); } function exposeAll() { // Make main display dropdown show full if currently hide var visDD = normed($("select.visDD")); // limit to hidden if (visDD) { if ($(visDD).attr('selectedIndex') === 0) { $(visDD).attr('selectedIndex',$(visDD).children('option').length - 1); - $(visDD).change();// trigger on change code, which may trigger supertrack reshaping + $(visDD).trigger("change");// trigger on change code, which may trigger supertrack reshaping } // and effecting inherited subtrack vis // If superChild and hidden by supertrack, wierd things go on unless we trigger reshape if ($(visDD).hasClass('superChild')) visTriggersHiddenSelect(visDD); } } function matSubCbClick(subCB) { // subCB:onclick When a subtrack checkbox is clicked, it may result in // Clicking/unclicking the corresponding matrix CB. Also the // subtrack may be hidden as a result. // NOTE: if "subCfg" then 'change' event will update it @@ -182,31 +182,31 @@ this.checked = state; matCbComplete(this,true); }); var subCbs = $("input.subCB"); for (var sIx=1;sIx 0) $(list).val(inp.value); } return true; } function compositeCfgRegisterOnchangeAction(prefix) // FIXME: OBSOLETE when subCfg is released { // After composite level cfg settings written to HTML it is necessary to go back and // make sure that each time they change, any matching subtrack level cfg setting are changed. var list = $("input[name^='"+prefix+".']").not("[name$='.vis']"); - $(list).change(function(){compositeCfgUpdateSubtrackCfgs(this);}); + $(list).on("change", function(){compositeCfgUpdateSubtrackCfgs(this);}); list = $("select[name^='"+prefix+".']").not("[name$='.vis']"); - $(list).change(function(){compositeCfgUpdateSubtrackCfgs(this);}); + $(list).on("change", function(){compositeCfgUpdateSubtrackCfgs(this);}); } function subtrackCfgHideAll(table) { // hide all the subtrack configuration stuff $("div[id^='div_cfg_']").each( function (i) { $( this ).css('display','none'); $( this ).children("input[name$='.childShowCfg']").val("off"); }); // Hide all "..." metadata displayed $("div[id $= '_meta']:visible").toggle(); $("img[src$='../images/upBlue.png']").attr('src','../images/downBlue.png'); } function subtrackCfgShow(tableName) @@ -707,31 +707,31 @@ else $(this).hide(); } //else // warn('DEBUG: subtrack table row '+ix+' without subCB?'); }); } } function showOrHideSelectedSubtracks(inp) { // Show or Hide subtracks based upon radio toggle var showHide; if (arguments.length > 0) showHide=inp; else { - var onlySelected = $("input.allOrOnly'"); + var onlySelected = $("input.allOrOnly"); if (onlySelected.length > 0) showHide = onlySelected[0].checked; else return; } showSubTrackCheckBoxes(showHide); var tbody = $("tbody.sortable"); $(tbody).each(function (i) { sortTable.alternateColors(this); }); } ///// Following functions called on page load function matInitializeMatrix() @@ -1191,31 +1191,31 @@ return ($(obj).hasClass('disabled')); } //////////////////// //// superTrack //// //////////////////// var superT = { submitAndLink: function (obj) { var thisForm=$(obj).parents('form'); if (thisForm && $(thisForm).length === 1) { thisForm = thisForm[0]; $(thisForm).attr('action',obj.href); // just attach the straight href - $(thisForm).submit(); + $(thisForm).trigger("submit"); return false; // should not get here! } return true; }, topVis: function (show) { var superSel = $('select.visDD'); if (superSel && superSel.length === 1) { superSel = superSel[0]; if (show) { $(superSel).addClass('normalText'); $(superSel).attr('selectedIndex',1); $(superSel).removeClass('hiddenText'); } else { @@ -1360,32 +1360,32 @@ mat.matrix = $('table.matrix'); if (mat.matrix && mat.matrix.length === 1) { mat.resizeAngleLabels(); if (theClient.isIePre11() === false) { // IE pre v11 can't handle the hover! var cells = $('td.matCell'); if (cells && cells.length > 0) { var classList = $( cells[0] ).attr("class").split(" "); classList = aryRemove(classList,["matCell"]); mat.dimensions = classList.length; if (mat.dimensions > 1) { // No need unless this is a 2D matrix $('.matCell').hover( function (e) {mat.cellHover(this,true);}, function (e) {mat.cellHover(this,false);} ); // blur doesn't work because the screen isn't repainted - $(mat.matrix).blur(mat.clearGhostHilites()); - $(window).bind('focus',function (e) {mat.clearGhostHilites();}); + $(mat.matrix).on("blur", mat.clearGhostHilites()); + $(window).on('focus',function (e) {mat.clearGhostHilites();}); } } } } } }; // The following js depends upon the jQuery library $(document).ready(function() { mat.init(); if (normed($('table.subtracks'))) { matInitializeMatrix(); @@ -1410,81 +1410,80 @@ }); // Put navigation links in top corner navigationLinksSetup(); }); function selectLinkChanges($changed, $affected, mapping) { // When the $changed changes, examine the value of $affected to see if it // needs to be tweaked according to mapping, which is an object of objects // like this: { 'pickySetting' : { 'notOKValue': 'OKValue' } } // If $changed changes to 'pickySetting', and $affected is 'notOKValue', // then $affected is changed to 'OKValue'. Any notOKValue for pickySetting // is disabled. If $changed doesn't have a pickySetting, then all options // are enabled. var $affectedOptions = $affected.children('option'); - $changed.bind("change", function () { + $changed.on("change", function () { var changedVal = $changed.val(); var subst = mapping[changedVal]; - $affectedOptions.removeAttr('disabled'); + $affectedOptions.prop('disabled', false); if (subst) { var affectedVal = $affected.val(); if (subst[affectedVal]) { $affected.val(subst[affectedVal]); } for (var notOK in subst) { /* jshint loopfunc: true */// function inside loop works and replacement is awkward. var $option = $affectedOptions.filter( function() { return $(this).text() === notOK; } ); $option.attr('disabled','disabled'); } } }); } function multiWigSetupOnChange(track) { var $overlay = $('select[name="' + track + '.aggregate"]'); var $winFunc = $('select[name="' + track + '.windowingFunction"]'); if ($overlay && $winFunc) { selectLinkChanges($overlay, $winFunc, { 'stacked': { 'mean+whiskers': 'mean' } }); } else { $("#message").text('$ cant find my selectors for ' + track + '!'); } } // toggle the visibility of advanced controls in the filters function advancedSearchOnChange(controlName) { - $(document.getElementById(controlName)).click(function() { + $(document.getElementById(controlName)).on("click", function() { // get the list of advanced controls advancedControls = document.getElementsByClassName('advanced'); var newStyle; if ($(advancedControls).css('display') === 'none') { newStyle='display:visible'; $(this).find('img').attr('src','../images/upBlue.png'); } else { newStyle = 'display:none'; $(this).find('img').attr('src','../images/downBlue.png'); } for (var control in advancedControls ) advancedControls[control].style = newStyle; - } - ); + }); } var hlColor = '#aac6ff'; var prevHlColor; var hlColorDefault = '#aac6ff'; function makeHighlightPicker(cartVar, parentEl, trackName, label, cartColor = hlColorDefault) { /* Create an input with a color selection field, optionally append the resulting * html to parentEl, if parent is not null */ /* Some helper function for keeping track of colors */ let saveHlColor = function(hlColor, trackName) { hlColor = hlColor; if (typeof common !== "undefined" && common.track) { // regular hgTrackUi setCartVars([cartVar], [hlColor], null, true); @@ -1551,28 +1550,28 @@ showPalette: true, showInput: true, showSelectionPalette: true, showInitial: true, preferredFormat: "hex", localStorageKey: "genomebrowser", change: function() { let color = $(inpSpec).spectrum("get"); $(inpText).val(color); saveHlColor(color, trackName); }, }; $(inpSpec).spectrum(opt); // update the color picker if you change the input box - $(inpText).change(function() { + $(inpText).on("change", function() { $(inpSpec).spectrum("set", $(inpText).val()); saveHlColor($(inpText).val(), trackName); }); // Restore the default on Reset link click - $(inpResetLink).click(function() { + $(inpResetLink).on("click", function() { let hlDefault = hlColorDefault; $(inpText).val(hlDefault); $(inpSpec).spectrum("set", hlDefault); saveHlColor(hlDefault, trackName); }); $(inpSpec).spectrum("set", $(inpText).val()); }