<commit_before><script>

// Fetch version number of SmoothScroll
function get_manifest(callback) {
  var xhr = new XMLHttpRequest();
  xhr.onload = function () {
    callback(JSON.parse(xhr.responseText));
  };
  xhr.open('GET', '../manifest.json', true);
  xhr.send(null);
}

get_manifest(function (manifest) {
  version = manifest.version;
  init();
});

function setDefault(key, value) {
  if (localStorage[key] == null) {
    localStorage[key] = value;
  }
}

function init() {

  // TODO: store the defaults in the localStorage so
  // they are available for sscr.js and on options.html

  // Set the default settings
  setDefault("version", version);
  // general & mouse
  setDefault("framerate", 50);
  setDefault("animtime", 400);
  setDefault("scrollsz", 120);
  setDefault("middlemouse", true);
  // pulse
  setDefault("pulseAlgorithm", true);
  setDefault("pulseScale", 8);
  setDefault("pulseNormalize", 1);
  // keyboard
  setDefault("keyboardsupport", true);
  setDefault("arrscroll", 50);
  // exlude page
  setDefault("exclude", "twitter.com, www.msn.com");

  var store = localStorage;

  if (store.exclude.indexOf(", gmail.com") != -1) {
    store.exclude = store.exclude.replace(", gmail.com", "");
  }

  /**
   * NOTE: It's easier if we give an example 
   * how to format the excluded pages list,
   * plus the new twitter and msn are examples.
   */

  // Fresh install
  if (!store.version) {
    // chrome.tabs.create({url: "chrome-extension://cccpiddacjljmfbbgeimpelpndgpoknn/options_page/options.html"});
  }

  // If updated do something
  if (store.version != version) {
    store.version = version;
    // This should be replaced by an infobar once the API is ready
    // chrome.tabs.create({url: "chrome-extension://cccpiddacjljmfbbgeimpelpndgpoknn/options_page/options.html"});
  }
}

// If content scripts connect send the settings
chrome.extension.onConnect.addListener(function (port) {
  if (port.name == 'smoothscroll') {
    port.postMessage(localStorage);
  }
});

</script><commit_msg>updated comments<commit_after><script>

// Fetch version number of SmoothScroll
function get_manifest(callback) {
  var xhr = new XMLHttpRequest();
  xhr.onload = function () {
    callback(JSON.parse(xhr.responseText));
  };
  xhr.open('GET', '../manifest.json', true);
  xhr.send(null);
}

get_manifest(function (manifest) {
  version = manifest.version;
  init();
});

function setDefault(key, value) {
  if (localStorage[key] == null) {
    localStorage[key] = value;
  }
}

function init() {

  // TODO: store the defaults in the localStorage so
  // they are available for sscr.js and on options.html

  // Set the default settings
  setDefault("version", version);
  // general & mouse
  setDefault("framerate", 50);
  setDefault("animtime", 400);
  setDefault("scrollsz", 120);
  setDefault("middlemouse", true);
  // pulse
  setDefault("pulseAlgorithm", true);
  setDefault("pulseScale", 8);
  setDefault("pulseNormalize", 1);
  // keyboard
  setDefault("keyboardsupport", true);
  setDefault("arrscroll", 50);
  // exlude page
  setDefault("exclude", "twitter.com, www.msn.com");

  var store = localStorage;

  if (store.exclude.indexOf(", gmail.com") != -1) {
    store.exclude = store.exclude.replace(", gmail.com", "");
  }

  /**
   * NOTE: It's easier if we give an example 
   * how to format the excluded pages list,
   * plus twitter and msn are good examples.
   */

  // Fresh install
  if (!store.version) {
    // chrome.tabs.create({url: "chrome-extension://cccpiddacjljmfbbgeimpelpndgpoknn/options_page/options.html"});
  }

  // If updated do something
  if (store.version != version) {
    store.version = version;
    // This should be replaced by an infobar once the API is ready
    // chrome.tabs.create({url: "chrome-extension://cccpiddacjljmfbbgeimpelpndgpoknn/options_page/options.html"});
  }
}

// If content scripts connect send the settings
chrome.extension.onConnect.addListener(function (port) {
  if (port.name == 'smoothscroll') {
    port.postMessage(localStorage);
  }
});

</script>
{'fraction_non_alphanumeric': 0.1435361216730038, 'fraction_numerical': 0.006178707224334601, 'mean_word_length': 3.163204747774481, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1739599', 'n_tokens_mistral': 1416, 'n_tokens_neox': 1301, 'n_words': 317}