<commit_before>'use strict';

var rprotocol = /^https?:\/\//;

document.addEventListener('mousedown', clicked, false);

function clicked (e) {
  var a = e.target;
  while (a && a.tagName !== 'A') {
    a = a.parentElement;
  }
  if (a) {
    expand(a);
  }
}

function expand (a) {
  var expanded = a.getAttribute('data-expanded-url');
  if (expanded) {
    a.href = expanded;
    return;
  }
  var title = a.getAttribute('title');
  if (rprotocol.test(title)) {
    a.href = title;
  }
}<commit_msg>simplified logic<commit_after>'use strict';

var rprotocol = /^https?:\/\//;

document.addEventListener('mousedown', clicked, false);

function clicked (e) {
  var a = e.target;
  while (a) {
    if (a.tagName === 'A') {
      expand(a);
      return;
    }
    a = a.parentElement;
  }
}

function expand (a) {
  var expanded = a.getAttribute('data-expanded-url');
  if (expanded) {
    a.href = expanded;
    return;
  }
  var title = a.getAttribute('title');
  if (rprotocol.test(title)) {
    a.href = title;
  }
}
{'fraction_non_alphanumeric': 0.17976424361493124, 'fraction_numerical': 0.0, 'mean_word_length': 2.9042145593869733, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7607248', 'n_tokens_mistral': 376, 'n_tokens_neox': 375, 'n_words': 83}