<commit_before>// Returns the array of class names
$.fn.getClassNames = function() {
  var klasses = $(this).attr("class");
  if (klasses != null) {
    return klasses.split(" ");
  } else {
    return [];
  }
};

// returns true if the passed in string is a class of $(this)
$.fn.hasClass = function(klas) {
  var has = false;
  var klasses = $(this).getClassNames();
  for (i = 0; i < klasses.length; i += 1) {
    if (klasses[i] == klas) {
      has = i;
      break;
    }
  }
  return has;
};

// returns the first class found that can be parsed to int, or false if none found
$.fn.getNumberClass = function() {
  var num = false;
  var klasses = $(this).getClassNames();
  for (i = 0; i < klasses.length; i += 1) {
    if (!isNaN(klasses[i])) {
      num = klasses[i];
      break;
    }
  }
  return num;
};

// returns "on" if the given element has the class "on"
// returns "off" if the given element has the class "off"
// returns false if class "on" or "off" is not found on given element
// returns fasle if both "on" and "off" are found
$.fn.onOrOff = function() {
  var on = $(this).hasClass("on");
  var off = $(this).hasClass("off");
  if (on && !off) {
    status = "on";
  } else if (off && !on) {
    status = "off";
  } else {
    status = false;
  }
  return status;
};

$.fn.turnOn = function() {
  if ($(this).hasClass("off")) {
    $(this).removeClass("off")
  }
  $(this).addClass("on");

  return this;
}

$.fn.turnOff = function() {
  if ($(this).hasClass("on")) {
    $(this).removeClass("on")
  }
  $(this).addClass("off");
 
  return this;
}

$.fn.toggleOnOff = function() {<commit_msg>fix onOrOff jquery plugin, use var, this was causing failure in firefox<commit_after>// Returns the array of class names
$.fn.getClassNames = function() {
  var klasses = $(this).attr("class");
  if (klasses != null) {
    return klasses.split(" ");
  } else {
    return [];
  }
};

// returns true if the passed in string is a class of $(this)
$.fn.hasClass = function(klas) {
  var has = false;
  var klasses = $(this).getClassNames();
  for (i = 0; i < klasses.length; i += 1) {
    if (klasses[i] == klas) {
      has = i;
      break;
    }
  }
  return has;
};

// returns the first class found that can be parsed to int, or false if none found
$.fn.getNumberClass = function() {
  var num = false;
  var klasses = $(this).getClassNames();
  for (i = 0; i < klasses.length; i += 1) {
    if (!isNaN(klasses[i])) {
      num = klasses[i];
      break;
    }
  }
  return num;
};

// returns "on" if the given element has the class "on"
// returns "off" if the given element has the class "off"
// returns false if class "on" or "off" is not found on given element
// returns fasle if both "on" and "off" are found
$.fn.onOrOff = function() {
  var onOrOff = false;
  var on = $(this).hasClass("on");
  var off = $(this).hasClass("off");
  if (on && !off) {
    onOrOff = "on";
  } else if (off && !on) {
    onOrOff = "off";
  }
  return onOrOff;
};

$.fn.turnOn = function() {
  if ($(this).hasClass("off")) {
    $(this).removeClass("off")
  }
  $(this).addClass("on");

  return this;
}

$.fn.turnOff = function() {
  if ($(this).hasClass("on")) {
    $(this).removeClass("on")
  }
  $(this).addClass("off");
 
  return this;
}

$.fn.toggleOnOff = function() {
{'fraction_non_alphanumeric': 0.18203957382039573, 'fraction_numerical': 0.0024353120243531205, 'mean_word_length': 2.847775175644028, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '3507418', 'n_tokens_mistral': 1166, 'n_tokens_neox': 1155, 'n_words': 363}