<commit_before>
  // emits:  card:movestart, card:moveend, card:tagged, card:untagged
  
  // triggers:  card:movestart, card:moveend, card:tagged, card:untagged
  
  // on (socket):  card:moveend --> card:movestart + card:moveend, card:tagged --> card:tagged, card:untagged --> card:untagged
  
  // on (queue):  

var Card = (function() {

function Card( queue, data ) {
  var card = this;
  
  card.id = data.id;  
  card.links = data.links || {};
  card.x = data.x;
  card.y = data.y;
  card.tagged = data.tagged || '';
  // triggers
  
  queue
    .on( card, 'canvascard:moved', function( data ) {
      if ( card.id === data.card.id &&
          ( card.x != data.x || card.y != data.y ) ) {
        __moveTo( data.x, data.y );
    
        __broadcastEvent( 'moved' );
      }
    })
    .on( card, 'card:updated', function( data ) {  
      if ( card.id === data.id &&
          ( card.x != data.x || card.y != data.y ) ) {
        __moveTo( data.x, data.y );
      }
    });
  
  // private

  function __broadcastEvent( ev ) {  
    queue.trigger( card, 'card:' + ev, { card: card } );
  }
  
  function __moveTo( x, y ) {
    card.x = x;
    card.y = y;
  }
  
  function __tag( color ) {
    card.tagged = color;
  }
  
  function __untag() {
    card.tagged = false;
  }
  
  // public functions

  card.getId = function() {
    return card.id;
  };

  card.getPocketId = function() {
    return card.links.pocket;
  };

  card.getBoardId = function() {
    return card.links.board;
  };

  card.getPosition = function() {
    return { 
      board: card.getBoardId(),
      x: card.x,
      y: card.y
    };
  };
  
  card.tag = function( color ) {
    __untag( color );
    
    __broadcastEvent( 'tagged' );
    
    return card;
  };
  
  card.untag = function() {
    __untag();
    
    __broadcastEvent( 'untagged' );
    
    return card;
  };
  
  return card;
}

return Card;

})();<commit_msg>fixed issue with color tags not being colored<commit_after>
  // emits:  card:movestart, card:moveend, card:tagged, card:untagged
  
  // triggers:  card:movestart, card:moveend, card:tagged, card:untagged
  
  // on (socket):  card:moveend --> card:movestart + card:moveend, card:tagged --> card:tagged, card:untagged --> card:untagged
  
  // on (queue):  

var Card = (function() {

function Card( queue, data ) {
  var card = this;
  
  card.id = data.id;  
  card.links = data.links || {};
  card.x = data.x;
  card.y = data.y;
  card.tagged = data.tagged || '';
  // triggers
  
  queue
    .on( card, 'canvascard:moved', function( data ) {
      if ( card.id === data.card.id &&
          ( card.x != data.x || card.y != data.y ) ) {
        __moveTo( data.x, data.y );
    
        __broadcastEvent( 'moved' );
      }
    })
    .on( card, 'card:updated', function( data ) {  
      if ( card.id === data.id &&
          ( card.x != data.x || card.y != data.y ) ) {
        __moveTo( data.x, data.y );
      }
    });
  
  // private

  function __broadcastEvent( ev ) {  
    queue.trigger( card, 'card:' + ev, { card: card } );
  }
  
  function __moveTo( x, y ) {
    card.x = x;
    card.y = y;
  }
  
  function __tag( color ) {
    card.tagged = color;
  }
  
  function __untag() {
    card.tagged = false;
  }
  
  // public functions

  card.getId = function() {
    return card.id;
  };

  card.getPocketId = function() {
    return card.links.pocket;
  };

  card.getBoardId = function() {
    return card.links.board;
  };

  card.getPosition = function() {
    return { 
      board: card.getBoardId(),
      x: card.x,
      y: card.y
    };
  };
  
  card.tag = function( color ) {
    __tag( color );
    
    __broadcastEvent( 'tagged' );
    
    return card;
  };
  
  card.untag = function() {
    __untag();
    
    __broadcastEvent( 'untagged' );
    
    return card;
  };
  
  return card;
}

return Card;

})();
{'fraction_non_alphanumeric': 0.1641636457793889, 'fraction_numerical': 0.0, 'mean_word_length': 2.0226917057902973, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7526717', 'n_tokens_mistral': 1461, 'n_tokens_neox': 1416, 'n_words': 299}