6e42ae17b627fe6b858dc0c9117422f0ea9f889a tdreszer Wed Nov 23 11:20:26 2011 -0800 Hopefully these are the last missing pieces of MATRIX_SQUEEZE diff --git src/hg/js/hui.js src/hg/js/hui.js index a1edc4c..a1d3c4a 100644 --- src/hg/js/hui.js +++ src/hg/js/hui.js @@ -1226,77 +1226,102 @@ } 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)); } } } } -/* SOON TO BE ENABLED var mat = { // Beginings of matrix object + matrix: undefined, dimensions: 0, + cellInFocus: undefined, - cellHover: function (obj,on) + cellHover: function (cell,on) { - var classList = $( obj ).attr("class").split(" "); - classList = aryRemove(classList,"matCell"); + if (on) { + if (mat.cellInFocus != undefined) + mat.clearGhostHilites(); // Necessary to clear ghosts + mat.cellInFocus = cell; + } else + mat.cellInFocus = undefined; + + var classList = $( cell ).attr("class").split(" "); + classList = aryRemove(classList,["matCell"]); + var color = (on ? "#FCECC0" : "");// "#FFF9D2"); setting to "" removes the hilite for (var ix=0;ix < classList.length;ix++) { - var cells = $(".matCell."+classList[ix]); - if (on) - $(cells).css({backgroundColor:"#FCECC0"}); - else - $(cells).css({backgroundColor:"#FFF9D2"}); + if (classList[ix] == 'all') + continue; + if (ix == 0) { + $(".matCell."+classList[ix]).css({backgroundColor: color }); + } else { + $(cell).closest('tr').css({backgroundColor: color }) // faster? + } } - if (on && obj.title.length == 0) { + if (on && cell.title.length == 0) { for (var ix=0;ix < classList.length;ix++) { - if (ix > 0) - obj.title += " and "; - obj.title += $("th."+classList[ix]).first().text(); + if (classList[ix] == 'all') { // on a label already + cell.title = ""; + break; + } + if (cell.title.length > 0) + cell.title += " and "; + cell.title += $("th."+classList[ix]).first().text(); } } }, + clearGhostHilites: function () + { + $('.matCell').css({backgroundColor:""}); + $(mat.matrix).find('tr').css({backgroundColor:""}); + }, + init: function () { + mat.matrix = $('table.matrix'); + if (mat.matrix != undefined && mat.matrix.length == 1) { var cells = $('td.matCell'); if (cells != undefined && cells.length > 0) { var classList = $( cells[0] ).attr("class").split(" "); - classList = aryRemove(classList,"matCell"); + classList = aryRemove(classList,["matCell"]); mat.dimensions = classList.length; if (mat.dimensions > 1) { // No need unless this is a 2D matrix - $('td.matCell').hover( + $('.matCell').hover( function (e) {mat.cellHover(this,true)}, function (e) {mat.cellHover(this,false)} ); + $(mat.matrix).blur(mat.clearGhostHilites()); + $(window).bind('focus',function (e) {mat.clearGhostHilites();}); // blur doesn't work because the screen isn't repainted + } } } } } -*/ // The following js depends upon the jQuery library $(document).ready(function() { - // SOON TO BE ENABLED: mat.init(); + mat.init(); // 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)