rem: var t = e.target, parent = t.parentNode; var tv = t.pileViewObj || null; var pv = parent.pileViewObj || null;  if(tv == gFloatingPile || pv == gFloatingPile) return null;   if(pv) return pv.getTargetCard(e);   if(!tv) {  t = t.previousSibling; if(!t || !t.pileViewObj) return null; var rp = t.pileViewObj.pile.rightParent;  if(!rp || rp.view.pixelBottom < y) return null; t = rp.view; }  const x = e.pageX, y = e.pageY;   var p = t.pile; while(!p.hasCards) { var lp = p.leftParent; var rp = p.rightParent; if(rp && x > rp.view.pixelLeft) p = rp; else if(lp && lp.view.pixelRight > x) p = lp;  else if(lp && lp.rightParent) p = lp.rightParent;  else return null;  if(p.view.pixelBottom < y) return null; }  return p.firstCard; } 
add: for(var t = e.target; t && !t.pileViewObj; t = t.parentNode); if(!t || !t.pileViewObj) return null; t = t.pileViewObj; return t != gFloatingPile ? t.getTargetCard(e) : null; }, 
context:   _getTargetCard: function(e) {    var t = e.target, parent = t.parentNode;    var tv = t.pileViewObj || null;    var pv = parent.pileViewObj || null;    if(tv == gFloatingPile || pv == gFloatingPile) return null;    // occupied pile, foundation, or stock    if(pv) return pv.getTargetCard(e);    // get from a <flex/> or spacer to the pile it covers    if(!tv) {      // if t is a spacer between two piles we change t to the pile on the row above      t = t.previousSibling;      if(!t || !t.pileViewObj) return null; // spacer is left of the pyramid      var rp = t.pileViewObj.pile.rightParent;      // spacer on right of pyramid, or if click was not in region overlapping row above      if(!rp || rp.view.pixelBottom < y) return null;      t = rp.view;    }    const x = e.pageX, y = e.pageY;    // The target pile is empty.  This usually means that an empty pile is overlapping a card    // which the user is trying to click on.    var p = t.pile;    while(!p.hasCards) {      var lp = p.leftParent;      var rp = p.rightParent;      if(rp && x > rp.view.pixelLeft) p = rp;      else if(lp && lp.view.pixelRight > x) p = lp;      // is it the pile directly above?      else if(lp && lp.rightParent) p = lp.rightParent;      // user is probably being stupid      else return null;      // are we too low down anyway?      if(p.view.pixelBottom < y) return null;    }        return p.firstCard;  }
meta: 3385	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/3385/b417237dbf319255b6c43804f55eba9b471f4760/lib-layouts.js/clean/code/lib-layouts.js