src/js/INTER-Mediator.js
/** --------------------------------------------------------------------
     * Seeking nodes and if a node is an enclosure, proceed repeating.
     */
Seeking nodes and if a node is an enclosure, proceed repeating.
Seeking nodes and if a node is an enclosure proceed repeating .
async function seekEnclosureNode(node, currentRecord, parentObjectInfo, currentContextObj) {
      if (node.nodeType === 1) { 
        try {
          if (INTERMediatorLib.isEnclosure(node, false)) { 
            const className = node.getAttribute('class')
            const attr = node.getAttribute('data-im-control')
            if ((className && className.match(/_im_post/)) ||
              (attr && attr.indexOf('post') >= 0)) {
              setupPostOnlyEnclosure(node)
            } else {
              await expandEnclosure(node, currentRecord, parentObjectInfo, currentContextObj)
            }
          } else {
            const children = node.childNodes 
            if (children) {
              for (let i = 0; i < children.length; i++) {
                if (children[i].nodeType === 1) {
                  await seekEnclosureNode(children[i], currentRecord, parentObjectInfo, currentContextObj)
                }
              }
            }
          }
        } catch (ex) {
          if (ex.message === '_im_auth_required_') {
            throw ex
          } else {
            INTERMediatorLog.setErrorMessage(ex, 'EXCEPTION-10')
          }
        }
      }
    }
async function seekEnclosureNode ( node , currentRecord , parentObjectInfo , currentContextObj ) { if ( node . nodeType === 1 ) { try { if ( INTERMediatorLib . isEnclosure ( node , false ) ) { const className = node . getAttribute ( 'class' ) const attr = node . getAttribute ( 'data-im-control' ) if ( ( className && className . match ( / _im_post / ) ) || ( attr && attr . indexOf ( 'post' ) >= 0 ) ) { setupPostOnlyEnclosure ( node ) } else { await expandEnclosure ( node , currentRecord , parentObjectInfo , currentContextObj ) } } else { const children = node . childNodes if ( children ) { for ( let i = 0 ; i < children . length ; i ++ ) { if ( children [ i ] . nodeType === 1 ) { await seekEnclosureNode ( children [ i ] , currentRecord , parentObjectInfo , currentContextObj ) } } } } } catch ( ex ) { if ( ex . message === '_im_auth_required_' ) { throw ex } else { INTERMediatorLog . setErrorMessage ( ex , 'EXCEPTION-10' ) } } } }
Seeking nodes and if a node is an enclosure, proceed repeating.
Seeking nodes and if a node is an enclosure proceed repeating .
// Work for an element // Linked element and an enclosure // Check all child nodes.