static/js/interface.js
/**
 * Initialize list select table.
 * @function initListSel
 * @description The list select table is like a dropdown menu. It is launched
 * by a source DOM. The user clicks an item, and this code will transfer the
 * selection back to the source DOM and trigger an event of it.
 */
Initialize list select table.
@function initListSel
@description The list select table is like a dropdown menu. It is launched
by a source DOM. The user clicks an item, and this code will transfer the
selection back to the source DOM and trigger an event of it.
Initialize list select table . @function initListSel @description The list select table is like a dropdown menu . It is launched by a source DOM . The user clicks an item and this code will transfer the selection back to the source DOM and trigger an event of it .
function initListSel() {
  byId('list-options').addEventListener('click', function (e) {
    let src, val;
    for (let row of this.rows) {
      if (row.contains(e.target)) {
        val = row.cells[0].textContent;
        if (val.match(/\s/)) val = '';
        src = byId(this.getAttribute('data-target-id'));
        src.value = val;
        if (src.nodeName.toLowerCase() == 'input') {
          src.focus(); 
        } else {
          src.click(); 
        }
        this.parentElement.classList.add('hidden');
        break;
      }
    }
  });
}
function initListSel ( ) { byId ( 'list-options' ) . addEventListener ( 'click' , function ( e ) { let src , val ; for ( let row of this . rows ) { if ( row . contains ( e . target ) ) { val = row . cells [ 0 ] . textContent ; if ( val . match ( / \s / ) ) val = '' ; src = byId ( this . getAttribute ( 'data-target-id' ) ) ; src . value = val ; if ( src . nodeName . toLowerCase ( ) == 'input' ) { src . focus ( ) ; } else { src . click ( ) ; } this . parentElement . classList . add ( 'hidden' ) ; break ; } } } ) ; }
Initialize list select table.
Initialize list select table .
// for text box etc. // for button, menu item, etc.