<commit_before>$.fn.moveImages = function(filename) {
  // Close your eyes for what follows might be terrible frontend code
  img_copy = $('#newest_image').clone();
  img_copy.removeAttr("id");

  // only add thumbnail if newest image has a source
  if($("#thumbnails ul li").size() == 0 && $('#newest_image').attr("href")) {
    $("#thumbnails ul").prepend("<li></li>");
    $("#thumbnails li").first().html(img_copy);
  }
  else if($("#thumbnails ul li").size() == 1) {
    oldFirstLi = $("#thumbnails li").first();
    newFirstLi = oldFirstLi.clone().prependTo(oldFirstLi.parent());
    newFirstLi.attr("class", "first");
    oldFirstLi.attr("class", "last");
    newFirstLi.html(img_copy);
  }
  else {
    oldFirstLi = $("#thumbnails li").first();
    //Remove the class attr of the first element
    oldFirstLi.removeAttr("class");

    // Remove the last list element
    $("#thumbnails ul").last().remove();

    // Set the class of the new last element to "last"
    $("#thumbnails li").last().attr("class", "last");

    //Copy the big image to the thumbnails
    newFirstLi = oldFirstLi.clone().prependTo(oldFirstLi.parent());
    newFirstLi.attr("class", "first");
    newFirstLi.html(img_copy);
  }

  $('#newest_image').attr("href", "/screenshots/" + filename);
  $('#newest_image img').attr("src", "/screenshots/" + filename);
};<commit_msg>Add scoping to jquery plugin<commit_after>(function ( $ ) {
  $.fn.moveImages = function(filename) {
    // Close your eyes for what follows might be terrible frontend code
    img_copy = $('#newest_image').clone();
    img_copy.removeAttr("id");

    // only add thumbnail if newest image has a source
    if($("#thumbnails ul li").size() == 0 && $('#newest_image').attr("href")) {
      $("#thumbnails ul").prepend("<li></li>");
      $("#thumbnails li").first().html(img_copy);
    }
    else if($("#thumbnails ul li").size() == 1) {
      oldFirstLi = $("#thumbnails li").first();
      newFirstLi = oldFirstLi.clone().prependTo(oldFirstLi.parent());
      newFirstLi.attr("class", "first");
      oldFirstLi.attr("class", "last");
      newFirstLi.html(img_copy);
    }
    else {
      oldFirstLi = $("#thumbnails li").first();
      //Remove the class attr of the first element
      oldFirstLi.removeAttr("class");

      // Remove the last list element if the limit is reached
      if($('#thumbnails ul li').size() > 6) {
        $("#thumbnails ul li").last().remove();
      }

      // Set the class of the new last element to "last"
      $("#thumbnails li").last().attr("class", "last");

      //Copy the big image to the thumbnails
      newFirstLi = oldFirstLi.clone().prependTo(oldFirstLi.parent());
      newFirstLi.attr("class", "first");
      newFirstLi.html(img_copy);
    }

    $('#newest_image').attr("href", "/screenshots/" + filename);
    $('#newest_image img').attr("src", "/screenshots/" + filename);
  };
}( jQuery ));
{'fraction_non_alphanumeric': 0.19408121128699243, 'fraction_numerical': 0.0017205781142463868, 'mean_word_length': 3.493044822256569, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, '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': '1271996', 'n_tokens_mistral': 917, 'n_tokens_neox': 908, 'n_words': 218}