src/basis/tracker.js
function checkShow(){
  /**
   * Checks visibility of an element on a page in a browser
   * @param {HTMLElement} element some DOM node
   * @private
   * @return {boolean}
   */
  function isVisible(element){
    if (getComputedStyle(element, 'visibility') != 'visible')
      return false;

    var box = getBoundingRect(element);

    if (!box.width || !box.height)
      return false;

    return true;
  }

  var list = getSelectorList(SHOW_EVENT);

  for (var i = 0; i < list.length; i++)
  {
    var selector = list[i];
    var elements = document.querySelectorAll(getCssSelectorFromPath(selector.selector, true));
    var visibleElement = basis.array.search(basis.array(elements), true, isVisible);
    var visible = Boolean(visibleElement);
    var state;

    if (!hasOwnProperty.call(list.visible, selector.selectorStr))
      state = list.visible[selector.selectorStr] = false;
    else
      state = list.visible[selector.selectorStr];

    list.visible[selector.selectorStr] = visible;

    if (state == false && visible)
      track({
        type: 'ui',
        path: stringifyPath(getPathByNode(visibleElement)),
        selector: selector.selectorStr,
        event: SHOW_EVENT,
        data: selector.data
      });
  }
}
function checkShow(){
  /**
   * Checks visibility of an element on a page in a browser
   * @param {HTMLElement} element some DOM node
   * @private
   * @return {boolean}
   */
  function isVisible(element){
    if (getComputedStyle(element, 'visibility') != 'visible')
      return false;

    var box = getBoundingRect(element);

    if (!box.width || !box.height)
      return false;

    return true;
  }

  var list = getSelectorList(SHOW_EVENT);

  for (var i = 0; i < list.length; i++)
  {
    var selector = list[i];
    var elements = document.querySelectorAll(getCssSelectorFromPath(selector.selector, true));
    var visibleElement = basis.array.search(basis.array(elements), true, isVisible);
    var visible = Boolean(visibleElement);
    var state;

    if (!hasOwnProperty.call(list.visible, selector.selectorStr))
      state = list.visible[selector.selectorStr] = false;
    else
      state = list.visible[selector.selectorStr];

    list.visible[selector.selectorStr] = visible;

    if (state == false && visible)
      track({
        type: 'ui',
        path: stringifyPath(getPathByNode(visibleElement)),
        selector: selector.selectorStr,
        event: SHOW_EVENT,
        data: selector.data
      });
  }
}
function checkShow ( ) { /**
   * Checks visibility of an element on a page in a browser
   * @param {HTMLElement} element some DOM node
   * @private
   * @return {boolean}
   */ function isVisible ( element ) { if ( getComputedStyle ( element , 'visibility' ) != 'visible' ) return false ; var box = getBoundingRect ( element ) ; if ( ! box . width || ! box . height ) return false ; return true ; } var list = getSelectorList ( SHOW_EVENT ) ; for ( var i = 0 ; i < list . length ; i ++ ) { var selector = list [ i ] ; var elements = document . querySelectorAll ( getCssSelectorFromPath ( selector . selector , true ) ) ; var visibleElement = basis . array . search ( basis . array ( elements ) , true , isVisible ) ; var visible = Boolean ( visibleElement ) ; var state ; if ( ! hasOwnProperty . call ( list . visible , selector . selectorStr ) ) state = list . visible [ selector . selectorStr ] = false ; else state = list . visible [ selector . selectorStr ] ; list . visible [ selector . selectorStr ] = visible ; if ( state == false && visible ) track ( { type : 'ui' , path : stringifyPath ( getPathByNode ( visibleElement ) ) , selector : selector . selectorStr , event : SHOW_EVENT , data : selector . data } ) ; } }
Tracks visibilty changes for nodes marked with show event in custom tracking maps
@private
@return
Tracks visibilty changes for nodes marked with show event in custom tracking maps