← back to mac-sullivan__pushing-together-nfp

Function bodies 5 total

All specs Real LLM only Function bodies
barRect function · javascript · L220-L225 (6 LOC)
assets/js/main.js
  function barRect(el) {
    const listRect = navList.getBoundingClientRect();
    const rect     = el.getBoundingClientRect();
    const pad      = 12;
    return { left: rect.left - listRect.left + pad, width: rect.width - pad * 2 };
  }
setBar function · javascript · L227-L242 (16 LOC)
assets/js/main.js
  function setBar(el, instant) {
    const { left, width } = barRect(el);
    if (instant) {
      bar.style.transition = 'none';
      bar.style.left    = left + 'px';
      bar.style.width   = width + 'px';
      bar.style.opacity = '1';
      // Force reflow then re-enable transition
      bar.getBoundingClientRect();
      bar.style.transition = '';
    } else {
      bar.style.left    = left + 'px';
      bar.style.width   = width + 'px';
      bar.style.opacity = '1';
    }
  }
splitHeading function · javascript · L301-L338 (38 LOC)
assets/js/main.js
  function splitHeading(el) {
    if (el._awSplit || isSkipped(el)) return;
    el._awSplit = true;

    const nodes = Array.from(el.childNodes);
    el.innerHTML = '';
    let idx = 0;

    const makeWord = (content, isNode) => {
      const clip  = document.createElement('span');
      clip.className = 'aw-clip';
      const word  = document.createElement('span');
      word.className = 'aw-word';
      word.style.transitionDelay = `${idx * 0.05}s`;
      isNode ? word.appendChild(content) : (word.textContent = content);
      clip.appendChild(word);
      idx++;
      return clip;
    };

    nodes.forEach(node => {
      if (node.nodeType === Node.TEXT_NODE) {
        node.textContent.split(/(\s+)/).forEach(part => {
          if (!part) return;
          if (/^\s+$/.test(part)) {
            el.appendChild(document.createTextNode(' '));
          } else {
            el.appendChild(makeWord(part, false));
          }
        });
      } else {
        el.appendChild(makeWord(node.
setupImg function · javascript · L344-L351 (8 LOC)
assets/js/main.js
  function setupImg(el, dark) {
    if (el._awImg || isSkipped(el)) return;
    el._awImg = true;
    el.classList.add('aw-img');
    if (dark) el.classList.add('aw-img-dark');
    el._awObs = imgObs;
    imgObs.observe(el);
  }
setupPara function · javascript · L357-L364 (8 LOC)
assets/js/main.js
  function setupPara(el, delay) {
    if (el._awPara || isSkipped(el)) return;
    el._awPara = true;
    el.classList.add('aw-para');
    if (delay) el.style.transitionDelay = delay;
    el._awObs = paraObs;
    paraObs.observe(el);
  }