<commit_before>angular.module('openspecimen')
  .directive('osKeyValues', function() {
    return {
      restrict: 'C',

      link: function(scope, element, attrs) {
        scope.$watch(
          function() {
            var result = '';
            angular.forEach(element.find('li.item .value'),
              function(el, idx) {
                result += idx + el.scrollWidth;
              }
            );
            return result;
          },
          function() {
            angular.forEach(element.find('li.item .value'),
              function(el) {
                if (el.offsetWidth < el.scrollWidth) {
                  el.setAttribute('title', el.textContent.trim());
                }
              }
            );
          }
        );
      }
    };
  });<commit_msg>OPSMN-4354: Implementation of os-tooltip widget.<commit_after>angular.module('openspecimen')
  .directive('osKeyValues', function() {
    return {
      restrict: 'C',

      link: function(scope, element, attrs) {
        scope.$watch(
          function() {
            var result = '';
            angular.forEach(element.find('li.item .value'),
              function(el, idx) {
                result += idx + el.scrollWidth;
              }
            );
            return result;
          },
          function() {
            angular.forEach(element.find('li.item .value'),
              function(el) {
                if (el.offsetWidth < el.scrollWidth) {
                  el.setAttribute('title', el.textContent.trim());
                }
              }
            );
          }
        );
      }
    };
  })

  .directive('osTooltip', function($compile) {
    return {
      restrict: 'A',

      terminal: true,

      priority: 100000,

      compile: function(tElem, tAttrs) {
        var tooltip = tAttrs.osTooltip;
        tElem.removeAttr('os-tooltip');
        tElem.attr({
          'bs-tooltip': '',
          'data-title': tooltip,
          'trigger'   : 'hover focus',
          'placement' : 'auto'
        });

        var linkFn = $compile(tElem);
        return {
          pre: function(scope, element, attrs) {
          },

          post: function(scope, element, attrs) {
            linkFn(scope, function(clone) { element.replaceWith(clone); });
          }
        }
      }
    }
  });
{'fraction_non_alphanumeric': 0.13775290572535515, 'fraction_numerical': 0.004304778303917348, 'mean_word_length': 1.3714285714285714, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4131877', 'n_tokens_mistral': 646, 'n_tokens_neox': 632, 'n_words': 108}