<commit_before>function toggleMergeButton(element) {
  if (document.getElementsByClassName("js-issue-title")[0].textContent.indexOf("WIP") > -1) {
    if (element.className.indexOf("primary") > -1) {
      element.className = element.className.replace(/primary/g, 'disabled').replace(/js-details-target/g, '');
    }
  } else {
    if (element.className.indexOf("disabled") > -1) {
      element.className = element.className.replace(/disabled/g, 'primary js-details-target');
    }
  }
}

function observeMergeButton() {
  var target = document.querySelector('body');
  var config = {
    childList: true,
    subtree: true,
    characterData: true
  };

  var observer = new MutationObserver(function(mutations, self) {
    mutations.forEach(function(mutation) {
      if (mutation.type === 'childList') {
        var elements = document.querySelectorAll('.merge-branch-action');
        Array.prototype.forEach.call(elements, function(element) {
          toggleMergeButton(element);
        });
      }
    });
  });

  observer.observe(target, config);
}

window.onload = observeMergeButton;<commit_msg>refactoring<commit_after>function toggleMergeButton(element) {
  if (document.getElementsByClassName("js-issue-title")[0].textContent.indexOf("WIP") > -1) {
    if (element.className.indexOf("primary") > -1) {
      element.className = element.className.replace(/primary/g, 'disabled').replace(/js-details-target/g, '');
    }
  } else {
    if (element.className.indexOf("disabled") > -1) {
      element.className = element.className.replace(/disabled/g, 'primary js-details-target');
    }
  }
}

function observeMergeButton() {
  var target = document.querySelector('body');
  var config = {
    childList: true,
    subtree: true,
    characterData: true
  };

  var observer = new MutationObserver(function(mutations, self) {
    mutations.forEach(function(mutation) {
      if (mutation.type === 'characterData') {
        var elements = document.querySelectorAll('.merge-branch-action');
        Array.prototype.forEach.call(elements, function(element) {
          toggleMergeButton(element);
        });
      }
    });
  });

  observer.observe(target, config);
}

window.onload = function() {
  toggleMergeButton(document.querySelector(".merge-branch-action"));
  observeMergeButton();
}
{'fraction_non_alphanumeric': 0.15394622723330442, 'fraction_numerical': 0.003469210754553339, 'mean_word_length': 3.6606060606060606, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '7165537', 'n_tokens_mistral': 678, 'n_tokens_neox': 678, 'n_words': 103}