<commit_before>// This wraps the returned element with some basic functions needed for ZeroClipboard
function elementWrapper(element) {

  // don't wrap twice
  if (element.addClass) return element;

  // extend element with a few useful methods
  element.hide = function () { this.style.display = 'none'; };
  element.show = function () { this.style.display = ''; };
  element.addClass = function (name) { this.removeClass(name); this.className += ' ' + name; };
  element.removeClass = function (name) {
    var classes = this.className.split(/\s+/);
    var idx = -1;
    for (var k = 0; k < classes.length; k++) {
      if (classes[k] == name) { idx = k; k = classes.length; }
    }
    if (idx > -1) {
      classes.splice(idx, 1);
      this.className = classes.join(' ');
    }
    return this;
  };
  element.hasClass = function (name) {
    return !!this.className.match(new RegExp("\\s*" + name + "\\s*"));
  };
  return element;
}

ZeroClipboard.$ = function (query) {

  var ZeroClipboardSelect = function (s, n) { return n.querySelectorAll(s); },
    result;

  // Prefer Sizzle, if available.
  if (typeof Sizzle === "function") {
    ZeroClipboardSelect = function (s, n) { return Sizzle.uniqueSort(Sizzle(s, n)); };
  }

  if (typeof query === "string") {
    result = ZeroClipboardSelect(query, document);
    // last ditch effort for backwards compatibility
    if (result.length === 0) result = [document.getElementById(query)];
  }

  result.map(function (elm) {
    return elementWrapper(elm);
  });

  // for single matches
  if (result.length === 1) return result[0];

  return result;
};<commit_msg>Moving this so the diff looks better<commit_after>ZeroClipboard.$ = function (query) {

  var ZeroClipboardSelect = function (s, n) { return n.querySelectorAll(s); },
    result;

  // Prefer Sizzle, if available.
  if (typeof Sizzle === "function") {
    ZeroClipboardSelect = function (s, n) { return Sizzle.uniqueSort(Sizzle(s, n)); };
  }

  if (typeof query === "string") {
    result = ZeroClipboardSelect(query, document);
    // last ditch effort for backwards compatibility
    if (result.length === 0) result = [document.getElementById(query)];
  }

  result.map(function (elm) {
    return elementWrapper(elm);
  });

  // for single matches
  if (result.length === 1) return result[0];

  return result;
};

// This wraps the returned element with some basic functions needed for ZeroClipboard
function elementWrapper(element) {

  // don't wrap twice
  if (element.addClass) return element;

  // extend element with a few useful methods
  element.hide = function () { this.style.display = 'none'; };
  element.show = function () { this.style.display = ''; };
  element.addClass = function (name) { this.removeClass(name); this.className += ' ' + name; };
  element.removeClass = function (name) {
    var classes = this.className.split(/\s+/);
    var idx = -1;
    for (var k = 0; k < classes.length; k++) {
      if (classes[k] == name) { idx = k; k = classes.length; }
    }
    if (idx > -1) {
      classes.splice(idx, 1);
      this.className = classes.join(' ');
    }
    return this;
  };
  element.hasClass = function (name) {
    return !!this.className.match(new RegExp("\\s*" + name + "\\s*"));
  };
  return element;
}
{'fraction_non_alphanumeric': 0.15539920464973997, 'fraction_numerical': 0.004282655246252677, 'mean_word_length': 3.1762452107279695, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5437859', 'n_tokens_mistral': 1032, 'n_tokens_neox': 1000, 'n_words': 289}