<commit_before>function blacklisted() {
  var parser = new UAParser();
  var browser = parser.getResult().browser.name;
  var version = parseFloat(parser.getResult().browser.version);

  return (browser === 'IE' && version < 8.0);
}

function addLoadingNotice(label, $container) {
  return $('<div class="row notice"/>').html('<div class="notice-label col-md-6">' + label + '</div>' + '<div class="notice-state text-muted col-md-6">Loading...</div>').appendTo($container);
}

function setErrorNotice($notice, message) {
  message = message || "Error";
  $notice.find('.notice-state').html(message).removeClass('text-muted').addClass('text-danger');
}

function setSuccessNotice($notice, message) {
  message = message || "Success";

  $notice.find('.notice-state').html(message).removeClass('text-muted').addClass('text-success');
}

function domainFromUrl(url) {
	var a = document.createElement('a');
	a.href = url;
	return a.hostname;
}

function storeUserData(label, value) {
  window.userData = window.userData || {};
  window.userData[label] = value;
  $('#user_datum_data').val(JSON.stringify(window.userData, null, 2));
}

function checkCustom(description, domain, $container, testFunction) {
  var html_label, text_label, $notice;

  html_label = description + '<br><small>' + domain + '</small>';
  text_label = description + ' (' + domain + ')';
  $container = $container || $('.results');
  $notice = addLoadingNotice(html_label, $container);

  function success(message) {
    storeUserData(text_label, message || true);
    setSuccessNotice($notice, message);
  }

  function error(message) {
    storeUserData(text_label, message || false);
    setErrorNotice($notice, message);
  }

  testFunction(success, error);
}

function checkScript(description, src) {
  checkCustom(description, domainFromUrl(src), undefined, function (pass, fail) {
    var $script;
    $script = $('<script/>').
      on('load', function () { pass(); }).
      on('error', function () { fail(); }).
      attr("type", "text/javascript").
      attr("src", src);

      document.body.appendChild($script[0]);
  });
}

function checkImage(description, src) {
  checkCustom(description, domainFromUrl(src), undefined, function (pass, fail) {
    $('<img/>').
      on('load', function () { pass(); }).
      on('error', function () { fail(); }).
      attr("src", src);
  });
}

function checkDefined(description, domain, variable) {
  checkCustom(description, domain, undefined, function (pass, fail) {
    if (typeof variable === "undefined") {
      fail();
    } else {
      pass();
    }
  });
}

function showBrowserInfo(description, testFunction) {
  checkCustom(description, "", $('.browser-info'), testFunction);
}

