Example #1
0
      var match = childMatch || checkLiMatch(subItem);
      //console.log(subItem, match);
      subItem.hidden = !match;

      return prevValue || match;
    }, false);

    li.hidden = !(childMatch || checkLiMatch(li));

  }

};


TutorialMap.prototype.throttleFilter = throttle(TutorialMap.prototype.filter, 200);
delegate.delegateMixin(TutorialMap.prototype);


function isSubSequence(str1, str2) {
  var i = 0;
  var j = 0;
  while (i < str1.length && j < str2.length) {
    if (str1[i] == str2[j]) {
      i++;
      j++;
    } else {
      i++;
    }
  }
  return j == str2.length;
Example #2
0
};

exports.codeTabs = function(iframe) {
  function hideShowArrows() {

    // add arrows if needed
    var elem = iframe.closest('.code-tabs');
    var contentElem = iframe.closest('[data-code-tabs-content]');
    var switchesElem = elem.querySelector('[data-code-tabs-switches]');
    var switchesElemItems = switchesElem.firstElementChild;

    if (switchesElemItems.offsetWidth > switchesElem.offsetWidth) {
      elem.classList.add('code-tabs_scroll');
    } else {
      elem.classList.remove('code-tabs_scroll');
    }

  }

  hideShowArrows();
  onResizeQueue.push(hideShowArrows);
};



window.addEventListener('resize', throttle(function() {
  onResizeQueue.forEach(function(onResize) {
    onResize();
  });
}, 200));