<commit_before>  /*
   * This script is injected into the webpage so that it has access to MathJax
   */

  var preferences;


  $(document).ready(function() {

      /*
       * input.codeshard helper elements are generated in inject.js
       */


      // initialize preview images
      $.map($(".problem-content img"), function(n) {
          // create offscreen to determine width and height
          var testImage = new Image();
          testImage.src = $(n).attr("src");

          // get the native width and height of the image
          var imageWidth = testImage.width;
          var imageHeight = testImage.height;
          // add class name so that the later image hover event doesn't work on popups too
          $(n).addClass('wwImage');

          // append to DOM, shift to the right and upwards a little
          $(n).before('<span class="topPopup-container"><div class="topPopup" style="width:'+imageWidth+'px; height:'+imageHeight+'px;left:'+$(n).width()/2+'px;"><img src="'+$(n).attr('src')+'"></div></span>');
      });


      // guesstimate how many questions the user got wrong
      var summary = $(".scoreSummary")[0];

      // TODO: MAKE SURE THAT IT SELECTS THE RIGHT PERCENTAGE (IT SHOULD BE THE ONE THAT SAYS "CURRENT SCORE")
      var captured = /\d+%/.exec($(summary).text());

      // if the problem has not been attempted, the percentage won't even be there, so don't check (also, it returns null, which would trigger an error later)
      if (captured !== null) {
          var percentageCorrect = captured[0].replace("%", "");

          var totalProblems = $(".codeshard").length;

          var problemsWrong = Math.ceil((100-percentageCorrect) / 100 * totalProblems);

          $(summary).children().html("I estimate that you answered <b>" + (problemsWrong == 0 ? "zero" : problemsWrong) + "</b> question" + (problemsWrong == 1 ? "" : "s") + " incorrectly.<br>" + $(summary).children().html());
      }

      $('button.replace_btn').on('click', function(e) {
        console.log("hi");
        e.stopImmediatePropagation();
        if ($(this).hasClass("replace_ready")) {
            let original = $(this);
            let variable = original.next().val();
            let value = original.next().next().val();<commit_msg>Fixed button doing it's default.<commit_after>  /*
   * This script is injected into the webpage so that it has access to MathJax
   */

  var preferences;


  $(document).ready(function() {

      /*
       * input.codeshard helper elements are generated in inject.js
       */


      // initialize preview images
      $.map($(".problem-content img"), function(n) {
          // create offscreen to determine width and height
          var testImage = new Image();
          testImage.src = $(n).attr("src");

          // get the native width and height of the image
          var imageWidth = testImage.width;
          var imageHeight = testImage.height;
          // add class name so that the later image hover event doesn't work on popups too
          $(n).addClass('wwImage');

          // append to DOM, shift to the right and upwards a little
          $(n).before('<span class="topPopup-container"><div class="topPopup" style="width:'+imageWidth+'px; height:'+imageHeight+'px;left:'+$(n).width()/2+'px;"><img src="'+$(n).attr('src')+'"></div></span>');
      });


      // guesstimate how many questions the user got wrong
      var summary = $(".scoreSummary")[0];

      // TODO: MAKE SURE THAT IT SELECTS THE RIGHT PERCENTAGE (IT SHOULD BE THE ONE THAT SAYS "CURRENT SCORE")
      var captured = /\d+%/.exec($(summary).text());

      // if the problem has not been attempted, the percentage won't even be there, so don't check (also, it returns null, which would trigger an error later)
      if (captured !== null) {
          var percentageCorrect = captured[0].replace("%", "");

          var totalProblems = $(".codeshard").length;

          var problemsWrong = Math.ceil((100-percentageCorrect) / 100 * totalProblems);

          $(summary).children().html("I estimate that you answered <b>" + (problemsWrong == 0 ? "zero" : problemsWrong) + "</b> question" + (problemsWrong == 1 ? "" : "s") + " incorrectly.<br>" + $(summary).children().html());
      }

      $('button.replace_btn').on('click', function(e) {
        console.log("hi");
        e.preventDefault();
        if ($(this).hasClass("replace_ready")) {
            let original = $(this);
            let variable = original.next().val();
            let value = original.next().next().val();
{'fraction_non_alphanumeric': 0.15543358946212954, 'fraction_numerical': 0.004829857299670692, 'mean_word_length': 2.6331738437001593, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '2515137', 'n_tokens_mistral': 1309, 'n_tokens_neox': 1229, 'n_words': 395}