function testAll(){
  showBrowserInfo('User Agent String', function(success, error) {
    if (navigator.userAgent === undefined) {
      error('Undefined');
    } else if (blacklisted()) {
      error(navigator.userAgent + "\n Your browser may be in a compatibility mode supporting an older version of IE.");
    } else {
      success(navigator.userAgent);
    }
  });

  showBrowserInfo('Window Size', function(success, error) {
    var viewport = window.session.device.viewport;

    if (viewport.width === undefined && viewport.height === undefined) {
      error('Undefined');
    } else {
      success(viewport.width + " x " + viewport.height);
    }
  });

  showBrowserInfo('Screen Size', function(success, error) {
    var screen = window.session.device.screen;

    if (screen.width === undefined && screen.height === undefined) {
      error("Undefined");
    } else {
      success(screen.width + " x " + screen.height);
    }
  });

  showBrowserInfo('Operating System', function(success, error) {
    if (window.session.browser.os === undefined) {
      error("Undefined");
    } else {
      success(window.session.browser.os);
    }
  });

  showBrowserInfo('Browser', function(success, error) {
    var browser = window.session.browser;

    if (browser.browser === undefined && browser.version === undefined) {
      error("Undefined");
    } else {
      success(browser.browser + " " + browser.version);
    }
  });

  showBrowserInfo('Date', function(success, error) {
    if (Date() === undefined) {
      error('Undefined');
    } else {
      success(Date());
    }
  });

  checkImage("Platform: Public CDN", "https://assets-cdn.continuity.net/production/assets/cc_logos/CC_logo_white.png");
  checkImage("Platform: Control", "https://control.continuity.net/browser-test.png");
  checkImage("Platform: Private Assets", "https://control-production.s3.amazonaws.com/browser-test.png");
  checkDefined("Platform: Branch Maps", "maps.googleapis.com", window.google && window.google.maps);

  checkDefined("Support: Live Chat", "lptag.liveperson.net", window.lpTag);
  checkDefined("Support: Walk-throughs", "cdn.walkme.com", window._walkmeInternals);
  checkImage("Support: Walk-through Assets", "https://d2qhvajt3imc89.cloudfront.net/customers/Continuity+Control/Continuity_01_up.png");<commit_msg>disable tests that need additional setup<commit_after>function blacklisted() {
  var parser = new UAParser();
  var browser = parser.getResult().browser.name;
  var version = parseFloat(parser.getResult().browser.version);

  return (browser === 'IE' && version < 8.0);
}

function addLoadingNotice(label, $container) {
  return $('<div class="row notice"/>').html('<div class="notice-label col-md-6">' + label + '</div>' + '<div class="notice-state text-muted col-md-6">Loading...</div>').appendTo($container);
}

function setErrorNotice($notice, message) {
  message = message || "Error";
  $notice.find('.notice-state').html(message).removeClass('text-muted').addClass('text-danger');
}

function setSuccessNotice($notice, message) {
  message = message || "Success";

  $notice.find('.notice-state').html(message).removeClass('text-muted').addClass('text-success');
}

function domainFromUrl(url) {
	var a = document.createElement('a');
	a.href = url;
	return a.hostname;
}

function storeUserData(label, value) {
  window.userData = window.userData || {};
  window.userData[label] = value;
  $('#user_datum_data').val(JSON.stringify(window.userData, null, 2));
}

function checkCustom(description, domain, $container, testFunction) {
  var html_label, text_label, $notice;

  html_label = description + '<br><small>' + domain + '</small>';
  text_label = description + ' (' + domain + ')';
  $container = $container || $('.results');
  $notice = addLoadingNotice(html_label, $container);

  function success(message) {
    storeUserData(text_label, message || true);
    setSuccessNotice($notice, message);
  }

  function error(message) {
    storeUserData(text_label, message || false);
    setErrorNotice($notice, message);
  }

  testFunction(success, error);
}

function checkScript(description, src) {
  checkCustom(description, domainFromUrl(src), undefined, function (pass, fail) {
    var $script;
    $script = $('<script/>').
      on('load', function () { pass(); }).
      on('error', function () { fail(); }).
      attr("type", "text/javascript").
      attr("src", src);

      document.body.appendChild($script[0]);
  });
}

function checkImage(description, src) {
  checkCustom(description, domainFromUrl(src), undefined, function (pass, fail) {
    $('<img/>').
      on('load', function () { pass(); }).
      on('error', function () { fail(); }).
      attr("src", src);
  });
}

function checkDefined(description, domain, variable) {
  checkCustom(description, domain, undefined, function (pass, fail) {
    if (typeof variable === "undefined") {
      fail();
    } else {
      pass();
    }
  });
}

function showBrowserInfo(description, testFunction) {
  checkCustom(description, "", $('.browser-info'), testFunction);
}

function testAll(){
  showBrowserInfo('User Agent String', function(success, error) {
    if (navigator.userAgent === undefined) {
      error('Undefined');
    } else if (blacklisted()) {
      error(navigator.userAgent + "\n Your browser may be in a compatibility mode supporting an older version of IE.");
    } else {
      success(navigator.userAgent);
    }
  });

  showBrowserInfo('Window Size', function(success, error) {
    var viewport = window.session.device.viewport;

    if (viewport.width === undefined && viewport.height === undefined) {
      error('Undefined');
    } else {
      success(viewport.width + " x " + viewport.height);
    }
  });

  showBrowserInfo('Screen Size', function(success, error) {
    var screen = window.session.device.screen;

    if (screen.width === undefined && screen.height === undefined) {
      error("Undefined");
    } else {
      success(screen.width + " x " + screen.height);
    }
  });

  showBrowserInfo('Operating System', function(success, error) {
    if (window.session.browser.os === undefined) {
      error("Undefined");
    } else {
      success(window.session.browser.os);
    }
  });

  showBrowserInfo('Browser', function(success, error) {
    var browser = window.session.browser;

    if (browser.browser === undefined && browser.version === undefined) {
      error("Undefined");
    } else {
      success(browser.browser + " " + browser.version);
    }
  });

  showBrowserInfo('Date', function(success, error) {
    if (Date() === undefined) {
      error('Undefined');
    } else {
      success(Date());
    }
  });

  checkImage("Platform: Public CDN", "https://assets-cdn.continuity.net/production/assets/cc_logos/CC_logo_white.png");
  checkImage("Platform: Control", "https://control.continuity.net/browser-test.png");
  checkImage("Platform: Private Assets", "https://control-production.s3.amazonaws.com/browser-test.png");
  checkDefined("Platform: Branch Maps", "maps.googleapis.com", window.google && window.google.maps);

  // TODO:
  //checkDefined("Support: Live Chat", "lptag.liveperson.net", window.lpTag);
  //checkDefined("Support: Walk-throughs", "cdn.walkme.com", window._walkmeInternals);

  checkImage("Support: Walk-through Assets", "https://d2qhvajt3imc89.cloudfront.net/customers/Continuity+Control/Continuity_01_up.png");
{'fraction_non_alphanumeric': 0.17413230495401957, 'fraction_numerical': 0.0025709482843864332, 'mean_word_length': 4.090085556114746, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 23, 'https://': 8, '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': '401050', 'n_tokens_mistral': 3060, 'n_tokens_neox': 3000, 'n_words': 603}