<commit_before>  // used by the tabbing interface to make sure the correct
  // ajax content is loaded
  var path = 'device';

  function inner_view_processing() {
    // VLANs column list collapser trigger
    // it's a bit of a faff because we can't easily use Bootstrap's collapser
    $('.nd_collapse_vlans').toggle(function() {
        $(this).siblings('.nd_collapsing').toggle();
        $(this).siblings('.cell-arrow-up-down')
          .toggleClass('icon-chevron-up icon-chevron-down');
        $(this).html('<div class="cell-arrow-up-down icon-chevron-down icon-large"></div>Hide VLANs');
      }, function() {
        $(this).siblings('.nd_collapsing').toggle();
        $(this).siblings('.cell-arrow-up-down')
          .toggleClass('icon-chevron-up icon-chevron-down');
        $(this).html('<div class="cell-arrow-up-down icon-chevron-up icon-large"></div>Show VLANs');
    });

    // toggle visibility of port up/down and edit controls
    $('.nd_editable_cell').hover(function() {
      $(this).children('.nd_hand_icon').toggle();
      if ($(this).is(':focus')) {
        $(this).children('.nd_edit_icon').toggle(false); // ports
        $(this).siblings('td').find('.nd_device_details_edit').toggle(false); // details
      }
      else {
        $(this).children('.nd_edit_icon').toggle(); // ports
        $(this).siblings('td').find('.nd_device_details_edit').toggle(); // details
      }
    });

    $('[contenteditable=true]').focus(function() {
        $(this).children('.nd_edit_icon').toggle(false); // ports
        $(this).siblings('td').find('.nd_device_details_edit').toggle(false); // details
    });

    // activity for port up/down control
    $('.icon-hand-up').click(function() {
      port_control(this); // save
    });
    $('.icon-hand-down').click(function() {
      port_control(this); // save
    });

    // activity for contenteditable control
    $('[contenteditable=true]').keydown(function() {
      var esc = event.which == 27,
          nl  = event.which == 13;

      if (esc) {
        document.execCommand('undo');
        $(this).blur();
      }
      else if (nl) {
        $(this).blur();
        event.preventDefault();
        port_control(this); // save
      }
    });
<commit_msg>fix undo on edit and edit icon hiding<commit_after>  // used by the tabbing interface to make sure the correct
  // ajax content is loaded
  var path = 'device';

  function inner_view_processing() {
    // VLANs column list collapser trigger
    // it's a bit of a faff because we can't easily use Bootstrap's collapser
    $('.nd_collapse_vlans').toggle(function() {
        $(this).siblings('.nd_collapsing').toggle();
        $(this).siblings('.cell-arrow-up-down')
          .toggleClass('icon-chevron-up icon-chevron-down');
        $(this).html('<div class="cell-arrow-up-down icon-chevron-down icon-large"></div>Hide VLANs');
      }, function() {
        $(this).siblings('.nd_collapsing').toggle();
        $(this).siblings('.cell-arrow-up-down')
          .toggleClass('icon-chevron-up icon-chevron-down');
        $(this).html('<div class="cell-arrow-up-down icon-chevron-up icon-large"></div>Show VLANs');
    });

    // toggle visibility of port up/down and edit controls

    $('.nd_editable_cell').mouseenter(function() {
      $(this).children('.nd_hand_icon').show();
      if (! $(this).is(':focus')) {
        $(this).children('.nd_edit_icon').show(); // ports
        $(this).siblings('td').find('.nd_device_details_edit').show(); // details
      }
    });

    $('.nd_editable_cell').mouseleave(function() {
      $(this).children('.nd_hand_icon').hide();
      if (! $(this).is(':focus')) {
        $(this).children('.nd_edit_icon').hide(); // ports
        $(this).siblings('td').find('.nd_device_details_edit').hide(); // details
      }
    });

    $('[contenteditable=true]').focus(function() {
        $(this).children('.nd_edit_icon').hide(); // ports
        $(this).siblings('td').find('.nd_device_details_edit').hide(); // details
    });

    // activity for port up/down control
    $('.icon-hand-up').click(function() {
      port_control(this); // save
    });
    $('.icon-hand-down').click(function() {
      port_control(this); // save
    });

    var dirty = false;

    // activity for contenteditable control
    $('[contenteditable=true]').keydown(function() {
      var esc = event.which == 27,
          nl  = event.which == 13;

      if (esc) {
        if (dirty) { document.execCommand('undo') }
        $(this).blur();
        dirty = false;

      }
      else if (nl) {
        event.preventDefault();
        $(this).blur();
        dirty = false;
        port_control(this); // save
      }
      else {
        dirty = true;
      }
    });

{'fraction_non_alphanumeric': 0.19341910989242775, 'fraction_numerical': 0.0016874077198903185, 'mean_word_length': 2.600607441154138, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '938985', 'n_tokens_mistral': 1498, 'n_tokens_neox': 1443, 'n_words': 258}