<commit_before>function addNote(url, note) {
  var noteObjects = getNotes(url);
  noteObjects.push(note);
  saveNotes(url, noteObjects);
}

function getNotes(url){
  if (localStorage[url] === undefined){
    return [];
  } else {
    var retrievedObject = localStorage.getItem(url);
    return JSON.parse(retrievedObject);
  }
}

function removeNote(url, index){
  var notes = JSON.parse(localStorage.getItem(url));
  notes.splice(index, 1);
  saveNotes(url, notes);
}

function saveNotes(url, notes) {
  localStorage[url] = JSON.stringify(notes);
}

window.onload = function(){
  var onButton = document.getElementById('on');
  var offButton = document.getElementById('off');

  onButton.addEventListener('click', function(){
    localStorage["enabled"] = true
    console.log(localStorage.enabled, "enabled should be true")
  });

  offButton.addEventListener('click', function(){
    localStorage["enabled"] = false
    console.log(localStorage.enabled, "enabled should be false")
  });  
}

chrome.runtime.onMessage.addListener(function(message, sender, sendResponse){
  var enabled = localStorage.enabled === "true"
  if (message.method === "add note"){
    addNote(message.url, message.note);
  }
  else if (message.method === "remove note"){
    removeNote(message.url, message.index);
  }
  sendResponse({notesArray: getNotes(message.url), enable: enabled});
});

chrome.browserAction.setPopup({popup: "popup.html"});


<commit_msg>removed console.logs from JSONparser<commit_after>function addNote(url, note) {
  var noteObjects = getNotes(url);
  noteObjects.push(note);
  saveNotes(url, noteObjects);
}

function getNotes(url){
  if (localStorage[url] === undefined){
    return [];
  } else {
    var retrievedObject = localStorage.getItem(url);
    return JSON.parse(retrievedObject);
  }
}

function removeNote(url, index){
  var notes = JSON.parse(localStorage.getItem(url));
  notes.splice(index, 1);
  saveNotes(url, notes);
}

function saveNotes(url, notes) {
  localStorage[url] = JSON.stringify(notes);
}

window.onload = function(){
  var onButton = document.getElementById('on');
  var offButton = document.getElementById('off');

  onButton.addEventListener('click', function(){
    localStorage["enabled"] = true
  });

  offButton.addEventListener('click', function(){
    localStorage["enabled"] = false
  });  
}

chrome.runtime.onMessage.addListener(function(message, sender, sendResponse){
  var enabled = localStorage.enabled === "true"
  if (message.method === "add note"){
    addNote(message.url, message.note);
  }
  else if (message.method === "remove note"){
    removeNote(message.url, message.index);
  }
  sendResponse({notesArray: getNotes(message.url), enable: enabled});
});

chrome.browserAction.setPopup({popup: "popup.html"});



{'fraction_non_alphanumeric': 0.15392934390771448, 'fraction_numerical': 0.0007209805335255948, 'mean_word_length': 4.993520518358531, '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': '6458261', 'n_tokens_mistral': 861, 'n_tokens_neox': 836, 'n_words': 169}