<commit_before><!DOCTYPE html>
<html>
<head>
  <title>Popup outside click handler</title>
  <style>
    #log {
      border: 1px solid lightgrey;
      margin: 5px;
    }

    .log-entry {
      margin: 3px;
    }
  </style>
  <script>
    const intervalMs = 900;
    var onloadIntervalId = undefined;
    var onclickIntervalId = undefined;
    var numberOfAttempts = 10;

    function $(id) {
      return document.getElementById(id);
    }

    function log(msg, color) {
      var styleStr = "background-color:" + color;

      $("log").innerHTML += "<span class='log-entry' style='" + styleStr + "'>"
          + msg + "</span>";
    }

    function callWindowOpen(label) {
      var link = "http://www.example.com?label=" + label;
      var result = window.open(link);
      log(label, result? "lightgreen" : "lightpink");

      if (numberOfAttempts == 0) {
        if (onloadIntervalId)
          window.clearInterval(onloadIntervalId);
        if (onclickIntervalId)
          window.clearInterval(onclickIntervalId);
        log("done", "beige");
      } else {
        numberOfAttempts--;
      }
    }

    function init() {
      log("starting...", "beige");

      onloadIntervalId = window.setInterval(callWindowOpen, intervalMs, "task-from-load");

        window.addEventListener("click", () => {
        log("click", "yellow");
        if (!onclickIntervalId) {<commit_msg>Tweak popup-outside-click.<commit_after><!DOCTYPE html>
<html>
<head>
  <title>Popup outside click handler</title>
  <style>
    #log {
      border: 1px solid lightgrey;
      margin: 5px;
    }

    .log-entry {
      margin: 3px;
    }
  </style>
  <script>
    const intervalMs = 900;
    var onloadIntervalId = undefined;
    var onclickIntervalId = undefined;
    var numberOfAttempts = 10;

    function $(id) {
      return document.getElementById(id);
    }

    function log(msg, color) {
      var styleStr = "background-color:" + color;

      $("log").innerHTML += "<span class='log-entry' style='" + styleStr + "'>"
          + msg + "</span>";
    }

    function callWindowOpen(label) {
      var link = "http://www.example.com?label=" + label;
      var result = window.open(link);
      log(label, result? "lightgreen" : "lightpink");

      if (--numberOfAttempts <= 0) {
        if (onloadIntervalId)
          window.clearInterval(onloadIntervalId);
        if (onclickIntervalId)
          window.clearInterval(onclickIntervalId);
        log("done", "beige");
      }
    }

    function init() {
      log("starting...", "beige");

      onloadIntervalId = window.setInterval(callWindowOpen, intervalMs, "task-from-load");

      window.addEventListener("click", () => {
        log("click", "yellow");
        if (!onclickIntervalId) {
{'fraction_non_alphanumeric': 0.14836363636363636, 'fraction_numerical': 0.006545454545454545, 'mean_word_length': 2.5224071702944943, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 25, 'https://': 0, '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': '481961', 'n_tokens_mistral': 885, 'n_tokens_neox': 833, 'n_words': 179}