f0924536bd800beff82e24c628629e2b19f6a72c Merge parents 2ee534e 9a71b67 tdreszer Tue Oct 25 17:45:03 2011 -0700 Fixed merge-o-mangla. diff --cc src/hg/js/hui.js index 9dba603,4382e5c..fec56c5 --- src/hg/js/hui.js +++ src/hg/js/hui.js @@@ -84,51 -85,43 +84,51 @@@ $( matCBs ).each( function (i) { matChkBoxNormalize( this, classesHidden ); }); } } matSubCBsSelected(); 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 = $("select.visDD"); // limit to hidden - if ($(visDD).length == 1 && $(visDD).attr('selectedIndex') == 0) { // limit to hidden - $(visDD).attr('selectedIndex',$(visDD).children('option').length - 1); - $(visDD).change();// trigger on change code, which may trigger supertrack reshaping + var visDD = normed($("select.visDD")); // limit to hidden + if (visDD != undefined) { + if ($(visDD).attr('selectedIndex') == 0) { + $(visDD).attr('selectedIndex',$(visDD).children('option').length - 1); - $(visDD).change(); // triggers onchange code effecting inherited subtrack vis - } ++ $(visDD).change();// trigger on change code, which may trigger supertrack reshaping ++ } // and effecting inherited subtrack vis } } 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. - matSubCBsetShadow(subCB); + + // NOTE: if "subCfg" then 'change' event will update it + if (isFauxDisabled(subCB,false)) { // disabled subCB is still clickable when "subCfg" + subCB.checked = true; + fauxDisable(subCB,false,""); // enable and get rid of message + } + matSubCBsetShadow(subCB,false); hideOrShowSubtrack(subCB); // When subCBs are clicked, 3-state matCBs may need to be set var classes = matViewClasses('hidden'); classes = classes.concat( matAbcCBclasses(false) ); var matCB = matCbFindFromSubCb( subCB ); if( matCB != undefined ) { matChkBoxNormalize( matCB, classes ); } //var abcCB = matAbcCbFindFromSubCb( subCB ); //if( abcCB != undefined ) { // matChkBoxNormalize( abcCB, classes ); //} if(subCB.checked) exposeAll(); // Unhide composite vis? @@@ -1091,70 -1136,128 +1091,160 @@@ } }); } } function tableSortAtButtonPress(anchor,tagId) { // Special ONLY for hgTrackUi sorting. Others use utils.js::tableSortOnButtonPress() var table = $( anchor ).parents("table.sortable"); if (table) { subtrackCfgHideAll(table); waitOnFunction( _tableSortOnButtonPressEncapsulated, anchor, tagId); } return false; // called by link so return false means don't try to go anywhere } +function fauxDisable(obj,disable,title) +{// Makes an obj appear disabled, but it isn't + // span.disabled & input.disabled is opacity 0.5 + // div.disabled is border-color: gray; color: gray; + if ($(obj).hasClass('subCB') == false || typeof(subCfg) !== "undefined") { + if(disable) { + if ($.browser.msie) + $(obj).css('opacity', '0.5'); + $(obj).addClass('disabled'); + } else { + if ($.browser.msie) + $(obj).css('opacity', '1'); // For some reason IE<9 accepts direct change but isn't happy with simply adding class! + $(obj).removeClass('disabled'); + } + } else { + obj.disabled = disable; + } + if (arguments.length > 2) + $(obj).attr("title",title); +} + +function isFauxDisabled(obj,orReallyDisabled) +{// Is object [faux] disabled? + if (orReallyDisabled && obj.disabled) + return true; + + return ($(obj).hasClass('disabled')); +} + + //////////////////// + //// superTrack //// + //////////////////// + var superT = { + + submitAndLink: function (obj) + { + var thisForm=$(obj).parents('form'); + if(thisForm != undefined && $(thisForm).length == 1) { + thisForm = thisForm[0]; + $(thisForm).attr('action',obj.href); // just attach the straight href + $(thisForm).submit(); + return false; // should not get here! + } + return true; + }, + + topVis: function (show) + { + var superSel = $('select.visDD'); + if (superSel != undefined && superSel.length == 1) { + superSel = superSel[0]; + if (show) { + $(superSel).addClass('normalText'); + $(superSel).attr('selectedIndex',1); + $(superSel).removeClass('hiddenText'); + } else { + $(superSel).attr('selectedIndex',0); + $(superSel).removeClass('normalText'); + $(superSel).addClass('hiddenText'); + } + } + }, + + plusMinus: function (check) + { + $("input:checkbox").each(function (i) { + $(this).attr("checked",check); + superT.childChecked(this,1); + if (!check) // all are unchecked so we can hide this whole thing. + superT.topVis(check); + }); + }, + + childChecked: function (cb,defaultVis) + { + var sel = $('select[name="' + cb.id + '"]'); + if (sel != undefined && sel.length == 1) { + sel = sel[0]; + var selIx = $(sel).attr('selectedIndex'); + if (cb.checked && selIx.toString() == "0") { + // What can be done to more intelligently default this? + // All to dense? Probably the best idea + // When first rendering page? Then how to save? + // Logic is: from [+][-] then dense; from cb, then full + if (defaultVis == undefined) + defaultVis = (sel.options.length - 1); // full + superT.selChanged(sel,defaultVis); + } else if (!(cb.checked) && selIx.toString() != "0") { + superT.selChanged(sel,0); + } + } + }, + + selChanged: function(sel,val) + { + var selIx = val; + if (val == undefined) // onchange event + selIx = $(sel).attr('selectedIndex'); + else // called from childChecked() so set value + $(sel).attr('selectedIndex',val); + + if (selIx == 0) { + $(sel).removeClass('normalText'); + $(sel).addClass('hiddenText'); + } else { + $(sel).removeClass('hiddenText'); + $(sel).addClass('normalText'); + superT.topVis(true); + } + if (val == undefined) { // onchange event only + var cb = $('input#'+sel.name); + if (cb != undefined && cb.length == 1) { + cb = cb[0]; + $(cb).attr('checked',(selIx > 0)); + } + } + } + } + // The following js depends upon the jQuery library $(document).ready(function() { + if (normed($('table.subtracks')) != undefined) { + matInitializeMatrix(); + + // If divs with class 'subCfg' then initialize the subtrack cfg code + // NOTE: must be before any ddcl setup + if (typeof(subCfg) !== "undefined" && normed($("div.subCfg")) != undefined) { + subCfg.initialize(); + } + } + // Initialize sortable tables $('table.sortable').each(function (ix) { sortTableInitialize(this,true,true); }); // Register tables with drag and drop $("table.tableWithDragAndDrop").each(function (ix) { tableDragAndDropRegister(this); }); - $('.halfVis').css('opacity', '0.5'); // The 1/2 opacity just doesn't get set from cgi! - - $('.filterComp').each( function(i) { // Do this by 'each' to set noneIsAll individually - if (newJQuery == false) - $(this).dropdownchecklist({ firstItemChecksAll: true, noneIsAll: $(this).hasClass('filterBy'), maxDropHeight: filterByMaxHeight(this) }); - }); - // Put navigation links in top corner navigationLinksSetup(); });