<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" ) {
    if ( data.text.length <= 0 ) {
      $('#new_fact_form').hide(0, updateHeight);
    }

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

function updateHeight(){
  top.postMessage({message: "changeHeight", height: $(document).height()}, "*");
}

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

if ( $('.alert').length === 1 ) {
  top.postMessage("showNotification", "*");

  $('.alert').bind('closed', function (e) {
    top.postMessage('hideNotification', "*");
  });
}

$('#cancel').on('click', function (e) {
  e.preventDefault();

  addToChannelView.resetClickedState();

  top.window.close();
});


})();<commit_msg>updateHeight upon resize of popup<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 ) {
      $('#new_fact_form').hide(0, updateHeight);
    }

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

function updateHeight(){
  top.postMessage({message: "changeHeight", height: $(document).height()}, "*");
}

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

if ( $('.alert').length === 1 ) {
  top.postMessage("showNotification", "*");

  $('.alert').bind('closed', function (e) {
    top.postMessage('hideNotification', "*");
  });
}

$('#cancel').on('click', function (e) {
  e.preventDefault();

  addToChannelView.resetClickedState();

  top.window.close();
});


$(window).on('resize', function(e) {
  console.info( "Resize" );
  updateHeight();
});
})();
{'fraction_non_alphanumeric': 0.23654944394349264, 'fraction_numerical': 0.003005710850616171, 'mean_word_length': 4.555926544240401, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3422897', 'n_tokens_mistral': 1066, 'n_tokens_neox': 1056, 'n_words': 177}