<commit_before>(function() {
var top = window.top;

function passThroughClick(elem, messageKey) {
  elem.bind('click', function() {
    top.postMessage(messageKey, "*");
  });
}

window.addEventListener("message", function(messageObject) {
  var data = messageObject.data;

  if ( data === "highlight" ) {
    $('#highlight').prop('checked', true );
  } else if ( data === "annotate" ) {
    $('#annotate_button>input').prop('checked',true);
  } else if ( typeof data.title !== "undefined" ) {
    top.postMessage({message: "changeHeight", height: $(document).height()}, "*");

    $('#title').val(data.title);
    $('#fact').val(data.text);
    $('#url').val(data.url);
  } else if ( data === "blacklist" ) {
    $('#highlight').prop('disabled', true);
    $('#annotate_button>input').prop('disabled', true);
  }
}, false);

passThroughClick( $('#annotate_button>input'), "annotateToggle");
passThroughClick( $('#highlight'), "highlightToggle");

if ( $('.alert').length === 1 ) {
  top.postMessage("showNotification", "*");<commit_msg>This function gets called all the time, now it only changes the popup height if actual text is selected<commit_after>(function() {
var top = window.top;

function passThroughClick(elem, messageKey) {
  elem.bind('click', function() {
    top.postMessage(messageKey, "*");
  });
}

window.addEventListener("message", function(messageObject) {
  var data = messageObject.data;

  if ( data === "highlight" ) {
    $('#highlight').prop('checked', true );
  } else if ( data === "annotate" ) {
    $('#annotate_button>input').prop('checked',true);
  } else if ( typeof data.title !== "undefined" ) {
    if ( data.text.length > 0 ) {
      top.postMessage({message: "changeHeight", height: $(document).height()}, "*");
    }

    $('#title').val(data.title);
    $('#fact').val(data.text);
    $('#url').val(data.url);
  } else if ( data === "blacklist" ) {
    $('#highlight').prop('disabled', true);
    $('#annotate_button>input').prop('disabled', true);
  }
}, false);

passThroughClick( $('#annotate_button>input'), "annotateToggle");
passThroughClick( $('#highlight'), "highlightToggle");

if ( $('.alert').length === 1 ) {
  top.postMessage("showNotification", "*");
{'fraction_non_alphanumeric': 0.2230281051677244, 'fraction_numerical': 0.0013599274705349048, 'mean_word_length': 4.732467532467532, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '5778708', 'n_tokens_mistral': 684, 'n_tokens_neox': 671, 'n_words': 133}