<commit_before>/**
 * Copyright IBM Corp. 2016
 * Licensed under the MIT License.
 */

var apps = chrome.extension.getURL('applications.json');
var xhr = new XMLHttpRequest();
xhr.overrideMimeType("application/json");
xhr.onreadystatechange = function () {
  if (xhr.readyState == 4 && xhr.status == "200") {
    var appsStr = replaceExtensionPath(xhr.responseText);
    localStorage.setItem('applications-json', appsStr);
    var pageScript = document.createElement('script');
    pageScript.src = chrome.extension.getURL('page.js');
    pageScript.onload = function() {
      this.parentNode.removeChild(this);
    };
    (document.head||document.documentElement).appendChild(pageScript);
  }
};
xhr.open('GET', apps, true);
xhr.send();

function replaceExtensionPath(appsStr) {
  var extensionPath = chrome.extension.getURL('');
  var apps = [];
  try {
    apps = JSON.parse(appsStr);
    apps.forEach(function(app) {
      var extensions = app.extensions;
      extensions.forEach(function(extension) {
        var extensionUrl = extension.url;
        if (extensionUrl && extensionUrl.indexOf('${extensionPath}/') > -1) {
          extension.url = extensionUrl.replace('${extensionPath}/', extensionPath);
        }
        if (extension.payload) {
          extensionUrl = extension.payload.url;
          if (extensionUrl && extensionUrl.indexOf('${extensionPath}/') > -1) {
            extension.payload.url = extensionUrl.replace('${extensionPath}/', extensionPath);
          } else {
            extensionUrl = extension.payload.href;
            if (extensionUrl && extensionUrl.indexOf('${extensionPath}/') > -1) {
              extension.payload.href = extensionUrl.replace('${extensionPath}/', extensionPath);
            }
          }
        }
      });
    });<commit_msg>262676 addressed feedback<commit_after>/**
 * Copyright IBM Corp. 2016
 * Licensed under the MIT License.
 */

var apps = chrome.extension.getURL('applications.json');
var xhr = new XMLHttpRequest();
xhr.overrideMimeType("application/json");
xhr.onreadystatechange = function () {
  if (xhr.readyState == 4 && xhr.status == "200") {
    var appsStr = replaceExtensionPath(xhr.responseText);
    localStorage.setItem('applications-json', appsStr);
    var pageScript = document.createElement('script');
    pageScript.src = chrome.extension.getURL('page.js');
    pageScript.onload = function() {
      this.parentNode.removeChild(this);
    };
    (document.head||document.documentElement).appendChild(pageScript);
  }
};
xhr.open('GET', apps, true);
xhr.send();

function replaceExtensionPath(appsStr) {
  var extensionPath = chrome.extension.getURL('');
  var apps = [];
  try {
    apps = JSON.parse(appsStr);
    apps.forEach(function(app) {
      var extensions = app.extensions;
      extensions.forEach(function(extension) {
        var extensionUrl = extension.url;
        if (extensionUrl && extensionUrl.indexOf('${extensionPath}/') > -1) {
          extension.url = extensionUrl.replace('${extensionPath}/', extensionPath);
        }
        if (extension.payload) {
          extensionUrl = extension.payload.url || extension.payload.href;
          if (extensionUrl && extensionUrl.indexOf('${extensionPath}/') > -1) {
            if (extension.payload.url) {
              extension.payload.url = extensionUrl.replace('${extensionPath}/', extensionPath);
            } else if (extension.payload.href) {
              extension.payload.href = extensionUrl.replace('${extensionPath}/', extensionPath);
            }
          }
        }
      });
    });
{'fraction_non_alphanumeric': 0.14803370786516853, 'fraction_numerical': 0.007584269662921348, 'mean_word_length': 3.1551925320886816, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '2601543', 'n_tokens_mistral': 1012, 'n_tokens_neox': 986, 'n_words': 179}