<commit_before><!doctype html>
<title>Diamond - JSON Blaster</title>
<script type="text/javascript" src="{{ static_url('testui/jquery.js') }}"></script>

<style type="text/css">
.hidden {
  display: none;
}

#filters, .filter {
  margin-top: 2em;
}

#scope {
  margin-top: 1em;
}

table {
  table-layout: fixed;
}

th {
  text-align: right;
  padding-right: 0.5em;
  width: 8em;
}
</style>

<div id="prototype" class="hidden">
  <div class="filter">
    <table>
      <tr><th>Name<td><input type="text" name="name" size="40">
      <tr><th>Filter<td><input type="file" name="code"><img class="hidden" src="{{ static_url('testui/spinner.gif') }}">
      <tr><th>Arguments<td><input class="multiple" type="text" name="arguments" size="40">
      <tr><th>Blob argument<td><input type="file" name="blob"><img class="hidden" src="{{ static_url('testui/spinner.gif') }}">
      <tr><th>Dependencies<td><input class="multiple" type="text" name="dependencies" size="40">
      <tr><th>Minimum score<td><input type="text" name="min_score" size="40">
      <tr><th>Maximum score<td><input type="text" name="max_score" size="40">
      <tr><th><td><input class="delete" type="submit" value="Delete filter">
    </table>
  </div>
</div>

<input id="add" type="submit" value="Add filter">
<input id="search" type="submit" value="Search">

<table id="scope">
  <tr><th>Scope cookie<td><input name="cookie" type="file"><img class="hidden" src="{{ static_url('testui/spinner.gif') }}">
</table>

<div id="filters">
</div>

<script type="text/javascript">
$(function() {
  var filterIndex = 1;
  var pendingIO = 0;

  // Start an I/O operation.
  function _pending_inc() {
    pendingIO++;
    $('#search').attr('disabled', 'disabled');
  }

  // Finish an I/O operation.
  function _pending_dec() {
    if (!--pendingIO) {
      $('#search').removeAttr('disabled');
    }
  }

  // Handle loading of a scope cookie.
  $('#scope [name=cookie]').change(function() {
    var input = this;
    var reader = new FileReader();
    _pending_inc();
    reader.onloadend = function() {
      if (reader.error) {
        alert('Error reading file.');
        $(input).removeData('data');
      } else {
        $(input).data('data', reader.result);
      }
      $(input).next().hide();
      _pending_dec();<commit_msg>blaster: Fix phantom scope cookie issue in Firefox<commit_after><!doctype html>
<title>Diamond - JSON Blaster</title>
<script type="text/javascript" src="{{ static_url('testui/jquery.js') }}"></script>

<style type="text/css">
.hidden {
  display: none;
}

#filters, .filter {
  margin-top: 2em;
}

#scope {
  margin-top: 1em;
}

table {
  table-layout: fixed;
}

th {
  text-align: right;
  padding-right: 0.5em;
  width: 8em;
}
</style>

<div id="prototype" class="hidden">
  <div class="filter">
    <table>
      <tr><th>Name<td><input type="text" name="name" size="40">
      <tr><th>Filter<td><input type="file" name="code"><img class="hidden" src="{{ static_url('testui/spinner.gif') }}">
      <tr><th>Arguments<td><input class="multiple" type="text" name="arguments" size="40">
      <tr><th>Blob argument<td><input type="file" name="blob"><img class="hidden" src="{{ static_url('testui/spinner.gif') }}">
      <tr><th>Dependencies<td><input class="multiple" type="text" name="dependencies" size="40">
      <tr><th>Minimum score<td><input type="text" name="min_score" size="40">
      <tr><th>Maximum score<td><input type="text" name="max_score" size="40">
      <tr><th><td><input class="delete" type="submit" value="Delete filter">
    </table>
  </div>
</div>

<input id="add" type="submit" value="Add filter">
<input id="search" type="submit" value="Search">

<table id="scope">
  <tr><th>Scope cookie<td><!-- input dynamically inserted here --><img class="hidden" src="{{ static_url('testui/spinner.gif') }}">
</table>

<div id="filters">
</div>

<script type="text/javascript">
$(function() {
  var filterIndex = 1;
  var pendingIO = 0;

  // Start an I/O operation.
  function _pending_inc() {
    pendingIO++;
    $('#search').attr('disabled', 'disabled');
  }

  // Finish an I/O operation.
  function _pending_dec() {
    if (!--pendingIO) {
      $('#search').removeAttr('disabled');
    }
  }

  // Handle loading of a scope cookie.  Dynamically create the cookie
  // input so some browsers won't prepopulate the field (incorrectly, since
  // our handler doesn't get a chance to run).
  var scope_input = $('<input name="cookie" type="file">').
      prependTo($('#scope td'));
  scope_input.change(function() {
    var input = this;
    var reader = new FileReader();
    _pending_inc();
    reader.onloadend = function() {
      if (reader.error) {
        alert('Error reading file.');
        $(input).removeData('data');
      } else {
        $(input).data('data', reader.result);
      }
      $(input).next().hide();
      _pending_dec();
{'fraction_non_alphanumeric': 0.20616649537512846, 'fraction_numerical': 0.006988694758478931, 'mean_word_length': 4.052959501557632, 'pattern_counts': {'":': 0, '<': 122, '<?xml version=': 0, '>': 122, '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': '1555115', 'n_tokens_mistral': 1669, 'n_tokens_neox': 1628, 'n_words': 361}