<commit_before>;(function (chrome, interceptors) {
  var settings = {
    enabled: false
  };

  var populate = function () {
    var $body = $("body");
    $body.append("<h1>Enable Map Replace</h1>")
         .append("<label><input type='checkbox' id='isEnabled' />Enable Map Replace for all pages</label>");

    _.each(interceptors, function (interceptor, interceptorId) {
      $body.append("<h2>" + interceptor.name + "</h2>");

      _.each(interceptor.layers, function (layer, layerId) {
        var input = "<label><input type='radio' data-maptype='" + interceptorId + "' data-layertype='" + layerId + "' name='layerid' />" + layer.name + "</label>";
        $body.append(input);
      });
    });
  };

  var saveSettings = function() {
    chrome.storage.sync.set({
      "mapSettings": settings
    });
  };

  var enableDisableSelection = function() {
    $("input[type='radio']").attr("disabled", function () {
      return settings.enabled ? null : "disabled";
    });
  };

  populate();
  enableDisableSelection();

  $("input[type='radio']").click(function (e) {
    var newSettings = $(e.currentTarget).data();
    settings.maptype = newSettings.maptype;
    settings.layertype = newSettings.layertype;
    saveSettings();
  });

  $("input[type='checkbox']").click(function (e) {
    settings.enabled = $(e.currentTarget).is(":checked");
    enableDisableSelection();
    saveSettings();
  });

  chrome.storage.sync.get("mapSettings", function (storedSettings) {
    var mapSettings = storedSettings.mapSettings;
    settings.maptype = mapSettings.maptype;
    settings.layertype = mapSettings.layertype;
    settings.enabled = mapSettings.enabled;

    var checkedAttr = settings.enabled ? "checked" : null;
    $("input[type='checkbox']").attr("checked", checkedAttr);
    $("input[data-layertype='" + mapSettings.layertype + "']").attr("checked", "checked");
  });<commit_msg>Fixes issue on initial deactivation/activation of radio-buttons.<commit_after>;(function (chrome, interceptors) {
  var settings = {
    enabled: false
  };

  var populate = function () {
    var $body = $("body");
    $body.append("<h1>Enable Map Replace</h1>")
         .append("<label><input type='checkbox' id='isEnabled' />Enable Map Replace for all pages</label>");

    _.each(interceptors, function (interceptor, interceptorId) {
      $body.append("<h2>" + interceptor.name + "</h2>");

      _.each(interceptor.layers, function (layer, layerId) {
        var input = "<label><input type='radio' data-maptype='" + interceptorId + "' data-layertype='" + layerId + "' name='layerid' />" + layer.name + "</label>";
        $body.append(input);
      });
    });
  };

  var saveSettings = function() {
    chrome.storage.sync.set({
      "mapSettings": settings
    });
  };

  var enableDisableSelection = function() {
    $("input[type='radio']").attr("disabled", function () {
      return settings.enabled ? null : "disabled";
    });
  };

  populate();

  $("input[type='radio']").click(function (e) {
    var newSettings = $(e.currentTarget).data();
    settings.maptype = newSettings.maptype;
    settings.layertype = newSettings.layertype;
    saveSettings();
  });

  $("input[type='checkbox']").click(function (e) {
    settings.enabled = $(e.currentTarget).is(":checked");
    enableDisableSelection();
    saveSettings();
  });

  chrome.storage.sync.get("mapSettings", function (storedSettings) {
    var mapSettings = storedSettings.mapSettings;
    settings.maptype = mapSettings.maptype;
    settings.layertype = mapSettings.layertype;
    settings.enabled = mapSettings.enabled;

    var checkedAttr = settings.enabled ? "checked" : null;
    $("input[type='checkbox']").attr("checked", checkedAttr);
    $("input[data-layertype='" + mapSettings.layertype + "']").attr("checked", "checked");
    enableDisableSelection();
  });
{'fraction_non_alphanumeric': 0.18203064139184627, 'fraction_numerical': 0.002077382498052454, 'mean_word_length': 3.791044776119403, 'pattern_counts': {'":': 4, '<': 23, '<?xml version=': 0, '>': 23, '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': '5298928', 'n_tokens_mistral': 1181, 'n_tokens_neox': 1142, 'n_words': 214}