Skip to content
This repository has been archived by the owner on Jun 22, 2020. It is now read-only.

Commit

Permalink
Implemented Profile removal.
Browse files Browse the repository at this point in the history
Possibly, implement profile editing next.
  • Loading branch information
shibin-george committed Feb 13, 2015
1 parent 94ce605 commit c6cb862
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
var button = document.createElement("div");
button.innerHTML = '\n<button id="OKButton"> Click to add </button>';
document.getElementById('checklist').appendChild(button);
document.getElementById('OKButton').addEventListener("click", function(){
button.addEventListener("click", function(){
finalizeChoice();
});
});
Expand Down Expand Up @@ -303,6 +303,35 @@ function deleteProfile(){
document.getElementById('CheckAll').onclick = function(){
toggle();
};

//add a button to finalise the list
var button = document.createElement("div");
button.innerHTML = '\n<button id="OKButton"> Click to delete </button>';
document.getElementById('status').appendChild(button);
button.addEventListener("click", function(){
var tabs = document.getElementsByName('Checkbox');
var s = "";
var value = [];
var numChoices = 0;
console.log("Number of checkboxes = " + tabs.length);
for(i=0; i<tabs.length; i++){
if(tabs[i].className == 'SelectedProfile'){
//this particular tab has to be added
s += tabs[i].id + "\n";
value.push(tabs[i].id);
numChoices += 1;
}
}
if(numChoices > 0){
//renderStatus('You have chosen to delete\n' + s);
chrome.storage.local.remove(value, function(){
renderStatus('Successfully removed selected profile(s)');
});
} else {
renderStatus('You must choose atleast one profile');
}

});
});
}

Expand Down

0 comments on commit c6cb862

Please sign in to comment.