<commit_before>(function() {
  var COOKIE_NAME, createCookie, getCookie, notsupported, sha2support, testImage;

  COOKIE_NAME = "sha2supported";

  if (typeof window.console === 'undefined') {
    window.console = {
      log: function() {}
    };
  }

  setSupported = function(status) {
    expires = "; expires=" + Infinity;
    document.cookie = COOKIE_NAME + "=" + status + expires + "; path=/";
  }

  getSupported = function() {
    if (document.cookie.length > 0) {
      c_start = document.cookie.indexOf(COOKIE_NAME + "=");
      if (c_start != -1) {
          c_start = c_start + COOKIE_NAME.length + 1;
          c_end = document.cookie.indexOf(";", c_start);
          if (c_end == -1) {
              c_end = document.cookie.length;
          }
          return unescape(document.cookie.substring(c_start, c_end));
      }
    }
    return "";
  }

  notsupported = function(){
    setSupported("notsupported");
    alert("This is a bad browser! No SHA2 support!");
  }

  supported = function(){
    console.log("supported");
    setSupported("supported");
  }

  sha2support = getSupported();

  if(sha2support === "supported"){
    console.log("already tested, all good");
    supported();
  }
  else if(sha2support === "notsupported"){
    console.log("already testsed, not supported");
    notsupported();
  }
  else {
    console.log("testing");
    testImage = new Image()
    testImage.onload = supported;
    testImage.onerror = notsupported;
    testImage.src = "https://www.zendesk.com/public/assets/images/favicon.png"
  }

})();<commit_msg>Use a callback to handle displaying support status<commit_after>(function(window) {
  var COOKIE_NAME, createCookie, getCookie, notsupported, sha2support, testImage;

  COOKIE_NAME = "sha2supported";

  setSupported = function(status) {
    expires = "; expires=" + Infinity;
    document.cookie = COOKIE_NAME + "=" + status + expires + "; path=/";
  }

  getSupported = function() {
    if (document.cookie.length > 0) {
      c_start = document.cookie.indexOf(COOKIE_NAME + "=");
      if (c_start != -1) {
          c_start = c_start + COOKIE_NAME.length + 1;
          c_end = document.cookie.indexOf(";", c_start);
          if (c_end == -1) {
              c_end = document.cookie.length;
          }
          return unescape(document.cookie.substring(c_start, c_end));
      }
    }
    return "";
  }

  notsupported = function(){
    if(sha2support==""){
      sha2support = "notsupported";
      setSupported(sha2support);
    }
    if(sha2callback){ sha2callback.call(sha2support); }
  }

  supported = function(){
    if(sha2support==""){
      sha2support = "supported";
      setSupported(sha2support);
    }
    if(sha2callback){ sha2callback.call(this, sha2support); }
  }

  testforsupport = function(){
    testImage = new Image()
    testImage.onload = supported;
    testImage.onerror = notsupported;
    testImage.src = "https://www.zendesk.com/public/assets/images/favicon.png"
  }

  sha2support = "";
  sha2callback = null;

  window.sha2supportTest = function(callback){
    sha2support = getSupported();
    sha2callback = callback;

    if(sha2support === "supported"){
      supported();
    }
    else if(sha2support === "notsupported"){
      notsupported();
    }
    else {
      testforsupport();
    }
  }

})(window);
{'fraction_non_alphanumeric': 0.14698795180722893, 'fraction_numerical': 0.010542168674698794, 'mean_word_length': 2.8842105263157896, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '1616877', 'n_tokens_mistral': 1085, 'n_tokens_neox': 1045, 'n_words': 196}