<commit_before>angular.module(PKG.name + '.commons')
  .directive('draggable', function() {
    return function(scope, element, attrs) {
      var el = element[0];
      var dropZone = attrs.dropZone;
       el.draggable = true;

       el.addEventListener(
           'dragstart',
           function(e) {
               e.dataTransfer.effectAllowed = 'copy';
               e.dataTransfer.setData('Text', this.id);
               e.dataTransfer.setData('DropZone', dropZone);
               this.classList.add('drag');
               return false;
           },
           false
       );

       el.addEventListener(
           'dragend',
           function(e) {
               this.classList.remove('drag');
               return false;
           },
           false
       );
    }
  })

  .directive('droppable', function() {
    return {
        scope: {
            drop: '&' // parent
        },
        link: function(scope, element) {
          var el = element[0];

          el.addEventListener(
            'dragover',
            function(e) {
                e.dataTransfer.dropEffect = 'copy';
                // allows us to drop
                if (e.preventDefault) e.preventDefault();
                this.classList.add('over');
                return false;
            },
            false
          );

          el.addEventListener(
            'dragenter',
            function(e) {
                this.classList.add('over');
                return false;
            },
            false
          );

          el.addEventListener(
            'dragleave',
            function(e) {
                this.classList.remove('over');
                return false;
            },
            false
          );

            el.addEventListener(
                'drop',
                function(e) {
                    // Stops some browsers from redirecting.
                    if (e.stopPropagation) e.stopPropagation();

                    this.classList.remove('over');
                    var id = e.dataTransfer.getData('Text'),
                        dropZone = e.dataTransfer.getData('DropZone');

                    // var item = document.getElementById(e.dataTransfer.getData('Text'));
                    // this.appendChild(item);

                    // call the drop passed drop function
                    scope.$apply(function(scope) {
                        var fn = scope.drop();
                        if ('undefined' !== typeof fn) {
                          fn(id, dropZone);
                        }
                    });
                    return false;
                },
                false
            );
        }
    }
  });<commit_msg>Adds data & id properties to the dragable item (to be received on dropped)<commit_after>angular.module(PKG.name + '.commons')
  .directive('draggable', function() {
    return function(scope, element, attrs) {
      var el = element[0];
      var dropZone = attrs.dropZone,
          data = attrs.model;
       el.draggable = true;

       el.addEventListener(
           'dragstart',
           function(e) {
               e.dataTransfer.effectAllowed = 'copy';
               e.dataTransfer.setData('Id', this.id);
               e.dataTransfer.setData('DropZone', dropZone);
               e.dataTransfer.setData('Data', data);
               this.classList.add('drag');
               return false;
           },
           false
       );

       el.addEventListener(
           'dragend',
           function(e) {
               this.classList.remove('drag');
               return false;
           },
           false
       );
    }
  })

  .directive('droppable', function() {
    return {
        scope: {
            drop: '&' // parent
        },
        link: function(scope, element) {
          var el = element[0];

          el.addEventListener(
            'dragover',
            function(e) {
                e.dataTransfer.dropEffect = 'copy';
                // allows us to drop
                if (e.preventDefault) e.preventDefault();
                this.classList.add('over');
                return false;
            },
            false
          );

          el.addEventListener(
            'dragenter',
            function(e) {
                this.classList.add('over');
                return false;
            },
            false
          );

          el.addEventListener(
            'dragleave',
            function(e) {
                this.classList.remove('over');
                return false;
            },
            false
          );

            el.addEventListener(
                'drop',
                function(e) {
                    // Stops some browsers from redirecting.
                    if (e.stopPropagation) e.stopPropagation();

                    this.classList.remove('over');
                    var id = e.dataTransfer.getData('Id'),
                        dropZone = e.dataTransfer.getData('DropZone'),
                        data = e.dataTransfer.getData('Data');

                    // var item = document.getElementById(e.dataTransfer.getData('Text'));
                    // this.appendChild(item);

                    // call the drop passed drop function
                    scope.$apply(function(scope) {
                        var fn = scope.drop();
                        if ('undefined' !== typeof fn) {
                          fn(id, dropZone, data);
                        }
                    });
                    return false;
                },
                false
            );
        }
    }
  });
{'fraction_non_alphanumeric': 0.1116254228235713, 'fraction_numerical': 0.0007121239095602635, 'mean_word_length': 1.0722980450018444, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6526094', 'n_tokens_mistral': 1370, 'n_tokens_neox': 1325, 'n_words': 255}