<commit_before>/*global chrome hashblot queue blotpw*/

function updateFromPhrase(phrase) {
  document.getElementById('blotpath').setAttribute('d',
    phrase ? hashblot.sha1qp(phrase) : '');
}

function calculateHashblot() {
  updateFromPhrase(blotpw.blotString({
    email: document.getElementById('email').value,
    domain: document.getElementById('domain').value,
    salt: document.getElementById('salt').value}));
}

var currentInfo;

function loadInfo() {
  chrome.tabs.query({active: true, currentWindow: true}, function (tabs) {
    var currentUrl = tabs[0].url;
    var hostname = blotpw.getHostnameFromUrl(changeInfo.url);
    if (hostname) {
      blotpw.getDomainAndInfo(hostname, function(err,info) {
        currentInfo = info;
        setStateFromCurrentInfo();
      });
    }
  });
}

function getResultsFromInfo(info) {
  return {
    domain: info.domain,
    email: info.record ? (info.record.email || '')
      : info.defaults && (info.defaults.email || ''),
    salt: info.record ? (info.record.salt || '')
      : info.defaults && (info.defaults.salt || ''),
    memo: info.record && (info.record.memo || '')
  };
}

function setStateFromCurrentInfo() {
  var info = getResultsFromInfo(currentInfo);
  document.getElementById('domain').value = info.domain;
  document.getElementById('domainname').textContent = info.domain;<commit_msg>Fixes, for undefineds and undeclareds<commit_after>/*global chrome hashblot queue blotpw*/

function updateFromPhrase(phrase) {
  document.getElementById('blotpath').setAttribute('d',
    phrase ? hashblot.sha1qp(phrase) : '');
}

function calculateHashblot() {
  updateFromPhrase(blotpw.blotString({
    email: document.getElementById('email').value,
    domain: document.getElementById('domain').value,
    salt: document.getElementById('salt').value}));
}

var currentInfo;

function loadInfo() {
  chrome.tabs.query({active: true, currentWindow: true}, function (tabs) {
    var hostname = blotpw.getHostnameFromUrl(tabs[0].url);
    if (hostname) {
      blotpw.getDomainAndInfo(hostname, function(err,info) {
        currentInfo = info;
        setStateFromCurrentInfo();
      });
    }
  });
}

function getResultsFromInfo(info) {
  return {
    domain: info.domain,
    email: info.record ? info.record.email || ''
      : info.defaults && info.defaults.email || '',
    salt: info.record ? info.record.salt || ''
      : info.defaults && info.defaults.salt || '',
    memo: info.record && info.record.memo || ''
  };
}

function setStateFromCurrentInfo() {
  var info = getResultsFromInfo(currentInfo);
  document.getElementById('domain').value = info.domain;
  document.getElementById('domainname').textContent = info.domain;
{'fraction_non_alphanumeric': 0.15139146567717995, 'fraction_numerical': 0.001484230055658627, 'mean_word_length': 4.164750957854406, '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': '5943825', 'n_tokens_mistral': 827, 'n_tokens_neox': 813, 'n_words': 138}