static/js/select.js
/**
 * Initialize info table in-row controls.
 * @function initInfoCtrl
 * @param {Object} mo - main object
 * @description The info table is located in middle of the side panel. It
 * displays a summary of metadata of selected contigs. When the user hovers
 * a row, an inline control bar will emerge and let the user operate on the
 * specific row.
 */
Initialize info table in-row controls.
@function initInfoCtrl
@param {Object} mo - main object
@description The info table is located in middle of the side panel. It
displays a summary of metadata of selected contigs. When the user hovers
a row, an inline control bar will emerge and let the user operate on the
specific row.
Initialize info table in - row controls . @function initInfoCtrl @param { Object } mo - main object @description The info table is located in middle of the side panel . It displays a summary of metadata of selected contigs . When the user hovers a row an inline control bar will emerge and let the user operate on the specific row .
function initInfoCtrl(mo) {
  byId('info-metric-btn').addEventListener('click', function () {
    const row = byId('info-table').rows[
      this.parentElement.getAttribute('data-row')];
    if (row.getAttribute('data-met') === 'sum') {
      row.setAttribute('data-met', 'mean');
      this.innerHTML = '<span style="text-decoration: overline;">' +
        '<i>x</i></span>';
    } else {
      row.setAttribute('data-met', 'sum');
      this.innerHTML = '&Sigma;<i>x</i>';
    }
    updateInfoRow(row, mo);
  });
  byId('info-ref-sel').addEventListener('change', function () {
    const row = byId('info-table').rows[this.parentElement
      .parentElement.getAttribute('data-row')];
    row.setAttribute('data-ref', this.value);
    updateInfoRow(row, mo);
    this.blur();
  });
  byId('info-plot-btn').addEventListener('click', function () {
    const div = this.parentElement;
    const idx = byId('info-table').rows[div.getAttribute('data-row')]
      .getAttribute('data-idx');
    mo.mini.field = idx;
    byId('mini-field-sel').value = idx;
    updateMiniPlot(mo);
    byId('mini-canvas').parentElement.classList.remove('hidden');
  });
  byId('info-hide-btn').addEventListener('click', function () {
    const div = this.parentElement;
    const row = byId('info-table').rows[div.getAttribute('data-row')];
    div.classList.add('hidden');
    byId('info-table').deleteRow(row.rowIndex);
  });
}
function initInfoCtrl ( mo ) { byId ( 'info-metric-btn' ) . addEventListener ( 'click' , function ( ) { const row = byId ( 'info-table' ) . rows [ this . parentElement . getAttribute ( 'data-row' ) ] ; if ( row . getAttribute ( 'data-met' ) === 'sum' ) { row . setAttribute ( 'data-met' , 'mean' ) ; this . innerHTML = '<span style="text-decoration: overline;">' + '<i>x</i></span>' ; } else { row . setAttribute ( 'data-met' , 'sum' ) ; this . innerHTML = '&Sigma;<i>x</i>' ; } updateInfoRow ( row , mo ) ; } ) ; byId ( 'info-ref-sel' ) . addEventListener ( 'change' , function ( ) { const row = byId ( 'info-table' ) . rows [ this . parentElement . parentElement . getAttribute ( 'data-row' ) ] ; row . setAttribute ( 'data-ref' , this . value ) ; updateInfoRow ( row , mo ) ; this . blur ( ) ; } ) ; byId ( 'info-plot-btn' ) . addEventListener ( 'click' , function ( ) { const div = this . parentElement ; const idx = byId ( 'info-table' ) . rows [ div . getAttribute ( 'data-row' ) ] . getAttribute ( 'data-idx' ) ; mo . mini . field = idx ; byId ( 'mini-field-sel' ) . value = idx ; updateMiniPlot ( mo ) ; byId ( 'mini-canvas' ) . parentElement . classList . remove ( 'hidden' ) ; } ) ; byId ( 'info-hide-btn' ) . addEventListener ( 'click' , function ( ) { const div = this . parentElement ; const row = byId ( 'info-table' ) . rows [ div . getAttribute ( 'data-row' ) ] ; div . classList . add ( 'hidden' ) ; byId ( 'info-table' ) . deleteRow ( row . rowIndex ) ; } ) ; }
Initialize info table in-row controls.
Initialize info table in - row controls .
// Toggle summary metric (sum or mean). // Weight variable by reference. // Plot variable. // Hide variable