Here's a useful function to add to your helpers.js file.

function empty(card) {
  var src=card.src; var ok=true;
  if (src.indexOf('empty')==-1) ok=false;
  return ok;
}

We can now turn our attention to incorporating the temp panel into check_first(card).

function check_first(card) {
  var ok; g_seq=[];
  if (empty(card)) {
    ok=false;
  } else {
    if (klass(card)=='temp') {
      ok=true;
    } else { // must be main
      var c=card.style.gridColumnStart; // column #
      ...
    }
  }
  return ok;
}

If you try to move a card from main to temp, once again nothing happens.
This time it's check_second(card) that is falling over.