<commit_before>//= require js-routes

$(document).ready(function() {
  if($('body').children('#tc-inspector-links').length == 0)
    $('body').append('<div id="tc-inspector-links"></div>');
    
  // for each key add a link that goes to the key page
  $('.tc-inspector-key').each(function(){
    var top = $(this).offset().top - 20;
    var left = $(this).offset().left - 10;
    var id = $(this).data('id');
    // missing translation will be in red while translated will be in green
    var badgeClass = getBadge($(this).data('type'));
    $('#tc-inspector-links').append($('<a>').attr('title', 'Click to visit key').attr('target', '_blank').attr('href', Routes.translation_center_translation_key_path(id)).attr('data-id', id).attr('style', 'left:' + left + 'px;top:' + top + 'px' ).attr('class', 'icon-edit tc-badge ' + badgeClass  + ' tc-inspector-link'));

  });

  // highlight the key when user hovers over it
  $(".tc-inspector-link").mouseover(function() {
    var id = $(this).data('id');
    var key = $('.tc-inspector-key[data-id=' + id + ']');
    var color = getColor(key.data('type'));
    key.css('color', color);
  }).mouseout(function(){
    var id = $(this).data('id');
    $('.tc-inspector-key[data-id=' + id + ']').css('color', '');
  });
<commit_msg>handle scroll<commit_after>//= require js-routes

$(document).ready(function() {
  if($('body').children('#tc-inspector-links').length == 0)
    $('body').append('<div id="tc-inspector-links"></div>');

  $(window).scroll(function() {
    $('.tc-inspector-key').each(function(){
      $(this).offset().top = $(this).offset().top - $(window).scrollTop()
    })
  });
    
  // for each key add a link that goes to the key page
  $('.tc-inspector-key').each(function(){
    var top = $(this).offset().top - 20;
    var left = $(this).offset().left - 10;
    var id = $(this).data('id');
    // missing translation will be in red while translated will be in green
    var badgeClass = getBadge($(this).data('type'));
    $('#tc-inspector-links').append($('<a>').attr('title', 'Click to visit key').attr('target', '_blank').attr('href', Routes.translation_center_translation_key_path(id)).attr('data-id', id).attr('style', 'left:' + left + 'px;top:' + top + 'px' ).attr('class', 'icon-edit tc-badge ' + badgeClass  + ' tc-inspector-link'));

  });

  // highlight the key when user hovers over it
  $(".tc-inspector-link").mouseover(function() {
    var id = $(this).data('id');
    var key = $('.tc-inspector-key[data-id=' + id + ']');
    var color = getColor(key.data('type'));
    key.css('color', color);
  }).mouseout(function(){
    var id = $(this).data('id');
    $('.tc-inspector-key[data-id=' + id + ']').css('color', '');
  });

{'fraction_non_alphanumeric': 0.24372230428360414, 'fraction_numerical': 0.003692762186115214, 'mean_word_length': 3.736013986013986, 'pattern_counts': {'":': 0, '<': 9, '<?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': '4622847', 'n_tokens_mistral': 931, 'n_tokens_neox': 900, 'n_words': 192}