Sha256: 583ed498c47bb27a8b4e58c32b427ca57193799df98b7cc4ac4b5356200d7fa7

Contents?: true

Size: 1.97 KB

Versions: 3

Compression:

Stored size: 1.97 KB

Contents

I"Ú(function() {
  $(document).ready(function() {
    $("body").append('<div id="i18n_viz_tooltip">...</div>').click(function() {
      return $("#i18n_viz_tooltip").hide();
    });
    $.fn.initGUI = function() {
      var $i18n_element, keys;
      $i18n_element = $(this);
      keys = $i18n_element.data("i18n-keys");
      $i18n_element.mouseenter(function() {
        var $tooltip, left, top;
        $tooltip = $("#i18n_viz_tooltip");
        top = $i18n_element.offset().top - $tooltip.outerHeight();
        left = $i18n_element.offset().left;
        if (top < 0) {
          top = $i18n_element.offset().top + $i18n_element.height() + 10;
        }
        $tooltip.html('');
        keys.forEach(function(value) {
          if (window.I18nViz.external_tool_url.length > 0) {
            return $tooltip.append('<a href="' + window.I18nViz.external_tool_url + value + '" target="_blank">' + value + '</a>');
          } else {
            return $tooltip.append("<span>" + value + "</span>");
          }
        });
        return $tooltip.css({
          top: top,
          left: left
        }).show();
      });
      return $i18n_element;
    };
    $(":i18n-textnode").each(function() {
      return $(this).enrichWithI18nData().clearI18nText().initGUI();
    });
    return $("input:i18n-value-placeholder").each(function() {
      var $i18n_input_element, cleared_input_value, cleared_placeholder_value, input_value, placeholder_value;
      $i18n_input_element = $(this);
      input_value = $i18n_input_element.val();
      placeholder_value = $i18n_input_element.attr('placeholder');
      $i18n_input_element.enrichWithI18nData();
      cleared_input_value = input_value.replace(window.I18nViz.global_regex, "");
      $(this).val(cleared_input_value);
      if (placeholder_value) {
        cleared_placeholder_value = placeholder_value.replace(window.I18nViz.global_regex, "");
        return $(this).attr('placeholder', cleared_placeholder_value);
      }
    });
  });

}).call(this);
:ET

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
i18n_viz-1.2.0 test/dummy/tmp/cache/assets/sprockets/v3.0/kYBgQseAwKYSnoDv56FL04ImSWjGiZYrv9Koqs8Pskg.cache
i18n_viz-1.1.0 test/dummy/tmp/cache/assets/sprockets/v3.0/kYBgQseAwKYSnoDv56FL04ImSWjGiZYrv9Koqs8Pskg.cache
i18n_viz-1.0.1 test/dummy/tmp/cache/assets/sprockets/v3.0/kYBgQseAwKYSnoDv56FL04ImSWjGiZYrv9Koqs8Pskg.cache