<commit_before><!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <script>
      var message = {};
      safari.application.addEventListener('message', function handleMessage(e) {
        switch (e.name) {
          case 'mouseover':
            // copy any new state into our state
            for (var key in e.message)
              if (e.message.hasOwnProperty(key))
                message[key] = e.message[key];

            var s = getStatus(message);
            e.target.page.dispatchMessage('displayStatus', s);

            if (safari.extension.settings.longURL && !safari.application.privateBrowsing.enabled) {
              // TODO debounce?
              lengthenURL(e.message.href, function(result) {
                var url = result['long-url'];
                if (url) e.target.page.dispatchMessage('displayStatus', s + ' (' +  url + ')');
              });
            }
            break;

          case 'mouseout':
            e.target.page.dispatchMessage('hideStatus');
            break;
        }
      }, false);

      var keyMap = {
        'false,false,false': 'go',
        'false,false,true':  'readingList',
        'false,true,false':  'download',
        'false,true,true':   'go',
        'true,false,false':  'newTabBehind',
        'true,false,true':   'newTab',
        'true,true,false':   'newWindowBehind',
        'true,true,true':    'newWindow',
      };
      function getStatus(options) {
        var absoluteURL = safari.extension.settings.absoluteURL,
            href = decodeURIComponent((absoluteURL ? options.href : options.hrefRelative).trim().replace(/\n/g, ' ')),
            email = href.match(/^mailto:([^?]+)(\?subject=([^&]+))?/i),
            script = href.match(/^javascript:(.*)/);

        if (options.ctrlKey) {
          return strings.menu.replace(/{href}/g, href);
        } else if (script) {
          return strings.script.replace(/{src}/g, script[1]);
        } else if (email) {
          if (email[3]) {
            return strings.email.subject.replace(/{to}/g, email[1])
                                        .replace(/{subject}/g, decodeURIComponent(email[3]));
          } else {
            return strings.email.to.replace(/{to}/g, email[1]);
          }
        } else {
          var keys = [options.metaKey, options.altKey, options.shiftKey];
          return strings[keyMap[keys]].replace(/{href}/g, href);
        }
      }

      var strings;
      (function loadNextLocale(locales) {
        if (!locales.length) return;
        getJSON('locale/' + locales.shift() + '.json', function(json) {
          if (json)
            strings = json;
          else
            loadNextLocale(locales);<commit_msg>easier to read key map<commit_after><!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <script>
      var message = {};
      safari.application.addEventListener('message', function handleMessage(e) {
        switch (e.name) {
          case 'mouseover':
            // copy any new state into our state
            for (var key in e.message)
              if (e.message.hasOwnProperty(key))
                message[key] = e.message[key];

            var s = getStatus(message);
            e.target.page.dispatchMessage('displayStatus', s);

            if (safari.extension.settings.longURL && !safari.application.privateBrowsing.enabled) {
              // TODO debounce?
              lengthenURL(e.message.href, function(result) {
                var url = result['long-url'];
                if (url) e.target.page.dispatchMessage('displayStatus', s + ' (' +  url + ')');
              });
            }
            break;

          case 'mouseout':
            e.target.page.dispatchMessage('hideStatus');
            break;
        }
      }, false);

      var keyMap = {
        '0,0,0': 'go',
        '0,0,1': 'readingList',
        '0,1,0': 'download',
        '0,1,1': 'go',
        '1,0,0': 'newTabBehind',
        '1,0,1': 'newTab',
        '1,1,0': 'newWindowBehind',
        '1,1,1': 'newWindow',
      };
      function getStatus(options) {
        var absoluteURL = safari.extension.settings.absoluteURL,
            href = decodeURIComponent((absoluteURL ? options.href : options.hrefRelative).trim().replace(/\n/g, ' ')),
            email = href.match(/^mailto:([^?]+)(\?subject=([^&]+))?/i),
            script = href.match(/^javascript:(.*)/);

        if (options.ctrlKey) {
          return strings.menu.replace(/{href}/g, href);
        } else if (script) {
          return strings.script.replace(/{src}/g, script[1]);
        } else if (email) {
          if (email[3]) {
            return strings.email.subject.replace(/{to}/g, email[1])
                                        .replace(/{subject}/g, decodeURIComponent(email[3]));
          } else {
            return strings.email.to.replace(/{to}/g, email[1]);
          }
        } else {
          var keys = [options.metaKey, options.altKey, options.shiftKey];
          return strings[keyMap[keys.map(Number)]].replace(/{href}/g, href);
        }
      }

      var strings;
      (function loadNextLocale(locales) {
        if (!locales.length) return;
        getJSON('locale/' + locales.shift() + '.json', function(json) {
          if (json)
            strings = json;
          else
            loadNextLocale(locales);
{'fraction_non_alphanumeric': 0.15828817043543264, 'fraction_numerical': 0.006727714445897963, 'mean_word_length': 1.8377518557794275, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '592872', 'n_tokens_mistral': 1582, 'n_tokens_neox': 1557, 'n_words': 285}