<commit_before>// This is the JS embedded in the page that will host the iFrame
// It assumes that there is no jQuery, just a modern browser.

// when we're good to go
window.onload = function() {
  // find the div
  var embedDiv = document.getElementById('swarmize-embedded-form');

  // extract token from data attribute
  var token = embedDiv.dataset.swarmizeToken;

  // insert an iFrame containing the embed
  if(window.location.hostname == 'alpha.swarmize.com') {
    var origin = window.location.origin;
  } else {
    var origin = 'http://cdn.swarmize.com';
  }
  embedDiv.innerHTML = "<iframe src='" + origin + "/swarms/"+token+"/embed' width='460' height='400' frameBorder='0' seamless='seamless'></iframe>";

  var iframe = embedDiv.getElementsByTagName('iframe')[0];

  iframe.setAttribute('width', '100%');
  
  respondToMessage = function(e) {
    var chunks = e.data.split("|");

    // when the form changes size, update the height of the iFrame
    if(chunks[0] == 'swarmizeSetHeight') {
      var height = chunks[1];
      iframe.setAttribute('height', height);
    }

    // when the form is submitted, scroll top the top of the iFrame
    if(chunks[0] == 'swarmizeFormSuccess') {
      window.scrollTo(0,iframe.offsetTop);
    }<commit_msg>Width should be a style declaration, not an attribute.<commit_after>// This is the JS embedded in the page that will host the iFrame
// It assumes that there is no jQuery, just a modern browser.

// when we're good to go
window.onload = function() {
  // find the div
  var embedDiv = document.getElementById('swarmize-embedded-form');

  // extract token from data attribute
  var token = embedDiv.dataset.swarmizeToken;

  // insert an iFrame containing the embed
  if(window.location.hostname == 'alpha.swarmize.com') {
    var origin = window.location.origin;
  } else {
    var origin = 'http://cdn.swarmize.com';
  }
  embedDiv.innerHTML = "<iframe src='" + origin + "/swarms/"+token+"/embed' width='460' height='400' frameBorder='0' seamless='seamless'></iframe>";

  var iframe = embedDiv.getElementsByTagName('iframe')[0];

  iframe.style.width = '100%';
  
  respondToMessage = function(e) {
    var chunks = e.data.split("|");

    // when the form changes size, update the height of the iFrame
    if(chunks[0] == 'swarmizeSetHeight') {
      var height = chunks[1];
      iframe.setAttribute('height', height);
    }

    // when the form is submitted, scroll top the top of the iFrame
    if(chunks[0] == 'swarmizeFormSuccess') {
      window.scrollTo(0,iframe.offsetTop);
    }
{'fraction_non_alphanumeric': 0.1359717868338558, 'fraction_numerical': 0.011755485893416929, 'mean_word_length': 3.510600706713781, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '5207409', 'n_tokens_mistral': 822, 'n_tokens_neox': 775, 'n_words': 234}